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

@@ -532,7 +532,7 @@ class TimerecordingController extends mfBaseController
}
}
public function updatePlushours($userid)
public function updatePlushours($userid, $enddate = null)
{
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
if ($employee) {
@@ -553,13 +553,20 @@ class TimerecordingController extends mfBaseController
$overtime_timestamp = $employee->startdate;
$overtime_now = $overtime;
}
if ($employee->enddate && $employee->enddate < time() - 86400) {
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
if (!$enddate) {
if ($employee->enddate && $employee->enddate < time() - 86400) {
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
} else {
$endtime = time() - 86400;
}
} else {
$endtime = time() - 86400;
if ($employee->enddate && $employee->enddate < $enddate) {
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
} else {
$endtime = $enddate;
}
}
$endtime = date("Y-m-d", $endtime);
$endtime = strtotime($endtime . " 23:59:00");
@@ -586,13 +593,19 @@ class TimerecordingController extends mfBaseController
$plushours_now = $plushours_now - $minushours;
$diffTime = $diffTime - $minushours;
$overtime_now = $overtime_now - $minushoursovertime;
if ($employee->plushours_now != $plushours_now || $employee->overtime_now != $overtime_now) {
$employeeupdate = new TimerecordingEmployee($employee->id);
$data = [];
$data['plushours_now'] = $plushours_now;
$data['overtime_now'] = $overtime_now;
$employeeupdate->update($data);
$employeeupdate->save();
if (!$enddate) {
if ($employee->plushours_now != $plushours_now || $employee->overtime_now != $overtime_now) {
$employeeupdate = new TimerecordingEmployee($employee->id);
$data = [];
$data['plushours_now'] = $plushours_now;
$data['overtime_now'] = $overtime_now;
$employeeupdate->update($data);
$employeeupdate->save();
}
} else {
$response['plushours'] = $plushours_now;
$response['overtime'] = $overtime_now;
return $response;
}
}
}
@@ -656,7 +669,7 @@ class TimerecordingController extends mfBaseController
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
} elseif ($holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
} elseif ($holiDay[$dDate]) {
$holidayrows[$timestamp] = $holiDay[$dDate];
}
@@ -675,7 +688,7 @@ class TimerecordingController extends mfBaseController
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
} elseif ($holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
} elseif ($holiDay[$dDate]) {
$holidayrows[$timestamp] = $holiDay[$dDate];
}
$timestamp = $timestamp + 86400;
@@ -935,18 +948,18 @@ class TimerecordingController extends mfBaseController
);
}
endforeach;
foreach ($holidayrows as $key => $holidayrow) {
$day = $daysgerm[date("w", $key)];
$rows[] = array(
'date' => array('date' => '<span class="text-bold holiday-text">'.$day." ".date("d.m.Y",$key).'</span>', 'order' => $key),
'start' => array('start' => "-", 'order' => "-"),
'end' => array('end' => "-", 'order' => "-"),
'sum' => array('sum' => "-", 'order' => "-"),
'category' => array('category' => '<span class="text-bold holiday-text">Feiertag <i class="far fa-fw fa-umbrella-beach "></i></span>', 'order' => 'Feiertag'),
'comment' => array('comment' => '<span class="text-bold holiday-text">'.$holidayrow.'</span>', 'order' => $holidayrow),
'edit' => array('edit' => "", 'order' => ""),
);
}
foreach ($holidayrows as $key => $holidayrow) {
$day = $daysgerm[date("w", $key)];
$rows[] = array(
'date' => array('date' => '<span class="text-bold holiday-text">' . $day . " " . date("d.m.Y", $key) . '</span>', 'order' => $key),
'start' => array('start' => "-", 'order' => "-"),
'end' => array('end' => "-", 'order' => "-"),
'sum' => array('sum' => "-", 'order' => "-"),
'category' => array('category' => '<span class="text-bold holiday-text">Feiertag <i class="far fa-fw fa-umbrella-beach "></i></span>', 'order' => 'Feiertag'),
'comment' => array('comment' => '<span class="text-bold holiday-text">' . $holidayrow . '</span>', 'order' => $holidayrow),
'edit' => array('edit' => "", 'order' => ""),
);
}
if ($datatype == 5) {
$response['is'] = $isSeconds;
$response['must'] = $mustSeconds;