diff --git a/application/TimerecordingBilling/TimerecordingBillingController.php b/application/TimerecordingBilling/TimerecordingBillingController.php
index 325baecf5..dbf4f5405 100644
--- a/application/TimerecordingBilling/TimerecordingBillingController.php
+++ b/application/TimerecordingBilling/TimerecordingBillingController.php
@@ -267,10 +267,11 @@ class TimerecordingBillingController extends mfBaseController
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
- //Übergangslösung für Oktober
- if ($employee_number == '1029' && $nlz == 0 && $monthbmd =='10') {
-
- $bodyarray = [$monthbmd, $companybmd, $employee_number, "4080", '17,42', "", '', "", "", "", ""];
+ if ($timerecordingBillingEmployee->night_allowance > 0) {
+ $nightAllowance = $timerecordingBillingEmployee->night_allowance / 3600;
+ $nightAllowance = round($nightAllowance, 2);
+ $nightAllowance = str_replace(".", ",", $nightAllowance);
+ $bodyarray = [$monthbmd, $companybmd, $employee_number, "4080", $nightAllowance, "", '', "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
@@ -616,6 +617,7 @@ class TimerecordingBillingController extends mfBaseController
$data['overtime50free'] = $timerecording['overtimes']['O50free'];
$data['overtime100'] = $timerecording['overtimes']['O100pfl'];
$data['overtime100free'] = $timerecording['overtimes']['O100free'];
+ $data['night_allowance'] = $timerecording['overtimes']['nightAllowance'];
$data['transfer_plushours'] = $timerecording['overtimes']['Osum'];
$diff = $timerecording['istimeall'] - $timerecording['musttime'];
@@ -888,7 +890,7 @@ class TimerecordingBillingController extends mfBaseController
$holidays_now = $holidays;
}
$timerecordings = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'timerecordingCategory_id' => 3]);
- $timerecordingscorrections = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp,'endsdate' => $enddate, 'days' => 1]);
+ $timerecordingscorrections = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'endsdate' => $enddate, 'days' => 1]);
foreach ($timerecordings as $timerecording) {
if ($timerecording->end > $enddate) {
diff --git a/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php b/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php
index 4718a5c64..bbf954306 100644
--- a/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php
+++ b/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php
@@ -15,6 +15,7 @@ class TimerecordingBillingEmployeeModel
private $overtime100;
private $overtime100free;
private $overtime_plushours;
+ private $night_allowance;
private $homeoffice;
private $diet;
private $nlz;
diff --git a/application/TimerecordingReport/TimerecordingReportController.php b/application/TimerecordingReport/TimerecordingReportController.php
index 2ca626e31..55eb80591 100644
--- a/application/TimerecordingReport/TimerecordingReportController.php
+++ b/application/TimerecordingReport/TimerecordingReportController.php
@@ -177,7 +177,6 @@ class TimerecordingReportController extends mfBaseController
}
-
} else if ($datatype == 5) {
$firstdate = strtotime(date("Y-01-01", $datayear));
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
@@ -200,7 +199,6 @@ class TimerecordingReportController extends mfBaseController
}
-
}
@@ -235,7 +233,7 @@ class TimerecordingReportController extends mfBaseController
$datadate = date("Y-m-d", $timerecording->start);
$enddate = date("Y-m-d", $timerecording->end + 7200);
- $enddate2= date("Y-m-d", $timerecording->end);
+ $enddate2 = date("Y-m-d", $timerecording->end);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
@@ -439,13 +437,13 @@ class TimerecordingReportController extends mfBaseController
$seconds = $timerecording->end - $timerecording->start;
$minutes = floor(($seconds % 3600) / 60);
$hours = floor($seconds / 3600);
- $sum = "-" .sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
+ $sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
$day = $daysgerm[date("w", $timerecording->start)];
}
- if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0 )|| ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
+ if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
$state = '';
- } else if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 1 )) {
+ } else if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 1)) {
$state = '';
}
$edit = "";
@@ -471,7 +469,7 @@ class TimerecordingReportController extends mfBaseController
if ($timerecording->completed == 0):
- if ($timerecording->approved == 0 || $timerecording->approved == 1) :
+ if ($timerecording->approved == 0 || $timerecording->approved == 1) :
$ddays = $timerecording->days;
if ($timerecording->timerecordingCategory->hourday == 8) {
$ddays = round($timerecording->hours_bpa / 60 / 60, 2);
@@ -574,7 +572,7 @@ class TimerecordingReportController extends mfBaseController
die();
}
- private function checkOvertime($timerecording,$night_allowance=0)
+ private function checkOvertime($timerecording, $night_allowance = 0)
{
$start = $timerecording->start;
$end = $timerecording->end;
@@ -584,6 +582,7 @@ class TimerecordingReportController extends mfBaseController
$O100pfl = 0;
$O100end = strtotime(date('Y-m-d', $start) . " 06:00:00");
$O100start = strtotime(date('Y-m-d', $start) . " 22:00:00");
+ $nightAllowance = 0;
foreach ($this->holidays as $holiday) {
@@ -593,10 +592,10 @@ class TimerecordingReportController extends mfBaseController
$end = $timerecording->end;
$startday = date('Y-m-d', $start);
- if ((date('w', $start) == 0 || $holiDay[$startday]) && $night_allowance==0) {
+ if ((date('w', $start) == 0 || $holiDay[$startday]) && $night_allowance == 0) {
$O100free = $O100free + $timerecording->end - $timerecording->start;
} else {
- if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance==0) {
+ if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance == 0) {
$sum = $end - $start;
if ($sum >= 10800) {
if ($start < $O100end) {
@@ -626,16 +625,20 @@ class TimerecordingReportController extends mfBaseController
// }
// }
// }
- } else {
-// if (date('w', $start) == 6) {
-// $O50free = $O50free + $end - $start;
-// }
+ } else if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance == 1) {
+ if ($start < $O100end) {
+ $nightAllowance = $nightAllowance + $O100end - $start;
+ }
+ if ($end >= $O100start) {
+ $nightAllowance = $nightAllowance + $end - $O100start;
+ }
}
}
$response['O100free'] = $O100free;
$response['O100pfl'] = $O100pfl;
$response['O50free'] = $O50free;
$response['O50pfl'] = $O50pfl;
+ $response['nightAllowance'] = $nightAllowance;
$response['sum'] = $O100free + $O100pfl + $O50free + $O50pfl;
return $response;
}
@@ -663,7 +666,7 @@ class TimerecordingReportController extends mfBaseController
$plusHours_now = $employee[0]->plushours_now;
$overtime_now = $employee[0]->overtime_now;
$auto_workinghours = $employee[0]->auto_workinghours;
- $night_allowance= $employee[0]->night_allowance;
+ $night_allowance = $employee[0]->night_allowance;
$startdate = $employee[0]->startdate;
if ($employee[0]->enddate) {
$enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59");
@@ -828,6 +831,7 @@ class TimerecordingReportController extends mfBaseController
$O50free = 0;
$O50pfl = 0;
$Osum = 0;
+ $nightAllowance = 0;
foreach ($timerecordings as $timerecording):
$state = "";
@@ -896,7 +900,7 @@ class TimerecordingReportController extends mfBaseController
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
} else {
- $overtimes = $this->checkOvertime($timerecording,$night_allowance);
+ $overtimes = $this->checkOvertime($timerecording, $night_allowance);
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
if ($employee->only_admin != 1) {
@@ -907,6 +911,7 @@ class TimerecordingReportController extends mfBaseController
$O100free = $O100free + $overtimes['O100free'];
$O50free = $O50free + $overtimes['O50free'];
$O50pfl = $O50pfl + $overtimes['O50pfl'];
+ $nightAllowance = $nightAllowance + $overtimes['nightAllowance'];
$Osum = $Osum + $overtimes['sum'];
}
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
@@ -1176,7 +1181,7 @@ class TimerecordingReportController extends mfBaseController
$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,'nightAllowance' => $nightAllowance, 'Osum' => $Osum];
if ($ajax == 1) {
$json = json_encode($json);
diff --git a/db/migrations/20251130130230_add_timerecording_billing_employee_night_allowance.php b/db/migrations/20251130130230_add_timerecording_billing_employee_night_allowance.php
new file mode 100644
index 000000000..cf83534b3
--- /dev/null
+++ b/db/migrations/20251130130230_add_timerecording_billing_employee_night_allowance.php
@@ -0,0 +1,31 @@
+getEnvironment() == "thetool") {
+ $table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
+ $table->addColumn("night_allowance", "integer", ["null" => false, "default" => 0, "after" => "overtime_plushours"]);
+ $table->update();
+ }
+
+ if($this->getEnvironment() == "addressdb") {
+
+ }
+ }
+
+ public function down(): void
+ {
+ if($this->getEnvironment() == "thetool") {
+ $this->table("TimerecordingBillingEmployee")->removeColumn("night_allowance")->save();
+ }
+
+ if($this->getEnvironment() == "addressdb") {
+
+ }
+ }
+}