Zeiterfassung Update

* automatische Berechnung und BMD Import für NachtZulagen + Migration
This commit is contained in:
Daniel Spitzer
2025-11-30 15:00:14 +01:00
parent e117a37b40
commit 515063a03b
4 changed files with 61 additions and 22 deletions

View File

@@ -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'];

View File

@@ -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;

View File

@@ -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
} }
} }
@@ -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) {
@@ -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;
} }
@@ -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 = "";
@@ -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);

View File

@@ -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") {
}
}
}