Zeiterfassung update

* Autoausfüllen -> fertiggestellt
* Überprüfungen Buchungsüberschneidungen ausgebaut
* Abwesenheitskalender Mouseover eingebaut
* Abwesenheiten ohne Ende Update -> Gesundmeldung generiert nun ein Update mit Ende auf die Abwesenheit
This commit is contained in:
Spitzer Daniel
2024-02-22 14:53:48 +01:00
parent cdbf9de6fe
commit 1fee0b1eef
11 changed files with 426 additions and 43 deletions

View File

@@ -74,10 +74,10 @@ class TimerecordingReportController extends mfBaseController
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
$whend = strtotime(date('Y-m-d', time()) . " " . $workinghour->end . ":00");
if (!$workingHours[$workinghour->day]) {
$workingHours[$workinghour->day] = $whend - $whstart;
if (!$workingHours[$workinghour->user_id][$workinghour->day]) {
$workingHours[$workinghour->user_id][$workinghour->day] = $whend - $whstart;
} else {
$workingHours[$workinghour->day] = $workingHours[$workinghour->day] + $whend - $whstart;
$workingHours[$workinghour->user_id][$workinghour->day] = $workingHours[$workinghour->user_id][$workinghour->day] + $whend - $whstart;
}
}
foreach ($holidays as $holiday) {
@@ -89,6 +89,7 @@ class TimerecordingReportController extends mfBaseController
$year = date('Y', $dataweek);
$timestamp_montag = strtotime("{$year}-W{$kw}");
$timestamp_sonntag = strtotime("{$year}-W{$kw}-7");
$firstdate = strtotime(date("Y-m-d", $timestamp_montag) . " 00:00:00");
$lastdate = strtotime(date("Y-m-d", $timestamp_sonntag) . ' 23:59:59');
$searchArray = ['start' => $timestamp_montag, 'end' => $lastdate];
@@ -164,10 +165,10 @@ class TimerecordingReportController extends mfBaseController
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
$day = $daysgerm[date("w", $timerecording->start)];
$isSeconds = $isSeconds + $seconds;
} else if ($timerecording->timerecordingCategory->hourday == 2) {
} 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);
$datadate = date("Y-m-d", $timerecording->start);
$enddate = date("Y-m-d", $timerecording->end);
$enddate = date("Y-m-d", $timerecording->end + 7200);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
@@ -177,23 +178,69 @@ class TimerecordingReportController extends mfBaseController
} else {
$endtimecalc = $timerecording->end;
}
if ($firstdate > $timerecording->start) {
$starttimecalc = $firstdate;
} else {
$starttimecalc = $timerecording->start;
}
$summcounter = 0;
for ($i = $timerecording->start; $i <= $endtimecalc; $i = $i + 86400) {
$holidaycounter = $workingHours[date("w", $i)];
$savecounter = 0;
// echo $starttimecalc."<br>";
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
$isSeconds = $isSeconds + $holidaycounter;
$summcounter = $summcounter + $holidaycounter;
$summcounter = $summcounter + $holidaycounter;;
if ($savecounter == 1000) {
echo $savecounter;
die();
}
$savecounter++;
}
$seconds = $summcounter;
$minutes = floor(($seconds % 3600) / 60);
$hours = floor($seconds / 3600);
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
} else if ($timerecording->timerecordingCategory->hourday == 3 || $timerecording->timerecordingCategory->hourday == 4) {
$date = date("d.m.Y", $timerecording->start);
} else if ($timerecording->timerecordingCategory->hourday == 3 && !$timerecording->end) {
$date = date("d.m.Y", $timerecording->start) . " - " . $daysgerm[date("w", time())] . " " . date("d.m.Y", time());;
$datadate = date("Y-m-d", $timerecording->start);
$enddatetemp = date("Y-m-d", time());
$enddatetemp = strtotime($enddatetemp . " 23:59:59");
$enddate = date("Y-m-d", $enddatetemp + 7200);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
if ($lastdate < time()) {
$endtimecalc = $lastdate;
} else {
$endtimecalc = time();
}
$summcounter = 0;
if ($firstdate > $timerecording->start) {
$starttimecalc = $firstdate;
} else {
$starttimecalc = $timerecording->start;
}
$summcounter = 0;
$savecounter = 0;
// echo $starttimecalc."<br>";
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
$isSeconds = $isSeconds + $holidaycounter;
$summcounter = $summcounter + $holidaycounter;;
if ($savecounter == 1000) {
echo $savecounter;
die();
}
$savecounter++;
}
$seconds = $summcounter;
$minutes = floor(($seconds % 3600) / 60);
$hours = floor($seconds / 3600);
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
}
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
@@ -203,10 +250,13 @@ class TimerecordingReportController extends mfBaseController
}
$edit = "";
if ($timerecording->businesstrip == 1) {
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-2'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
} else {
$category = $timerecording->timerecordingCategory->name;
}
if ($timerecording->timerecordingCategory->hourday == 3 && !$timerecording->end) {
$category = $category . " <span class='text-bold ml-1'>(Offen)</span>";
}
if ($timerecording->completed == 0):
@@ -237,6 +287,7 @@ class TimerecordingReportController extends mfBaseController
'sum' => array('sum' => $sum, 'order' => $sum),
'cstart' => array('cstart' => $datadate, 'order' => $datadate),
'cend' => array('cend' => $enddate, 'order' => $enddate),
'ccategory' => array('ccategory' => $timerecording->timerecordingCategory->name, 'order' => $timerecording->timerecordingCategory->name),
'category' => array('category' => $category, 'order' => $timerecording->timerecordingCategory->name),
'comment' => array('comment' => $timerecording->comment, 'order' => $timerecording->comment),
'edit' => array('edit' => $edit, 'order' => $edit),