diff --git a/Layout/default/TimerecordingBilling/DetailClosed.php b/Layout/default/TimerecordingBilling/DetailClosed.php index 66d95337b..4f4cc945b 100644 --- a/Layout/default/TimerecordingBilling/DetailClosed.php +++ b/Layout/default/TimerecordingBilling/DetailClosed.php @@ -165,7 +165,13 @@ - + + + + + '); $('#submit-button').data('type', 'difference'); - $('#plushours25_div').show(); + $('.overtime-modal-div').show(); } if (button.hasClass('change-overtime')) { $('#overtimeModal-title').text('Überstunden Transfer'); $('#overtimes').html(''); $('#submit-button').data('type', 'overtime'); $('#overtimeModal').data('id', button.data('id')); - $('#plushours25_div').hide(); + $('.overtime-modal-div').hide(); } $('.change-overtime-value').val(''); }); @@ -316,17 +322,19 @@ var overtime50 = $('#overtime50').val(); var overtime100 = $('#overtime100').val(); var overtimebpa = $('#overtimebpa').val(); + var overtimehours = $('#overtimehours').val(); $.post(" 'saveovertime']) ?>", { id: id, type: $(this).data('type'), plushours25: plushours25, + overtimehours:overtimehours, overtime50: overtime50, overtime100: overtime100, overtimebpa: overtimebpa, ajax: 1 }).done(function (data) { window.location.reload(); - +ö }); }); //$.post(insertUrl, { diff --git a/application/TimerecordingBilling/TimerecordingBillingController.php b/application/TimerecordingBilling/TimerecordingBillingController.php index 0e4f7fffe..961e5446e 100644 --- a/application/TimerecordingBilling/TimerecordingBillingController.php +++ b/application/TimerecordingBilling/TimerecordingBillingController.php @@ -527,6 +527,11 @@ class TimerecordingBillingController extends mfBaseController $data['transfer_plushours'] = $data['transfer_plushours'] + ($diff - $maxplushours); } + if ($timerecording['employee_id'] == "12") { + $data['transfer_plushours'] = $data['transfer_plushours'] - $data['overtime50free'] ; + $data['overtime50free'] = 0; + } + if ($data['transfer_plushours'] > 0) { $timerecordingEmployee = new TimerecordingEmployee($timerecording['employee_id']); @@ -586,6 +591,7 @@ class TimerecordingBillingController extends mfBaseController $dataemployee['plushours'] = $timerecordingEmployee->plushours + $timerecordingBillingEmployee->transfer_plushours; $dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now + $timerecordingBillingEmployee->transfer_overtime; $dataemployee['overtime'] = $timerecordingEmployee->overtime + $timerecordingBillingEmployee->transfer_overtime; + $dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $timerecordingBillingEmployee->transfer_bpahours; $timerecordingEmployee->update($dataemployee); $timerecordingEmployee->save(); } @@ -617,6 +623,7 @@ class TimerecordingBillingController extends mfBaseController $timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id); $dataemployee = []; $dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $this->request->overtimebpa * 3600; + $data['transfer_bpahours'] = $timerecordingbillingsemployee->transfer_overtimebpa - $this->request->overtimebpa * 3600; $sum += $this->request->overtimebpa * 3600; $timerecordingEmployee->update($dataemployee); $timerecordingEmployee->save(); @@ -645,6 +652,7 @@ class TimerecordingBillingController extends mfBaseController $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; @@ -654,10 +662,22 @@ class TimerecordingBillingController extends mfBaseController $timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id); $dataemployee = []; $dataemployee['bpahours'] = $timerecordingEmployee->bpahours + $this->request->overtimebpa * 3600; + $data['transfer_bpahours'] = $timerecordingbillingsemployee->transfer_overtimebpa - $this->request->overtimebpa * 3600; $sum += $this->request->overtimebpa * 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 ($sum > 0) { $data['transfer_plushours'] = $timerecordingbillingsemployee->transfer_plushours + $sum; $data['plushours_all'] = $timerecordingbillingsemployee->plushours_all - $sum; diff --git a/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php b/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php index c468e130f..23be9e55a 100644 --- a/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php +++ b/application/TimerecordingBillingEmployee/TimerecordingBillingEmployeeModel.php @@ -20,6 +20,7 @@ class TimerecordingBillingEmployeeModel private $nlz_detail; private $transfer_plushours; private $transfer_overtime; + private $transfer_bpahours; public static function find($data) diff --git a/db/migrations/20240507055303_timerecording_billing_employee_add_fields_transfer_bpa.php b/db/migrations/20240507055303_timerecording_billing_employee_add_fields_transfer_bpa.php new file mode 100644 index 000000000..2c1c49cce --- /dev/null +++ b/db/migrations/20240507055303_timerecording_billing_employee_add_fields_transfer_bpa.php @@ -0,0 +1,31 @@ +getEnvironment() == "thetool") { + $table = $this->table("TimerecordingBillingEmployee", ["signed" => true]); + $table->addColumn("transfer_bpahours", "integer", ["null" => false, "default" => 0, "after" => "transfer_overtime"]); + $table->update(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $this->table("TimerecordingBillingEmployee")->removeColumn("transfer_bpahours")->save(); + } + + if ($this->getEnvironment() == "addressdb") { + + } + } +}