Zeiterfassung Update Monatsabschluss/Verrechnung

* Berechnungen aller Ü50/Ü100/M25 sowie Steuerfrei und Pflichtig
* Transfer Mehrstunden auf Ü50/Ü100/M25
* Anpassungen der Exports LZs MehrstundenGL ÜGL Ü50,Ü100,M25
* Autoberechnung der anteiligen Mehrstunden
* automatische Ü100 Rausrechnung laut gesetzlichen Vorgaben

Bugfixes:
* Start und Enddatum eines Mitarbeiters werden nun überall berücksichtigt.

* Textuelle Bereinigungen
* Umfangreiche Testscenarien Verechnung/Exports
This commit is contained in:
Spi
2024-05-05 12:36:47 +02:00
parent 45a07abf0e
commit b821c9f2c4
11 changed files with 386 additions and 111 deletions

View File

@@ -2,7 +2,7 @@
class TimerecordingReportController extends mfBaseController
{
private $holidays ;
protected function init()
{
$this->needlogin = true;
@@ -14,6 +14,7 @@ class TimerecordingReportController extends mfBaseController
if (!$me->is(["employee"])) {
$this->redirect("Dashboard");
}
$this->holidays=TimerecordingHolidayModel::getAll();
}
protected function indexAction()
@@ -36,7 +37,6 @@ class TimerecordingReportController extends mfBaseController
$dataweek = $this->request->dataweek;
$datamonth = $this->request->datamonth;
$datayear = $this->request->datayear;
$data = [];
switch ($do) {
@@ -74,7 +74,6 @@ class TimerecordingReportController extends mfBaseController
}
$workinghours = TimerecordingEmployeeWorkingHourModel::getAll();
$holidays = TimerecordingHolidayModel::getAll();
foreach ($workinghours as $workinghour) {
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
@@ -85,7 +84,7 @@ class TimerecordingReportController extends mfBaseController
$workingHours[$workinghour->user_id][$workinghour->day] = $workingHours[$workinghour->user_id][$workinghour->day] + $whend - $whstart;
}
}
foreach ($holidays as $holiday) {
foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
}
@@ -397,8 +396,8 @@ class TimerecordingReportController extends mfBaseController
$O100end = strtotime(date('Y-m-d', $start) . " 06:00:00");
$O100start = strtotime(date('Y-m-d', $start) . " 22:00:00");
$holidays = TimerecordingHolidayModel::getAll();
foreach ($holidays as $holiday) {
foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
}
$start = $timerecording->start;
@@ -417,29 +416,31 @@ class TimerecordingReportController extends mfBaseController
if ($end >= $O100start) {
$O100free = $O100free + $end - $O100start;
}
if (date('w', $start) == 6) {
if ($sum != $O100free) {
$O50free = $O50free + $sum - $O100free;
}
}
//sind nun Mehrstunden
// if (date('w', $start) == 6) {
// if ($sum != $O100free) {
// $O50free = $O50free + $sum - $O100free;
// }
// }
} else {
if ($start < $O100end) {
$O100pfl = $O100pfl + $O100end - $start;
}
if ($end >= $O100start) {
$O100pfl = $O100pfl + $end - $O100start;
}
if (date('w', $start) == 6) {
if ($sum != $O100free) {
$O50free = $O50free + $sum - $O100free;
}
}
}
// else {
// if ($start < $O100end) {
// $O100pfl = $O100pfl + $O100end - $start;
// }
// if ($end >= $O100start) {
// $O100pfl = $O100pfl + $end - $O100start;
// }
// if (date('w', $start) == 6) {
// if ($sum != $O100free) {
// $O50free = $O50free + $sum - $O100free;
// }
// }
// }
} else {
if (date('w', $start) == 6) {
$O50free = $O50free + $end - $start;
}
// if (date('w', $start) == 6) {
// $O50free = $O50free + $end - $start;
// }
}
}
$response['O100free'] = $O100free;
@@ -482,7 +483,7 @@ class TimerecordingReportController extends mfBaseController
$bpahours = $employee[0]->bpahours;
}
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $user_id]);
$holidays = TimerecordingHolidayModel::getAll();
foreach ($workinghours as $workinghour) {
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
@@ -493,7 +494,7 @@ class TimerecordingReportController extends mfBaseController
$workingHours[$workinghour->day] = $workingHours[$workinghour->day] + $whend - $whstart;
}
}
foreach ($holidays as $holiday) {
foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
}
@@ -576,8 +577,13 @@ class TimerecordingReportController extends mfBaseController
$dietsum = 0;
$diet = 0;
$dietbase = TimerecordingBillingModel::$dieatBase;
$O100free = 0;
$O100pfl = 0;
$O50free = 0;
$O50pfl = 0;
$Osum=0;
foreach ($timerecordings as $timerecording):
$state = "";
$enddate = "";
$sum = "-";
@@ -647,6 +653,11 @@ class TimerecordingReportController extends mfBaseController
$overtimes = $this->checkOvertime($timerecording);
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
$isSeconds = $isSeconds - $overtimes['sum'];
$O100pfl = $O100pfl + $overtimes['O100pfl'];
$O100free = $O100free + $overtimes['O100free'];
$O50free = $O50free + $overtimes['O50free'];
$O50pfl = $O50pfl + $overtimes['O50pfl'];
$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);
@@ -859,6 +870,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];
if ($ajax == 1) {
$json = json_encode($json);