Zeiterfassung Update
* Erstberechnung Überstunden 50%/100% Steuerfrei/Steuerpflichtig * Feiertag werden nun in der Buchungsübersicht angezeigt
This commit is contained in:
@@ -386,6 +386,69 @@ class TimerecordingReportController extends mfBaseController
|
||||
die();
|
||||
}
|
||||
|
||||
private function checkOvertime($timerecording)
|
||||
{
|
||||
$start = $timerecording->start;
|
||||
$end = $timerecording->end;
|
||||
$O50free = 0;
|
||||
$O50pfl = 0;
|
||||
$O100free = 0;
|
||||
$O100pfl = 0;
|
||||
$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) {
|
||||
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
|
||||
}
|
||||
$start = $timerecording->start;
|
||||
$end = $timerecording->end;
|
||||
$startday = date('Y-m-d', $start);
|
||||
|
||||
if (date('w', $start) == 0 || $holiDay[$startday]) {
|
||||
$O100free = $O100free + $timerecording->end - $timerecording->start;
|
||||
} else {
|
||||
if ($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) {
|
||||
$sum = $end - $start;
|
||||
if ($sum >= 10800) {
|
||||
if ($start < $O100end) {
|
||||
$O100free = $O100free + $O100end - $start;
|
||||
}
|
||||
if ($end >= $O100start) {
|
||||
$O100free = $O100free + $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;
|
||||
}
|
||||
}
|
||||
}
|
||||
$response['O100free'] = $O100free;
|
||||
$response['O100pfl'] = $O100pfl;
|
||||
$response['O50free'] = $O50free;
|
||||
$response['O50pfl'] = $O50pfl;
|
||||
$response['sum'] = $O100free + $O100pfl + $O50free + $O50pfl;
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getTimerecordingsTimes($datatype, $dataweek, $datamonth, $datayear, $user_id = NULL, $ajax = 1)
|
||||
{
|
||||
@@ -567,7 +630,6 @@ class TimerecordingReportController extends mfBaseController
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $seconds;
|
||||
}
|
||||
|
||||
|
||||
if ($timerecording->timerecordingCategory->short != "1000,1200,1400") {
|
||||
if (!$daysum[$timerecording->timerecordingCategory->name]) {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $seconds;
|
||||
@@ -581,6 +643,10 @@ class TimerecordingReportController extends mfBaseController
|
||||
$nlzTimes[$timerecording->id]['unpaid'] = $timerecording->timerecordingCategory->unpaid;
|
||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
||||
} else {
|
||||
$overtimes = $this->checkOvertime($timerecording);
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
|
||||
$isSeconds = $isSeconds - $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);
|
||||
|
||||
Reference in New Issue
Block a user