Zeiterfassung

* Anpassungen Urlaubsanzeige bei Arbeitszeitänderungen
This commit is contained in:
Daniel Spitzer
2025-06-27 09:22:06 +02:00
parent 7552fe0ab1
commit 6ae084f291
2 changed files with 68 additions and 1 deletions

View File

@@ -96,6 +96,28 @@ class TimerecordingReportController extends mfBaseController
}
}
$workinghourshistory = TimerecordingEmployeeWorkingHourHistoryModel::getAll();
if ($workinghourshistory) {
$workingHoursHistory[2147483500] = $workingHours;
foreach ($workinghourshistory as $workinghourhistory) {
$workingHoursHistory[$workinghourshistory->user_id][2147483500] = $workingHours;
$whenddate = $workinghourhistory->enddate;
$workinghourhistoryhours = json_decode($workinghourhistory->workinghours, true);
foreach ($workinghourhistoryhours as $workinghourhistoryhour) {
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghourhistoryhour['start'] . ":00");
$whend = strtotime(date('Y-m-d', time()) . " " . $workinghourhistoryhour['end'] . ":00");
if (!$workingHoursHistory[$workinghourhistory->user_id][$whenddate][$workinghourhistoryhour['day']]) {
$workingHoursHistory[$workinghourhistory->user_id][$whenddate][$workinghourhistoryhour['day']] = $whend - $whstart;
} else {
$workingHoursHistory[$workinghourhistory->user_id][$whenddate][$workinghourhistoryhour['day']] = $workingHoursHistory[$whenddate][$workinghourhistoryhour['day']] + $whend - $whstart;
}
}
// echo $workinghourhistory->user_id."<br>";
}
}
// var_dump($workingHoursHistory);
// die();
foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
@@ -218,7 +240,15 @@ class TimerecordingReportController extends mfBaseController
$hcounter = 0;
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
$hidedate .= date("d.m.Y", $i) . " ";
if ($workingHoursHistory[$timerecording->user_id]) {
foreach ($workingHoursHistory[$timerecording->user_id] as $whkey => $whdata) {
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
if ($whtimestamp >= $i) {
unset($workingHours[$timerecording->user_id]);
$workingHours[$timerecording->user_id] = $whdata;
}
}
}
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
$daycheck = date("Y-m-d", $i);
if (!$holiDay[$daycheck]) {
@@ -271,11 +301,21 @@ class TimerecordingReportController extends mfBaseController
}
$summcounter = 0;
$savecounter = 0;
// echo $starttimecalc."<br>";
$hidedate = "<span class='d-none'>";
$hcounter = 0;
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
$hidedate .= date("d.m.Y", $i) . " ";
if ($workingHoursHistory[$timerecording->user_id]) {
foreach ($workingHoursHistory[$timerecording->user_id] as $whkey => $whdata) {
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
if ($whtimestamp >= $i) {
unset($workingHours[$timerecording->user_id]);
$workingHours[$timerecording->user_id] = $whdata;
}
}
}
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
$daycheck = date("Y-m-d", $i);
if (!$holiDay[$daycheck]) {