Merge branch 'spidev' into 'master'

Zeiterfassung Update

See merge request fronk/thetool!368
This commit is contained in:
Daniel Spitzer
2024-05-16 12:55:47 +00:00
5 changed files with 285 additions and 80 deletions

View File

@@ -690,6 +690,75 @@ class TimerecordingBillingController extends mfBaseController
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
}
} else if ($type == "bpa") {
$sum = 0;
$data = [];
if ($this->request->plushours) {
$timerecordingbillingsemployee->timerecordingEmployee->id;
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
$dataemployee = [];
$dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now + $this->request->plushours * 3600;
$dataemployee['plushours'] = $timerecordingEmployee->plushours + $this->request->plushours * 3600;
$data['transfer_plushours'] = $timerecordingbillingsemployee->transfer_plushours - $this->request->plushours * 3600;
$data['plushours_all'] = $timerecordingbillingsemployee->plushours_all + $this->request->plushours * 3600;
$sum += $this->request->plushours * 3600;
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
}
if ($this->request->overtimehours) {
$timerecordingbillingsemployee->timerecordingEmployee->id;
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
$dataemployee = [];
$dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now + $this->request->overtimehours * 3600;
$dataemployee['overtime'] = $timerecordingEmployee->overtime + $this->request->overtimehours * 3600;
$data['transfer_overtime'] = $timerecordingbillingsemployee->transfer_overtime - $this->request->overtimehours * 3600;
$sum += $this->request->overtimehours * 3600;
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
}
if ($data) {
$data['transfer_bpahours'] = $timerecordingbillingsemployee->transfer_bpahours + $sum;
$timerecordingbillingsemployee->update($data);
$timerecordingbillingsemployee->save();
$dataemployee = [];
$dataemployee['bpahours'] = $timerecordingEmployee->bpahours - $sum;
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
}
} else if ($type == "plushours25" || $type == "overtime50free" || $type == "overtime100free") {
$sum = 0;
$data = [];
if ($this->request->plushours) {
$timerecordingbillingsemployee->timerecordingEmployee->id;
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
$dataemployee = [];
$dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now + $this->request->plushours * 3600;
$dataemployee['plushours'] = $timerecordingEmployee->plushours + $this->request->plushours * 3600;
$data['transfer_plushours'] = $timerecordingbillingsemployee->transfer_plushours - $this->request->plushours * 3600;
$data['plushours_all'] = $timerecordingbillingsemployee->plushours_all + $this->request->plushours * 3600;
$sum += $this->request->plushours * 3600;
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
}
if ($this->request->overtimehours) {
$timerecordingbillingsemployee->timerecordingEmployee->id;
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
$dataemployee = [];
$dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now + $this->request->overtimehours * 3600;
$dataemployee['overtime'] = $timerecordingEmployee->overtime + $this->request->overtimehours * 3600;
$data['transfer_overtime'] = $timerecordingbillingsemployee->transfer_overtime - $this->request->overtimehours * 3600;
$sum += $this->request->overtimehours * 3600;
$timerecordingEmployee->update($dataemployee);
$timerecordingEmployee->save();
}
if ($data) {
$data[$type] = $timerecordingbillingsemployee->{$type} - $sum;
$timerecordingbillingsemployee->update($data);
$timerecordingbillingsemployee->save();
}
}
$response['state'] = "success";
echo json_encode($response);

View File

@@ -157,6 +157,7 @@ private $holidays ;
$enddate = "";
$sum = "-";
$day = "";
$enddatecend="";
$orderdate = $timerecording->start;
if ($timerecording->timerecordingCategory->hourday == 1) {
$date = date("d.m.Y", $timerecording->start);
@@ -224,6 +225,7 @@ private $holidays ;
$enddatetemp = date("Y-m-d", time());
$enddatetemp = strtotime($enddatetemp . " 23:59:59");
$enddate = date("Y-m-d", $enddatetemp + 7200);
$enddatecend= date("Y-m-d", $enddatetemp + 1216800);
$start = "-";
$end = "-";
$day = $daysgerm[date("w", $timerecording->start)];
@@ -355,6 +357,11 @@ private $holidays ;
endif;
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
} else {
if (!$enddatecend)
{
$enddatecend=$enddate;
}
$rows[] = array(
'user' => array('user' => $timerecording->user->name, 'order' => $timerecording->user->name),
'date' => array('date' => $state . $day . " " . $date, 'order' => $orderdate),
@@ -362,7 +369,7 @@ private $holidays ;
'end' => array('end' => $end, 'order' => $end),
'sum' => array('sum' => $sum, 'order' => $sum),
'cstart' => array('cstart' => $datadate, 'order' => $datadate),
'cend' => array('cend' => $enddate, 'order' => $enddate),
'cend' => array('cend' => $enddatecend, 'order' => $enddatecend),
'ccategory' => array('ccategory' => $timerecording->timerecordingCategory->name, 'order' => $timerecording->timerecordingCategory->name),
'category' => array('category' => $category, 'order' => $timerecording->timerecordingCategory->name),
'comment' => array('comment' => $timerecording->comment, 'order' => $timerecording->comment),