Merge branch 'master' into fronkdev

This commit is contained in:
Frank Schubert
2024-07-11 13:28:35 +02:00
17 changed files with 483 additions and 208 deletions
@@ -19,14 +19,6 @@ class FiberPlanPipeController extends mfBaseController
protected function indexAction()
{
$this->layout()->setTemplate("FiberPlanPipe/Index");
$fiberplanpipes = FiberPlanPipeModel::getAll();
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
$fiberplanpipeEndpoints = FiberPlanPipeEndpointModel::getAll();
$this->layout()->set("fiberplanpipeEndpoints", $fiberplanpipeEndpoints);
$this->layout()->set("pipworkeraddresses", $pipworkeraddresses);
$this->layout()->set("fiberplanpipes", $fiberplanpipes);
}
protected function addAction()
@@ -56,6 +48,9 @@ class FiberPlanPipeController extends mfBaseController
case "getPops":
$return = $this->getPops($network);
break;
case "getFiberPlanPipes":
$return = $this->getFiberPlanPipes();
break;
default:
$return = false;
}
@@ -283,4 +278,110 @@ class FiberPlanPipeController extends mfBaseController
{
FiberPlanPipeModel::getBuildingInfo($network, $bdtype);
}
protected function getFiberPlanPipes()
{
$fiberplanpipes = FiberPlanPipeModel::getAll();
$pipworkeraddresses = FiberPlanPipeModel::getPipeworkerAddresses();
$fiberplanpipeEndpoints = FiberPlanPipeEndpointModel::getAll();
$typeOption = FiberPlanPipeModel::$type_definition;
$statusOption = FiberPlanPipeModel::$status_definition;
$dimension_v1Option = FiberPlanPipeModel::$type_descrition_definition;
$responsibleOption[1] = "(F)";
$responsibleOption[2] = "(P)";
foreach ($pipworkeraddresses as $pipworkeraddress) {
$Pipeworker[$pipworkeraddress->id] = $pipworkeraddress->company;
}
$responsecount = count($fiberplanpipes);
foreach ($fiberplanpipes as $fiberplanpipe) {
unset($networks);
unset($endpoints);
// Performance Killer muss bereinigt werden
foreach ($fiberplanpipeEndpoints[$fiberplanpipe->id] as $fiberplanpipeEndpoint) {
if ($fiberplanpipeEndpoint->pop_id) {
$networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name;
$endpoints[] = '<span title="POP">(P) </span>' . $fiberplanpipeEndpoint->pop->name;
} else if ($fiberplanpipeEndpoint->building_id) {
$networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name;
$endpoints[] = '<span title="Building">(B) </span>' . $fiberplanpipeEndpoint->building->street . " " . $fiberplanpipeEndpoint->building->number;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) {
$networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name;
if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "1") {
$endpoints[] = '<span title="Verteiler">(V) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
} elseif ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "2") {
$endpoints[] = '<span title="Schacht">(S) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "3") {
$endpoints[] = '<span title="Greenfield">(G) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "4") {
$endpoints[] = '<span title="Abzweigepunkt">(A) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
}
}
}
//....
if ($fiberplanpipe->type == "3") {
$name = "";
if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 && $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe7x4) {
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe7x4 . "*7x4";
} else if ($fiberplanpipe->fiberPlanPipeTemplate->pipe14x10) {
$name = $fiberplanpipe->fiberPlanPipeTemplate->fiberPlanPipeManufacturer->name . " " . $fiberplanpipe->fiberPlanPipeTemplate->pipe14x10 . "*14x10";
}
$typeDescription = $name;
//
} else {
$typeDescription = $dimension_v1Option[$fiberplanpipe->type_description];
}
$startpoint = '<span class="startpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->startpoint_type] . "/" . $buildings[$fiberplanpipe->startpoint_type][$fiberplanpipe->startpoint]['name'] . '</span>';
$endpoint = '<span class="endpoint" data-toggle="modal" data-target="#pipemap" data-gpslat="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_lat'] . '" data-gpslong="' . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['gps_long'] . '">' . $starting_pointOption[$fiberplanpipe->entpoint_type] . "/" . $buildings[$fiberplanpipe->entpoint_type][$fiberplanpipe->endpoint]['name'] . '</span>';
$responsible = $responsibleOption[$fiberplanpipe->responsible];
if ($fiberplanpipe->address_id) {
$responsible .= " " . $Pipeworker[$fiberplanpipe->address_id];
if ($fiberplanpipe->responsible_text) {
$responsible .= " (" . $fiberplanpipe->responsible_text . ")";
}
} else {
$responsible .= " " . $fiberplanpipe->responsible_text;
}
if ($fiberplanpipe->startpoint_network_id == $fiberplanpipe->endpoint_network_id) {
$networkName = $Network[$fiberplanpipe->startpoint_network_id];
} else {
$networkName = $Network[$fiberplanpipe->startpoint_network_id] . " / " . $Network[$fiberplanpipe->endpoint_network_id];
}
$edit = '<a href="' . self::getUrl("FiberPlanPipe", "edit", ["id" => $fiberplanpipe->id]) . '"><i
class="far fa-edit" title="Bearbeiten"></i></a><a href="' . self::getUrl("FiberPlanPipe", "delete", ["id" => $fiberplanpipe->id]) . '"
onclick="if(!confirm(\'Rohrverzeichnis wirklich löschen?\')) return false;"
class="text-danger"
title="Löschen"><i class="fas fa-trash"></i></a>';
$rows[] = array(
'description' => array('description' => '<a href="' . self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) . '">' . $fiberplanpipe->description . '</a>', 'order' => $fiberplanpipe->description),
'typeOption' => array('typeOption' => $typeOption[$fiberplanpipe->type] . " / " . $typeDescription, 'order' => $typeOption[$fiberplanpipe->type] . " / " . $typeDescription),
'length' => array('length' => $fiberplanpipe->length, 'order' => $fiberplanpipe->length),
'networks' => array('networks' => implode(',', $networks), 'order' => implode(',', $networks)),
'startpoint' => array('startpoint' => $endpoints[0], 'order' => $endpoints[0]),
'endpoint' => array('endpoint' => $endpoints[count($endpoints) - 1], 'order' => $endpoints[count($endpoints) - 1]),
'responsible' => array('responsible' => $responsible, 'order' => $responsible),
'state' => array('state' => $statusOption[$fiberplanpipe->status], 'order' => $statusOption[$fiberplanpipe->status]),
'edit' => array('edit' => $edit, 'order' => ''),
);
}
$json['success'] = true;
$json['data'] = $rows;
$json['recordsFiltered'] = $responsecount;
$json['recordsTotal'] = $responsecount;
$json = json_encode($json);
echo trim($json);
die();
}
}
@@ -16,6 +16,7 @@ class FiberPlanPipeModel
private $comment;
public static $type_descrition_definition = array(1 => "MR7", 2 => "MR14", 3 => "MR16", 4 => "MR20", 5 => "PE32", 6 => "PE40", 7 => "PE50", 8 => "KSR50", 9 => "KSR80", 10 => "KSR100");
public static $type_definition = array(1 => "Enzel", 2 => "Schutzrohr", 3 => "Verband");
public static $status_definition = array(10 => "Geplant", 20 => "Umsetzung", 30 => "Fertiggestellt");
public static function find($data)
{
@@ -41,7 +41,7 @@ class TimerecordingBillingController extends mfBaseController
protected function overviewAction()
{
$timerecordingBillings = TimerecordingBillingModel::getAll();
$timerecordingBillingsEmployees = TimerecordingBillingEmployeeModel::getAll();
$timerecordingBillingsEmployees = TimerecordingBillingEmployeeModel::getAllOrderbyNameDate();
$this->layout()->setTemplate("TimerecordingBilling/Overview");
$this->layout()->set("timerecordingbillings", $timerecordingBillings);
$this->layout()->set("timerecordingbillingsemployees", $timerecordingBillingsEmployees);
@@ -224,9 +224,9 @@ class TimerecordingBillingController extends mfBaseController
$file = fopen("php://output", 'w');
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=' . $filename);
$monthunix=(strtotime("01." .$month));
$monthunix = (strtotime("01." . $month));
$monthbmd = date("n", $monthunix);
$monthend = date("d.m.Y", strtotime("last day of this month",$monthunix));
$monthend = date("d.m.Y", strtotime("last day of this month", $monthunix));
$companybmd = "1";
if ($nlz == 0) {
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
@@ -269,6 +269,12 @@ class TimerecordingBillingController extends mfBaseController
if ($timerecordingBillingEmployee->overtime50free > 64800) {
$bodyarray = [$monthbmd, "1", $employee_number, "3110", "18", "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
if ($timerecordingBillingEmployee->timerecordingEmployee->jobbike == 1) {
$bodyarray = [$monthbmd, "1", $employee_number, "3115", "18", "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
$bodyarray = [$monthbmd, "1", $employee_number, "3116", "18", "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
$diffsum = $timerecordingBillingEmployee->overtime50free - 64800;
$diffsum = $diffsum / 3600;
$diffsum = round($diffsum, 2);
@@ -279,6 +285,12 @@ class TimerecordingBillingController extends mfBaseController
$overtime50free = str_replace(".", ",", $overtime50free);
$bodyarray = [$monthbmd, "1", $employee_number, "3110", $overtime50free, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
if ($timerecordingBillingEmployee->timerecordingEmployee->jobbike == 1) {
$bodyarray = [$monthbmd, "1", $employee_number, "3115", $overtime50free, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
$bodyarray = [$monthbmd, "1", $employee_number, "3116", $overtime50free, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
}
@@ -291,6 +303,12 @@ class TimerecordingBillingController extends mfBaseController
if ($timerecordingBillingEmployee->overtime100free > 64800) {
$bodyarray = [$monthbmd, "1", $employee_number, "3160", "18", "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
if ($timerecordingBillingEmployee->timerecordingEmployee->jobbike == 1) {
$bodyarray = [$monthbmd, "1", $employee_number, "3165", "18", "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
$bodyarray = [$monthbmd, "1", $employee_number, "3166", "18", "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
$diffsum = $timerecordingBillingEmployee->overtime100free - 64800;
$diffsum = $diffsum / 3600;
$diffsum = round($diffsum, 2);
@@ -300,6 +318,12 @@ class TimerecordingBillingController extends mfBaseController
} else {
$bodyarray = [$monthbmd, "1", $employee_number, "3160", $overtime100free, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
if ($timerecordingBillingEmployee->timerecordingEmployee->jobbike == 1) {
$bodyarray = [$monthbmd, "1", $employee_number, "3165", $overtime100free, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
$bodyarray = [$monthbmd, "1", $employee_number, "3166", $overtime100free, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
}
}
@@ -333,16 +357,16 @@ class TimerecordingBillingController extends mfBaseController
} else {
if ($timerecordingBillingEmployee->nlz_detail) {
foreach (json_decode($timerecordingBillingEmployee->nlz_detail, true) as $nlztime) {
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
fputcsv($file, $bodyarray, ";");
if ($nlztime['categoryshort'] != "99") {
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
fputcsv($file, $bodyarray, ";");
}
}
}
if ($timerecordingBillingEmployee->holidays>0) {
if ($timerecordingBillingEmployee->holidays > 0) {
//last day of month
$bodyarray = [$companybmd, $employee_number, 1, "1", "", "4", $monthend, $monthend, $timerecordingBillingEmployee->holidays, '0'];
fputcsv($file, $bodyarray, ";");
@@ -584,11 +608,8 @@ class TimerecordingBillingController extends mfBaseController
if ($timerecording['homeoffice']) {
$data['homeoffice'] = $timerecording['homeoffice'];
}
if (!$data['diet']) {
$data['diet'] = 0;
}
$timerecordingbillingemployee = TimerecordingBillingEmployeeModel::create($data);
@@ -93,6 +93,22 @@ class TimerecordingBillingEmployeeModel
}
public static function getAllOrderbyNameDate()
{
$items = [];
$db = FronkDB::singleton();
$res = $db->select("TimerecordingBillingEmployee", "*", "1=1 ORDER by `timerecordingEmployee_id`,`timerecordingBilling_id` DESC ");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new TimerecordingBillingEmployee($data);
}
}
return $items;
}
public static function getFirst()
{
$db = FronkDB::singleton();
@@ -123,6 +123,7 @@ class TimerecordingEmployeeController extends mfBaseController
$data = [];
$data['user_id'] = trim($r->user_id);
$data['auto_workinghours'] = trim($r->auto_workinghours);
$data['jobbike'] = trim($r->jobbike);
$data['holidays'] = trim($r->holidays);
$data['plushours'] = $plushours;
$data['startdate'] = strtotime($r->startdate);
@@ -172,6 +173,9 @@ class TimerecordingEmployeeController extends mfBaseController
if (!$data['auto_workinghours']) {
$data['auto_workinghours'] = 0;
}
if (!$data['jobbike']) {
$data['jobbike'] = 0;
}
if ($mode == "edit") {
$timerecordingemployees->update($data);
@@ -19,6 +19,7 @@ class TimerecordingEmployeeModel
private $startdate;
private $enddate;
private $bmd_active;
private $jobbike;
private $birthday;
public static $employeetypesbmd = array('1' => '1000', '2' => '1200', '3' => '1400');
@@ -157,7 +157,7 @@ private $holidays ;
$enddate = "";
$sum = "-";
$day = "";
$enddatecend="";
$enddatecend = "";
$orderdate = $timerecording->start;
if ($timerecording->timerecordingCategory->hourday == 1) {
$date = date("d.m.Y", $timerecording->start);
@@ -225,7 +225,7 @@ private $holidays ;
$enddatetemp = date("Y-m-d", time());
$enddatetemp = strtotime($enddatetemp . " 23:59:59");
$enddate = date("Y-m-d", $enddatetemp + 7200);
$enddatecend= date("Y-m-d", $enddatetemp + 1216800);
$enddatecend = date("Y-m-d", $enddatetemp + 1216800);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
@@ -266,6 +266,7 @@ private $holidays ;
$date = date("d.m.Y", $timerecording->start);
$start = "-";
$end = "-";
$datadate = date("Y-m-d", $timerecording->start);
$day = $daysgerm[date("w", $timerecording->start)];
if ($timerecording->days > 0) {
if ($timerecording->days == 1) {
@@ -357,9 +358,8 @@ private $holidays ;
endif;
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
} else {
if (!$enddatecend)
{
$enddatecend=$enddate;
if (!$enddatecend) {
$enddatecend = $enddate;
}
$rows[] = array(
@@ -588,7 +588,7 @@ private $holidays ;
$O100pfl = 0;
$O50free = 0;
$O50pfl = 0;
$Osum=0;
$Osum = 0;
foreach ($timerecordings as $timerecording):
$state = "";
@@ -599,9 +599,10 @@ private $holidays ;
if ($oldday != date('Y-m-d', $timerecording->start)) {
if ($homeoffice == 1) {
$homeofficesum++;
$homeofficesum ++;
$homeoffice = false;
}
$homeoffice = false;
if ($diet > 10800) {
if ($diet >= 43200) {
$diet = 43200;
@@ -613,14 +614,13 @@ private $holidays ;
$diet = 0;
}
if ($timerecording->homeoffice == 1 && (!$homeoffice || $homeoffice == 1)) {
$homeoffice = 1;
} else {
$homeoffice = 0;
} else if ($timerecording->timerecordingCategory_id != '9') { //Speziallösung für Arztbesuch (zusätzlich Homeoffice erlaubt)
$homeoffice = 'NOK';
}
if ($timerecording->businesstrip == 1 && $timerecording->timerecordingCategory->hourday == 1) {
$diet = $diet + $timerecording->end - $timerecording->start;
}
@@ -664,7 +664,7 @@ private $holidays ;
$O100free = $O100free + $overtimes['O100free'];
$O50free = $O50free + $overtimes['O50free'];
$O50pfl = $O50pfl + $overtimes['O50pfl'];
$Osum=$Osum+$overtimes['sum'];
$Osum = $Osum + $overtimes['sum'];
}
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
@@ -760,7 +760,8 @@ private $holidays ;
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
} else if ($timerecording->timerecordingCategory->hourday == 5) {
$date = date("d.m.Y", $timerecording->start);
$datadate = date("Y-m-d", $timerecording->start);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
@@ -770,7 +771,12 @@ private $holidays ;
} else {
$daysum[$timerecording->timerecordingCategory->name] = $daysum[$timerecording->timerecordingCategory->name] + $timerecording->days;
}
$nlzTimes[$timerecording->id]['start'] = date("d.m.Y", $timerecording->start);
$nlzTimes[$timerecording->id]['end'] = date("d.m.Y", $timerecording->end);
$nlzTimes[$timerecording->id]['days'] = $sumdays;
$nlzTimes[$timerecording->id]['unpaid'] = $timerecording->timerecordingCategory->unpaid;
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
$nlzTimes[$timerecording->id]['categoryshort'] = '99';
} else if ($timerecording->timerecordingCategory->hourday == 6) {
$date = date("d.m.Y", $timerecording->start);
$datadate = date("Y-m-d", $timerecording->start);
@@ -826,7 +832,6 @@ private $holidays ;
endforeach;
if ($homeoffice == 1) {
$homeofficesum++;
$homeoffice = 0;
}
if ($diet > 10800) {
if ($diet >= 43200) {
@@ -883,7 +888,7 @@ private $holidays ;
$json['time']['daysum'] = $daysum;
$json['recordsFiltered'] = $responsecount;
$json['recordsTotal'] = $responsecount;
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl,'Osum'=>$Osum];
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl, 'Osum' => $Osum];
if ($ajax == 1) {
$json = json_encode($json);