Zeiterfassung Update

* Berechnungsupdate Mehrstunden + Überstunden
 * Fix: Gewisse Buchungskonstellationen konnten bei Änderungen des Min Feld von der Endzeit so setzen das die Überprüfung nicht Richtig ist. Des min Feld wird nun immer richtig gesetzt. (Habs schon im Live gefixt, da es relativ akut war)
This commit is contained in:
Spitzer Daniel
2024-03-07 10:11:11 +01:00
parent 0480e1b59c
commit 4ae74a0e6e
4 changed files with 10 additions and 11 deletions

View File

@@ -97,8 +97,8 @@ $type[3] = "Lehrling";
<td class="text-center"><?= $sum ?></td>
<td class="text-center"
data-order="<?= ($timerecordingemployees[$timerecordinguser->id]['plushours_now']) ? $timerecordingemployees[$timerecordinguser->id]['plushours_now'] : 0 ?>"><?= $plusHours ?></td>
<td class="text-center"><?= sprintf('%02d:%02d', floor($timerecordingemployees[$timerecordinguser->id]['overtime_now'] / 3600), floor($timerecordingemployees[$timerecordinguser->id]['overtime_now'] / 60 % 60)) ?></td>
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] . ' Tage' : '' ?> </td>
<td class="text-center" data-order="<?= $timerecordingemployees[$timerecordinguser->id]['overtime'] ?>"><?= sprintf('%02d:%02d', floor($timerecordingemployees[$timerecordinguser->id]['overtime'] / 3600), floor($timerecordingemployees[$timerecordinguser->id]['overtime'] / 60 % 60)) ?></td>
<td class="text-center" data-order="<?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] : '' ?>"><?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] . ' Tage' : '' ?> </td>
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['auto_workinghours'] == '1') ? 'Ja' : 'Nein' ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("TimerecordingEmployee", "edit", ['id' => $timerecordingemployees[$timerecordinguser->id]['id'], "userid" => $timerecordinguser->id]) ?>"><i

View File

@@ -343,7 +343,7 @@ class TimerecordingController extends mfBaseController
$this->redirect("Timerecording");
}
protected function updateHolidays($userid)
public function updateHolidays($userid)
{
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
if ($employee) {
@@ -387,7 +387,7 @@ class TimerecordingController extends mfBaseController
}
//check if holiday is already in the list
foreach ($holidayDays as $key => $holidayDay) {
if ($realholiDay[$key]) {
if (($realholiDay[$key])) {
} else if ($workingHours[date('w', strtotime($key))]) {
$holidays_now--;
@@ -457,6 +457,7 @@ class TimerecordingController extends mfBaseController
$plusHours = $employee[0]->plushours_now;
$auto_workinghours = $employee[0]->auto_workinghours;
$startdate = $employee[0]->startdate;
$overtime = $employee[0]->overtime;
}
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $userid]);
$holidays = TimerecordingHolidayModel::getAll();
@@ -509,11 +510,8 @@ class TimerecordingController extends mfBaseController
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}
$timestamp = $timestamp + 86400;
}
} else if ($datatype == 3) {
$firstdate = strtotime(date("Y-01-01", $datayear));
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
@@ -528,11 +526,8 @@ class TimerecordingController extends mfBaseController
if (!$holiDay[$dDate]) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
}
$timestamp = $timestamp + 86400;
}
} else if ($datatype == 5) {
$firstdate = $startime;
$lastdate = $endtime;
@@ -565,7 +560,6 @@ class TimerecordingController extends mfBaseController
$state = "";
$enddate = "";
$sum = "-";
$day = "";
$orderdate = $timerecording->start;
if ($timerecording->timerecordingCategory->hourday == 1) {
@@ -742,6 +736,7 @@ class TimerecordingController extends mfBaseController
$response['must'] = $mustSeconds;
return $response;
} else {
$plusHours = $overtime + $plusHours;
if ($plusHours < 0) {
$plusHours = $plusHours * -1;
$plusHours = "-" . sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));

View File

@@ -270,7 +270,9 @@ $(document).ready(function () {
$('#date').val($(this).data('date'));
$('#start').val($(this).data('start'));
$('#end').val($(this).data('end'));
$('#end').prop("min", $('#start').val());
$('#enddate').val($(this).data('enddate'));
$('#enddate').prop("min", $('#date').val());
$('#comment').val($(this).data('comment'));
if ($(this).data('businesstrip') == 1) {
$('#businesstrip').prop("checked", true);

View File

@@ -303,8 +303,10 @@ $(document).ready(function () {
$('#date').val($(this).data('date'));
$('#start').val($(this).data('start'));
$('#end').val($(this).data('end'));
$('#end').prop("min", $('#start').val());
$('#days').val($(this).data('days'));
$('#enddate').val($(this).data('enddate'));
$('#enddate').prop("min", $('#date').val());
$('#comment').val($(this).data('comment'));
if ($(this).data('businesstrip') == 1) {
$('#businesstrip').prop("checked", true);