Merge branch 'spidev' into 'master'
Zeiterfassungs Update See merge request fronk/thetool!310
This commit is contained in:
60
application/TimerecordingBilling/TimerecordingBilling.php
Normal file
60
application/TimerecordingBilling/TimerecordingBilling.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBilling extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
private $timerecordingEmployee;
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if ($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if ($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if ($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if ($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if (!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if ($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,10 +26,31 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$months[] = date("m.Y", $month);
|
||||
$month = strtotime("+1 month", $month);
|
||||
}
|
||||
$timerecordingBillings = TimerecordingBillingModel::getAll();
|
||||
|
||||
foreach ($timerecordingBillings as $timerecordingBilling) {
|
||||
$timerecordingbillings[$timerecordingBilling->month] = $timerecordingBilling;
|
||||
echo $timerecordingBilling->month;
|
||||
}
|
||||
|
||||
$this->layout()->set("months", $months);
|
||||
$this->layout()->set("timerecordingbillings", $timerecordingbillings);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Index");
|
||||
}
|
||||
|
||||
protected function detailClosedAction($timerecordingBilling)
|
||||
{
|
||||
$r = $this->request;
|
||||
$month = $r->get("month");
|
||||
$month = strtotime("01." . $month);
|
||||
|
||||
$timerecordings = TimerecordingBillingEmployeeModel::search(["timerecordingBilling_id" => $timerecordingBilling[0]->id]);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/DetailClosed");
|
||||
$this->layout()->set("month", date("m.Y", $month));
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
|
||||
}
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
@@ -37,20 +58,26 @@ class TimerecordingBillingController extends mfBaseController
|
||||
if (!$month) {
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
$month = strtotime("01." . $month);
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
$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);
|
||||
$timerecordingBilling = TimerecordingBillingModel::search(["month" => $month]);
|
||||
if ($timerecordingBilling) {
|
||||
$this->detailclosedAction($timerecordingBilling);
|
||||
} else {
|
||||
$month = strtotime("01." . $month);
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
if ($timerecordingsEmolyee->bmd_active == 0) 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));
|
||||
}
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Detail");
|
||||
$this->layout()->set("month", date("m.Y", $month));
|
||||
}
|
||||
|
||||
protected function apiAction()
|
||||
@@ -67,6 +94,18 @@ class TimerecordingBillingController extends mfBaseController
|
||||
case "generatebmdexportnlz":
|
||||
$return = $this->generateBmdExport($month, 1);
|
||||
break;
|
||||
case "generatebmdexportclosed":
|
||||
$return = $this->generateBmdExportClosed($month);
|
||||
break;
|
||||
case "generatebmdexportnlzclosed":
|
||||
$return = $this->generateBmdExportClosed($month, 1);
|
||||
break;
|
||||
case "completemonth":
|
||||
$return = $this->completemonth($month);
|
||||
break;
|
||||
case "saveovertime":
|
||||
$return = $this->saveovertime();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
@@ -92,13 +131,73 @@ class TimerecordingBillingController extends mfBaseController
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordingbillings = new TimerecordingBilling($id);
|
||||
if (!$timerecordingbillings->id) {
|
||||
$this->layout()->setFlash("Timerecording nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['month'] = trim($r->month);
|
||||
$data['closetime'] = time();
|
||||
|
||||
|
||||
if (!$data['month']) {
|
||||
$data['month'] = NULL;
|
||||
}
|
||||
if (!$data['closetime']) {
|
||||
$data['closetime'] = NULL;
|
||||
}
|
||||
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingbillings->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordingbillings = TimerecordingBillingModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordingbillings->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Timerecording konnte nicht angelegt werden", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
// $this->layout()->setFlash("Timerecording erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
// $this->layout()->setFlash("Timerecording erfolgreich angelegt", "success");
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordingbillings = new TimerecordingBilling($id);
|
||||
if (!$timerecordingbillings->id || $timerecordingbillings->id != $id) {
|
||||
$this->layout()->setFlash("Timerecording nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
$timerecordingbillings->delete();
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
protected function generateBmdLine()
|
||||
@@ -106,13 +205,14 @@ class TimerecordingBillingController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function generateBmdExport($month, $nlz = 0)
|
||||
protected function generateBmdExportClosed($month, $nlz = 0)
|
||||
{
|
||||
//create and download csv file
|
||||
$filename = "BMDExport_" . $month . ".csv";
|
||||
$filename = "import_bmd_" . $month . ".csv";
|
||||
$file = fopen("php://output", 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename=' . $filename);
|
||||
$monthbmd = date("n", strtotime("01." . $month));
|
||||
$companybmd = "1";
|
||||
if ($nlz == 0) {
|
||||
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
@@ -120,17 +220,113 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$headerarray = ["Firma", "Mitarbeiter", "DV-Nr", "Art", "Sonderzeit", "Verarbeitungs-KZ", "Von", "Bis", "Verwaltung", "Bezahlt"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
}
|
||||
$billing = TimerecordingBillingModel::search(["month" => $month]);
|
||||
$timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::search(["timerecordingBilling_id" => $billing[0]->id]);
|
||||
foreach ($timerecordingBillingEmployees as $timerecordingBillingEmployee) {
|
||||
if ($timerecordingBillingEmployee->timerecordingEmployee->bmd_active == 0) continue;
|
||||
$user = new User($timerecordingBillingEmployee->timerecordingEmployee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
$employee_type = $employeetypesbmd[$timerecordingBillingEmployee->timerecordingEmployee->type];
|
||||
if ($nlz == 0) {
|
||||
$hours = $timerecordingBillingEmployee->ishours / 3600;
|
||||
$hours = round($hours, 2);
|
||||
$hours = str_replace(".", ",", $hours);
|
||||
if ($hours > 0) {
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($timerecordingBillingEmployee->overtime50free > 0) {
|
||||
$overtime50free = $timerecordingBillingEmployee->overtime50free / 3600;
|
||||
$overtime50free = round($overtime50free, 2);
|
||||
$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);
|
||||
$overtime100free = str_replace(".", ",", $overtime100free);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3150", $overtime100free, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($timerecordingBillingEmployee->homeoffice > 0) {
|
||||
$homeoffice = $timerecordingBillingEmployee->homeoffice;
|
||||
$homeoffice = round($homeoffice, 2);
|
||||
$homeoffice = str_replace(".", ",", $homeoffice);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "7590", $homeoffice, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($timerecordingBillingEmployee->nlz_detail) {
|
||||
foreach (json_decode($timerecordingBillingEmployee->nlz_detail, true) as $nlztime) {
|
||||
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($timerecordingBillingEmployee->diet > 0 && $nlz == 0) {
|
||||
$dietsum = round($timerecordingBillingEmployee->diet, 2);
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($file);
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function generateBmdExport($month, $nlz = 0, $export = 1)
|
||||
{
|
||||
//create and download csv file
|
||||
if ($export == 1) {
|
||||
$filename = "import_bmd_" . $month . ".csv";
|
||||
$file = fopen("php://output", 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename=' . $filename);
|
||||
}
|
||||
if ($export == 1) {
|
||||
if ($nlz == 0) {
|
||||
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
} else {
|
||||
$headerarray = ["Firma", "Mitarbeiter", "DV-Nr", "Art", "Sonderzeit", "Verarbeitungs-KZ", "Von", "Bis", "Verwaltung", "Bezahlt"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$month = strtotime("01." . $month);
|
||||
//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;
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
$employee_type = $employeetypesbmd[$timerecordingsEmolyee->type];
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
$timerecording = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
if ($export == 0) {
|
||||
$reponse[$employee_number]['employee_id'] = $timerecordingsEmolyee->id;
|
||||
$reponse[$employee_number]['homeoffice'] = $timerecording['time']['homeoffice'];
|
||||
$reponse[$employee_number]['istimeall'] = $timerecording['time']['isorder'];
|
||||
$reponse[$employee_number]['musttime'] = $timerecording['time']['mustorder'];
|
||||
}
|
||||
|
||||
foreach ($timerecording['time']['isclean'] as $key => $value) {
|
||||
$hours = $value;
|
||||
@@ -139,8 +335,12 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$hours = round($hours, 2);
|
||||
$hours = str_replace(".", ",", $hours);
|
||||
if (strpos($key, ',') !== false && $nlz == 0) {
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
if ($export == 1) {
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$reponse[$employee_number]['istime'] = $value;
|
||||
}
|
||||
} else if (strpos($key, ',') === false && $nlz == 1) {
|
||||
|
||||
}
|
||||
@@ -149,13 +349,34 @@ class TimerecordingBillingController extends mfBaseController
|
||||
|
||||
if ($timerecording['time']['diet'] > 0 && $nlz == 0) {
|
||||
$dietsum = round($timerecording['time']['diet'], 2);
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
if ($export == 1) {
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$reponse[$employee_number]['diet'] = $dietsum;
|
||||
}
|
||||
}
|
||||
if (!empty($timerecording['time']['nlztimes']) && $nlz == 1) {
|
||||
if (!empty($timerecording['time']['nlztimes']) && ($nlz == 1 || $export == 0)) {
|
||||
foreach ($timerecording['time']['nlztimes'] as $nlztime) {
|
||||
if (strtotime($nlztime['start']) < $month) {
|
||||
$nlztime['start'] = date("d.m.Y", $month);
|
||||
}
|
||||
if ((strtotime($nlztime['end']) + 84599) > $monthend) {
|
||||
$nlztime['end'] = date("d.m.Y", $monthend);
|
||||
}
|
||||
|
||||
|
||||
if (strpos($nlztime['categoryshort'], '6-') !== false) {
|
||||
$catExtended = explode("-", $nlztime['categoryshort']);
|
||||
$catExtended = $catExtended[1];
|
||||
$nlztime['categoryshort'] = "6";
|
||||
} else {
|
||||
$catExtended = "";
|
||||
}
|
||||
|
||||
if ($nlztime['minutes']) {
|
||||
$timesecounds = $nlztime['minutes'];
|
||||
$time = $nlztime['minutes'] / 60;
|
||||
$time = round($time, 2);
|
||||
$time = str_replace(".", ",", $time);
|
||||
@@ -166,19 +387,162 @@ class TimerecordingBillingController extends mfBaseController
|
||||
}
|
||||
|
||||
} else {
|
||||
$time = "";
|
||||
$pay = "";
|
||||
if (empty($catExtended)) {
|
||||
$time = "";
|
||||
$timesecounds = "";
|
||||
$pay = "";
|
||||
} else {
|
||||
//calc days from $nlztime['start'] to $nlztime['end']
|
||||
$start = strtotime($nlztime['start']);
|
||||
$end = strtotime($nlztime['end']);
|
||||
$time = ($end - $start);
|
||||
$timesecounds = $time;
|
||||
$time = $time / 86400 + 1;
|
||||
$time = round($time, 0);
|
||||
|
||||
|
||||
if ($nlztime['unpaid'] == "0") {
|
||||
$pay = $time;
|
||||
} else {
|
||||
$pay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ($export == 1) {
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $catExtended, "3", $nlztime['start'], $nlztime['end'], $time, $pay];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$reponse[$employee_number]['nlz'][] = array("categoryshort" => $nlztime['categoryshort'], "catExtended" => $catExtended, "start" => $nlztime['start'], "end" => $nlztime['end'], "time" => $time, "pay" => $pay);
|
||||
}
|
||||
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], "", "3", $nlztime['start'], $nlztime['end'], $time, $pay];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
}
|
||||
if ($export == 0) {
|
||||
$reponse[$employee_number]['daysum'] = json_encode($timerecording['time']['daysum']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ($export == 1) {
|
||||
fclose($file);
|
||||
exit;
|
||||
} else {
|
||||
return $reponse;
|
||||
}
|
||||
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
protected function completemonth($month)
|
||||
{
|
||||
$id = $this->saveAction();
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
|
||||
$timerecordings = $this->generateBmdExport($month, 0, 0);
|
||||
foreach ($timerecordings as $employeenumber => $timerecording) {
|
||||
$data = [];
|
||||
$data['timerecordingBilling_id'] = $id;
|
||||
$data['timerecordingEmployee_id'] = $timerecording['employee_id'];
|
||||
$data['musthours'] = $timerecording['musttime'];
|
||||
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']);
|
||||
}
|
||||
if ($timerecording['daysum']) {
|
||||
$data['nlz'] = $timerecording['daysum'];
|
||||
}
|
||||
if ($timerecording['homeoffice']) {
|
||||
$data['homeoffice'] = $timerecording['homeoffice'];
|
||||
}
|
||||
|
||||
|
||||
if (!$data['diet']) {
|
||||
$data['diet'] = 0;
|
||||
|
||||
}
|
||||
|
||||
$timerecordingbillingemployee = TimerecordingBillingEmployeeModel::create($data);
|
||||
$timerecordingbillingemployee->save();
|
||||
}
|
||||
$result['state'] = "success";
|
||||
echo json_encode($result);
|
||||
die();
|
||||
}
|
||||
|
||||
protected function saveovertime()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$type = $this->request->type;
|
||||
$timerecordingbillingsemployee = new TimerecordingBillingEmployee($id);
|
||||
if ($type == "overtime") {
|
||||
$sum = 0;
|
||||
$data = [];
|
||||
if ($this->request->overtime50) {
|
||||
$data['overtime50free'] = $timerecordingbillingsemployee->overtime50free + $this->request->overtime50 * 3600;
|
||||
$sum += $this->request->overtime50 * 3600;
|
||||
}
|
||||
if ($this->request->overtime100) {
|
||||
$data['overtime100free'] = $timerecordingbillingsemployee->overtime100free + $this->request->overtime100 * 3600;
|
||||
$sum += $this->request->overtime100 * 3600;
|
||||
}
|
||||
if ($this->request->overtimebpa) {
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $this->request->overtimebpa * 3600;
|
||||
$sum += $this->request->overtimebpa * 3600;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
|
||||
}
|
||||
if ($data) {
|
||||
$timerecordingbillingsemployee->update($data);
|
||||
$timerecordingbillingsemployee->save();
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now - $sum;
|
||||
$dataemployee['overtime'] = $timerecordingEmployee->overtime - $sum;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
}
|
||||
} else if ($type == "difference") {
|
||||
$sum = 0;
|
||||
$data = [];
|
||||
if ($this->request->overtime50) {
|
||||
$data['overtime50free'] = $timerecordingbillingsemployee->overtime50free + $this->request->overtime50 * 3600;
|
||||
$sum += $this->request->overtime50 * 3600;
|
||||
}
|
||||
if ($this->request->overtime100) {
|
||||
$data['overtime100free'] = $timerecordingbillingsemployee->overtime100free + $this->request->overtime100 * 3600;
|
||||
$sum += $this->request->overtime100 * 3600;
|
||||
}
|
||||
if ($this->request->overtimebpa) {
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $this->request->overtimebpa * 3600;
|
||||
$sum += $this->request->overtimebpa * 3600;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
|
||||
}
|
||||
if ($sum > 0) {
|
||||
$data['ishourssum'] = $timerecordingbillingsemployee->ishourssum - $sum;
|
||||
$timerecordingbillingsemployee->update($data);
|
||||
$timerecordingbillingsemployee->save();
|
||||
}
|
||||
}
|
||||
$response['state'] = "success";
|
||||
echo json_encode($response);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,125 @@ class TimerecordingBillingModel
|
||||
{
|
||||
public static $dieatBase = 26.4;
|
||||
public static $excludeEmployees = [1000, 1001, 9999, 4, 5, 6, 7, 8, 9, 10];
|
||||
private $month;
|
||||
private $closetime;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new TimerecordingBilling();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBilling", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBilling($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBilling", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBilling($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBilling", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBilling($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBilling", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBilling($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("month", $filter)) {
|
||||
$month = $filter['month'];
|
||||
if ($month) {
|
||||
$where .= " AND month=$month";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingEmployee extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $timerecordingBilling;
|
||||
private $timerecordingEmployee;
|
||||
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||
if ($this->creator === null) {
|
||||
$this->creator = new User($this->create_by);
|
||||
if ($this->creator->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||
}
|
||||
}
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||
if ($this->editor === null) {
|
||||
$this->editor = new User($this->edit_by);
|
||||
if ($this->editor->id) {
|
||||
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||
}
|
||||
}
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||
if (!$this->$name) {
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
}
|
||||
|
||||
if ($this->$name->id) {
|
||||
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingEmployeeController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingBillingEmployee/Index");
|
||||
$timerecordingbillingemployees = TimerecordingBillingEmployeeModel::getAll();
|
||||
$this->layout()->set("timerecordingbillingemployees", $timerecordingbillingemployees);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::getAll();
|
||||
$this->layout()->set("timerecordingBillingEmployees", $timerecordingBillingEmployees);
|
||||
$timerecordingEmployees = TimerecordingEmployeeModel::getAll();
|
||||
$this->layout()->set("timerecordingEmployees", $timerecordingEmployees);
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingBillingEmployee/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("fdfsdf nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
||||
if ($timerecordingbillingemployees->id != $id) {
|
||||
$this->layout()->setFlash("fdfsdf nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
$this->layout()->set("timerecordingbillingemployees", $timerecordingbillingemployees);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
//var_dump($r->get());exit;
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
||||
if (!$timerecordingbillingemployees->id) {
|
||||
$this->layout()->setFlash("dfsdfsdfds nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['timerecordingBillingEmployee_id'] = trim($r->timerecordingBillingEmployee_id);
|
||||
$data['timerecordingEmployee_id'] = trim($r->timerecordingEmployee_id);
|
||||
$data['type'] = trim($r->type);
|
||||
$data['ishours'] = trim($r->ishours);
|
||||
$data['overtime25'] = trim($r->overtime25);
|
||||
$data['plushours50'] = trim($r->plushours50);
|
||||
$data['plushours50free'] = trim($r->plushours50free);
|
||||
$data['plushours100'] = trim($r->plushours100);
|
||||
$data['plushours100free'] = trim($r->plushours100free);
|
||||
$data['homeoffice'] = trim($r->homeoffice);
|
||||
$data['diet'] = trim($r->diet);
|
||||
$data['nlz'] = trim($r->nlz);
|
||||
$data['nlz_detail'] = trim($r->nlz_detail);
|
||||
|
||||
|
||||
if (!$data['timerecordingBillingEmployee_id']) {
|
||||
$data['timerecordingBillingEmployee_id'] = NULL;
|
||||
}
|
||||
if (!$data['timerecordingEmployee_id']) {
|
||||
$data['timerecordingEmployee_id'] = NULL;
|
||||
}
|
||||
if (!$data['type']) {
|
||||
$data['type'] = NULL;
|
||||
}
|
||||
if (!$data['ishours']) {
|
||||
$data['ishours'] = NULL;
|
||||
}
|
||||
if (!$data['overtime25']) {
|
||||
$data['overtime25'] = NULL;
|
||||
}
|
||||
if (!$data['plushours50']) {
|
||||
$data['plushours50'] = NULL;
|
||||
}
|
||||
if (!$data['plushours50free']) {
|
||||
$data['plushours50free'] = NULL;
|
||||
}
|
||||
if (!$data['plushours100']) {
|
||||
$data['plushours100'] = NULL;
|
||||
}
|
||||
if (!$data['plushours100free']) {
|
||||
$data['plushours100free'] = NULL;
|
||||
}
|
||||
if (!$data['homeoffice']) {
|
||||
$data['homeoffice'] = NULL;
|
||||
}
|
||||
if ($data['diet'] == NULL) {
|
||||
$data['diet'] = 0;
|
||||
}
|
||||
if (!$data['nlz']) {
|
||||
$data['nlz'] = NULL;
|
||||
}
|
||||
if (!$data['nlz_detail']) {
|
||||
$data['nlz_detail'] = NULL;
|
||||
}
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingbillingemployees->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordingbillingemployees = TimerecordingBillingEmployeeModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordingbillingemployees->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("fdfsdf konnte nicht angelegt werden", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("fdfsdf erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("fdfsdf erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordingbillingemployees = new TimerecordingBillingEmployee($id);
|
||||
if (!$timerecordingbillingemployees->id || $timerecordingbillingemployees->id != $id) {
|
||||
$this->layout()->setFlash("fdfsdf nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
$timerecordingbillingemployees->delete();
|
||||
$this->redirect("TimerecordingBillingEmployee");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingEmployeeModel
|
||||
{
|
||||
private $timerecordingBilling_id;
|
||||
private $timerecordingEmployee_id;
|
||||
private $musthours;
|
||||
private $type;
|
||||
private $ishours;
|
||||
private $ishourssum;
|
||||
private $overtime25;
|
||||
private $plushours50;
|
||||
private $plushours50free;
|
||||
private $plushours100;
|
||||
private $plushours100free;
|
||||
private $homeoffice;
|
||||
private $diet;
|
||||
private $nlz;
|
||||
private $nlz_detail;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new TimerecordingBillingEmployee();
|
||||
|
||||
foreach ($data as $field => $value) {
|
||||
if (property_exists(get_called_class(), $field)) {
|
||||
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||
$model->$field = null;
|
||||
continue;
|
||||
}
|
||||
$model->$field = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$me = mfValuecache::singleton()->get("me");
|
||||
if (!$me) {
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
mfValuecache::singleton()->set("me", $me);
|
||||
}
|
||||
|
||||
if ($model->create_by === null) {
|
||||
$model->create_by = $me->id;
|
||||
}
|
||||
if ($model->edit_by === null) {
|
||||
$model->edit_by = $me->id;
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public static function getOne($id)
|
||||
{
|
||||
if (!is_numeric($id) || !$id) {
|
||||
throw new Exception("Invalid number", 400);
|
||||
}
|
||||
$item = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingBillingEmployee($data);
|
||||
if ($item->id) {
|
||||
return $item;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function search($filter)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("timerecordingBilling_id", $filter)) {
|
||||
$timerecordingBilling_id = $filter['timerecordingBilling_id'];
|
||||
if (is_numeric($timerecordingBilling_id)) {
|
||||
$where .= " AND timerecordingBilling_id='$timerecordingBilling_id'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class TimerecordingCar extends mfBaseModel
|
||||
{
|
||||
private $user;
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ class TimerecordingCarController extends mfBaseController
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
|
||||
$timerecordingusers = UserModel::search(['employee' => 'true']);
|
||||
$this->layout()->set("timerecordingusers", $timerecordingusers);
|
||||
$this->layout()->setTemplate("TimerecordingCar/Form");
|
||||
|
||||
}
|
||||
@@ -58,6 +59,7 @@ class TimerecordingCarController extends mfBaseController
|
||||
$this->redirect("TimerecordingCar");
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->set("timerecordingcars", $timerecordingcars);
|
||||
return $this->addAction();
|
||||
}
|
||||
@@ -80,6 +82,7 @@ class TimerecordingCarController extends mfBaseController
|
||||
|
||||
$data = [];
|
||||
$data['number_plate'] = trim($r->number_plate);
|
||||
$data['user_id'] = trim($r->user_id);
|
||||
$data['brand'] = trim($r->brand);
|
||||
$data['model'] = trim($r->model);
|
||||
$data['mileage'] = trim($r->mileage);
|
||||
@@ -88,6 +91,9 @@ class TimerecordingCarController extends mfBaseController
|
||||
$data['first_approval'] = trim($r->first_approval);
|
||||
|
||||
|
||||
if (!$data['user_id']) {
|
||||
$data['user_id'] = null;
|
||||
}
|
||||
if (!$data['initial_approval']) {
|
||||
$data['initial_approval'] = null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
class TimerecordingCarModel
|
||||
{
|
||||
private $user_id;
|
||||
private $number_plate;
|
||||
private $brand;
|
||||
private $model;
|
||||
|
||||
@@ -114,13 +114,21 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['holidays'] = trim($r->holidays);
|
||||
$data['plushours'] = $plushours;
|
||||
$data['startdate'] = strtotime($r->startdate);
|
||||
$data['enddate'] = strtotime($r->enddate);
|
||||
$data['type'] = trim($r->type);
|
||||
$data['bmd_active'] = trim($r->bmd_active);
|
||||
$data['overtime'] = $overtime;
|
||||
#
|
||||
|
||||
if (!$data['overtime']) {
|
||||
$data['overtime'] = 0;
|
||||
}
|
||||
if (!$data['bmd_active']) {
|
||||
$data['bmd_active'] = 0;
|
||||
}
|
||||
if (!$data['enddate']) {
|
||||
$data['enddate'] = null;
|
||||
}
|
||||
|
||||
if ($r->birthday) {
|
||||
$data['birthday'] = strtotime($r->birthday);
|
||||
|
||||
@@ -16,6 +16,8 @@ class TimerecordingEmployeeModel
|
||||
private $overtime_timestamp;
|
||||
private $bpahours;
|
||||
private $startdate;
|
||||
private $enddate;
|
||||
private $bmd_active;
|
||||
private $birthday;
|
||||
public static $employeetypesbmd = array('1' => '1000', '2' => '1200', '3' => '1400');
|
||||
|
||||
|
||||
@@ -411,6 +411,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$overtime_now = $employee[0]->overtime_now;
|
||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||
$startdate = $employee[0]->startdate;
|
||||
$bpahours = $employee[0]->bpahours;
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $user_id]);
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
@@ -775,6 +776,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$json['time']['plushours'] = sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
$json['time']['plushours_now'] = $plusHours_now;
|
||||
$json['time']['plushours_noworder'] = $plusHours_noworder;
|
||||
$json['time']['bpahours'] = sprintf('%02dh:%02dm', floor($bpahours / 3600), floor($bpahours / 60 % 60));
|
||||
|
||||
$json['time']['overtime_now'] = sprintf('%02dh:%02dm', floor($overtime_now / 3600), floor($overtime_now / 60 % 60));
|
||||
$json['time']['overtime_noworder'] = $overtime_now;
|
||||
$json['time']['homeoffice'] = $homeofficesum;
|
||||
|
||||
Reference in New Issue
Block a user