Zeiterfassung Update
* Script für Email Alarmierung §57a * Automatische auswahl beim Buchen von Dienstreisen auf das zugewiesene Fahrzeug
This commit is contained in:
@@ -111,7 +111,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
|||||||
action="<?= self::getUrl("Timerecording", "save") ?>">
|
action="<?= self::getUrl("Timerecording", "save") ?>">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<input id="id" type="hidden" name="id" value=""/>
|
<input id="id" data-userid="<?= $me->id ?>" type="hidden" name="id" value=""/>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-lg-2">
|
<div class="form-group col-lg-2">
|
||||||
<label class="col-form-label" for="timerecordingCategory_id">Buchungsart</label>
|
<label class="col-form-label" for="timerecordingCategory_id">Buchungsart</label>
|
||||||
@@ -214,11 +214,12 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
|||||||
|
|
||||||
<select id="timerecordingCar_id" name="timerecordingCar_id"
|
<select id="timerecordingCar_id" name="timerecordingCar_id"
|
||||||
class="select2 form-control">
|
class="select2 form-control">
|
||||||
<option value="">Auto auswählen</option>
|
<option value="">Kein Firmenauto</option>
|
||||||
<?php foreach ($timerecordingCars as $timerecordingCar): ?>
|
<?php foreach ($timerecordingCars as $timerecordingCar): ?>
|
||||||
|
|
||||||
<option value="<?= $timerecordingCar->id ?>"
|
<option value="<?= $timerecordingCar->id ?>"
|
||||||
data-mileagenow="<?= $timerecordingCar->mileage_now ?>"><?= $timerecordingCar->number_plate . " (" . $timerecordingCar->brand." ".$timerecordingCar->model . ")" ?></option>
|
data-user="<?= $timerecordingCar->user_id ?>"
|
||||||
|
data-mileagenow="<?= $timerecordingCar->mileage_now ?>"><?= $timerecordingCar->number_plate . " (" . $timerecordingCar->brand . " " . $timerecordingCar->model . ")" ?></option>
|
||||||
</option>
|
</option>
|
||||||
<?php
|
<?php
|
||||||
endforeach; ?>
|
endforeach; ?>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ ksort($timerecordingUsers);
|
|||||||
class="select2 form-control" required="required">
|
class="select2 form-control" required="required">
|
||||||
<option value="-"> </option>
|
<option value="-"> </option>
|
||||||
<?php foreach ($timerecordingUsers as $key => $timerecordingUser): ?>
|
<?php foreach ($timerecordingUsers as $key => $timerecordingUser): ?>
|
||||||
<option <?= ($timerecordingcars->user_id==$timerecordingUser) ? 'selected="selected' : "" ?> value="<?= $timerecordingUser ?>"><?= $key ?></option>
|
<option <?= ($timerecordingcars->user_id==$timerecordingUser) ? 'selected="selected"' : "" ?> value="<?= $timerecordingUser ?>"><?= $key ?></option>
|
||||||
<?php
|
<?php
|
||||||
endforeach; ?>
|
endforeach; ?>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -419,6 +419,11 @@ $(document).ready(function () {
|
|||||||
$('#homeoffice').prop('checked', false);
|
$('#homeoffice').prop('checked', false);
|
||||||
$('#homeoffice-div').hide();
|
$('#homeoffice-div').hide();
|
||||||
$('.car-div-car').show();
|
$('.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 {
|
} else {
|
||||||
$('#businesstrip_info').hide();
|
$('#businesstrip_info').hide();
|
||||||
$('#businesstrip_info').val('');
|
$('#businesstrip_info').val('');
|
||||||
@@ -489,7 +494,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("body").on("change", "#mileage_start", 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 () {
|
$("body").on("click", ".delete-item", function () {
|
||||||
|
|||||||
66
scripts/check_timerecording_p57a.php
Normal file
66
scripts/check_timerecording_p57a.php
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
//require 'vendor/autoload.php';
|
||||||
|
require("../config/config.php");
|
||||||
|
|
||||||
|
define('FRONKDB_SQLDEBUG', false);
|
||||||
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
||||||
|
|
||||||
|
require_once(LIBDIR . "/mvcfronk/mfRouter/mfRouter.php");
|
||||||
|
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseModel.php");
|
||||||
|
require_once(LIBDIR . "/mvcfronk/mfBase/mfBaseController.php");
|
||||||
|
|
||||||
|
$me = new User(154);
|
||||||
|
define("INTERNAL_USER_ID", $me->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";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user