$userid]);
if ($employee) {
@@ -553,13 +553,20 @@ class TimerecordingController extends mfBaseController
$overtime_timestamp = $employee->startdate;
$overtime_now = $overtime;
}
- if ($employee->enddate && $employee->enddate < time() - 86400) {
- $endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
+ if (!$enddate) {
+ if ($employee->enddate && $employee->enddate < time() - 86400) {
+ $endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
+ } else {
+ $endtime = time() - 86400;
+ }
} else {
- $endtime = time() - 86400;
+ if ($employee->enddate && $employee->enddate < $enddate) {
+ $endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
+ } else {
+ $endtime = $enddate;
+ }
}
-
$endtime = date("Y-m-d", $endtime);
$endtime = strtotime($endtime . " 23:59:00");
@@ -586,13 +593,19 @@ class TimerecordingController extends mfBaseController
$plushours_now = $plushours_now - $minushours;
$diffTime = $diffTime - $minushours;
$overtime_now = $overtime_now - $minushoursovertime;
- if ($employee->plushours_now != $plushours_now || $employee->overtime_now != $overtime_now) {
- $employeeupdate = new TimerecordingEmployee($employee->id);
- $data = [];
- $data['plushours_now'] = $plushours_now;
- $data['overtime_now'] = $overtime_now;
- $employeeupdate->update($data);
- $employeeupdate->save();
+ if (!$enddate) {
+ if ($employee->plushours_now != $plushours_now || $employee->overtime_now != $overtime_now) {
+ $employeeupdate = new TimerecordingEmployee($employee->id);
+ $data = [];
+ $data['plushours_now'] = $plushours_now;
+ $data['overtime_now'] = $overtime_now;
+ $employeeupdate->update($data);
+ $employeeupdate->save();
+ }
+ } else {
+ $response['plushours'] = $plushours_now;
+ $response['overtime'] = $overtime_now;
+ return $response;
}
}
}
@@ -656,7 +669,7 @@ class TimerecordingController extends mfBaseController
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
- } elseif ($holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
+ } elseif ($holiDay[$dDate]) {
$holidayrows[$timestamp] = $holiDay[$dDate];
}
@@ -675,7 +688,7 @@ class TimerecordingController extends mfBaseController
$dDay = date('w', $timestamp);
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
$mustSeconds = $mustSeconds + $workingHours[$dDay];
- } elseif ($holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
+ } elseif ($holiDay[$dDate]) {
$holidayrows[$timestamp] = $holiDay[$dDate];
}
$timestamp = $timestamp + 86400;
@@ -935,18 +948,18 @@ class TimerecordingController extends mfBaseController
);
}
endforeach;
- foreach ($holidayrows as $key => $holidayrow) {
- $day = $daysgerm[date("w", $key)];
- $rows[] = array(
- 'date' => array('date' => '
'.$day." ".date("d.m.Y",$key).'', 'order' => $key),
- 'start' => array('start' => "-", 'order' => "-"),
- 'end' => array('end' => "-", 'order' => "-"),
- 'sum' => array('sum' => "-", 'order' => "-"),
- 'category' => array('category' => '
Feiertag ', 'order' => 'Feiertag'),
- 'comment' => array('comment' => '
'.$holidayrow.'', 'order' => $holidayrow),
- 'edit' => array('edit' => "", 'order' => ""),
- );
- }
+ foreach ($holidayrows as $key => $holidayrow) {
+ $day = $daysgerm[date("w", $key)];
+ $rows[] = array(
+ 'date' => array('date' => '
' . $day . " " . date("d.m.Y", $key) . '', 'order' => $key),
+ 'start' => array('start' => "-", 'order' => "-"),
+ 'end' => array('end' => "-", 'order' => "-"),
+ 'sum' => array('sum' => "-", 'order' => "-"),
+ 'category' => array('category' => '
Feiertag ', 'order' => 'Feiertag'),
+ 'comment' => array('comment' => '
' . $holidayrow . '', 'order' => $holidayrow),
+ 'edit' => array('edit' => "", 'order' => ""),
+ );
+ }
if ($datatype == 5) {
$response['is'] = $isSeconds;
$response['must'] = $mustSeconds;
diff --git a/application/TimerecordingBilling/TimerecordingBillingController.php b/application/TimerecordingBilling/TimerecordingBillingController.php
index a5a6f5f22..0e4f7fffe 100644
--- a/application/TimerecordingBilling/TimerecordingBillingController.php
+++ b/application/TimerecordingBilling/TimerecordingBillingController.php
@@ -55,6 +55,9 @@ class TimerecordingBillingController extends mfBaseController
{
$r = $this->request;
$month = $r->get("month");
+ $monthstart = strtotime("01." . $month);
+ $monthend = strtotime("last day of this month", $monthstart);
+
if (!$month) {
$this->redirect("TimerecordingBilling");
}
@@ -64,16 +67,17 @@ class TimerecordingBillingController extends mfBaseController
} else {
$month = strtotime("01." . $month);
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
+ $timerecordingReport = new TimerecordingReportController();
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
- if ($timerecordingsEmolyee->bmd_active == 0) continue;
+ if ($timerecordingsEmolyee->bmd_active == 0 || $timerecordingsEmolyee->startdate > $monthend || ($timerecordingsEmolyee->enddate && $timerecordingsEmolyee->enddate < $monthstart)) continue;
$user = new User($timerecordingsEmolyee->user_id);
$employee_number = (string)$user->getFlag('employee_number');
- $timerecordingReport = new TimerecordingReportController();
$timerecordings[$timerecordingsEmolyee->user_id]['user_id'] = $timerecordingsEmolyee->user_id;
$timerecordings[$timerecordingsEmolyee->user_id]['user_name'] = $timerecordingsEmolyee->user->name;
$timerecordings[$timerecordingsEmolyee->user_id]['employee_number'] = $employee_number;
$timerecordings[$timerecordingsEmolyee->user_id]['data'] = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
}
+
$this->layout()->set("timerecordings", $timerecordings);
$this->layout()->setTemplate("TimerecordingBilling/Detail");
$this->layout()->set("month", date("m.Y", $month));
@@ -103,6 +107,9 @@ class TimerecordingBillingController extends mfBaseController
case "completemonth":
$return = $this->completemonth($month);
break;
+ case "abortmonth":
+ $return = $this->abortmonth($month);
+ break;
case "saveovertime":
$return = $this->saveovertime();
break;
@@ -121,7 +128,6 @@ class TimerecordingBillingController extends mfBaseController
protected function addAction()
{
-
}
protected function editAction()
@@ -186,7 +192,6 @@ class TimerecordingBillingController extends mfBaseController
return $id;
}
-
protected function deleteAction()
{
$id = $this->request->id;
@@ -195,7 +200,6 @@ class TimerecordingBillingController extends mfBaseController
$this->layout()->setFlash("Timerecording nicht gefunden.", "error");
$this->redirect("TimerecordingBilling");
}
-
$timerecordingbillings->delete();
$this->redirect("TimerecordingBilling");
}
@@ -229,6 +233,7 @@ class TimerecordingBillingController extends mfBaseController
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
$employee_type = $employeetypesbmd[$timerecordingBillingEmployee->timerecordingEmployee->type];
$overtimebase = 0;
+ $plushoursbase = 0;
if ($nlz == 0) {
$hours = $timerecordingBillingEmployee->ishours / 3600;
$hours = round($hours, 2);
@@ -237,20 +242,62 @@ class TimerecordingBillingController extends mfBaseController
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
+ if ($timerecordingBillingEmployee->plushours25 > 0) {
+ $plushours25 = $timerecordingBillingEmployee->plushours25 / 3600;
+ $plushours25 = round($plushours25, 2);
+ $plushoursbase = $plushoursbase + $plushours25;
+ $plushours25 = str_replace(".", ",", $plushours25);
+ $bodyarray = [$monthbmd, "1", $employee_number, "3050", $plushours25, "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ }
if ($timerecordingBillingEmployee->overtime50free > 0) {
$overtime50free = $timerecordingBillingEmployee->overtime50free / 3600;
$overtime50free = round($overtime50free, 2);
$overtimebase = $overtimebase + $overtime50free;
- $overtime50free = str_replace(".", ",", $overtime50free);
- $bodyarray = [$monthbmd, "1", $employee_number, "3110", $overtime50free, "", "", "", "", "", ""];
- fputcsv($file, $bodyarray, ";");
+
+ if ($timerecordingBillingEmployee->overtime50free > 64800) {
+ $bodyarray = [$monthbmd, "1", $employee_number, "3110", "18", "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ $diffsum = $timerecordingBillingEmployee->overtime50free - 64800;
+ $diffsum = $diffsum / 3600;
+ $diffsum = round($diffsum, 2);
+ $diffsum = str_replace(".", ",", $diffsum);
+ $bodyarray = [$monthbmd, "1", $employee_number, "3120", $diffsum, "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ } else {
+ $overtime50free = str_replace(".", ",", $overtime50free);
+ $bodyarray = [$monthbmd, "1", $employee_number, "3110", $overtime50free, "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ }
+
+
}
if ($timerecordingBillingEmployee->overtime100free > 0) {
$overtime100free = $timerecordingBillingEmployee->overtime100free / 3600;
$overtime100free = round($overtime100free, 2);
$overtimebase = $overtimebase + $overtime100free;
$overtime100free = str_replace(".", ",", $overtime100free);
- $bodyarray = [$monthbmd, "1", $employee_number, "3160", $overtime100free, "", "", "", "", "", ""];
+ if ($timerecordingBillingEmployee->overtime100free > 64800) {
+ $bodyarray = [$monthbmd, "1", $employee_number, "3160", "18", "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ $diffsum = $timerecordingBillingEmployee->overtime100free - 64800;
+ $diffsum = $diffsum / 3600;
+ $diffsum = round($diffsum, 2);
+ $diffsum = str_replace(".", ",", $diffsum);
+ $bodyarray = [$monthbmd, "1", $employee_number, "3150", $diffsum, "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ } else {
+ $bodyarray = [$monthbmd, "1", $employee_number, "3160", $overtime100free, "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ }
+
+ }
+ if ($timerecordingBillingEmployee->overtime100 > 0) {
+ $overtime100 = $timerecordingBillingEmployee->overtime100 / 3600;
+ $overtime100 = round($overtime100, 2);
+ $overtimebase = $overtimebase + $overtime100;
+ $overtime100free = str_replace(".", ",", $overtime100);
+ $bodyarray = [$monthbmd, "1", $employee_number, "3150", $overtime100, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
if ($overtimebase > 0) {
@@ -258,6 +305,11 @@ class TimerecordingBillingController extends mfBaseController
$bodyarray = [$monthbmd, "1", $employee_number, "3100", $overtimebase, "", "", "", "", "", ""];
fputcsv($file, $bodyarray, ";");
}
+ if ($plushoursbase > 0) {
+ $plushoursbase = str_replace(".", ",", $plushoursbase);
+ $bodyarray = [$monthbmd, "1", $employee_number, "3000", $plushoursbase, "", "", "", "", "", ""];
+ fputcsv($file, $bodyarray, ";");
+ }
if ($timerecordingBillingEmployee->homeoffice > 0) {
$homeoffice = $timerecordingBillingEmployee->homeoffice;
@@ -273,8 +325,6 @@ class TimerecordingBillingController extends mfBaseController
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
fputcsv($file, $bodyarray, ";");
-
-
}
}
}
@@ -283,12 +333,8 @@ class TimerecordingBillingController extends mfBaseController
$dietsum = str_replace(".", ",", $dietsum);
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
fputcsv($file, $bodyarray, ";");
-
}
-
}
-
-
fclose($file);
exit;
}
@@ -317,13 +363,11 @@ class TimerecordingBillingController extends mfBaseController
//last of month
$monthend = date("Y-m-d", strtotime("last day of this month", $month));
$monthend = strtotime($monthend . " 23:59:59");
-
-
$monthbmd = date("n", $month);
$companybmd = "1";
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
- if ($timerecordingsEmolyee->bmd_active == 0) continue;
+ if ($timerecordingsEmolyee->bmd_active == 0 || $timerecordingsEmolyee->startdate > $monthend || ($timerecordingsEmolyee->enddate && $timerecordingsEmolyee->enddate < $month)) continue;
$user = new User($timerecordingsEmolyee->user_id);
$employee_number = (string)$user->getFlag('employee_number');
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
@@ -332,9 +376,11 @@ class TimerecordingBillingController extends mfBaseController
$timerecording = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
if ($export == 0) {
$reponse[$employee_number]['employee_id'] = $timerecordingsEmolyee->id;
+ $reponse[$employee_number]['user_id'] = $timerecordingsEmolyee->user_id;
$reponse[$employee_number]['homeoffice'] = $timerecording['time']['homeoffice'];
$reponse[$employee_number]['istimeall'] = $timerecording['time']['isorder'];
$reponse[$employee_number]['musttime'] = $timerecording['time']['mustorder'];
+ $reponse[$employee_number]['overtimes'] = $timerecording['time']['overtimes'];
}
foreach ($timerecording['time']['isclean'] as $key => $value) {
@@ -446,21 +492,63 @@ class TimerecordingBillingController extends mfBaseController
protected function completemonth($month)
{
$id = $this->saveAction();
- $user = new User($timerecordingsEmolyee->user_id);
- $employee_number = (string)$user->getFlag('employee_number');
+ $enddate = strtotime("01." . $month);
+ $enddate = strtotime("last day of this month", $enddate);
+ $enddate = strtotime("23:59:59", $enddate);
$timerecordings = $this->generateBmdExport($month, 0, 0);
+ $timerecordingworkinghours = TimerecordingEmployeeWorkingHourModel::getAllArray();
+
foreach ($timerecordings as $employeenumber => $timerecording) {
+
+ $timerecordingworkinghour = $timerecordingworkinghours[$timerecording['user_id']]['secondcounter'];
+ if ($timerecordingworkinghour == 138600) {
+ $maxplushours = 23400;
+ } else {
+ $maxplushours = (138600 - $timerecordingworkinghour) * 4.33;
+ $maxplushours = round($maxplushours, 0);
+ $maxplushours = $maxplushours + 23400;
+ }
+
$data = [];
$data['timerecordingBilling_id'] = $id;
$data['timerecordingEmployee_id'] = $timerecording['employee_id'];
$data['musthours'] = $timerecording['musttime'];
+ $data['overtime50'] = $timerecording['overtimes']['O50pfl'];
+ $data['overtime50free'] = $timerecording['overtimes']['O50free'];
+ $data['overtime100'] = $timerecording['overtimes']['O100pfl'];
+ $data['overtime100free'] = $timerecording['overtimes']['O100free'];
+ $data['transfer_plushours'] = $timerecording['overtimes']['Osum'];
+
+ $diff = $timerecording['istimeall'] - $timerecording['musttime'];
+
+ if ($diff > $maxplushours) {
+ $data['overtime50free'] = $data['overtime50free'] + ($diff - $maxplushours);
+ $data['transfer_plushours'] = $data['transfer_plushours'] + ($diff - $maxplushours);
+ }
+
+
+ if ($data['transfer_plushours'] > 0) {
+ $timerecordingEmployee = new TimerecordingEmployee($timerecording['employee_id']);
+ $dataemployee = [];
+ $dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now - $data['transfer_plushours'];
+ $dataemployee['plushours'] = $timerecordingEmployee->plushours - $data['transfer_plushours'];
+ $timerecordingEmployee->update($dataemployee);
+ $timerecordingEmployee->save();
+ }
+ $timerecordingController = new TimerecordingController();
+ $plushours = $timerecordingController->updatePlushours($timerecording['user_id'], $enddate);
+ $data['plushours_all'] = $plushours['plushours'];
+
+
if ($timerecording['istime']) {
$data['ishours'] = $timerecording['istime'];
} else {
$data['ishours'] = 0;
}
$data['ishourssum'] = $timerecording['istimeall'];
+
+
$data['diet'] = $timerecording['diet'];
if ($timerecording['nlz']) {
$data['nlz_detail'] = json_encode($timerecording['nlz']);
@@ -486,6 +574,28 @@ class TimerecordingBillingController extends mfBaseController
die();
}
+ protected function abortmonth($month)
+ {
+ $timerecordingBilling = TimerecordingBillingModel::search(["month" => $month]);
+ $timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::search(["timerecordingBilling_id" => $timerecordingBilling[0]->id]);
+
+ foreach ($timerecordingBillingEmployees as $timerecordingBillingEmployee) {
+ $timerecordingEmployee = new TimerecordingEmployee($timerecordingBillingEmployee->timerecordingEmployee->id);
+ $dataemployee = [];
+ $dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now + $timerecordingBillingEmployee->transfer_plushours;
+ $dataemployee['plushours'] = $timerecordingEmployee->plushours + $timerecordingBillingEmployee->transfer_plushours;
+ $dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now + $timerecordingBillingEmployee->transfer_overtime;
+ $dataemployee['overtime'] = $timerecordingEmployee->overtime + $timerecordingBillingEmployee->transfer_overtime;
+ $timerecordingEmployee->update($dataemployee);
+ $timerecordingEmployee->save();
+ }
+ $timerecordingBilling[0]->delete();
+ $result['state'] = "success";
+ echo json_encode($result);
+ die();
+
+ }
+
protected function saveovertime()
{
$id = $this->request->id;
@@ -513,6 +623,7 @@ class TimerecordingBillingController extends mfBaseController
}
if ($data) {
+ $data['transfer_overtime'] = $timerecordingbillingsemployee->transfer_overtime + $sum;
$timerecordingbillingsemployee->update($data);
$timerecordingbillingsemployee->save();
$timerecordingbillingsemployee->timerecordingEmployee->id;
@@ -526,6 +637,10 @@ class TimerecordingBillingController extends mfBaseController
} else if ($type == "difference") {
$sum = 0;
$data = [];
+ if ($this->request->plushours25) {
+ $data['plushours25'] = $timerecordingbillingsemployee->plushours25 + $this->request->plushours25 * 3600;
+ $sum += $this->request->plushours25 * 3600;
+ }
if ($this->request->overtime50) {
$data['overtime50free'] = $timerecordingbillingsemployee->overtime50free + $this->request->overtime50 * 3600;
$sum += $this->request->overtime50 * 3600;
@@ -542,12 +657,18 @@ class TimerecordingBillingController extends mfBaseController
$sum += $this->request->overtimebpa * 3600;
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
-
}
if ($sum > 0) {
- $data['ishourssum'] = $timerecordingbillingsemployee->ishourssum - $sum;
+ $data['transfer_plushours'] = $timerecordingbillingsemployee->transfer_plushours + $sum;
+ $data['plushours_all'] = $timerecordingbillingsemployee->plushours_all - $sum;
$timerecordingbillingsemployee->update($data);
$timerecordingbillingsemployee->save();
+ $timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
+ $dataemployee = [];
+ $dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now - $sum;
+ $dataemployee['plushours'] = $timerecordingEmployee->plushours - $sum;
+ $timerecordingEmployee->update($dataemployee);
+ $timerecordingEmployee->save();
}
}
$response['state'] = "success";
diff --git a/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php b/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php
index c7f69fd18..c468e130f 100644
--- a/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php
+++ b/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php
@@ -8,15 +8,18 @@ class TimerecordingBillingEmployeeModel
private $type;
private $ishours;
private $ishourssum;
- private $overtime25;
- private $plushours50;
- private $plushours50free;
- private $plushours100;
- private $plushours100free;
+ private $plushours_all;
+ private $plushours25;
+ private $overtime50;
+ private $overtime50free;
+ private $overtime100;
+ private $overtime100free;
private $homeoffice;
private $diet;
private $nlz;
private $nlz_detail;
+ private $transfer_plushours;
+ private $transfer_overtime;
public static function find($data)
diff --git a/application/TimerecordingEmployee/TimerecordingEmployeeController.php b/application/TimerecordingEmployee/TimerecordingEmployeeController.php
index 3eb110ba2..1e3ab5531 100644
--- a/application/TimerecordingEmployee/TimerecordingEmployeeController.php
+++ b/application/TimerecordingEmployee/TimerecordingEmployeeController.php
@@ -97,14 +97,26 @@ class TimerecordingEmployeeController extends mfBaseController
}
}
$plushours = $r->plushours;
- $plushours = str_replace(',', '.', $plushours);
- if (is_numeric($plushours)) {
- $plushours = $plushours * 3600;
+ if ($plushours) {
+ $plushours = str_replace(',', '.', $plushours);
+ if (is_numeric($plushours)) {
+ $plushours = $plushours * 3600;
+ } else {
+ $plushours = 0;
+ }
+ } else {
+ $plushours = 0;
}
$overtime = $r->overtime;
- $overtime = str_replace(',', '.', $overtime);
- if (is_numeric($overtime)) {
- $overtime = $overtime * 3600;
+ if ($overtime) {
+ $overtime = str_replace(',', '.', $overtime);
+ if (is_numeric($overtime)) {
+ $overtime = $overtime * 3600;
+ } else {
+ $overtime = 0;
+ }
+ } else {
+ $overtime = 0;
}
@@ -119,7 +131,9 @@ class TimerecordingEmployeeController extends mfBaseController
$data['bmd_active'] = trim($r->bmd_active);
$data['overtime'] = $overtime;
-
+ if (!$data['holidays']) {
+ $data['holidays'] = 0;
+ }
if ($r->bpahours) {
$bpahours = $r->bpahours;
$bpahours = str_replace(',', '.', $bpahours);
diff --git a/application/TimerecordingReport/TimerecordingReportController.php b/application/TimerecordingReport/TimerecordingReportController.php
index 5c7886dc8..61126a838 100644
--- a/application/TimerecordingReport/TimerecordingReportController.php
+++ b/application/TimerecordingReport/TimerecordingReportController.php
@@ -2,7 +2,7 @@
class TimerecordingReportController extends mfBaseController
{
-
+private $holidays ;
protected function init()
{
$this->needlogin = true;
@@ -14,6 +14,7 @@ class TimerecordingReportController extends mfBaseController
if (!$me->is(["employee"])) {
$this->redirect("Dashboard");
}
+ $this->holidays=TimerecordingHolidayModel::getAll();
}
protected function indexAction()
@@ -36,7 +37,6 @@ class TimerecordingReportController extends mfBaseController
$dataweek = $this->request->dataweek;
$datamonth = $this->request->datamonth;
$datayear = $this->request->datayear;
-
$data = [];
switch ($do) {
@@ -74,7 +74,6 @@ class TimerecordingReportController extends mfBaseController
}
$workinghours = TimerecordingEmployeeWorkingHourModel::getAll();
- $holidays = TimerecordingHolidayModel::getAll();
foreach ($workinghours as $workinghour) {
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
@@ -85,7 +84,7 @@ class TimerecordingReportController extends mfBaseController
$workingHours[$workinghour->user_id][$workinghour->day] = $workingHours[$workinghour->user_id][$workinghour->day] + $whend - $whstart;
}
}
- foreach ($holidays as $holiday) {
+ foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
}
@@ -397,8 +396,8 @@ class TimerecordingReportController extends mfBaseController
$O100end = strtotime(date('Y-m-d', $start) . " 06:00:00");
$O100start = strtotime(date('Y-m-d', $start) . " 22:00:00");
- $holidays = TimerecordingHolidayModel::getAll();
- foreach ($holidays as $holiday) {
+
+ foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
}
$start = $timerecording->start;
@@ -417,29 +416,31 @@ class TimerecordingReportController extends mfBaseController
if ($end >= $O100start) {
$O100free = $O100free + $end - $O100start;
}
- if (date('w', $start) == 6) {
- if ($sum != $O100free) {
- $O50free = $O50free + $sum - $O100free;
- }
- }
+ //sind nun Mehrstunden
+// if (date('w', $start) == 6) {
+// if ($sum != $O100free) {
+// $O50free = $O50free + $sum - $O100free;
+// }
+// }
- } else {
- if ($start < $O100end) {
- $O100pfl = $O100pfl + $O100end - $start;
- }
- if ($end >= $O100start) {
- $O100pfl = $O100pfl + $end - $O100start;
- }
- if (date('w', $start) == 6) {
- if ($sum != $O100free) {
- $O50free = $O50free + $sum - $O100free;
- }
- }
}
+// else {
+// if ($start < $O100end) {
+// $O100pfl = $O100pfl + $O100end - $start;
+// }
+// if ($end >= $O100start) {
+// $O100pfl = $O100pfl + $end - $O100start;
+// }
+// if (date('w', $start) == 6) {
+// if ($sum != $O100free) {
+// $O50free = $O50free + $sum - $O100free;
+// }
+// }
+// }
} else {
- if (date('w', $start) == 6) {
- $O50free = $O50free + $end - $start;
- }
+// if (date('w', $start) == 6) {
+// $O50free = $O50free + $end - $start;
+// }
}
}
$response['O100free'] = $O100free;
@@ -482,7 +483,7 @@ class TimerecordingReportController extends mfBaseController
$bpahours = $employee[0]->bpahours;
}
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $user_id]);
- $holidays = TimerecordingHolidayModel::getAll();
+
foreach ($workinghours as $workinghour) {
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
@@ -493,7 +494,7 @@ class TimerecordingReportController extends mfBaseController
$workingHours[$workinghour->day] = $workingHours[$workinghour->day] + $whend - $whstart;
}
}
- foreach ($holidays as $holiday) {
+ foreach ($this->holidays as $holiday) {
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
}
@@ -576,8 +577,13 @@ class TimerecordingReportController extends mfBaseController
$dietsum = 0;
$diet = 0;
$dietbase = TimerecordingBillingModel::$dieatBase;
-
+ $O100free = 0;
+ $O100pfl = 0;
+ $O50free = 0;
+ $O50pfl = 0;
+ $Osum=0;
foreach ($timerecordings as $timerecording):
+
$state = "";
$enddate = "";
$sum = "-";
@@ -647,6 +653,11 @@ class TimerecordingReportController extends mfBaseController
$overtimes = $this->checkOvertime($timerecording);
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
$isSeconds = $isSeconds - $overtimes['sum'];
+ $O100pfl = $O100pfl + $overtimes['O100pfl'];
+ $O100free = $O100free + $overtimes['O100free'];
+ $O50free = $O50free + $overtimes['O50free'];
+ $O50pfl = $O50pfl + $overtimes['O50pfl'];
+ $Osum=$Osum+$overtimes['sum'];
}
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
@@ -859,6 +870,7 @@ class TimerecordingReportController extends mfBaseController
$json['time']['daysum'] = $daysum;
$json['recordsFiltered'] = $responsecount;
$json['recordsTotal'] = $responsecount;
+ $json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl,'Osum'=>$Osum];
if ($ajax == 1) {
$json = json_encode($json);
diff --git a/db/migrations/20240502074407_timerecording_billing_employee_add_fields_backups.php b/db/migrations/20240502074407_timerecording_billing_employee_add_fields_backups.php
new file mode 100644
index 000000000..f08622878
--- /dev/null
+++ b/db/migrations/20240502074407_timerecording_billing_employee_add_fields_backups.php
@@ -0,0 +1,33 @@
+getEnvironment() == "thetool") {
+ $table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
+ $table->addColumn("transfer_plushours", "integer", ["null" => false, "default" => 0, "after" => "nlz_detail"]);
+ $table->addColumn("transfer_overtime", "integer", ["null" => false, "default" => 0, "after" => "transfer_plushours"]);
+ $table->update();
+ }
+
+ if($this->getEnvironment() == "addressdb") {
+
+ }
+ }
+
+ public function down(): void
+ {
+ if($this->getEnvironment() == "thetool") {
+ $this->table("TimerecordingBillingEmployee")->removeColumn("transfer_plushours")->save();
+ $this->table("TimerecordingBillingEmployee")->removeColumn("transfer_overtime")->save();
+ }
+
+ if($this->getEnvironment() == "addressdb") {
+
+ }
+ }
+}
diff --git a/db/migrations/20240505072300_timerecording_billing_employee_add_fields_plushours_all.php b/db/migrations/20240505072300_timerecording_billing_employee_add_fields_plushours_all.php
new file mode 100644
index 000000000..03d706816
--- /dev/null
+++ b/db/migrations/20240505072300_timerecording_billing_employee_add_fields_plushours_all.php
@@ -0,0 +1,31 @@
+getEnvironment() == "thetool") {
+ $table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
+ $table->addColumn("plushours_all", "integer", ["null" => false, "default" => 0, "after" => "ishourssum"]);
+ $table->update();
+ }
+
+ if ($this->getEnvironment() == "addressdb") {
+
+ }
+ }
+
+ public function down(): void
+ {
+ if ($this->getEnvironment() == "thetool") {
+ $this->table("TimerecordingBillingEmployee")->removeColumn("plushours_all")->save();
+ }
+
+ if ($this->getEnvironment() == "addressdb") {
+
+ }
+ }
+}
diff --git a/public/assets/js/datatables-std.js b/public/assets/js/datatables-std.js
index 505d293c1..4a0074a67 100644
--- a/public/assets/js/datatables-std.js
+++ b/public/assets/js/datatables-std.js
@@ -52,7 +52,13 @@ table = $('#datatable').DataTable({
text: 'XLSX Export',
className: 'btn-success margina d-none d-lg-block',
exportOptions: {
- columns: ['th:not(:last-child)']
+ columns: ['th:not(:last-child)'],
+ format: {
+ body: function (data, row, column, node) {
+ data = $('
' + data + '
').text();
+ return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
+ }
+ }
}
}
], columnDefs: [