Files
thetool/Layout/default/TimerecordingBilling/DetailClosed.php
Daniel Spitzer b81ea45823 Zeiterfassung Feature Updates
* Reports wurde um Soll/Ist Detail Auswertung erweitert
* Nachtzulage wird nun auch in der Verrechnungsübersicht angezeigt
* M25,Ü50,Ü100 werden nun in Stichtagsauswertung mit berechnet
* Bei der offenen Arbeitstage Auswertung wird nun die Arbeitszeitverschiebung rausgerechnet
2026-02-13 08:39:15 +01:00

518 lines
29 KiB
PHP

<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= $git_merge_ts ?>" rel="stylesheet"
type="text/css"/>
<link href="<?= self::getResourcePath() ?>datatables/DataTables-2x/datatables.min.css?<?= $git_merge_ts ?>"
rel="stylesheet"
type="text/css"/>
<style>
.fa-arrow-right-from-bracket {
margin-top: 3px;
margin-right: 10px;
color: #2238d1;
cursor: pointer;
}
.fa-arrow-to-left {
color: #d12222;
cursor: pointer;
font-size: 16px;
position: absolute;
top: 10px;
left: 7px;
}
.fa-arrow-from-left {
color: #2238d1;
cursor: pointer;
font-size: 16px;
position: absolute;
top: 10px;
right: 10px;
}
.filler {
width: 30px;
height: 1px;
}
.filler-left {
display: inline-block;
margin-right: 0px;
}
.filler-0 {
width: 7px;
height: 1px;
}
.filler-1 {
width: 10px;
height: 1px;
}
.min-w-70 {
min-width: 70px;
}
.min-w-100 {
min-width: 100px;
}
#overtimeModal .table td, #overtimeModal .table th {
border: none;
}
@media (min-width: 992px) {
.modal-lg, .modal-xl {
max-width: 400px !important;
}
}
.sm-text-left {
font-size: 12px;
margin-left: 5px;
position: absolute;
top: 21px;
right: 30px;
color: #008b0b;
}
.sm-text-right-ot {
font-size: 12px;
margin-left: 5px;
position: absolute;
top: 18px;
right: 30px;
color: #008b0b;
}
.sm-text-right {
font-size: 12px;
margin-left: 5px;
position: absolute;
top: 21px;
right: 30px;
color: #f1556c;
}
</style>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">Zeiterfassung Verrechnung</li>
</ol>
</div>
<h4 id="month" data-month="<?= $month ?>" class="page-title">Verrechnung/Abrechnung <?= $month ?></h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12" id="page-header">
<div class="float-left">
<h4 class="header-title">Liste aller Mitarbeiter</h4>
</div>
</div>
</div>
<table id="datatable" class="table table-hover table-sm">
<thead>
<tr class="bg-white">
<th class="text-center">Mitarbeiter/PersNr.</th>
<th class="text-center">LZ</th>
<th class="text-center">NLZ</th>
<th class="text-center">NLZ+LZ</th>
<th class="text-center">Sollst.</th>
<th class="text-center">Sollabweichung</th>
<th class="text-center min-w-100">Mehrst.</th>
<th class="text-center min-w-100" title="Gesamte Gutstunden">Gutstunden</th>
<?php if ($me->superexpertEnabled()): ?>
<th class="text-center min-w-70">Black P. St.</th>
<?php endif; ?>
<th title="Mehrstunden 25%" class="text-center min-w-70">M25</th>
<th title="Überstunden 50%" class="text-center min-w-70">Ü50</th>
<th title="Überstunden 100%" class="text-center min-w-70">Ü100</th>
<th title="Nachtzulage" class="text-center min-w-70">NZ</th>
<th class="text-center">Diäten</th>
<th class="text-center" title="Homeoffice">HO</th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<?php if ($me->superexpertEnabled()): ?>
<th></th>
<?php endif; ?>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($timerecordings as $timerecording):
$user = new User($timerecording->timerecordingEmployee->user->id);
$employee_number = (string)$user->getFlag('employee_number');
unset ($nlz);
if ($timerecording->nlz) {
$nlz_details = json_decode($timerecording->nlz, true);
foreach ($nlz_details as $key => $nlz_detail) {
if ($nlz_detail < 100) {
if ($nlz_detail > 0) {
$nlz .= $key . ": " . $nlz_detail . " Tag(e)<br>";
}
} else {
$nlz .= $key . ": " . round($nlz_detail / 3600, 2) . " Stunden<br>";
}
}
} else {
$nlz = "";
}
if ($timerecording->transfer_overtime > 0) {
$overtimeclass = "sm-text-right";
} else {
$overtimeclass = "sm-text-right-ot";
}
?>
<tr>
<td class="text-nowrap">(<?= $employee_number ?>) <?= $timerecording->timerecordingEmployee->user->name ?> <?= ($timerecording->jobbike == 1) ? '<div class="float-right"><i title="Jobrad" class="fa-sharp fa-regular fa-person-biking"></i></div>' : '' ?></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 data-order="<?= $timerecording->overtime_plushours ?>"
class="text-center overtimeplushours-td"
data-overtimeplushours="<?= number_format(round(($timerecording->overtime_plushours) / 3600, 2), "2", ",", ".") ?>"><?= number_format(round(($timerecording->ishourssum - $timerecording->musthours) / 3600, 2), "2", ",", ".") ?>
<span class="text-danger font-weight-500"><?= ($timerecording->overtime_plushours) ? "(" . number_format(round(($timerecording->overtime_plushours) / 3600, 2), "2", ",", ".") . ")" : '' ?></span>
</td>
<td data-order="<?= $timerecording->plushours_all ?>"
data-transfer="<?= round($timerecording->transfer_plushours / 3600, 2) ?>"
class="text-center transfer_plushours_info position-relative"><?= '<span class="filler-left">' . number_format(round($timerecording->plushours_all / 3600, 2), "2", ",", ".") ?></span><?= ($timerecording->plushours_all > 0) ? '<i class="fas fa-arrow-from-left change-difference" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->plushours_all / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '' ?><?= ($timerecording->transfer_plushours) ? '<span class="ignore-export sm-text-right ">' . round($timerecording->transfer_plushours * -1 / 3600, 2) . '</span>' : '' ?></td>
<td data-transfer="<?= round($timerecording->transfer_overtime / 3600, 2) ?>"
data-order="<?= $timerecording->timerecordingEmployee->overtime_now ?>"
class="text-center position-relative transfer_overtime_info"><?= '<span class="filler-left">' . number_format(round($timerecording->timerecordingEmployee->overtime_now / 3600, 2), "2", ",", ".") ?></span><?= ($timerecording->timerecordingEmployee->overtime_now > 0) ? '<i class="fas fa-arrow-from-left 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>' : '' ?><?= ($timerecording->transfer_overtime) ? '<span class=" ' . $overtimeclass . '">' . round($timerecording->transfer_overtime * -1 / 3600, 2) . '</span>' : '' ?></span></td>
<?php if ($me->superexpertEnabled()): ?>
<td data-order="<?= $timerecording->timerecordingEmployee->bpahours ?>"
class="text-center position-relative"><?= ($timerecording->transfer_bpahours * -1 > 0) ? '<i class="fas fa-arrow-to-left change-bpa" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->transfer_bpahours * -1 / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '' ?> <?= '<span class="filler-left">' . number_format(round($timerecording->timerecordingEmployee->bpahours / 3600, 2), "2", ",", ".") ?><?= ($timerecording->transfer_bpahours) ? '<span class="ignore-export sm-text-left">' . (round($timerecording->transfer_bpahours * -1 / 3600, 2)) . '</span>' : '' ?> </span></td>
<?php endif; ?>
<td data-order="<?= $timerecording->plushours25 ?>"
class="text-center position-relative "><?= ($timerecording->plushours25 > 0) ? '<i class="fas fa-arrow-to-left change-overtime-25" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->plushours25 / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '' ?> <?= '<span class="filler-left">' . number_format(round($timerecording->plushours25 / 3600, 2), "2", ",", ".") ?></span></td>
<td data-order="<?= $timerecording->overtime50free ?>"
class="text-center position-relative "><?= ($timerecording->overtime50free > 0) ? '<i class="fas fa-arrow-to-left change-overtime-50" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->overtime50free / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '' ?> <?= '<span class="filler-left">' . number_format(round($timerecording->overtime50free / 3600, 2), "2", ",", ".") ?></span></td>
<td data-order="<?= $timerecording->overtime100free ?>"
class="text-center position-relative "><?= ($timerecording->overtime100free > 0) ? '<i class="fas fa-arrow-to-left change-overtime-100" data-toggle="modal" data-target="#overtimeModal" data-hours="' . number_format(round($timerecording->overtime100free / 3600, 2), "2", ",", ".") . '" data-id="' . $timerecording->id . '"></i>' : '' ?> <?= '<span class="filler-left">' . number_format(round($timerecording->overtime100free / 3600, 2), "2", ",", ".") ?></span></td>
<td class="text-center"><?= number_format(round($timerecording->night_allowance / 3600, 2), "2", ",", ".") ?></td>
<td data-order="<?= $timerecording->diet ?>"
class="text-center"><?= number_format($timerecording->diet, 2, ',', '.') . " €" ?></td>
<td class="text-center"><?= $timerecording->homeoffice ?> T</td>
</tr>
<?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>
</div>
</div>
<div class="modal fade" id="overtimeModal" tabindex="-1" role="dialog"
aria-labelledby="overtimeModalInfoLabel"
aria-hidden="true" data-id="">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="overtimeModal-title"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<table class="table ">
<tr>
<td colspan="2" id="modal-user-info"></td>
</tr>
<tr id="overtimes">
</tr>
<tr class="transfer-tr transfer-tr tr-plushours" style="display: none">
<th class="text-nowrap align-middle">Mehrstunden <span class="info"></span></th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="plushours"
id="plushours"></td>
</tr>
<tr class="overtime-modal-div transfer-tr tr-overtimehours" style="display:none">
<th class="align-middle">Gutstunden <span class="info"></span></th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="overtimehours"
id="overtimehours"></td>
</tr>
<tr class="overtime-modal-div transfer-tr tr-plushours25" 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 class="transfer-tr tr-overtime50">
<th class="align-middle">Überstunden 50</th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="overtime50"
id="overtime50"></td>
</tr>
<tr class="transfer-tr tr-overtime100">
<th class="text-nowrap align-middle">Überstunden 100</th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="overtime100"
id="overtime100"></td>
</tr>
<?php if ($me->superexpertEnabled()): ?>
<tr class="transfer-tr tr-overtimebpa">
<th class="text-nowrap align-middle ">Blackpig</th>
<td><input type="number" step="any" class="form-control change-overtime-value"
name="overtimebpa"
id="overtimebpa"></td>
</tr>
<?php endif; ?>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button id="submit-button" data-type="" type="button" class="btn btn-primary" data-dismiss="modal">
Speichern
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen
</button>
</div>
</div>
</div>
</div>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>datatables/DataTables-2x/datatables.min.js?<?= $git_merge_ts ?>"></script>
<script type="text/javascript">
var hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
<?php if ($me->superexpertEnabled()): ?>
hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14];
<?php endif; ?>
var pageLength = 100;
var initc=3;
var adminc=0;
<?php if ($me->superexpertEnabled()): ?>
adminc=1;
<?php endif; ?>
$(document).ready(function () {
$('body').on('click', '#bmd-export', function () {
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexportclosed']) ?>&month=' + $('#month').data('month'), '_blank');
});
$('body').on('click', '#bmd-export-nlz', function () {
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexportnlzclosed']) ?>&month=' + $('#month').data('month'), '_blank');
});
$('body').on('click', '#month-complete', function () {
if (confirm('Monat wirklich abschließen?')) {
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'completemonth']) ?>", {
month: $.trim($('#month').data('month')),
ajax: 1
}).done(function (data) {
});
}
});
$('#overtimeModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
$('.change-overtime-value').val('');
$('.change-overtime-value').attr('max', '');
$('.info').text('');
$('.transfer-tr').hide();
if (button.hasClass('change-difference')) {
$('#overtimeModal-title').text('Mehrstunden Transfer');
$('#overtimeModal').data('id', button.data('id'));
var overtimeplushours = button.closest('tr').find('.overtimeplushours-td').data('overtimeplushours');
if (overtimeplushours != "0,00") {
var overtimeplushourstext = '<span class="text-danger font-weight-500 ml-1">(' + button.closest('tr').find('.overtimeplushours-td').data('overtimeplushours') + ')</span>';
} else {
var overtimeplushourstext = "";
}
$('#overtimes').html('<th>Mehrstunden:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + overtimeplushourstext + '</td>');
$('#submit-button').data('type', 'difference');
$('.tr-plushours25').show();
$('.tr-overtimehours').show();
$('.tr-overtimebpa').show();
$('.tr-overtime50').show();
$('.tr-overtime100').show();
} else 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'));
$('.tr-overtime50').show();
$('.tr-overtimebpa').show();
$('.tr-overtime100').show();
} else if (button.hasClass('change-overtime-25')) {
$('.tr-plushours').show();
$('.tr-plushours').find('.info').text('(' + button.closest('tr').find('.transfer_plushours_info').data('transfer') + ')');
$('.tr-overtimehours').show();
$('.tr-overtimehours').find('.info').text('(' + button.closest('tr').find('.transfer_overtime_info').data('transfer') + ')');
$('#plushours').attr('max', button.closest('tr').find('.transfer_plushours_info').data('transfer'));
$('#overtimehours').attr('max', button.closest('tr').find('.transfer_overtime_info').data('transfer'));
$('#overtimeModal-title').text('Mehrstunden 25% Transfer');
$('#overtimes').html('<th>Mehrst. 25%:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
$('#submit-button').data('type', 'plushours25');
$('#overtimeModal').data('id', button.data('id'));
} else if (button.hasClass('change-overtime-50')) {
$('.tr-plushours').show();
$('.tr-plushours').find('.info').text('(' + button.closest('tr').find('.transfer_plushours_info').data('transfer') + ')');
$('.tr-overtimehours').show();
$('.tr-overtimehours').find('.info').text('(' + button.closest('tr').find('.transfer_overtime_info').data('transfer') + ')');
$('#plushours').attr('max', button.closest('tr').find('.transfer_plushours_info').data('transfer'));
$('#overtimehours').attr('max', button.closest('tr').find('.transfer_overtime_info').data('transfer'));
$('#overtimeModal-title').text('Überstunden 50% Transfer');
$('#overtimes').html('<th>Überst. 50%:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
$('#submit-button').data('type', 'overtime50free');
$('#overtimeModal').data('id', button.data('id'));
} else if (button.hasClass('change-overtime-100')) {
$('.tr-plushours').show();
$('.tr-plushours').find('.info').text('(' + button.closest('tr').find('.transfer_plushours_info').data('transfer') + ')');
$('.tr-overtimehours').show();
$('.tr-overtimehours').find('.info').text('(' + button.closest('tr').find('.transfer_overtime_info').data('transfer') + ')');
$('#plushours').attr('max', button.closest('tr').find('.transfer_plushours_info').data('transfer'));
$('#overtimehours').attr('max', button.closest('tr').find('.transfer_overtime_info').data('transfer'));
$('#overtimeModal-title').text('Überstunden 100% Transfer');
$('#overtimes').html('<th>Überst.100%:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
$('#submit-button').data('type', 'overtime100free');
$('#overtimeModal').data('id', button.data('id'));
} else if (button.hasClass('change-bpa')) {
$('.tr-plushours').show();
$('.tr-plushours').find('.info').text('(' + button.closest('tr').find('.transfer_plushours_info').data('transfer') + ')');
$('.tr-overtimehours').show();
$('.tr-overtimehours').find('.info').text('(' + button.closest('tr').find('.transfer_overtime_info').data('transfer') + ')');
$('#plushours').attr('max', button.closest('tr').find('.transfer_plushours_info').data('transfer'));
$('#overtimehours').attr('max', button.closest('tr').find('.transfer_overtime_info').data('transfer'));
$('#overtimeModal-title').text('Black P. Transfer');
$('#overtimes').html('<th>Black P:</th> <td id="overtime-hours" data-hours="' + button.data('hours') + '">' + button.data('hours') + '</td>');
$('#submit-button').data('type', 'bpa');
$('#overtimeModal').data('id', button.data('id'));
}
console.log(button.closest('tr').find('.fa-person-biking').length);
$('#modal-user-info').html('<span class="font-weight-500 font-15">'+ button.closest('tr').find('td').eq(0).text()+'</span>');
if (button.closest('tr').find('.fa-person-biking').length) {
$('#modal-user-info').append('<div class="float-right font-15">'+button.closest('tr').find('.fa-person-biking').closest('div').html()+'</div>');
}
});
$('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 keyup ', '.change-overtime-value', function () {
//$('#overtime-hours').data('hours') to float
var difference = 0;
$(".change-overtime-value").each(function (index) {
//check if float
var value = $(this).val().replace(",", ".");
if ($(this).attr('max') != '') {
if (parseFloat(value) > parseFloat($(this).attr('max'))) {
$(this).val($(this).attr('max'));
}
}
if (isNaN(parseFloat(value))) {
} else {
difference += parseFloat(value);
}
});
var valdiff = difference - parseFloat($(this).val());
valdiff = Math.round(valdiff * 100) / 100;
var hours = $('#overtime-hours').data('hours').replace(",", ".");
if (parseFloat(hours) < difference) {
difference = difference - parseFloat(hours)
difference = Math.round(difference * 100) / 100;
if (valdiff == 0) {
$(this).val(hours);
} else if (valdiff == parseFloat(hours)) {
$(this).val('0');
} else {
var calc = Math.round((hours - valdiff) * 100) / 100
$(this).val(calc);
}
} else {
hours = hours.replace(",", ".");
}
});
$('body').on('click', '#submit-button', function () {
var id = $('#overtimeModal').data('id');
var plushours25 = $('#plushours25').val();
var plushours = $('#plushours').val();
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'),
plushours: plushours,
plushours25: plushours25,
overtimehours: overtimehours,
overtime50: overtime50,
overtime100: overtime100,
overtimebpa: overtimebpa,
ajax: 1
}).done(function (data) {
window.location.reload();
});
});
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std2.js?<?= $git_merge_ts ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>