Files
thetool/Layout/default/TimerecordingReport/Index.php
Spi 2f81e1d77e Zeiterfassung Update
* Berechnungen BP
 * Möglichkeit Mehrstunden in Gutstunden umzuwandeln
2024-05-07 10:24:30 +02:00

416 lines
19 KiB
PHP

<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
$daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
$monthger[1] = "Jänner";
$monthger[2] = "Februar";
$monthger[3] = "März";
$monthger[4] = "April";
$monthger[5] = "Mai";
$monthger[6] = "Juni";
$monthger[7] = "Juli";
$monthger[8] = "August";
$monthger[9] = "September";
$monthger[10] = "Oktober";
$monthger[11] = "November";
$monthger[12] = "Dezember";
$time = time();
foreach ($timerecordingusers as $timerecordinguser) {
$timerecordingUsers[$timerecordinguser->name] = $timerecordinguser->id;
}
ksort($timerecordingUsers);
for ($i = 1; $i <= 25; $i++) {
$kw = date('W', $time);
$year = date('Y', $time);
$timestamp_montag = strtotime("{$year}-W{$kw}");
$timestamp_freitag = strtotime("{$year}-W{$kw}-7");
$weeks[$time] = "KW" . $kw . " " . $year . " (" . date('d.m', $timestamp_montag) . "-" . date('d.m', $timestamp_freitag) . ")";
$time = $time - 604800;
}
$time = time();
for ($i = 1; $i <= 12; $i++) {
$mon = date('n', $time);
$year = date('Y', $time);
$month[$time] = $monthger[$mon] . " " . $year;
$time = strtotime('-1 month', $time);
}
$years[time() + 31536000] = date('Y', time() + 31536000);
$years[time()] = date('Y', time());
$years[time() - 31536000] = date('Y', time() - 31536000);
?>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<style>
.edit-button {
color: #007bff;
cursor: pointer;
}
.approved-open {
background-color: #fdb751 !important;
color: #000;
border-radius: 5px;
}
.approved-closed {
background-color: #96ff68 !important;
color: #000;
border-radius: 5px;
padding-top: 2px;
}
.fa-clock {
color: #ff9b00;
font-size: 15px;
}
.edit-placeholder {
height: 15px;
width: 27px;
display: inline-block;
}
.fa-trash {
cursor: pointer;
}
.text-bold {
font-weight: 500;
color: #000;
}
.text-normal {
color: #000;
}
.fixed-state {
background-color: #d0fbd9;
}
.form-check-label {
margin-top: 2px;
}
</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">Auswertungen/Korrekturen</li>
</ol>
</div>
<h4 class="page-title">Auswertungen/Korrekturen</h4>
</div>
</div>
</div>
<!-- end page title -->
<form class="form-horizontal" method="post"
action="<?= self::getUrl("Timerecording", "save") ?>">
<div class="card">
<div class="card-body">
<input id="id" type="hidden" name="id" value=""/>
<div class="form-row">
<div class="form-group col-lg-2">
<label class="col-form-label" for="user_id">Mitarbeiter</label>
<select id="user_id_select" name="user_id"
class="select2 form-control" required="required">
<?php foreach ($timerecordingUsers as $key => $timerecordingUser): ?>
<option value="<?= $timerecordingUser ?>"><?= $key ?></option>
<?php
endforeach; ?>
</select>
<input id="user_id_input" name="user_id" disabled="disabled" style="display:none">
</div>
<div class="form-group col-lg-2">
<label class="col-form-label" for="timerecordingCategory_id">Buchungsart</label>
<select id="timerecordingCategory_id" name="timerecordingCategory_id"
class="select2 form-control" required="required">
<?php foreach ($timerecordingCategoriess as $timerecordingCategories): ?>
<option value="<?= $timerecordingCategories->id ?>"
data-approval="<?= $timerecordingCategories->approval ?>"
data-comment="<?= $timerecordingCategories->require_comment ?>"
data-hourday="<?= $timerecordingCategories->hourday ?>"
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"
data-homeoffice="<?= ($timerecordingCategories->hourday == 1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
<?php
endforeach; ?>
</select>
</div>
<div class="form-group col-lg-1">
<label class="col-form-label" for="date">Datum</label>
<div class="form-row">
<div class="col">
<input type="date" id="date" name="date" class="form-control "
value="<?= date("Y-m-d", time()) ?>"
placeholder="<?= date("d.m.Y", time()); ?>" required="required"/>
</div>
</div>
</div>
<div id="enddate-div" class="form-group col-lg-1" style="display:none">
<label class="col-form-label" for="enddate">bis Datum</label>
<div class="form-row">
<div class="col">
<input type="date" id="enddate" name="enddate" class="form-control "
value=""
placeholder=""/>
</div>
</div>
</div>
<div id="endtime-div" class="col-lg-2">
<div class="form-row">
<div class="form-group col">
<label class=" col-form-label" for="start">Von</label>
<input type="time" id="start" name="start" class="form-control "
value="08:00" placeholder="07:00" required="required"/>
</div>
<div class="form-group col">
<label class=" col-form-label" for="end">Bis</label>
<input type="time" id="end" name="end" class="form-control "
value="15:00" min="08:00" placeholder="15:00" required="required"/>
</div>
</div>
</div>
<div id="days-div" class="col-lg-1" style="display:none">
<div class="form-row">
<div class="form-group col">
<label class=" col-form-label" for="days">Anzahl Tage</label>
<input type="number" id="days" name="days" class="form-control "
placeholder=""/>
</div>
</div>
</div>
<div class="form-group col-lg-2">
<label class="col-form-label" for="comment">Anmerkung</label>
<input type="text" id="comment" name="comment" class="form-control">
</div>
<div class="form-group col-lg-2" id="div-calc-overtime" style="display:none">
<label class="col-form-label mobile-hide" for="comment">&nbsp;</label>
<div class=" d-block" style="padding: 0.45rem 0.9rem;" id="calc-overtime"></div>
</div>
</div>
<div class="row">
<div class="col-lg-1 mb-2" id="homeoffice-div">
<div class="form-check text-center mt-1">
<input class="form-check-input" type="checkbox" name="homeoffice"
id="homeoffice" value="1">
<label class="form-check-label" for="homeoffice">
Homeoffice
</label>
</div>
</div>
<div class="col-lg-2 mb-2 businesstrip-div businesstrip-check-div ">
<div class="form-check text-center mt-1">
<input class="form-check-input" type="checkbox" name="businesstrip"
id="businesstrip" value="1">
<label class="form-check-label" for="businesstrip">
Dienstreise > 12KM
</label>
</div>
</div>
<div class="col-lg-2 businesstrip-div">
<input style="display:none" type="text" id="businesstrip_info" name="businesstrip_info"
placeholder="Ort"
class="form-control"/>
</div>
<div class="col-lg-2 car-div car-div-car" style="display:none">
<select id="timerecordingCar_id" name="timerecordingCar_id"
class="select2 form-control">
<option value="">Auto auswählen</option>
<?php foreach ($timerecordingCars as $timerecordingCar): ?>
<option value="<?= $timerecordingCar->id ?>"
data-mileagenow="<?= $timerecordingCar->mileage_now ?>"><?= $timerecordingCar->number_plate . " (" . $timerecordingCar->brand." ".$timerecordingCar->model . ")" ?></option>
</option>
<?php
endforeach; ?>
</select>
</div>
<div class="col-lg-1 car-div " style="display:none">
<input style="" type="number" id="mileage_start" name="mileage_start"
placeholder="KM Start"
class="form-control"/>
</div>
<div class="col-lg-1 car-div" style="display:none">
<input style="" type="number" id="mileage_end" name="mileage_end"
placeholder="KM Ende"
class="form-control"/>
</div>
</div>
<div class=" row mt-2">
<div class="col-lg-2 ">
<button id="submit-button" type="submit" class="btn btn-primary">Speichern</button>
<button id="cancel-button" type="button" class="btn btn-secondary" style="display:none">
Abbrechen
</button>
</div>
</div>
</div>
<div class=" row mt-2">
<div class="col-lg-4" id="message-box">
</div>
</div>
</form>
</div>
<div class="card">
<div class="card-body mb-3">
<div class="form-group module-row row mb-3">
<div class="col-6 col-lg-1">
<label class="col-form-label label-calendar" for="lenght">Buchungszeitraum:</label>
</div>
<div class="col-6 col-lg-1 text-center">
<i class="fa-duotone fa-calendar-week display-calendar active-calendar" title="Kalenderwoche"
data-datatype="1"></i> <i class="fa-duotone fa-calendar-days display-calendar"
title="Kalendermonat" data-datatype="2"></i> <i title="Abwesenheiten"
class="fa-duotone fa-calendar-clock display-calendar"
data-datatype="3"></i>
</div>
<div class="col-lg-2">
<div class="form-row">
<div class="col" id="dataweek-col">
<div class="input-group">
<select id="dataweek" class="form-control select2">
<?php foreach ($weeks as $key => $week): ?>
<option value="<?= $key ?>"><?= $week ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="col" id="datamonth-col" style="display:none">
<div class="input-group">
<select id="datamonth" class="form-control select2">
<?php foreach ($month as $key => $Month): ?>
<option value="<?= $key ?>"><?= $Month ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="col" id="datayear-col" style="display:none">
<div class="input-group">
<select id="datayear" class="form-control select2">
<?php foreach ($years as $key => $Year): ?>
<option <?= (date('Y', time()) == $Year) ? "selected='selected'" : NULL ?>
value="<?= $key ?>"><?= $Year ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</div>
<div id="dynamictime-div" class="col-lg-3">
<div class="form-row">
<div class="col text-center">
<div class="input-group ">
<label class="col-form-label form-control"><span
class="text-bold">Sollzeit: </span><span id="must-time"
class="ml-1 text-normal"></span></label>
</div>
</div>
<div class="col text-center">
<div class="input-group ">
<label class="col-form-label form-control"><span class="text-bold">Istzeit: </span><span
id="is-time"
class="ml-1 text-normal"></span></label>
</div>
</div>
</div>
</div>
<!-- <div class="col-lg-3">-->
<!-- <div class="form-row">-->
<!-- <div class="col text-center">-->
<!-- <div class="input-group ">-->
<!-- <label class="col-form-label form-control fixed-state"><span-->
<!-- class="text-bold">Urlaubstage: </span><span id="holidays"-->
<!-- class="ml-1 text-normal"></span></label>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="col text-center">-->
<!-- <div class="input-group ">-->
<!-- <label class="col-form-label form-control fixed-state"><span-->
<!-- class="text-bold">Gutzeit: </span><span-->
<!-- id="plushours"-->
<!-- class="ml-1 text-normal"></span></label>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<table id="datatable" class="table table-hover table-sm">
<thead>
<tr>
<th style="min-width: 250px;" class="text-center text-nowrap ">Mitarbeiter</th>
<th style="width: 200px;" class="text-center text-nowrap ">Datum</th>
<th class="text-nowrap edit-width text-center">Von</th>
<th class="text-nowrap edit-width text-center">Bis</th>
<th class="text-nowrap edit-width text-center">Summe</th>
<th class="text-center text-nowrap">Buchungsart</th>
<th class="text-center">Anmerkung</th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [2, 3, 4, 7];
var pageLength = 100;
let insertUrl = "<?= self::getUrl("Timerecording", "save") ?>";
let deleteUrl = "<?= self::getUrl("Timerecording", "delete") ?>";
let requestUrl = "<?= self::getUrl("TimerecordingReport", "api", ['do' => 'getTimerecordings']) ?>";
let requestTimesUrl = "<?= self::getUrl("TimerecordingReport", "api", ['do' => 'getTimerecordingsTimes']) ?>";
let checkWorkinghoursUrl = "<?= self::getUrl("Timerecording", "api", ['do' => 'checkWorkinghours']) ?>";
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>js/pages/timerecordingReport/index.js?<?= $git_merge_ts ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>