Zeiterfassung Update Monatsabschluss/Verrechnung
* Berechnungen aller Ü50/Ü100/M25 sowie Steuerfrei und Pflichtig * Transfer Mehrstunden auf Ü50/Ü100/M25 * Anpassungen der Exports LZs MehrstundenGL ÜGL Ü50,Ü100,M25 * Autoberechnung der anteiligen Mehrstunden * automatische Ü100 Rausrechnung laut gesetzlichen Vorgaben Bugfixes: * Start und Enddatum eines Mitarbeiters werden nun überall berücksichtigt. * Textuelle Bereinigungen * Umfangreiche Testscenarien Verechnung/Exports
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="col-12" id="page-header">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Mitarbeiter</h4>
|
||||
</div>
|
||||
@@ -108,6 +108,9 @@
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="spinner-big text-info mt-3 ml-5" style="display: none" >
|
||||
<i class="fas fa-spinner fa-spin spinner-ico font-24 align-middle "></i> <span class="text-dark ml-2 font-weight-500 font-18 d-inline-block">Monatsabschluss wird generiert...</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -135,6 +138,9 @@
|
||||
});
|
||||
$('body').on('click', '#month-complete', function () {
|
||||
if (confirm('Monat ' + $('#month').data('month') + ' wirklich abschließen?')) {
|
||||
$('#datatable_wrapper').hide();
|
||||
$('#page-header').hide();
|
||||
$('.spinner-big').show();
|
||||
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'completemonth']) ?>", {
|
||||
month: $.trim($('#month').data('month')),
|
||||
ajax: 1
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="col-12" id="page-header">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Mitarbeiter</h4>
|
||||
</div>
|
||||
@@ -64,15 +64,17 @@
|
||||
<th class="text-center">Mitarbeiter/PersNr.</th>
|
||||
<th class="text-center">Leistungszeiten</th>
|
||||
<th class="text-center">Nichtleistungszeiten</th>
|
||||
<th class="text-center">Iststunden (NLZ+LZ)</th>
|
||||
<th class="text-center">Istst.(NLZ+LZ)</th>
|
||||
<th class="text-center">Sollstunden</th>
|
||||
<th class="text-center">Sollabweichung</th>
|
||||
<th class="text-center">Gesamt Überstunden</th>
|
||||
<th class="text-center">Mehrstunden</th>
|
||||
<th class="text-center">Ges. Überst.</th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th class="text-center">Black P. Stunden</th>
|
||||
<?php endif; ?>
|
||||
<th class="text-center">Ü50</th>
|
||||
<th class="text-center">Ü100</th>
|
||||
<th title="Mehrstunden 25%" class="text-center">M25</th>
|
||||
<th title="Überstunden 50%" class="text-center">Ü50</th>
|
||||
<th title="Überstunden 100%" class="text-center">Ü100</th>
|
||||
<th class="text-center">Diäten</th>
|
||||
<th class="text-center">Homeoffice</th>
|
||||
</tr>
|
||||
@@ -83,6 +85,7 @@
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<th></th>
|
||||
<?php endif; ?>
|
||||
@@ -91,6 +94,7 @@
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -113,19 +117,21 @@
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-nowrap">(<?= $employee_number ?>
|
||||
) <?= $timerecording->timerecordingEmployee->user->name ?> </td>
|
||||
<td class="text-nowrap">(<?= $employee_number ?>) <?= $timerecording->timerecordingEmployee->user->name ?> </td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->ishours / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= $nlz ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->ishourssum / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->musthours / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= (($timerecording->ishourssum - $timerecording->musthours) == 0) ? '<div class="filler-0 float-left"></div>' : '' ?><?= number_format(round(($timerecording->ishourssum - $timerecording->musthours) / 3600, 2), "2", ",", ".") ?>
|
||||
<?= (($timerecording->ishourssum - $timerecording->musthours) > 0) ? '<i class="float-right fa-regular fa-arrow-right-from-bracket change-difference" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round(($timerecording->ishourssum - $timerecording->musthours) / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '<div class="filler float-right"></div>' ?></td>
|
||||
<td class="text-center"><?= number_format(round(($timerecording->ishourssum-$timerecording->musthours) / 3600, 2), "2", ",", ".") ?></td>
|
||||
|
||||
<td class="text-center"><?= ($timerecording->plushours_all == 0) ? '<div class="filler-0 float-left"></div>' : '' ?><?= number_format(round(($timerecording->plushours_all) / 3600, 2), "2", ",", ".") ?>
|
||||
<?= ($timerecording->plushours_all > 0) ? '<i class="float-right fa-regular fa-arrow-right-from-bracket change-difference" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round(($timerecording->plushours_all) / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '<div class="filler float-right"></div>' ?></td>
|
||||
<td class="text-center"><?= ($timerecording->timerecordingEmployee->overtime_now == 0) ? '<div class="filler-0 float-left"></div>' : '' ?><?= number_format(round($timerecording->timerecordingEmployee->overtime_now / 3600, 2), "2", ",", ".") ?>
|
||||
<?= ($timerecording->timerecordingEmployee->overtime_now > 0) ? '<i class="float-right fa-regular fa-arrow-right-from-bracket change-overtime" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->timerecordingEmployee->overtime_now / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '<div class="filler float-right"></div>' ?></td>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<td class="text-center"><?= number_format(round($timerecording->timerecordingEmployee->bpahours / 3600, 2), "2", ",", ".") ?></td>
|
||||
<?php endif; ?>
|
||||
<td class="text-center"><?= number_format(round($timerecording->plushours25 / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->overtime50free / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format(round($timerecording->overtime100free / 3600, 2), "2", ",", ".") ?></td>
|
||||
<td class="text-center"><?= number_format($timerecording->diet, 2, ',', '.') . " €" ?></td>
|
||||
@@ -134,7 +140,9 @@
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="spinner-big text-info mt-3 ml-5" style="display: none" >
|
||||
<i class="fas fa-spinner fa-spin spinner-ico font-24 align-middle "></i> <span class="text-dark ml-2 font-weight-500 font-18 d-inline-block">Monatsabschluss wird rückgängig gemacht...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -157,6 +165,12 @@
|
||||
<table class="table ">
|
||||
<tr id="overtimes">
|
||||
</tr>
|
||||
<tr id="plushours25_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"
|
||||
id="plushours25"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-middle">Überstunden 50</th>
|
||||
<td><input type="number" step="any" class="form-control change-overtime-value"
|
||||
@@ -195,12 +209,14 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
var hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12];
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
||||
hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,12,13];
|
||||
<?php endif; ?>
|
||||
$(document).ready(function () {
|
||||
// $('.buttons-excel').closest('div').append('<div ><button id="month-complete" class="btn btn-danger margina">Monats Abschluss</button></div>');
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
$('.buttons-excel').closest('div').prepend('<div ><button id="month-abort" class="btn btn-danger margina">Abschluss Abbrechen</button></div>');
|
||||
<?php endif; ?>
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="bmd-export" class="btn btn-info margina">BMD Import</button></div>');
|
||||
$('.buttons-excel').closest('div').append('<div ><button id="bmd-export-nlz" class="btn btn-info margina">BMD NLZ Import</button></div>');
|
||||
|
||||
@@ -221,24 +237,42 @@
|
||||
}
|
||||
|
||||
});
|
||||
$('#overtimeModal').on('shown.bs.modal', function (event) {
|
||||
$('#overtimeModal').on('show.bs.modal', function (event) {
|
||||
var button = $(event.relatedTarget);
|
||||
|
||||
if (button.hasClass('change-difference')) {
|
||||
$('#overtimeModal-title').text('Mehrstunden Transfer');
|
||||
$('#overtimeModal').data('id', button.data('id'));
|
||||
|
||||
$('#overtimes').html('<th>Mehrstunden:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + ' (6,5)</td>');
|
||||
$('#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();
|
||||
}
|
||||
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();
|
||||
}
|
||||
$('.change-overtime-value').val('');
|
||||
});
|
||||
|
||||
$('body').on('click', '#month-abort', function () {
|
||||
if (confirm('Monatsabschluss ' + $('#month').data('month') + ' wirklich rückgängig machen?')) {
|
||||
$('#datatable_wrapper').hide();
|
||||
$('#page-header').hide();
|
||||
$('.spinner-big').show();
|
||||
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'abortmonth']) ?>", {
|
||||
month: $.trim($('#month').data('month')),
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
window.location.href = "<?= self::getUrl("TimerecordingBilling", "detail", ['month' => $month]) ?>";
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('body').on('change', '.change-overtime-value', function () {
|
||||
//$('#overtime-hours').data('hours') to float
|
||||
var difference = 0;
|
||||
@@ -278,12 +312,14 @@
|
||||
});
|
||||
$('body').on('click', '#submit-button', function () {
|
||||
var id = $('#overtimeModal').data('id');
|
||||
var plushours25 = $('#plushours25').val();
|
||||
var overtime50 = $('#overtime50').val();
|
||||
var overtime100 = $('#overtime100').val();
|
||||
var overtimebpa = $('#overtimebpa').val();
|
||||
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'saveovertime']) ?>", {
|
||||
id: id,
|
||||
type: $(this).data('type'),
|
||||
plushours25: plushours25,
|
||||
overtime50: overtime50,
|
||||
overtime100: overtime100,
|
||||
overtimebpa: overtimebpa,
|
||||
|
||||
@@ -143,25 +143,25 @@ $daysSelect .= "</select>";
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="form-group row">
|
||||
<div class="form-group row" style="display:none">
|
||||
<label class="col-lg-2 col-form-label" for="holidays">Initiale Urlaubstage</label>
|
||||
<div class="col-lg-1">
|
||||
<input required="required" type="number" id="holidays" name="holidays"
|
||||
<input type="number" id="holidays" name="holidays"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingemployees->holidays ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="form-group row" style="display:none">
|
||||
<label class="col-lg-2 col-form-label" for="plushours">Initiale Gutstunden</label>
|
||||
<div class="col-lg-1">
|
||||
<input required="required" type="text" id="plushours" name="plushours"
|
||||
<input type="text" id="plushours" name="plushours"
|
||||
class="form-control"
|
||||
value="<?= str_replace(".", ",", $timerecordingemployees->plushours / 3600) ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="form-group row" style="display:none">
|
||||
<label class="col-lg-2 col-form-label" for="overtime">Initiale Überstunden</label>
|
||||
<div class="col-lg-1">
|
||||
<input type="text" id="overtime" name="overtime"
|
||||
|
||||
@@ -532,7 +532,7 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function updatePlushours($userid)
|
||||
public function updatePlushours($userid, $enddate = null)
|
||||
{
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
if ($employee) {
|
||||
@@ -553,13 +553,20 @@ class TimerecordingController extends mfBaseController
|
||||
$overtime_timestamp = $employee->startdate;
|
||||
$overtime_now = $overtime;
|
||||
}
|
||||
if ($employee->enddate && $employee->enddate < time() - 86400) {
|
||||
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
|
||||
if (!$enddate) {
|
||||
if ($employee->enddate && $employee->enddate < time() - 86400) {
|
||||
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
|
||||
} else {
|
||||
$endtime = time() - 86400;
|
||||
}
|
||||
} else {
|
||||
$endtime = time() - 86400;
|
||||
if ($employee->enddate && $employee->enddate < $enddate) {
|
||||
$endtime = strtotime(date("Y-m-d", $employee->enddate) . " 23:59:00");
|
||||
} else {
|
||||
$endtime = $enddate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$endtime = date("Y-m-d", $endtime);
|
||||
$endtime = strtotime($endtime . " 23:59:00");
|
||||
|
||||
@@ -586,13 +593,19 @@ class TimerecordingController extends mfBaseController
|
||||
$plushours_now = $plushours_now - $minushours;
|
||||
$diffTime = $diffTime - $minushours;
|
||||
$overtime_now = $overtime_now - $minushoursovertime;
|
||||
if ($employee->plushours_now != $plushours_now || $employee->overtime_now != $overtime_now) {
|
||||
$employeeupdate = new TimerecordingEmployee($employee->id);
|
||||
$data = [];
|
||||
$data['plushours_now'] = $plushours_now;
|
||||
$data['overtime_now'] = $overtime_now;
|
||||
$employeeupdate->update($data);
|
||||
$employeeupdate->save();
|
||||
if (!$enddate) {
|
||||
if ($employee->plushours_now != $plushours_now || $employee->overtime_now != $overtime_now) {
|
||||
$employeeupdate = new TimerecordingEmployee($employee->id);
|
||||
$data = [];
|
||||
$data['plushours_now'] = $plushours_now;
|
||||
$data['overtime_now'] = $overtime_now;
|
||||
$employeeupdate->update($data);
|
||||
$employeeupdate->save();
|
||||
}
|
||||
} else {
|
||||
$response['plushours'] = $plushours_now;
|
||||
$response['overtime'] = $overtime_now;
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -656,7 +669,7 @@ class TimerecordingController extends mfBaseController
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
} elseif ($holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
|
||||
} elseif ($holiDay[$dDate]) {
|
||||
$holidayrows[$timestamp] = $holiDay[$dDate];
|
||||
}
|
||||
|
||||
@@ -675,7 +688,7 @@ class TimerecordingController extends mfBaseController
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
} elseif ($holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
|
||||
} elseif ($holiDay[$dDate]) {
|
||||
$holidayrows[$timestamp] = $holiDay[$dDate];
|
||||
}
|
||||
$timestamp = $timestamp + 86400;
|
||||
@@ -935,18 +948,18 @@ class TimerecordingController extends mfBaseController
|
||||
);
|
||||
}
|
||||
endforeach;
|
||||
foreach ($holidayrows as $key => $holidayrow) {
|
||||
$day = $daysgerm[date("w", $key)];
|
||||
$rows[] = array(
|
||||
'date' => array('date' => '<span class="text-bold holiday-text">'.$day." ".date("d.m.Y",$key).'</span>', 'order' => $key),
|
||||
'start' => array('start' => "-", 'order' => "-"),
|
||||
'end' => array('end' => "-", 'order' => "-"),
|
||||
'sum' => array('sum' => "-", 'order' => "-"),
|
||||
'category' => array('category' => '<span class="text-bold holiday-text">Feiertag <i class="far fa-fw fa-umbrella-beach "></i></span>', 'order' => 'Feiertag'),
|
||||
'comment' => array('comment' => '<span class="text-bold holiday-text">'.$holidayrow.'</span>', 'order' => $holidayrow),
|
||||
'edit' => array('edit' => "", 'order' => ""),
|
||||
);
|
||||
}
|
||||
foreach ($holidayrows as $key => $holidayrow) {
|
||||
$day = $daysgerm[date("w", $key)];
|
||||
$rows[] = array(
|
||||
'date' => array('date' => '<span class="text-bold holiday-text">' . $day . " " . date("d.m.Y", $key) . '</span>', 'order' => $key),
|
||||
'start' => array('start' => "-", 'order' => "-"),
|
||||
'end' => array('end' => "-", 'order' => "-"),
|
||||
'sum' => array('sum' => "-", 'order' => "-"),
|
||||
'category' => array('category' => '<span class="text-bold holiday-text">Feiertag <i class="far fa-fw fa-umbrella-beach "></i></span>', 'order' => 'Feiertag'),
|
||||
'comment' => array('comment' => '<span class="text-bold holiday-text">' . $holidayrow . '</span>', 'order' => $holidayrow),
|
||||
'edit' => array('edit' => "", 'order' => ""),
|
||||
);
|
||||
}
|
||||
if ($datatype == 5) {
|
||||
$response['is'] = $isSeconds;
|
||||
$response['must'] = $mustSeconds;
|
||||
|
||||
@@ -55,6 +55,9 @@ class TimerecordingBillingController extends mfBaseController
|
||||
{
|
||||
$r = $this->request;
|
||||
$month = $r->get("month");
|
||||
$monthstart = strtotime("01." . $month);
|
||||
$monthend = strtotime("last day of this month", $monthstart);
|
||||
|
||||
if (!$month) {
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
@@ -64,16 +67,17 @@ class TimerecordingBillingController extends mfBaseController
|
||||
} else {
|
||||
$month = strtotime("01." . $month);
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
if ($timerecordingsEmolyee->bmd_active == 0) continue;
|
||||
if ($timerecordingsEmolyee->bmd_active == 0 || $timerecordingsEmolyee->startdate > $monthend || ($timerecordingsEmolyee->enddate && $timerecordingsEmolyee->enddate < $monthstart)) continue;
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['user_id'] = $timerecordingsEmolyee->user_id;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['user_name'] = $timerecordingsEmolyee->user->name;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['employee_number'] = $employee_number;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['data'] = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
}
|
||||
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Detail");
|
||||
$this->layout()->set("month", date("m.Y", $month));
|
||||
@@ -103,6 +107,9 @@ class TimerecordingBillingController extends mfBaseController
|
||||
case "completemonth":
|
||||
$return = $this->completemonth($month);
|
||||
break;
|
||||
case "abortmonth":
|
||||
$return = $this->abortmonth($month);
|
||||
break;
|
||||
case "saveovertime":
|
||||
$return = $this->saveovertime();
|
||||
break;
|
||||
@@ -121,7 +128,6 @@ class TimerecordingBillingController extends mfBaseController
|
||||
protected function addAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
@@ -186,7 +192,6 @@ class TimerecordingBillingController extends mfBaseController
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
@@ -195,7 +200,6 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$this->layout()->setFlash("Timerecording nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
|
||||
$timerecordingbillings->delete();
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
@@ -229,6 +233,7 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
$employee_type = $employeetypesbmd[$timerecordingBillingEmployee->timerecordingEmployee->type];
|
||||
$overtimebase = 0;
|
||||
$plushoursbase = 0;
|
||||
if ($nlz == 0) {
|
||||
$hours = $timerecordingBillingEmployee->ishours / 3600;
|
||||
$hours = round($hours, 2);
|
||||
@@ -237,20 +242,62 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($timerecordingBillingEmployee->plushours25 > 0) {
|
||||
$plushours25 = $timerecordingBillingEmployee->plushours25 / 3600;
|
||||
$plushours25 = round($plushours25, 2);
|
||||
$plushoursbase = $plushoursbase + $plushours25;
|
||||
$plushours25 = str_replace(".", ",", $plushours25);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3050", $plushours25, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($timerecordingBillingEmployee->overtime50free > 0) {
|
||||
$overtime50free = $timerecordingBillingEmployee->overtime50free / 3600;
|
||||
$overtime50free = round($overtime50free, 2);
|
||||
$overtimebase = $overtimebase + $overtime50free;
|
||||
$overtime50free = str_replace(".", ",", $overtime50free);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3110", $overtime50free, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
if ($timerecordingBillingEmployee->overtime50free > 64800) {
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3110", "18", "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
$diffsum = $timerecordingBillingEmployee->overtime50free - 64800;
|
||||
$diffsum = $diffsum / 3600;
|
||||
$diffsum = round($diffsum, 2);
|
||||
$diffsum = str_replace(".", ",", $diffsum);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3120", $diffsum, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$overtime50free = str_replace(".", ",", $overtime50free);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3110", $overtime50free, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if ($timerecordingBillingEmployee->overtime100free > 0) {
|
||||
$overtime100free = $timerecordingBillingEmployee->overtime100free / 3600;
|
||||
$overtime100free = round($overtime100free, 2);
|
||||
$overtimebase = $overtimebase + $overtime100free;
|
||||
$overtime100free = str_replace(".", ",", $overtime100free);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3160", $overtime100free, "", "", "", "", "", ""];
|
||||
if ($timerecordingBillingEmployee->overtime100free > 64800) {
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3160", "18", "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
$diffsum = $timerecordingBillingEmployee->overtime100free - 64800;
|
||||
$diffsum = $diffsum / 3600;
|
||||
$diffsum = round($diffsum, 2);
|
||||
$diffsum = str_replace(".", ",", $diffsum);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3150", $diffsum, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else {
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3160", $overtime100free, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
|
||||
}
|
||||
if ($timerecordingBillingEmployee->overtime100 > 0) {
|
||||
$overtime100 = $timerecordingBillingEmployee->overtime100 / 3600;
|
||||
$overtime100 = round($overtime100, 2);
|
||||
$overtimebase = $overtimebase + $overtime100;
|
||||
$overtime100free = str_replace(".", ",", $overtime100);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3150", $overtime100, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($overtimebase > 0) {
|
||||
@@ -258,6 +305,11 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3100", $overtimebase, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if ($plushoursbase > 0) {
|
||||
$plushoursbase = str_replace(".", ",", $plushoursbase);
|
||||
$bodyarray = [$monthbmd, "1", $employee_number, "3000", $plushoursbase, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
|
||||
if ($timerecordingBillingEmployee->homeoffice > 0) {
|
||||
$homeoffice = $timerecordingBillingEmployee->homeoffice;
|
||||
@@ -273,8 +325,6 @@ class TimerecordingBillingController extends mfBaseController
|
||||
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -283,12 +333,8 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fclose($file);
|
||||
exit;
|
||||
}
|
||||
@@ -317,13 +363,11 @@ class TimerecordingBillingController extends mfBaseController
|
||||
//last of month
|
||||
$monthend = date("Y-m-d", strtotime("last day of this month", $month));
|
||||
$monthend = strtotime($monthend . " 23:59:59");
|
||||
|
||||
|
||||
$monthbmd = date("n", $month);
|
||||
$companybmd = "1";
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
if ($timerecordingsEmolyee->bmd_active == 0) continue;
|
||||
if ($timerecordingsEmolyee->bmd_active == 0 || $timerecordingsEmolyee->startdate > $monthend || ($timerecordingsEmolyee->enddate && $timerecordingsEmolyee->enddate < $month)) continue;
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
@@ -332,9 +376,11 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$timerecording = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
if ($export == 0) {
|
||||
$reponse[$employee_number]['employee_id'] = $timerecordingsEmolyee->id;
|
||||
$reponse[$employee_number]['user_id'] = $timerecordingsEmolyee->user_id;
|
||||
$reponse[$employee_number]['homeoffice'] = $timerecording['time']['homeoffice'];
|
||||
$reponse[$employee_number]['istimeall'] = $timerecording['time']['isorder'];
|
||||
$reponse[$employee_number]['musttime'] = $timerecording['time']['mustorder'];
|
||||
$reponse[$employee_number]['overtimes'] = $timerecording['time']['overtimes'];
|
||||
}
|
||||
|
||||
foreach ($timerecording['time']['isclean'] as $key => $value) {
|
||||
@@ -446,21 +492,63 @@ class TimerecordingBillingController extends mfBaseController
|
||||
protected function completemonth($month)
|
||||
{
|
||||
$id = $this->saveAction();
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$enddate = strtotime("01." . $month);
|
||||
$enddate = strtotime("last day of this month", $enddate);
|
||||
$enddate = strtotime("23:59:59", $enddate);
|
||||
|
||||
$timerecordings = $this->generateBmdExport($month, 0, 0);
|
||||
$timerecordingworkinghours = TimerecordingEmployeeWorkingHourModel::getAllArray();
|
||||
|
||||
foreach ($timerecordings as $employeenumber => $timerecording) {
|
||||
|
||||
$timerecordingworkinghour = $timerecordingworkinghours[$timerecording['user_id']]['secondcounter'];
|
||||
if ($timerecordingworkinghour == 138600) {
|
||||
$maxplushours = 23400;
|
||||
} else {
|
||||
$maxplushours = (138600 - $timerecordingworkinghour) * 4.33;
|
||||
$maxplushours = round($maxplushours, 0);
|
||||
$maxplushours = $maxplushours + 23400;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['timerecordingBilling_id'] = $id;
|
||||
$data['timerecordingEmployee_id'] = $timerecording['employee_id'];
|
||||
$data['musthours'] = $timerecording['musttime'];
|
||||
$data['overtime50'] = $timerecording['overtimes']['O50pfl'];
|
||||
$data['overtime50free'] = $timerecording['overtimes']['O50free'];
|
||||
$data['overtime100'] = $timerecording['overtimes']['O100pfl'];
|
||||
$data['overtime100free'] = $timerecording['overtimes']['O100free'];
|
||||
$data['transfer_plushours'] = $timerecording['overtimes']['Osum'];
|
||||
|
||||
$diff = $timerecording['istimeall'] - $timerecording['musttime'];
|
||||
|
||||
if ($diff > $maxplushours) {
|
||||
$data['overtime50free'] = $data['overtime50free'] + ($diff - $maxplushours);
|
||||
$data['transfer_plushours'] = $data['transfer_plushours'] + ($diff - $maxplushours);
|
||||
}
|
||||
|
||||
|
||||
if ($data['transfer_plushours'] > 0) {
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecording['employee_id']);
|
||||
$dataemployee = [];
|
||||
$dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now - $data['transfer_plushours'];
|
||||
$dataemployee['plushours'] = $timerecordingEmployee->plushours - $data['transfer_plushours'];
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
}
|
||||
$timerecordingController = new TimerecordingController();
|
||||
$plushours = $timerecordingController->updatePlushours($timerecording['user_id'], $enddate);
|
||||
$data['plushours_all'] = $plushours['plushours'];
|
||||
|
||||
|
||||
if ($timerecording['istime']) {
|
||||
$data['ishours'] = $timerecording['istime'];
|
||||
} else {
|
||||
$data['ishours'] = 0;
|
||||
}
|
||||
$data['ishourssum'] = $timerecording['istimeall'];
|
||||
|
||||
|
||||
$data['diet'] = $timerecording['diet'];
|
||||
if ($timerecording['nlz']) {
|
||||
$data['nlz_detail'] = json_encode($timerecording['nlz']);
|
||||
@@ -486,6 +574,28 @@ class TimerecordingBillingController extends mfBaseController
|
||||
die();
|
||||
}
|
||||
|
||||
protected function abortmonth($month)
|
||||
{
|
||||
$timerecordingBilling = TimerecordingBillingModel::search(["month" => $month]);
|
||||
$timerecordingBillingEmployees = TimerecordingBillingEmployeeModel::search(["timerecordingBilling_id" => $timerecordingBilling[0]->id]);
|
||||
|
||||
foreach ($timerecordingBillingEmployees as $timerecordingBillingEmployee) {
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingBillingEmployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now + $timerecordingBillingEmployee->transfer_plushours;
|
||||
$dataemployee['plushours'] = $timerecordingEmployee->plushours + $timerecordingBillingEmployee->transfer_plushours;
|
||||
$dataemployee['overtime_now'] = $timerecordingEmployee->overtime_now + $timerecordingBillingEmployee->transfer_overtime;
|
||||
$dataemployee['overtime'] = $timerecordingEmployee->overtime + $timerecordingBillingEmployee->transfer_overtime;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
}
|
||||
$timerecordingBilling[0]->delete();
|
||||
$result['state'] = "success";
|
||||
echo json_encode($result);
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
protected function saveovertime()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
@@ -513,6 +623,7 @@ class TimerecordingBillingController extends mfBaseController
|
||||
|
||||
}
|
||||
if ($data) {
|
||||
$data['transfer_overtime'] = $timerecordingbillingsemployee->transfer_overtime + $sum;
|
||||
$timerecordingbillingsemployee->update($data);
|
||||
$timerecordingbillingsemployee->save();
|
||||
$timerecordingbillingsemployee->timerecordingEmployee->id;
|
||||
@@ -526,6 +637,10 @@ class TimerecordingBillingController extends mfBaseController
|
||||
} else if ($type == "difference") {
|
||||
$sum = 0;
|
||||
$data = [];
|
||||
if ($this->request->plushours25) {
|
||||
$data['plushours25'] = $timerecordingbillingsemployee->plushours25 + $this->request->plushours25 * 3600;
|
||||
$sum += $this->request->plushours25 * 3600;
|
||||
}
|
||||
if ($this->request->overtime50) {
|
||||
$data['overtime50free'] = $timerecordingbillingsemployee->overtime50free + $this->request->overtime50 * 3600;
|
||||
$sum += $this->request->overtime50 * 3600;
|
||||
@@ -542,12 +657,18 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$sum += $this->request->overtimebpa * 3600;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
|
||||
}
|
||||
if ($sum > 0) {
|
||||
$data['ishourssum'] = $timerecordingbillingsemployee->ishourssum - $sum;
|
||||
$data['transfer_plushours'] = $timerecordingbillingsemployee->transfer_plushours + $sum;
|
||||
$data['plushours_all'] = $timerecordingbillingsemployee->plushours_all - $sum;
|
||||
$timerecordingbillingsemployee->update($data);
|
||||
$timerecordingbillingsemployee->save();
|
||||
$timerecordingEmployee = new TimerecordingEmployee($timerecordingbillingsemployee->timerecordingEmployee->id);
|
||||
$dataemployee = [];
|
||||
$dataemployee['plushours_now'] = $timerecordingEmployee->plushours_now - $sum;
|
||||
$dataemployee['plushours'] = $timerecordingEmployee->plushours - $sum;
|
||||
$timerecordingEmployee->update($dataemployee);
|
||||
$timerecordingEmployee->save();
|
||||
}
|
||||
}
|
||||
$response['state'] = "success";
|
||||
|
||||
@@ -8,15 +8,18 @@ class TimerecordingBillingEmployeeModel
|
||||
private $type;
|
||||
private $ishours;
|
||||
private $ishourssum;
|
||||
private $overtime25;
|
||||
private $plushours50;
|
||||
private $plushours50free;
|
||||
private $plushours100;
|
||||
private $plushours100free;
|
||||
private $plushours_all;
|
||||
private $plushours25;
|
||||
private $overtime50;
|
||||
private $overtime50free;
|
||||
private $overtime100;
|
||||
private $overtime100free;
|
||||
private $homeoffice;
|
||||
private $diet;
|
||||
private $nlz;
|
||||
private $nlz_detail;
|
||||
private $transfer_plushours;
|
||||
private $transfer_overtime;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
|
||||
@@ -97,14 +97,26 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
}
|
||||
}
|
||||
$plushours = $r->plushours;
|
||||
$plushours = str_replace(',', '.', $plushours);
|
||||
if (is_numeric($plushours)) {
|
||||
$plushours = $plushours * 3600;
|
||||
if ($plushours) {
|
||||
$plushours = str_replace(',', '.', $plushours);
|
||||
if (is_numeric($plushours)) {
|
||||
$plushours = $plushours * 3600;
|
||||
} else {
|
||||
$plushours = 0;
|
||||
}
|
||||
} else {
|
||||
$plushours = 0;
|
||||
}
|
||||
$overtime = $r->overtime;
|
||||
$overtime = str_replace(',', '.', $overtime);
|
||||
if (is_numeric($overtime)) {
|
||||
$overtime = $overtime * 3600;
|
||||
if ($overtime) {
|
||||
$overtime = str_replace(',', '.', $overtime);
|
||||
if (is_numeric($overtime)) {
|
||||
$overtime = $overtime * 3600;
|
||||
} else {
|
||||
$overtime = 0;
|
||||
}
|
||||
} else {
|
||||
$overtime = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +131,9 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['bmd_active'] = trim($r->bmd_active);
|
||||
$data['overtime'] = $overtime;
|
||||
|
||||
|
||||
if (!$data['holidays']) {
|
||||
$data['holidays'] = 0;
|
||||
}
|
||||
if ($r->bpahours) {
|
||||
$bpahours = $r->bpahours;
|
||||
$bpahours = str_replace(',', '.', $bpahours);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class TimerecordingReportController extends mfBaseController
|
||||
{
|
||||
|
||||
private $holidays ;
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
@@ -14,6 +14,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
if (!$me->is(["employee"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
$this->holidays=TimerecordingHolidayModel::getAll();
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
@@ -36,7 +37,6 @@ class TimerecordingReportController extends mfBaseController
|
||||
$dataweek = $this->request->dataweek;
|
||||
$datamonth = $this->request->datamonth;
|
||||
$datayear = $this->request->datayear;
|
||||
|
||||
$data = [];
|
||||
|
||||
switch ($do) {
|
||||
@@ -74,7 +74,6 @@ class TimerecordingReportController extends mfBaseController
|
||||
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::getAll();
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
foreach ($workinghours as $workinghour) {
|
||||
|
||||
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
|
||||
@@ -85,7 +84,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$workingHours[$workinghour->user_id][$workinghour->day] = $workingHours[$workinghour->user_id][$workinghour->day] + $whend - $whstart;
|
||||
}
|
||||
}
|
||||
foreach ($holidays as $holiday) {
|
||||
foreach ($this->holidays as $holiday) {
|
||||
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
|
||||
}
|
||||
|
||||
@@ -397,8 +396,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$O100end = strtotime(date('Y-m-d', $start) . " 06:00:00");
|
||||
$O100start = strtotime(date('Y-m-d', $start) . " 22:00:00");
|
||||
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
foreach ($holidays as $holiday) {
|
||||
|
||||
foreach ($this->holidays as $holiday) {
|
||||
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
|
||||
}
|
||||
$start = $timerecording->start;
|
||||
@@ -417,29 +416,31 @@ class TimerecordingReportController extends mfBaseController
|
||||
if ($end >= $O100start) {
|
||||
$O100free = $O100free + $end - $O100start;
|
||||
}
|
||||
if (date('w', $start) == 6) {
|
||||
if ($sum != $O100free) {
|
||||
$O50free = $O50free + $sum - $O100free;
|
||||
}
|
||||
}
|
||||
//sind nun Mehrstunden
|
||||
// if (date('w', $start) == 6) {
|
||||
// if ($sum != $O100free) {
|
||||
// $O50free = $O50free + $sum - $O100free;
|
||||
// }
|
||||
// }
|
||||
|
||||
} else {
|
||||
if ($start < $O100end) {
|
||||
$O100pfl = $O100pfl + $O100end - $start;
|
||||
}
|
||||
if ($end >= $O100start) {
|
||||
$O100pfl = $O100pfl + $end - $O100start;
|
||||
}
|
||||
if (date('w', $start) == 6) {
|
||||
if ($sum != $O100free) {
|
||||
$O50free = $O50free + $sum - $O100free;
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// if ($start < $O100end) {
|
||||
// $O100pfl = $O100pfl + $O100end - $start;
|
||||
// }
|
||||
// if ($end >= $O100start) {
|
||||
// $O100pfl = $O100pfl + $end - $O100start;
|
||||
// }
|
||||
// if (date('w', $start) == 6) {
|
||||
// if ($sum != $O100free) {
|
||||
// $O50free = $O50free + $sum - $O100free;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
if (date('w', $start) == 6) {
|
||||
$O50free = $O50free + $end - $start;
|
||||
}
|
||||
// if (date('w', $start) == 6) {
|
||||
// $O50free = $O50free + $end - $start;
|
||||
// }
|
||||
}
|
||||
}
|
||||
$response['O100free'] = $O100free;
|
||||
@@ -482,7 +483,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$bpahours = $employee[0]->bpahours;
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $user_id]);
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
|
||||
foreach ($workinghours as $workinghour) {
|
||||
|
||||
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
|
||||
@@ -493,7 +494,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$workingHours[$workinghour->day] = $workingHours[$workinghour->day] + $whend - $whstart;
|
||||
}
|
||||
}
|
||||
foreach ($holidays as $holiday) {
|
||||
foreach ($this->holidays as $holiday) {
|
||||
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
|
||||
}
|
||||
|
||||
@@ -576,8 +577,13 @@ class TimerecordingReportController extends mfBaseController
|
||||
$dietsum = 0;
|
||||
$diet = 0;
|
||||
$dietbase = TimerecordingBillingModel::$dieatBase;
|
||||
|
||||
$O100free = 0;
|
||||
$O100pfl = 0;
|
||||
$O50free = 0;
|
||||
$O50pfl = 0;
|
||||
$Osum=0;
|
||||
foreach ($timerecordings as $timerecording):
|
||||
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
@@ -647,6 +653,11 @@ class TimerecordingReportController extends mfBaseController
|
||||
$overtimes = $this->checkOvertime($timerecording);
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
|
||||
$isSeconds = $isSeconds - $overtimes['sum'];
|
||||
$O100pfl = $O100pfl + $overtimes['O100pfl'];
|
||||
$O100free = $O100free + $overtimes['O100free'];
|
||||
$O50free = $O50free + $overtimes['O50free'];
|
||||
$O50pfl = $O50pfl + $overtimes['O50pfl'];
|
||||
$Osum=$Osum+$overtimes['sum'];
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 2 || ($timerecording->timerecordingCategory->hourday == 3 && $timerecording->end)) {
|
||||
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
|
||||
@@ -859,6 +870,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$json['time']['daysum'] = $daysum;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl,'Osum'=>$Osum];
|
||||
|
||||
if ($ajax == 1) {
|
||||
$json = json_encode($json);
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingBillingEmployeeAddFieldsBackups extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
|
||||
$table->addColumn("transfer_plushours", "integer", ["null" => false, "default" => 0, "after" => "nlz_detail"]);
|
||||
$table->addColumn("transfer_overtime", "integer", ["null" => false, "default" => 0, "after" => "transfer_plushours"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingBillingEmployee")->removeColumn("transfer_plushours")->save();
|
||||
$this->table("TimerecordingBillingEmployee")->removeColumn("transfer_overtime")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingBillingEmployeeAddFieldsPlushoursAll extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingBillingEmployee", ["signed" => true]);
|
||||
$table->addColumn("plushours_all", "integer", ["null" => false, "default" => 0, "after" => "ishourssum"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingBillingEmployee")->removeColumn("plushours_all")->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,13 @@ table = $('#datatable').DataTable({
|
||||
text: 'XLSX Export',
|
||||
className: 'btn-success margina d-none d-lg-block',
|
||||
exportOptions: {
|
||||
columns: ['th:not(:last-child)']
|
||||
columns: ['th:not(:last-child)'],
|
||||
format: {
|
||||
body: function (data, row, column, node) {
|
||||
data = $('<p>' + data + '</p>').text();
|
||||
return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
], columnDefs: [
|
||||
|
||||
Reference in New Issue
Block a user