Zeiterfassung Update

* Berechnungen für Austritte implementiert.
This commit is contained in:
Spitzer Daniel
2024-04-26 12:29:01 +02:00
parent b3fcd1f6e8
commit 5a6224df9f
2 changed files with 23 additions and 6 deletions

View File

@@ -553,7 +553,13 @@ class TimerecordingController extends mfBaseController
$overtime_timestamp = $employee->startdate;
$overtime_now = $overtime;
}
$endtime = time() - 86400;
if ($employee->enddate && $employee->enddate < time() - 86400) {
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
} else {
$endtime = time() - 86400;
}
$endtime = date("Y-m-d", $endtime);
$endtime = strtotime($endtime . " 23:59:00");
@@ -608,6 +614,12 @@ class TimerecordingController extends mfBaseController
$plusHours = $employee[0]->plushours_now;
$auto_workinghours = $employee[0]->auto_workinghours;
$startdate = $employee[0]->startdate;
if ($employee[0]->enddate) {
$enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59");
} else {
$enddate = 2208985200;
}
$overtime = $employee[0]->overtime_now;
}
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $userid]);
@@ -641,7 +653,7 @@ class TimerecordingController extends mfBaseController
for ($i = 1; $i <= 7; $i++) {
$dDate = date('Y-m-d', $timestamp);
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}
@@ -658,7 +670,7 @@ class TimerecordingController extends mfBaseController
for ($i = 1; $i <= $daycount; $i++) {
$dDate = date('Y-m-d', $timestamp);
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}
$timestamp = $timestamp + 86400;
@@ -674,7 +686,7 @@ class TimerecordingController extends mfBaseController
for ($i = 1; $i <= $daycount; $i++) {
$dDate = date('Y-m-d', $timestamp);
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate]) {
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}
$timestamp = $timestamp + 86400;

View File

@@ -411,6 +411,11 @@ class TimerecordingReportController extends mfBaseController
$overtime_now = $employee[0]->overtime_now;
$auto_workinghours = $employee[0]->auto_workinghours;
$startdate = $employee[0]->startdate;
if ($employee[0]->enddate) {
$enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59");
} else {
$enddate = 2208985200;
}
$bpahours = $employee[0]->bpahours;
}
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $user_id]);
@@ -445,7 +450,7 @@ class TimerecordingReportController extends mfBaseController
$dDate = date('Y-m-d', $timestamp);
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}
@@ -466,7 +471,7 @@ class TimerecordingReportController extends mfBaseController
for ($i = 1; $i <= $daycount; $i++) {
$dDate = date('Y-m-d', $timestamp);
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}