325 lines
16 KiB
PHP
325 lines
16 KiB
PHP
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
|
|
|
?>
|
|
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
|
type="text/css"/>
|
|
<style>
|
|
.fa-arrow-right-from-bracket {
|
|
margin-top: 3px;
|
|
margin-right: 10px;
|
|
color: #2238d1;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.filler {
|
|
width: 30px;
|
|
height: 1px;
|
|
}
|
|
|
|
.filler-0 {
|
|
width: 7px;
|
|
height: 1px;
|
|
}
|
|
|
|
#overtimeModal .table td, #overtimeModal .table th {
|
|
border: none;
|
|
}
|
|
|
|
@media (min-width: 992px) {
|
|
.modal-lg, .modal-xl {
|
|
max-width: 400px !important;
|
|
}
|
|
}
|
|
|
|
</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">
|
|
<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>
|
|
<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">Sollstunden</th>
|
|
<th class="text-center">Sollabweichung</th>
|
|
<th class="text-center">Gesamt Überstunden</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 class="text-center">Diäten</th>
|
|
<th class="text-center">Homeoffice</th>
|
|
</tr>
|
|
<tr id="filterrow">
|
|
<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>
|
|
</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) {
|
|
$nlz .= $key . ": " . $nlz_detail . " Tag(e)<br>";
|
|
} else {
|
|
$nlz .= $key . ": " . round($nlz_detail / 3600, 2) . " Stunden<br>";
|
|
}
|
|
}
|
|
|
|
} else {
|
|
$nlz = "";
|
|
}
|
|
?>
|
|
<tr>
|
|
<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"><?= ($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->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>
|
|
<td class="text-center"><?= $timerecording->homeoffice ?> Tag(e)</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
</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">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<table class="table ">
|
|
<tr id="overtimes">
|
|
</tr>
|
|
<tr>
|
|
<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>
|
|
<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>
|
|
<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">
|
|
var hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
<?php if ($me->superexpertEnabled()): ?>
|
|
hidesearch = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
<?php endif; ?>
|
|
$(document).ready(function () {
|
|
// $('.buttons-excel').closest('div').append('<div ><button id="month-complete" class="btn btn-danger margina">Monats Abschluss</button></div>');
|
|
$('.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>');
|
|
|
|
$('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('shown.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>');
|
|
$('#submit-button').data('type', 'difference');
|
|
}
|
|
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'));
|
|
}
|
|
$('.change-overtime-value').val('');
|
|
});
|
|
$('body').on('change', '.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(",", ".");
|
|
// console.log(value);
|
|
if (isNaN(parseFloat(value))) {
|
|
|
|
} else {
|
|
difference += parseFloat(value);
|
|
}
|
|
});
|
|
var valdiff = difference - parseFloat($(this).val());
|
|
valdiff = Math.round(valdiff * 100) / 100;
|
|
console.log("valdif" + valdiff);
|
|
var hours = $('#overtime-hours').data('hours').replace(",", ".");
|
|
|
|
if (parseFloat(hours) < difference) {
|
|
difference = difference - parseFloat(hours)
|
|
difference = Math.round(difference * 100) / 100;
|
|
console.log(difference);
|
|
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 overtime50 = $('#overtime50').val();
|
|
var overtime100 = $('#overtime100').val();
|
|
var overtimebpa = $('#overtimebpa').val();
|
|
$.post("<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'saveovertime']) ?>", {
|
|
id: id,
|
|
type: $(this).data('type'),
|
|
overtime50: overtime50,
|
|
overtime100: overtime100,
|
|
overtimebpa: overtimebpa,
|
|
ajax: 1
|
|
}).done(function (data) {
|
|
window.location.reload();
|
|
|
|
});
|
|
});
|
|
//$.post(insertUrl, {
|
|
// id: $.trim($('#id').val()),
|
|
// timerecordingCategory_id: $.trim($('#timerecordingCategory_id').val()),
|
|
// date: $.trim($('#date').val()),
|
|
// enddate: $.trim($('#enddate').val()),
|
|
// start: $.trim($('#start').val()),
|
|
// end: $.trim($('#end').val()),
|
|
// comment: $.trim($('#comment').val()),
|
|
// businesstrip: businesstrip,
|
|
// businesstrip_info: $.trim($('#businesstrip_info').val()),
|
|
// timerecordingCar_id: $.trim($('#timerecordingCar_id').val()),
|
|
// mileage_start: $.trim($('#mileage_start').val()),
|
|
// mileage_end: $.trim($('#mileage_end').val()),
|
|
// homeoffice: homeoffice,
|
|
// hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
|
|
// ajax: 1
|
|
//}).done(function (data) {
|
|
// if (data.success) {
|
|
// window.location.href = '<?php //= self::getUrl("Timerecording") ?>//';
|
|
// } else {
|
|
// $('#error').html(data.error);
|
|
// }
|
|
//});
|
|
});
|
|
</script>
|
|
<script type="text/javascript"
|
|
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
|
|
|
|
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|