Zeiterfassungs Update
* Implementerung Fahrzeugverwaltung * neue Buchungsart Fahrtenbuch * Diverse Bugfixes
This commit is contained in:
@@ -22,7 +22,9 @@ class TimerecordingController extends mfBaseController
|
||||
$this->updateHolidays($this->me->id);
|
||||
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$timerecordingCars = TimerecordingCarModel::search(['timerecording' => 1]);
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$this->layout()->set("timerecordingCars", $timerecordingCars);
|
||||
$this->layout()->setTemplate("Timerecording/Index");
|
||||
}
|
||||
|
||||
@@ -206,13 +208,12 @@ class TimerecordingController extends mfBaseController
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
|
||||
$plushours = $employee[0]->plushours_now * 1.25;
|
||||
$overtime = $employee[0]->overtime * 1.5;
|
||||
$overtime = $employee[0]->overtime_now * 1.5;
|
||||
$overtimesum = $plushours + $overtime;
|
||||
if ($overtimesum < $isTime) {
|
||||
if ($overtimesum < 0) {
|
||||
$overtimesum = 0;
|
||||
}
|
||||
|
||||
$result['state'] = "error";
|
||||
$result['error'] = "Maximal verfügbarer ZA: " . sprintf('%02dh:%02dm', floor($overtimesum / 3600), floor($overtimesum / 60 % 60)) . ".";
|
||||
echo json_encode($result);
|
||||
@@ -221,7 +222,7 @@ class TimerecordingController extends mfBaseController
|
||||
if ($plushours >= $isTime) {
|
||||
$isTime = $isTime * 0.8;
|
||||
$return['hours'] = $isTime;
|
||||
} elseif ($plushours <= 0) {
|
||||
} elseif ($plushours == 0) {
|
||||
$isTime = $isTime * 0.66666666666666666666666666666667;
|
||||
$return ['hours_overtime'] = $isTime;
|
||||
} else {
|
||||
@@ -265,7 +266,7 @@ class TimerecordingController extends mfBaseController
|
||||
$this->updateOpenTimerecording();
|
||||
}
|
||||
$data = [];
|
||||
if ($hourday == 1 || $hourday == 6) {
|
||||
if ($hourday == 1 || $hourday == 6 || $hourday == 7) {
|
||||
$starttime = strtotime($r->date . " " . $r->start . ":00");
|
||||
$endtime = strtotime($r->date . " " . $r->end . ":00");
|
||||
if ($hourday == 6) {
|
||||
@@ -282,7 +283,7 @@ class TimerecordingController extends mfBaseController
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
}
|
||||
|
||||
if ($hourday != 5) {
|
||||
if ($hourday != 5 && $hourday != 7) {
|
||||
$result = $this->checkTimerecording($starttime, $endtime, $id);
|
||||
}
|
||||
if ($result['state'] == "error") {
|
||||
@@ -321,6 +322,19 @@ class TimerecordingController extends mfBaseController
|
||||
$data['businesstrip_info'] = $r->businesstrip_info;
|
||||
$data['homeoffice'] = $r->homeoffice;
|
||||
$data['days'] = $r->days;
|
||||
$data['timerecordingCar_id'] = $r->timerecordingCar_id;
|
||||
$data['mileage_start'] = $r->mileage_start;
|
||||
$data['mileage_end'] = $r->mileage_end;
|
||||
|
||||
if (!$data['timerecordingCar_id']) {
|
||||
$data['timerecordingCar_id'] = NULL;
|
||||
}
|
||||
if (!$data['mileage_start']) {
|
||||
$data['mileage_start'] = NULL;
|
||||
}
|
||||
if (!$data['mileage_end']) {
|
||||
$data['mileage_end'] = NULL;
|
||||
}
|
||||
|
||||
if (!$data['businesstrip'] || $data['businesstrip'] == "false") {
|
||||
$data['businesstrip'] = 0;
|
||||
@@ -436,6 +450,7 @@ class TimerecordingController extends mfBaseController
|
||||
$this->updateHolidays($data['user_id']);
|
||||
}
|
||||
$this->updatePlushours($data['user_id']);
|
||||
TimerecordingCarModel::calcMileage();
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
@@ -828,6 +843,16 @@ class TimerecordingController extends mfBaseController
|
||||
$sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
@@ -836,8 +861,17 @@ class TimerecordingController extends mfBaseController
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$edit = "";
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$distance = $timerecording->mileage_end - $timerecording->mileage_start;
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'>(" . $timerecording->timerecordingCar->number_plate . " " . $distance . "KM) (Zielort: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->businesstrip == 1) {
|
||||
if ($timerecording->timerecordingCar) {
|
||||
$distance = $timerecording->mileage_end - $timerecording->mileage_start;
|
||||
$car = " (" . $timerecording->timerecordingCar->number_plate . " " . $distance . "KM)";
|
||||
} else {
|
||||
$car = "";
|
||||
}
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'>$car (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->homeoffice == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
|
||||
} else {
|
||||
@@ -860,13 +894,16 @@ class TimerecordingController extends mfBaseController
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-car="' . $timerecording->timerecordingCar_id . '"
|
||||
data-mileagestart="' . $timerecording->mileage_start . '"
|
||||
data-mileageend="' . $timerecording->mileage_end . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
endif;
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && $timerecording->timerecordingCategory->hourday == 1) {
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
} else {
|
||||
$rows[] = array(
|
||||
'date' => array('date' => $state . $day . " " . $date, 'order' => $orderdate),
|
||||
|
||||
Reference in New Issue
Block a user