diff --git a/Layout/default/Timerecording/Index.php b/Layout/default/Timerecording/Index.php index cc6c94328..f47d0270b 100644 --- a/Layout/default/Timerecording/Index.php +++ b/Layout/default/Timerecording/Index.php @@ -111,7 +111,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000); action="">
- +
@@ -214,11 +214,12 @@ $years[time() - 31536000] = date('Y', time() - 31536000); diff --git a/public/js/pages/timerecording/index.js b/public/js/pages/timerecording/index.js index 56f8dcc46..8bebe8264 100644 --- a/public/js/pages/timerecording/index.js +++ b/public/js/pages/timerecording/index.js @@ -419,6 +419,11 @@ $(document).ready(function () { $('#homeoffice').prop('checked', false); $('#homeoffice-div').hide(); $('.car-div-car').show(); + $.each($('#timerecordingCar_id option'), function (index, value) { + if ($(this).data('user') == $('#id').data('userid')) { + $('#timerecordingCar_id').val($(this).val()).change(); + } + }); } else { $('#businesstrip_info').hide(); $('#businesstrip_info').val(''); @@ -489,7 +494,7 @@ $(document).ready(function () { }); $("body").on("change", "#mileage_start", function () { - $('#mileage_end').prop("min", $('#mileage_start').val()); + $('#mileage_end').prop("min", $('#mileage_start').val()); }); $("body").on("click", ".delete-item", function () { diff --git a/scripts/check_timerecording_p57a.php b/scripts/check_timerecording_p57a.php new file mode 100644 index 000000000..08a237c32 --- /dev/null +++ b/scripts/check_timerecording_p57a.php @@ -0,0 +1,66 @@ +id); +define("INTERNAL_USER_USERNAME", $me->username); + + +$timerecordingcars = TimerecordingCarModel::getAll(); +//var_dump($timerecordingemployees); + +foreach ($timerecordingcars as $timerecordingcar) { + unset ($approval); + if ($timerecordingcar->initial_approval) { + $initialApproval = date("Y-m-d H:i:s", $timerecordingcar->initial_approval); + $initialApprovalMonth = date("m", $timerecordingcar->initial_approval); + $firstApproval = strtotime('+' . $timerecordingcar->first_approval . 'years', strtotime($initialApproval)); + if ($firstApproval < time()) { + $firstApproval = strtotime(date("Y-$initialApprovalMonth-01", time())); + if ($firstApproval < time()) { + $firstApproval = strtotime(date("Y-$initialApprovalMonth-01", strtotime('+1 year'))); + } + } + + $checkDate = date("m/Y", strtotime('+1 month')); + $approval = date("m/Y", $firstApproval); + if ($checkDate == $approval) { + $model = trim($timerecordingcar->brand . " " . $timerecordingcar->model); + $message = "§57a Überprüfung des Fahrzeuges " . $timerecordingcar->number_plate . " (" . $model . ") ist im Monat " . $approval . " fällig."; + $message .= "\n\nFahrzeuginformationen:"; + $message .= "\nKennzeichen: " . $timerecordingcar->number_plate; + $message .= "\nMarke/Model: " . $model; + if ($timerecordingcar->mileage_now) { + $message .= "\nKilometerstand: " . number_format($timerecordingcar->mileage_now, 0, ',', '.') . " KM"; + } else { + $message .= "\nKilometerstand: -"; + } + if ($timerecordingcar->user_id) { + $message .= "\nFahrzeugverwalter: " . $timerecordingcar->user->name; + } else { + $message .= "\nFahrzeugverwalter: -"; + } + $email = new Emailnotification(); + $email->setSubject('Fälligkeit §57a Überprüfung im Monat ' . $approval . ' (' . $timerecordingcar->number_plate . ')'); + $email->setBody($message); + $email->setFrom('notify@xinon.at', 'Xinon Information'); + $email->setTo('backoffice@xinon.at'); + $email->send(); + + + } + + } + echo "\n"; +} + +