Zeiterfassung Update
* automatische Berechnung und BMD Import für NachtZulagen + Migration
This commit is contained in:
@@ -267,10 +267,11 @@ class TimerecordingBillingController extends mfBaseController
|
|||||||
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||||
fputcsv($file, $bodyarray, ";");
|
fputcsv($file, $bodyarray, ";");
|
||||||
}
|
}
|
||||||
//Übergangslösung für Oktober
|
if ($timerecordingBillingEmployee->night_allowance > 0) {
|
||||||
if ($employee_number == '1029' && $nlz == 0 && $monthbmd =='10') {
|
$nightAllowance = $timerecordingBillingEmployee->night_allowance / 3600;
|
||||||
|
$nightAllowance = round($nightAllowance, 2);
|
||||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "4080", '17,42', "", '', "", "", "", ""];
|
$nightAllowance = str_replace(".", ",", $nightAllowance);
|
||||||
|
$bodyarray = [$monthbmd, $companybmd, $employee_number, "4080", $nightAllowance, "", '', "", "", "", ""];
|
||||||
fputcsv($file, $bodyarray, ";");
|
fputcsv($file, $bodyarray, ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -616,6 +617,7 @@ class TimerecordingBillingController extends mfBaseController
|
|||||||
$data['overtime50free'] = $timerecording['overtimes']['O50free'];
|
$data['overtime50free'] = $timerecording['overtimes']['O50free'];
|
||||||
$data['overtime100'] = $timerecording['overtimes']['O100pfl'];
|
$data['overtime100'] = $timerecording['overtimes']['O100pfl'];
|
||||||
$data['overtime100free'] = $timerecording['overtimes']['O100free'];
|
$data['overtime100free'] = $timerecording['overtimes']['O100free'];
|
||||||
|
$data['night_allowance'] = $timerecording['overtimes']['nightAllowance'];
|
||||||
$data['transfer_plushours'] = $timerecording['overtimes']['Osum'];
|
$data['transfer_plushours'] = $timerecording['overtimes']['Osum'];
|
||||||
|
|
||||||
$diff = $timerecording['istimeall'] - $timerecording['musttime'];
|
$diff = $timerecording['istimeall'] - $timerecording['musttime'];
|
||||||
@@ -888,7 +890,7 @@ class TimerecordingBillingController extends mfBaseController
|
|||||||
$holidays_now = $holidays;
|
$holidays_now = $holidays;
|
||||||
}
|
}
|
||||||
$timerecordings = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'timerecordingCategory_id' => 3]);
|
$timerecordings = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'timerecordingCategory_id' => 3]);
|
||||||
$timerecordingscorrections = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp,'endsdate' => $enddate, 'days' => 1]);
|
$timerecordingscorrections = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'endsdate' => $enddate, 'days' => 1]);
|
||||||
foreach ($timerecordings as $timerecording) {
|
foreach ($timerecordings as $timerecording) {
|
||||||
|
|
||||||
if ($timerecording->end > $enddate) {
|
if ($timerecording->end > $enddate) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class TimerecordingBillingEmployeeModel
|
|||||||
private $overtime100;
|
private $overtime100;
|
||||||
private $overtime100free;
|
private $overtime100free;
|
||||||
private $overtime_plushours;
|
private $overtime_plushours;
|
||||||
|
private $night_allowance;
|
||||||
private $homeoffice;
|
private $homeoffice;
|
||||||
private $diet;
|
private $diet;
|
||||||
private $nlz;
|
private $nlz;
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else if ($datatype == 5) {
|
} else if ($datatype == 5) {
|
||||||
$firstdate = strtotime(date("Y-01-01", $datayear));
|
$firstdate = strtotime(date("Y-01-01", $datayear));
|
||||||
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
|
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
|
||||||
@@ -200,7 +199,6 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -235,7 +233,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
|
|
||||||
$datadate = date("Y-m-d", $timerecording->start);
|
$datadate = date("Y-m-d", $timerecording->start);
|
||||||
$enddate = date("Y-m-d", $timerecording->end + 7200);
|
$enddate = date("Y-m-d", $timerecording->end + 7200);
|
||||||
$enddate2= date("Y-m-d", $timerecording->end);
|
$enddate2 = date("Y-m-d", $timerecording->end);
|
||||||
$start = "-";
|
$start = "-";
|
||||||
$end = "-";
|
$end = "-";
|
||||||
$day = $daysgerm[date("w", $timerecording->start)];
|
$day = $daysgerm[date("w", $timerecording->start)];
|
||||||
@@ -439,13 +437,13 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$seconds = $timerecording->end - $timerecording->start;
|
$seconds = $timerecording->end - $timerecording->start;
|
||||||
$minutes = floor(($seconds % 3600) / 60);
|
$minutes = floor(($seconds % 3600) / 60);
|
||||||
$hours = floor($seconds / 3600);
|
$hours = floor($seconds / 3600);
|
||||||
$sum = "-" .sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
$sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||||
$day = $daysgerm[date("w", $timerecording->start)];
|
$day = $daysgerm[date("w", $timerecording->start)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0 )|| ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
|
if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
|
||||||
$state = '<i class="fa-regular fa-clock mr-1"></i>';
|
$state = '<i class="fa-regular fa-clock mr-1"></i>';
|
||||||
} else if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 1 )) {
|
} else if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 1)) {
|
||||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||||
}
|
}
|
||||||
$edit = "";
|
$edit = "";
|
||||||
@@ -574,7 +572,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkOvertime($timerecording,$night_allowance=0)
|
private function checkOvertime($timerecording, $night_allowance = 0)
|
||||||
{
|
{
|
||||||
$start = $timerecording->start;
|
$start = $timerecording->start;
|
||||||
$end = $timerecording->end;
|
$end = $timerecording->end;
|
||||||
@@ -584,6 +582,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$O100pfl = 0;
|
$O100pfl = 0;
|
||||||
$O100end = strtotime(date('Y-m-d', $start) . " 06:00:00");
|
$O100end = strtotime(date('Y-m-d', $start) . " 06:00:00");
|
||||||
$O100start = strtotime(date('Y-m-d', $start) . " 22:00:00");
|
$O100start = strtotime(date('Y-m-d', $start) . " 22:00:00");
|
||||||
|
$nightAllowance = 0;
|
||||||
|
|
||||||
|
|
||||||
foreach ($this->holidays as $holiday) {
|
foreach ($this->holidays as $holiday) {
|
||||||
@@ -593,10 +592,10 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$end = $timerecording->end;
|
$end = $timerecording->end;
|
||||||
$startday = date('Y-m-d', $start);
|
$startday = date('Y-m-d', $start);
|
||||||
|
|
||||||
if ((date('w', $start) == 0 || $holiDay[$startday]) && $night_allowance==0) {
|
if ((date('w', $start) == 0 || $holiDay[$startday]) && $night_allowance == 0) {
|
||||||
$O100free = $O100free + $timerecording->end - $timerecording->start;
|
$O100free = $O100free + $timerecording->end - $timerecording->start;
|
||||||
} else {
|
} else {
|
||||||
if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance==0) {
|
if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance == 0) {
|
||||||
$sum = $end - $start;
|
$sum = $end - $start;
|
||||||
if ($sum >= 10800) {
|
if ($sum >= 10800) {
|
||||||
if ($start < $O100end) {
|
if ($start < $O100end) {
|
||||||
@@ -626,16 +625,20 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
} else {
|
} else if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance == 1) {
|
||||||
// if (date('w', $start) == 6) {
|
if ($start < $O100end) {
|
||||||
// $O50free = $O50free + $end - $start;
|
$nightAllowance = $nightAllowance + $O100end - $start;
|
||||||
// }
|
}
|
||||||
|
if ($end >= $O100start) {
|
||||||
|
$nightAllowance = $nightAllowance + $end - $O100start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$response['O100free'] = $O100free;
|
$response['O100free'] = $O100free;
|
||||||
$response['O100pfl'] = $O100pfl;
|
$response['O100pfl'] = $O100pfl;
|
||||||
$response['O50free'] = $O50free;
|
$response['O50free'] = $O50free;
|
||||||
$response['O50pfl'] = $O50pfl;
|
$response['O50pfl'] = $O50pfl;
|
||||||
|
$response['nightAllowance'] = $nightAllowance;
|
||||||
$response['sum'] = $O100free + $O100pfl + $O50free + $O50pfl;
|
$response['sum'] = $O100free + $O100pfl + $O50free + $O50pfl;
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@@ -663,7 +666,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$plusHours_now = $employee[0]->plushours_now;
|
$plusHours_now = $employee[0]->plushours_now;
|
||||||
$overtime_now = $employee[0]->overtime_now;
|
$overtime_now = $employee[0]->overtime_now;
|
||||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||||
$night_allowance= $employee[0]->night_allowance;
|
$night_allowance = $employee[0]->night_allowance;
|
||||||
$startdate = $employee[0]->startdate;
|
$startdate = $employee[0]->startdate;
|
||||||
if ($employee[0]->enddate) {
|
if ($employee[0]->enddate) {
|
||||||
$enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59");
|
$enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59");
|
||||||
@@ -828,6 +831,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$O50free = 0;
|
$O50free = 0;
|
||||||
$O50pfl = 0;
|
$O50pfl = 0;
|
||||||
$Osum = 0;
|
$Osum = 0;
|
||||||
|
$nightAllowance = 0;
|
||||||
foreach ($timerecordings as $timerecording):
|
foreach ($timerecordings as $timerecording):
|
||||||
|
|
||||||
$state = "";
|
$state = "";
|
||||||
@@ -896,7 +900,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||||
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
||||||
} else {
|
} else {
|
||||||
$overtimes = $this->checkOvertime($timerecording,$night_allowance);
|
$overtimes = $this->checkOvertime($timerecording, $night_allowance);
|
||||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
|
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
|
||||||
if ($employee->only_admin != 1) {
|
if ($employee->only_admin != 1) {
|
||||||
|
|
||||||
@@ -907,6 +911,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$O100free = $O100free + $overtimes['O100free'];
|
$O100free = $O100free + $overtimes['O100free'];
|
||||||
$O50free = $O50free + $overtimes['O50free'];
|
$O50free = $O50free + $overtimes['O50free'];
|
||||||
$O50pfl = $O50pfl + $overtimes['O50pfl'];
|
$O50pfl = $O50pfl + $overtimes['O50pfl'];
|
||||||
|
$nightAllowance = $nightAllowance + $overtimes['nightAllowance'];
|
||||||
$Osum = $Osum + $overtimes['sum'];
|
$Osum = $Osum + $overtimes['sum'];
|
||||||
}
|
}
|
||||||
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
|
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
|
||||||
@@ -1176,7 +1181,7 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$json['time']['daysum'] = $daysum;
|
$json['time']['daysum'] = $daysum;
|
||||||
$json['recordsFiltered'] = $responsecount;
|
$json['recordsFiltered'] = $responsecount;
|
||||||
$json['recordsTotal'] = $responsecount;
|
$json['recordsTotal'] = $responsecount;
|
||||||
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl, 'Osum' => $Osum];
|
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl,'nightAllowance' => $nightAllowance, 'Osum' => $Osum];
|
||||||
|
|
||||||
if ($ajax == 1) {
|
if ($ajax == 1) {
|
||||||
$json = json_encode($json);
|
$json = json_encode($json);
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
final class AddTimerecordingBillingEmployeeNightAllowance extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if($this->getEnvironment() == "thetool") {
|
||||||
|
$table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
|
||||||
|
$table->addColumn("night_allowance", "integer", ["null" => false, "default" => 0, "after" => "overtime_plushours"]);
|
||||||
|
$table->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->getEnvironment() == "addressdb") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
if($this->getEnvironment() == "thetool") {
|
||||||
|
$this->table("TimerecordingBillingEmployee")->removeColumn("night_allowance")->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->getEnvironment() == "addressdb") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user