Zeiterfassung
Neue Features: * BP Stunden Aufbuchen/Mindern * Spezialbuchungen ohne Verechnungstechnische relevanz
This commit is contained in:
@@ -263,6 +263,7 @@ class TimerecordingController extends mfBaseController
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
$oldbpseconds=0;
|
||||
$enddate = $r->enddate;
|
||||
$hourday = $r->hourday;
|
||||
|
||||
@@ -286,9 +287,12 @@ class TimerecordingController extends mfBaseController
|
||||
} else if ($hourday == 5) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
} else if ($hourday == 8) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
}
|
||||
|
||||
if ($hourday != 5 && $hourday != 7) {
|
||||
if ($hourday != 5 && $hourday != 7 && $hourday != 8) {
|
||||
$result = $this->checkTimerecording($starttime, $endtime, $id);
|
||||
}
|
||||
if ($result['state'] == "error") {
|
||||
@@ -304,6 +308,7 @@ class TimerecordingController extends mfBaseController
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordings = new Timerecording($id);
|
||||
$oldbpseconds = $timerecordings->hours_bpa;
|
||||
if (!$timerecordings->id) {
|
||||
$this->layout()->setFlash("Buchungen nicht gefunden", "error");
|
||||
$this->redirect("Timerecording");
|
||||
@@ -326,7 +331,12 @@ class TimerecordingController extends mfBaseController
|
||||
$data['businesstrip'] = $r->businesstrip;
|
||||
$data['businesstrip_info'] = $r->businesstrip_info;
|
||||
$data['homeoffice'] = $r->homeoffice;
|
||||
$data['days'] = $r->days;
|
||||
if ($hourday == 8) {
|
||||
$data['days'] = 0;
|
||||
$data['hours_bpa'] = $r->days * 60 * 60;
|
||||
} else {
|
||||
$data['days'] = $r->days;
|
||||
}
|
||||
$data['timerecordingCar_id'] = $r->timerecordingCar_id;
|
||||
$data['mileage_start'] = $r->mileage_start;
|
||||
$data['mileage_end'] = $r->mileage_end;
|
||||
@@ -456,6 +466,9 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$this->updatePlushours($data['user_id']);
|
||||
TimerecordingCarModel::calcMileage();
|
||||
if ($data['hours_bpa']) {
|
||||
$this->updateBpHours($data['user_id'], $data['hours_bpa'], $oldbpseconds);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
@@ -537,6 +550,21 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function updateBpHours($userid, $seconds, $oldseconds = 0)
|
||||
{
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
if (!$employee) {
|
||||
return;
|
||||
}
|
||||
$employee = $employee[0];
|
||||
$bpHours = $employee->bpahours;
|
||||
$employeeupdate = new TimerecordingEmployee($employee->id);
|
||||
$data = [];
|
||||
$data['bpahours'] = $bpHours + $seconds - $oldseconds;
|
||||
$employeeupdate->update($data);
|
||||
$employeeupdate->save();
|
||||
}
|
||||
|
||||
public function updatePlushours($userid, $enddate = null)
|
||||
{
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
@@ -957,7 +985,7 @@ class TimerecordingController extends mfBaseController
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
} else {
|
||||
} else if ($timerecording->timerecordingCategory->hourday != 8) {
|
||||
$rows[] = array(
|
||||
'date' => array('date' => $state . $day . " " . $date, 'order' => $orderdate),
|
||||
'start' => array('start' => $start, 'order' => $start),
|
||||
@@ -1102,10 +1130,14 @@ class TimerecordingController extends mfBaseController
|
||||
$id = $this->request->id;
|
||||
$timerecordings = new Timerecording($id);
|
||||
$userid = $timerecordings->user_id;
|
||||
$oldbpseconds = $timerecordings->hours_bpa;
|
||||
if (!$timerecordings->id || $timerecordings->id != $id) {
|
||||
$this->layout()->setFlash("Buchung nicht gefunden.", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
if ($timerecordings->timerecordingCategory->hourday == 8) {
|
||||
$this->updateBpHours($userid, 0, $oldbpseconds);
|
||||
}
|
||||
$timerecordings->delete();
|
||||
$this->updateHolidays($userid);
|
||||
$this->updatePlushours($userid);
|
||||
|
||||
@@ -7,6 +7,7 @@ class TimerecordingModel
|
||||
private $end;
|
||||
private $hours;
|
||||
private $hours_overtime;
|
||||
private $hours_bpa;
|
||||
private $days;
|
||||
private $timerecordingCategory_id;
|
||||
private $businesstrip;
|
||||
|
||||
@@ -10,7 +10,7 @@ class TimerecordingCategoryModel
|
||||
private $only_admin;
|
||||
private $businesstrip;
|
||||
private $unpaid;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)");
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)",8 => "BP Stunden (Anzahl Stunden)");
|
||||
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
@@ -150,6 +150,13 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['bpahours_value'] = $bpahours_value;
|
||||
}
|
||||
}
|
||||
if ($this->me->superexpertEnabled()) {
|
||||
if ($r->only_admin) {
|
||||
$data['only_admin'] = $r->only_admin;
|
||||
} else {
|
||||
$data['only_admin'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$data['overtime']) {
|
||||
$data['overtime'] = 0;
|
||||
|
||||
@@ -20,6 +20,7 @@ class TimerecordingEmployeeModel
|
||||
private $enddate;
|
||||
private $bmd_active;
|
||||
private $jobbike;
|
||||
private $only_admin;
|
||||
private $birthday;
|
||||
public static $employeetypesbmd = array('1' => '1000', '2' => '1200', '3' => '1400');
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$this->layout()->setTemplate("TimerecordingReport/Index");
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$timerecordingEmployees = TimerecordingEmployeeModel::getAllArray();
|
||||
$this->layout()->set("timerecordingEmployees", $timerecordingEmployees);
|
||||
$timerecordingusers = UserModel::search(['employee' => 'true']);
|
||||
$this->layout()->set("timerecordingusers", $timerecordingusers);
|
||||
$timerecordings = TimerecordingModel::getAll();
|
||||
@@ -81,6 +83,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$plusHours = $employee[0]->plushours;
|
||||
|
||||
}
|
||||
$employeeArray = TimerecordingEmployeeModel::getAllArray();
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::getAll();
|
||||
foreach ($workinghours as $workinghour) {
|
||||
|
||||
@@ -164,6 +167,9 @@ class TimerecordingReportController extends mfBaseController
|
||||
$timerecordings = TimerecordingModel::search($searchArray);
|
||||
$responsecount = count($timerecordings);
|
||||
foreach ($timerecordings as $timerecording):
|
||||
if ($employeeArray[$timerecording->user_id]['only_admin'] == 1 && !$this->me->superexpertEnabled()) {
|
||||
continue;
|
||||
}
|
||||
$hiderecording = 0;
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
@@ -310,6 +316,21 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 8) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
// $hoursbpa = number_format($timerecording->hours_bpa / 60 / 60, "2", ",", '');
|
||||
$hoursbpa = round($timerecording->hours_bpa / 60 / 60, 2);
|
||||
$hoursbpa = str_replace(".", ",", $hoursbpa);
|
||||
|
||||
if ($timerecording->hours_bpa > 0) {
|
||||
$sum = "+" . $hoursbpa . " St";
|
||||
} else {
|
||||
$sum = $hoursbpa . " St";
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 6) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
@@ -363,6 +384,11 @@ class TimerecordingReportController extends mfBaseController
|
||||
|
||||
if ($timerecording->completed == 0):
|
||||
if ($timerecording->approved == 0) :
|
||||
$ddays = $timerecording->days;
|
||||
if ($timerecording->timerecordingCategory->hourday == 8) {
|
||||
$ddays = round($timerecording->hours_bpa / 60 / 60, 2);
|
||||
}
|
||||
|
||||
$edit = '<i class="far fa-edit edit-button" data-id="' . $timerecording->id . '"
|
||||
data-date="' . $datadate . '"
|
||||
data-category="' . $timerecording->timerecordingCategory->id . '"
|
||||
@@ -374,7 +400,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-days="' . $timerecording->days . '"
|
||||
data-days="' . $ddays . '"
|
||||
data-car="' . $timerecording->timerecordingCar_id . '"
|
||||
data-mileagestart="' . $timerecording->mileage_start . '"
|
||||
data-mileageend="' . $timerecording->mileage_end . '"
|
||||
@@ -384,9 +410,9 @@ class TimerecordingReportController extends mfBaseController
|
||||
endif;
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5 || $timerecording->timerecordingCategory->hourday == 8)) {
|
||||
} else if ($hiderecording == 1) {
|
||||
} else {
|
||||
} else if (($timerecording->timerecordingCategory->hourday == 8 && $this->me->superexpertEnabled()) || $timerecording->timerecordingCategory->hourday != 8) {
|
||||
if (!$enddatecend) {
|
||||
$enddatecend = $enddate;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user