Merge branch 'spidev' into 'master'

Zeiterfassung Update

See merge request fronk/thetool!352
This commit is contained in:
Daniel Spitzer
2024-05-07 06:54:41 +00:00
4 changed files with 64 additions and 4 deletions

View File

@@ -165,7 +165,13 @@
<table class="table ">
<tr id="overtimes">
</tr>
<tr id="plushours25_div" style="display:none">
<tr class="overtime-modal-div" style="display:none">
<th class="align-middle">Gutstundenkonto</th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="overtimehours"
id="overtimehours"></td>
</tr>
<tr class="overtime-modal-div" style="display:none">
<th class="align-middle">Mehrstunden 25</th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="plushours25"
@@ -246,14 +252,14 @@
$('#overtimes').html('<th>Mehrstunden:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
$('#submit-button').data('type', 'difference');
$('#plushours25_div').show();
$('.overtime-modal-div').show();
}
if (button.hasClass('change-overtime')) {
$('#overtimeModal-title').text('Überstunden Transfer');
$('#overtimes').html('<th>Überstunden:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
$('#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("<?= self::getUrl("TimerecordingBilling", "api", ['do' => '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, {

View File

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

View File

@@ -20,6 +20,7 @@ class TimerecordingBillingEmployeeModel
private $nlz_detail;
private $transfer_plushours;
private $transfer_overtime;
private $transfer_bpahours;
public static function find($data)

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class TimerecordingBillingEmployeeAddFieldsTransferBpa extends AbstractMigration
{
public function up(): void
{
if ($this->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") {
}
}
}