Merge branch 'spidev' into 'master'
Zeiterfassung Update See merge request fronk/thetool!276
This commit is contained in:
@@ -126,7 +126,9 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
data-approval="<?= $timerecordingCategories->approval ?>"
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"
|
||||
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"><?= $timerecordingCategories->name ?></option>
|
||||
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"
|
||||
data-homeoffice="<?= ($timerecordingCategories->hourday==1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
|
||||
</option>
|
||||
<?php
|
||||
endif;
|
||||
endforeach; ?>
|
||||
@@ -179,9 +181,19 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row" id="businesstrip-div">
|
||||
<div class="row" >
|
||||
<div class="col-lg-1 mb-2" id="homeoffice-div">
|
||||
|
||||
<div class="col-lg-2 mb-2">
|
||||
<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">
|
||||
|
||||
<div class="form-check text-center mt-1">
|
||||
<input class="form-check-input" type="checkbox" name="businesstrip"
|
||||
@@ -191,7 +203,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-2 businesstrip-div">
|
||||
<input style="display:none" type="text" id="businesstrip_info" name="businesstrip_info"
|
||||
placeholder="Ort"
|
||||
class="form-control"/>
|
||||
|
||||
@@ -223,16 +223,19 @@ $daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
}
|
||||
oldname = value.user.user;
|
||||
}
|
||||
holidays.push({
|
||||
id: cindex,
|
||||
backgroundColor: bgcolors[colorcount],
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: value.ccategory.ccategory + " " + value.user.user,
|
||||
description: value.ccategory.ccategory + " " + value.user.user
|
||||
});
|
||||
if (value.hourday.hourday!='5') {
|
||||
holidays.push({
|
||||
id: cindex,
|
||||
backgroundColor: bgcolors[colorcount],
|
||||
start: value.cstart.cstart,
|
||||
end: value.cend.cend,
|
||||
title: value.ccategory.ccategory + " " + value.user.user,
|
||||
description: value.ccategory.ccategory + " " + value.user.user
|
||||
});
|
||||
cindex++;
|
||||
}
|
||||
oldname = value.user.user;
|
||||
cindex++;
|
||||
|
||||
});
|
||||
|
||||
var initialLocaleCode = 'en';
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
<label class="col-lg-2 col-form-label" for="approval">Genehmigungspflichtig</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="approval" class="form-check-input" <?php if ($timerecordingcategoriess->approval) echo 'checked="checked"'; ?>
|
||||
<input id="approval"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->approval) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="approval" value="1" id="olt">
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,25 +76,30 @@
|
||||
Pflichtfeld</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="require_comment" class="form-check-input" <?php if ($timerecordingcategoriess->require_comment) echo 'checked="checked"'; ?>
|
||||
<input id="require_comment"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->require_comment) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="require_comment" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="businesstrip">Dienstreisemöglichkeit</label>
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="businesstrip">Dienstreisemöglichkeit</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="businesstrip" class="form-check-input" <?php if ($timerecordingcategoriess->businesstrip) echo 'checked="checked"'; ?>
|
||||
<input id="businesstrip"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->businesstrip) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="businesstrip" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="only_admin">Nur für Buchhaltung zu buchen</label>
|
||||
<label class="col-lg-2 col-form-label" for="only_admin">Nur für Buchhaltung zu
|
||||
buchen</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="only_admin" class="form-check-input" <?php if ($timerecordingcategoriess->only_admin) echo 'checked="checked"'; ?>
|
||||
<input id="only_admin"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->only_admin) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="only_admin" value="1">
|
||||
</div>
|
||||
</div>
|
||||
@@ -130,6 +136,15 @@
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll')
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$("body").on("change", "#hourday", function () {
|
||||
if ($(this).val() == 5) {
|
||||
$("#only_admin").prop("checked", true);
|
||||
} else {
|
||||
}
|
||||
});
|
||||
$("#hourday").change();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -5,6 +5,14 @@ $type[3] = "Lehrling";
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
.border-dark {
|
||||
border-color: #cbcbcb !important;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px dotted #adadad !important;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -71,6 +79,14 @@ $type[3] = "Lehrling";
|
||||
} else {
|
||||
$sum = "";
|
||||
}
|
||||
if ($timerecordingemployees[$timerecordinguser->id]['plushours_now'] < 0) {
|
||||
$plusHours = $timerecordingemployees[$timerecordinguser->id]['plushours_now'] * -1;
|
||||
$plusHours = "-" . sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
|
||||
} else {
|
||||
$plusHours = $timerecordingemployees[$timerecordinguser->id]['plushours_now'];
|
||||
$plusHours = sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
}
|
||||
?>
|
||||
|
||||
<tr>
|
||||
@@ -79,9 +95,10 @@ $type[3] = "Lehrling";
|
||||
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['startdate']) ? date("d.m.Y", $timerecordingemployees[$timerecordinguser->id]['startdate']) : "-" ?></td>
|
||||
<td class="text-center text-nowrap"><?= ($timerecordingworkinghours) ? $timerecordingworkinghours[$timerecordinguser->id]['datetimetext'] : "" ?></td>
|
||||
<td class="text-center"><?= $sum ?></td>
|
||||
<td class="text-center"><?= sprintf('%02d:%02d', ($timerecordingemployees[$timerecordinguser->id]['plushours_now']/ 3600),($timerecordingemployees[$timerecordinguser->id]['plushours_now']/ 60 % 60)) ?></td>
|
||||
<td class="text-center"><?= sprintf('%02d:%02d', ($timerecordingemployees[$timerecordinguser->id]['overtime_now']/ 3600),($timerecordingemployees[$timerecordinguser->id]['overtime_now']/ 60 % 60)) ?></td>
|
||||
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'].' Tage' : '' ?> </td>
|
||||
<td class="text-center"
|
||||
data-order="<?= ($timerecordingemployees[$timerecordinguser->id]['plushours_now']) ? $timerecordingemployees[$timerecordinguser->id]['plushours_now'] : 0 ?>"><?= $plusHours ?></td>
|
||||
<td class="text-center"><?= sprintf('%02d:%02d', floor($timerecordingemployees[$timerecordinguser->id]['overtime_now'] / 3600), floor($timerecordingemployees[$timerecordinguser->id]['overtime_now'] / 60 % 60)) ?></td>
|
||||
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['holidays_now']) ? $timerecordingemployees[$timerecordinguser->id]['holidays_now'] . ' Tage' : '' ?> </td>
|
||||
<td class="text-center"><?= ($timerecordingemployees[$timerecordinguser->id]['auto_workinghours'] == '1') ? 'Ja' : 'Nein' ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingEmployee", "edit", ['id' => $timerecordingemployees[$timerecordinguser->id]['id'], "userid" => $timerecordinguser->id]) ?>"><i
|
||||
@@ -100,7 +117,7 @@ $type[3] = "Lehrling";
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [3,4,5,6,7,9];
|
||||
var hidesearch = [3, 4, 5, 6, 7, 9];
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
@@ -92,7 +92,9 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
.fixed-state {
|
||||
background-color: #d0fbd9;
|
||||
}
|
||||
|
||||
.form-check-label {
|
||||
margin-top: 2px;
|
||||
}
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
@@ -140,7 +142,8 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
data-approval="<?= $timerecordingCategories->approval ?>"
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"
|
||||
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"><?= $timerecordingCategories->name ?></option>
|
||||
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"
|
||||
data-homeoffice="<?= ($timerecordingCategories->hourday == 1) ? 1 : 0 ?>"><?= $timerecordingCategories->name ?></option>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
</select>
|
||||
@@ -185,6 +188,16 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
</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"
|
||||
@@ -192,9 +205,18 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="businesstrip-div">
|
||||
<div class="row">
|
||||
<div class="col-lg-1 mb-2" id="homeoffice-div">
|
||||
|
||||
<div class="col-lg-2 mb-2">
|
||||
<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">
|
||||
|
||||
<div class="form-check text-center mt-1">
|
||||
<input class="form-check-input" type="checkbox" name="businesstrip"
|
||||
@@ -204,7 +226,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="col-lg-2 businesstrip-div">
|
||||
<input style="display:none" type="text" id="businesstrip_info" name="businesstrip_info"
|
||||
placeholder="Ort"
|
||||
class="form-control"/>
|
||||
@@ -316,7 +338,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<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="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>
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
<li class="has-submenu"><a href="#"><i class="far fa-fw fa-calendar-clock"></i>Zeiterfassung <div class="arrow-down"></div></a>
|
||||
<ul class="submenu">
|
||||
<li><a href="<?=self::getUrl("Timerecording")?>"><i class="far fa-fw fa-calendar text-info"></i> Buchungen</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingCalendar")?>"><i class="far fa-fw fa-calendar-days text-info"></i> Abwesenheitskalender</a></li>
|
||||
<?php if ($me->can('Fibu')): ?>
|
||||
<li><a href="<?=self::getUrl("TimerecordingPermit")?>"><i class="far fa-fw fa-calendar-check text-info"></i> Freigaben</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingCalendar")?>"><i class="far fa-fw fa-calendar-days text-info"></i> Abwesenheitskalender</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingReport")?>"><i class="far fa-fw fa-chart-pie text-info"></i> Auswertung/Korrektur</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingCategory")?>"><i class="far fa-fw fa-list text-info"></i> Buchungsarten</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingHoliday")?>"><i class="far fa-fw fa-umbrella-beach text-info"></i> Feiertage</a></li>
|
||||
|
||||
@@ -169,10 +169,14 @@ class TimerecordingController extends mfBaseController
|
||||
} else if ($hourday == 3) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = NULL;
|
||||
} else if ($hourday == 5) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
}
|
||||
|
||||
|
||||
$result = $this->checkTimerecording($starttime, $endtime, $id);
|
||||
if ($hourday != 5) {
|
||||
$result = $this->checkTimerecording($starttime, $endtime, $id);
|
||||
}
|
||||
if ($result['state'] == "error") {
|
||||
if ($r->ajax == 1) {
|
||||
echo json_encode($result);
|
||||
@@ -207,10 +211,18 @@ class TimerecordingController extends mfBaseController
|
||||
$data['comment'] = trim($r->comment);
|
||||
$data['businesstrip'] = $r->businesstrip;
|
||||
$data['businesstrip_info'] = $r->businesstrip_info;
|
||||
$data['homeoffice'] = $r->homeoffice;
|
||||
$data['days'] = $r->days;
|
||||
|
||||
if (!$data['businesstrip'] || $data['businesstrip'] == "false") {
|
||||
$data['businesstrip'] = 0;
|
||||
}
|
||||
if (!$data['homeoffice'] || $data['homeoffice'] == "false") {
|
||||
$data['homeoffice'] = 0;
|
||||
}
|
||||
if (!$data['days'] || $data['days'] == "false") {
|
||||
$data['days'] = 0;
|
||||
}
|
||||
if ($r->businesstrip == 1 && !$r->businesstrip_info) {
|
||||
$result['state'] = "error";
|
||||
$result['error'] = "Geschäftsreiseinformationen darf nicht leer sein";
|
||||
@@ -223,16 +235,36 @@ class TimerecordingController extends mfBaseController
|
||||
|
||||
|
||||
if (!$data['user_id']) {
|
||||
if ($r->ajax == 1) {
|
||||
$result['state'] = "error";
|
||||
$result['error'] = "Benutzer darf nicht leer sein";
|
||||
echo json_encode($result);
|
||||
die();
|
||||
}
|
||||
$this->layout()->setFlash("Benutzer darf nicht leer sein", "error");
|
||||
$this->redirect("Timerecording");
|
||||
|
||||
}
|
||||
if ($data['start'] < 1577833200) {
|
||||
if ($r->ajax == 1) {
|
||||
$result['state'] = "error";
|
||||
$result['error'] = "Ungültige Startzeit";
|
||||
echo json_encode($result);
|
||||
die();
|
||||
}
|
||||
$this->layout()->setFlash("Ungültige Startzeit", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
if ($data['end'] && $data['end'] < 1577833200) {
|
||||
if ($r->ajax == 1) {
|
||||
$result['state'] = "error";
|
||||
$result['error'] = "Ungültige Endzeit";
|
||||
echo json_encode($result);
|
||||
die();
|
||||
}
|
||||
$this->layout()->setFlash("Ungültige Endzeit", "error");
|
||||
$this->redirect("Timerecording");
|
||||
|
||||
}
|
||||
if (!$data['timerecordingCategory_id']) {
|
||||
$data['timerecordingCategory_id'] = NULL;
|
||||
@@ -290,7 +322,7 @@ class TimerecordingController extends mfBaseController
|
||||
$email->setTo(TT_TIMERECORDING_EMAIL);
|
||||
$email->send();
|
||||
}
|
||||
if ($data['timerecordingCategory_id'] == "3") {
|
||||
if ($data['timerecordingCategory_id'] == "3" || $timerecordingCategoriess[0]->hourday == "5") {
|
||||
$this->updateHolidays($data['user_id']);
|
||||
}
|
||||
$this->updatePlushours($data['user_id']);
|
||||
@@ -325,10 +357,12 @@ class TimerecordingController extends mfBaseController
|
||||
$realholiDay[date('Y-m-d', $realHoliday->timestamp)] = $realHoliday->timestamp;
|
||||
}
|
||||
if (!$holidays_timestamp) {
|
||||
$holidays_timestamp = $employee->startdate;
|
||||
//$holidays_timestamp = $employee->startdate;
|
||||
$holidays_timestamp = strtotime('2024-01-01 00:00:00');
|
||||
$holidays_now = $holidays;
|
||||
}
|
||||
$timerecordings = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'timerecordingCategory_id' => 3]);
|
||||
$timerecordingscorrections = TimerecordingModel::search(['user_id' => $userid, 'start' => $holidays_timestamp, 'days' => 1]);
|
||||
foreach ($timerecordings as $timerecording) {
|
||||
$daycounter = ($timerecording->end - $timerecording->start) / 86400;
|
||||
$daycounter = intval(round($daycounter, 0, PHP_ROUND_HALF_DOWN));
|
||||
@@ -359,6 +393,10 @@ class TimerecordingController extends mfBaseController
|
||||
$holidays_now--;
|
||||
}
|
||||
}
|
||||
foreach ($timerecordingscorrections as $timerecordingscorrection) {
|
||||
$holidays_now = $holidays_now + $timerecordingscorrection->days;
|
||||
}
|
||||
|
||||
if ($holidays_now != $employee->holidays_now) {
|
||||
$employeeupdate = new TimerecordingEmployee($employee->id);
|
||||
$data = [];
|
||||
@@ -369,7 +407,7 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
protected function updatePlushours($userid)
|
||||
public function updatePlushours($userid)
|
||||
{
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
if ($employee) {
|
||||
@@ -386,7 +424,7 @@ class TimerecordingController extends mfBaseController
|
||||
$endtime = strtotime($endtime . " 23:59:00");
|
||||
|
||||
if ($plushours_timestamp > 0) {
|
||||
$return = $this->getTimerecordingsApi(5, null, null, null, $plushours_timestamp, $endtime);
|
||||
$return = $this->getTimerecordingsApi(5, null, null, null, $plushours_timestamp, $endtime, $userid);
|
||||
$diffTime = $return['is'] - $return['must'];
|
||||
$plushours_now = $plushours_now + $diffTime;
|
||||
} else {
|
||||
@@ -402,22 +440,25 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
protected function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear, $startime = null, $endtime = null)
|
||||
protected function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear, $startime = null, $endtime = null, $userid = null)
|
||||
{
|
||||
$mustSeconds = 0;
|
||||
$isSeconds = 0;
|
||||
$holiDays = 0;
|
||||
$plusHours = 0;
|
||||
|
||||
$startdate = time();
|
||||
if (!$userid) {
|
||||
$userid = $this->me->id;
|
||||
}
|
||||
$rows = [];
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $this->me->id]);
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
if ($employee) {
|
||||
$holiDays = $employee[0]->holidays_now;
|
||||
$plusHours = $employee[0]->plushours_now;
|
||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||
|
||||
$startdate = $employee[0]->startdate;
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $this->me->id]);
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $userid]);
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
foreach ($workinghours as $workinghour) {
|
||||
|
||||
@@ -440,7 +481,7 @@ class TimerecordingController extends mfBaseController
|
||||
$timestamp_sonntag = strtotime("{$year}-W{$kw}-7");
|
||||
$firstdate = strtotime(date("Y-m-d", $timestamp_montag) . " 00:00:00");
|
||||
$lastdate = strtotime(date("Y-m-d", $timestamp_sonntag) . ' 23:59:59');
|
||||
$searchArray = ['user_id' => $this->me->id, 'start' => $timestamp_montag, 'end' => $lastdate];
|
||||
$searchArray = ['user_id' => $userid, 'start' => $timestamp_montag, 'end' => $lastdate];
|
||||
|
||||
$daycounter = '0';
|
||||
|
||||
@@ -448,7 +489,7 @@ class TimerecordingController extends mfBaseController
|
||||
for ($i = 1; $i <= 7; $i++) {
|
||||
$dDate = date('Y-m-d', $timestamp);
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate]) {
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
|
||||
@@ -459,13 +500,13 @@ class TimerecordingController extends mfBaseController
|
||||
$lastdate = strtotime(date("Y-m-t", $datamonth));
|
||||
$daycount = date("t", $datamonth);
|
||||
$lastdate = strtotime(date("Y-m-d", $lastdate) . ' 23:59:59');
|
||||
$searchArray = ['user_id' => $this->me->id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$searchArray = ['user_id' => $userid, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
for ($i = 1; $i <= $daycount; $i++) {
|
||||
$dDate = date('Y-m-d', $timestamp);
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate]) {
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
|
||||
@@ -478,7 +519,7 @@ class TimerecordingController extends mfBaseController
|
||||
$lastdate = strtotime(date("Y-12-31 23:59:59", $datayear));
|
||||
$daycount = date("t", $datamonth);
|
||||
$lastdate = strtotime(date("Y-m-d", $lastdate) . ' 23:59:59');
|
||||
$searchArray = ['user_id' => $this->me->id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$searchArray = ['user_id' => $userid, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
for ($i = 1; $i <= $daycount; $i++) {
|
||||
@@ -498,7 +539,7 @@ class TimerecordingController extends mfBaseController
|
||||
$timediff = $lastdate - $firstdate;
|
||||
$daycount = $timediff / 86400;
|
||||
$daycount = round($daycount, 0, PHP_ROUND_HALF_DOWN);
|
||||
$searchArray = ['user_id' => $this->me->id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$searchArray = ['user_id' => $userid, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
for ($i = 1; $i <= $daycount; $i++) {
|
||||
@@ -524,6 +565,7 @@ class TimerecordingController extends mfBaseController
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
|
||||
$day = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
@@ -538,6 +580,7 @@ class TimerecordingController extends mfBaseController
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
} 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);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$enddate = date("Y-m-d", $timerecording->end);
|
||||
@@ -557,10 +600,17 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$summcounter = 0;
|
||||
$savecounter = 0;
|
||||
$sumdays = 0;
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
$holidaycounter = $workingHours[date("w", $i)];
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
if ($holidaycounter) {
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;
|
||||
$sumdays++;
|
||||
}
|
||||
}
|
||||
if ($savecounter == 1000) {
|
||||
echo $savecounter;
|
||||
die();
|
||||
@@ -570,19 +620,28 @@ class TimerecordingController extends mfBaseController
|
||||
$seconds = $summcounter;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
|
||||
// $sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
if ($sumdays == 1 || $sumdays == 0) {
|
||||
$sum = $sumdays . " Tag";
|
||||
} else if ($sumdays > 1) {
|
||||
$sum = $sumdays . " Tage";
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 3 && !$timerecording->end) {
|
||||
$date = date("d.m.Y", $timerecording->start) . " - " . $daysgerm[date("w", time())] . " " . date("d.m.Y", time());;
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$enddatetemp = date("Y-m-d", time());
|
||||
$enddatetemp = strtotime($enddatetemp . " 23:59:59");
|
||||
$enddate = date("Y-m-d", $enddatetemp + 7200);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
if ($lastdate < $timerecording->end) {
|
||||
|
||||
if ($lastdate < time()) {
|
||||
$endtimecalc = $lastdate;
|
||||
} else {
|
||||
$endtimecalc = $timerecording->end;
|
||||
$endtimecalc = time();
|
||||
}
|
||||
$summcounter = 0;
|
||||
if ($firstdate > $timerecording->start) {
|
||||
$starttimecalc = $firstdate;
|
||||
} else {
|
||||
@@ -590,10 +649,14 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$summcounter = 0;
|
||||
$savecounter = 0;
|
||||
// echo $starttimecalc."<br>";
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
$holidaycounter = $workingHours[date("w", $i)];
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;
|
||||
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;;
|
||||
}
|
||||
if ($savecounter == 1000) {
|
||||
echo $savecounter;
|
||||
die();
|
||||
@@ -605,6 +668,24 @@ class TimerecordingController extends mfBaseController
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 5) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
if ($timerecording->days > 0) {
|
||||
if ($timerecording->days == 1) {
|
||||
$sum = "+" . $timerecording->days . " Tag";
|
||||
} else {
|
||||
$sum = "+" . $timerecording->days . " Tage";
|
||||
}
|
||||
} else {
|
||||
if ($timerecording->days == -1) {
|
||||
$sum = $timerecording->days . " Tag";
|
||||
} else {
|
||||
$sum = $timerecording->days . " Tage";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
@@ -614,7 +695,9 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$edit = "";
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-2'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->homeoffice == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
|
||||
} else {
|
||||
$category = $timerecording->timerecordingCategory->name;
|
||||
}
|
||||
@@ -634,6 +717,7 @@ class TimerecordingController extends mfBaseController
|
||||
data-comment="' . $timerecording->comment . '"
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
@@ -659,9 +743,10 @@ class TimerecordingController extends mfBaseController
|
||||
return $response;
|
||||
} else {
|
||||
if ($plusHours < 0) {
|
||||
$plusHoursMinutes = $plusHours * -1;
|
||||
$plusHours = $plusHours * -1;
|
||||
$plusHours = "-" . sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
} else {
|
||||
$plusHoursMinutes = $plusHours;
|
||||
$plusHours = sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
}
|
||||
|
||||
$json['success'] = true;
|
||||
@@ -669,7 +754,7 @@ class TimerecordingController extends mfBaseController
|
||||
$json['time']['is'] = sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
$json['time']['must'] = sprintf('%02dh:%02dm', floor($mustSeconds / 3600), floor($mustSeconds / 60 % 60));
|
||||
$json['time']['holidays'] = $holiDays;
|
||||
$json['time']['plushours'] = sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHoursMinutes / 60 % 60));
|
||||
$json['time']['plushours'] = $plusHours;
|
||||
$json['data'] = $rows;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
|
||||
@@ -5,9 +5,11 @@ class TimerecordingModel
|
||||
private $user_id;
|
||||
private $start;
|
||||
private $end;
|
||||
private $days;
|
||||
private $timerecordingCategory_id;
|
||||
private $businesstrip;
|
||||
private $businesstrip_info;
|
||||
private $homeoffice;
|
||||
private $comment;
|
||||
private $approved;
|
||||
private $completed;
|
||||
@@ -157,6 +159,13 @@ class TimerecordingModel
|
||||
$where .= " AND `start` >= $start AND `timerecordingCategory_id` = $timerecordingCategory_id ORDER by start ASC";
|
||||
}
|
||||
}
|
||||
if (array_key_exists("start", $filter) && array_key_exists("days", $filter)) {
|
||||
$days = $filter['days'];
|
||||
$start = $filter['start'];
|
||||
if ($days === 1) {
|
||||
$where .= " AND `start` >= $start AND `days` !=0 ORDER by start ASC";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists("starttime", $filter) && array_key_exists("endtime", $filter)) {
|
||||
@@ -164,10 +173,11 @@ class TimerecordingModel
|
||||
$endtime = $filter['endtime'];
|
||||
$id = $filter['id'];
|
||||
if (is_numeric($starttime) && is_numeric($endtime)) {
|
||||
$where .= " AND (((`start` <= $starttime AND `end` > $starttime ) OR (`start` > $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` <= $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` < $endtime AND `end` > $endtime) OR (`start` = $starttime AND `end` = $endtime )) OR ( `start` <= $starttime AND `end` IS NULL)) ORDER by user_id ASC";
|
||||
if ($id && is_numeric($id)) {
|
||||
$where .= " AND `id` != $id";
|
||||
}
|
||||
$where .= " AND (((`start` <= $starttime AND `end` > $starttime ) OR (`start` > $endtime AND `end` < $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` <= $endtime AND `end` <= $endtime) OR (`start` > $starttime AND `end` > $starttime AND `start` < $endtime AND `end` > $endtime) OR (`start` = $starttime AND `end` = $endtime )) OR ( `start` <= $starttime AND `end` IS NULL)) ORDER by user_id ASC";
|
||||
|
||||
//var_dump($where);exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class TimerecordingCalendarController extends mfBaseController
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
if (!$me->is(["employee"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class TimerecordingCategoryModel
|
||||
private $require_comment;
|
||||
private $only_admin;
|
||||
private $businesstrip;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum");
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage");
|
||||
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
@@ -103,6 +103,8 @@ class TimerecordingEmployeeWorkingHourModel
|
||||
$secondcounter = 0;
|
||||
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$dayHours[$data['user_id']][$data['day']][] = $data['start'] . " - " . $data['end'];
|
||||
|
||||
if ($olduser != $data['user_id']) {
|
||||
if ($counter > 0) {
|
||||
$secondcounter = 0;
|
||||
@@ -121,7 +123,6 @@ class TimerecordingEmployeeWorkingHourModel
|
||||
if (!$datetimetext) {
|
||||
$datetimetext = $daysshort[$data['day']];
|
||||
}
|
||||
echo $oldstart . $data['start'];
|
||||
if (($oldstart != $data['start'] || $oldend != $data['end']) && $oldend) {
|
||||
$datetimetext .= " - " . $daysshort[$oldday] . " " . $oldstart . " - " . $oldend;
|
||||
$datetimetext .= "<br> " . $daysshort[$data['day']];
|
||||
@@ -139,6 +140,51 @@ class TimerecordingEmployeeWorkingHourModel
|
||||
$datetimetext = TimerecordingEmployeeWorkingHourModel::cleardays($datetimetext);
|
||||
$items[$olduser]['datetimetext'] = $datetimetext;
|
||||
}
|
||||
foreach ($dayHours as $key => $dayHour) {
|
||||
foreach ($dayHour as $key2 => $dayHour2) {
|
||||
$dayhours[$key][$key2] = implode("<br>", $dayHour2);
|
||||
}
|
||||
}
|
||||
foreach ($dayhours as $key => $dayhour) {
|
||||
$oldday = false;
|
||||
$oldstring = false;
|
||||
$counter = 0;
|
||||
$oldkey = false;
|
||||
$oldkey2 = false;
|
||||
foreach ($dayhour as $key2 => $dayhour2) {
|
||||
if ($oldday != $key2) {
|
||||
if ($oldstring != $dayhour2 || $key2!=$oldkey2+1) {
|
||||
if ($oldkey2) {
|
||||
$daysitems[$key][$counter]['end'] = $oldkey2;
|
||||
$counter++;
|
||||
}
|
||||
$daysitems[$key][$counter]['start'] = $key2;
|
||||
}
|
||||
|
||||
$daysitems[$key][$counter]['string'] = $dayhour2;
|
||||
}
|
||||
$oldkey2 = $key2;
|
||||
$oldkey = $key;
|
||||
$oldstring = $dayhour2;
|
||||
|
||||
}
|
||||
$daysitems[$key][$counter]['end'] = $key2;
|
||||
|
||||
}
|
||||
|
||||
foreach ($daysitems as $key => $daysitem) {
|
||||
$datetimetext = "";
|
||||
foreach ($daysitem as $key2 => $daysItem) {
|
||||
if ($daysItem['start'] != $daysItem['end']) {
|
||||
$datetimetext .= '<div class="d-table border-bottom border-dark"><div class="d-table-cell w-50 align-middle pr-2 ">' . $daysshort[$daysItem['start']] . "-" . $daysshort[$daysItem['end']] . '</div><div class="d-table-cell">' . $daysItem['string'] . '</div></div>';
|
||||
} else {
|
||||
$datetimetext .= '<div class="d-table border-bottom border-dark"><div class="d-table-cell w-50 align-middle pr-2 ">' . $daysshort[$daysItem['start']] . '</div><div class="d-table-cell">' . $daysItem['string'] . '</div></div>';
|
||||
}
|
||||
}
|
||||
$items[$key]['datetimetext'] = $datetimetext;
|
||||
}
|
||||
|
||||
|
||||
return $items;
|
||||
|
||||
}
|
||||
@@ -153,7 +199,6 @@ class TimerecordingEmployeeWorkingHourModel
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingEmployeeWorkingHour", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
|
||||
@@ -11,7 +11,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
if (!$me->is(["employee"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
case "getTimerecordings":
|
||||
$return = $this->getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear);
|
||||
break;
|
||||
case "getTimerecordingsTimes":
|
||||
case "getTimerecordingsTimes":
|
||||
$return = $this->getTimerecordingsTimes($datatype, $dataweek, $datamonth, $datayear);
|
||||
break;
|
||||
default:
|
||||
@@ -103,7 +103,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$dDate = date('Y-m-d', $timestamp);
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate]) {
|
||||
// $mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
// $mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
|
||||
$timestamp = $timestamp + 86400;
|
||||
@@ -120,7 +120,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$dDate = date('Y-m-d', $timestamp);
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate]) {
|
||||
// $mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
// $mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
$timestamp = $timestamp + 86400;
|
||||
}
|
||||
@@ -189,11 +189,18 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
$summcounter = 0;
|
||||
$savecounter = 0;
|
||||
$sumdays = 0;
|
||||
// echo $starttimecalc."<br>";
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;;
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
if ($holidaycounter) {
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;
|
||||
$sumdays++;
|
||||
}
|
||||
}
|
||||
if ($savecounter == 1000) {
|
||||
echo $savecounter;
|
||||
die();
|
||||
@@ -203,7 +210,12 @@ class TimerecordingReportController extends mfBaseController
|
||||
$seconds = $summcounter;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
// $sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
if ($sumdays == 1 || $sumdays == 0) {
|
||||
$sum = $sumdays . " Tag";
|
||||
} else if ($sumdays > 1) {
|
||||
$sum = $sumdays . " Tage";
|
||||
}
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 3 && !$timerecording->end) {
|
||||
$date = date("d.m.Y", $timerecording->start) . " - " . $daysgerm[date("w", time())] . " " . date("d.m.Y", time());;
|
||||
@@ -231,8 +243,11 @@ class TimerecordingReportController extends mfBaseController
|
||||
// echo $starttimecalc."<br>";
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;;
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;;
|
||||
}
|
||||
if ($savecounter == 1000) {
|
||||
echo $savecounter;
|
||||
die();
|
||||
@@ -244,6 +259,25 @@ class TimerecordingReportController extends mfBaseController
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 5) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
if ($timerecording->days > 0) {
|
||||
if ($timerecording->days == 1) {
|
||||
$sum = "+" . $timerecording->days . " Tag";
|
||||
} else {
|
||||
$sum = "+" . $timerecording->days . " Tage";
|
||||
}
|
||||
} else {
|
||||
if ($timerecording->days == -1) {
|
||||
$sum = $timerecording->days . " Tag";
|
||||
} else {
|
||||
$sum = $timerecording->days . " Tage";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
@@ -254,6 +288,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$edit = "";
|
||||
if ($timerecording->businesstrip == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Dienstreise: " . $timerecording->businesstrip_info . ")</span>";
|
||||
} else if ($timerecording->homeoffice == 1) {
|
||||
$category = "<span>" . $timerecording->timerecordingCategory->name . "</span><span class='text-bold ml-1'> (Homeoffice)</span>";
|
||||
} else {
|
||||
$category = $timerecording->timerecordingCategory->name;
|
||||
}
|
||||
@@ -274,6 +310,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
data-userid="' . $timerecording->user_id . '"
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-days="' . $timerecording->days . '"
|
||||
title="Bearbeiten"></i>';
|
||||
else :
|
||||
$edit .= '<div class="edit-placeholder"></div>';
|
||||
@@ -294,6 +332,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
'category' => array('category' => $category, 'order' => $timerecording->timerecordingCategory->name),
|
||||
'comment' => array('comment' => $timerecording->comment, 'order' => $timerecording->comment),
|
||||
'edit' => array('edit' => $edit, 'order' => $edit),
|
||||
'hourday' => array('hourday' => $timerecording->timerecordingCategory->hourday, 'order' => $timerecording->timerecordingCategory->hourday),
|
||||
|
||||
);
|
||||
}
|
||||
endforeach;
|
||||
@@ -325,7 +365,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$holiDays = $employee[0]->holidays;
|
||||
$plusHours = $employee[0]->plushours;
|
||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||
|
||||
$startdate = $employee[0]->startdate;
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $r->user_id]);
|
||||
$holidays = TimerecordingHolidayModel::getAll();
|
||||
@@ -358,7 +398,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
for ($i = 1; $i <= 7; $i++) {
|
||||
$dDate = date('Y-m-d', $timestamp);
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate]) {
|
||||
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
|
||||
@@ -375,7 +416,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
for ($i = 1; $i <= $daycount; $i++) {
|
||||
$dDate = date('Y-m-d', $timestamp);
|
||||
$dDay = date('w', $timestamp);
|
||||
if (!$holiDay[$dDate]) {
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
|
||||
@@ -495,6 +536,12 @@ class TimerecordingReportController extends mfBaseController
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 5) {
|
||||
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$sum = $timerecording->days . " Tage";
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingAddFieldsHomeoffice extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Timerecording", ["signed" => true]);
|
||||
$table->addColumn("homeoffice", "integer", ["null" => false, "default" => '0', "after" => "businesstrip_info"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Timerecording")->removeColumn("homeoffice")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingAddFieldsDays extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Timerecording", ["signed" => true]);
|
||||
$table->addColumn("days", "integer", ["null" => false, "default" => '0', "after" => "end"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$this->table("Timerecording")->removeColumn("days")->save();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ table = $('#datatable').DataTable({
|
||||
_: "comment.comment",
|
||||
"sort": "comment.order"
|
||||
},
|
||||
className: "text-center"
|
||||
className: "text-left"
|
||||
}, {
|
||||
"data": {
|
||||
_: "edit.edit",
|
||||
@@ -224,16 +224,24 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
if (parseInt($(this).find(':selected').data('businesstrip')) === 1) {
|
||||
$('#businesstrip-div').show();
|
||||
$('.businesstrip-div').show();
|
||||
$('#businesstrip').prop("checked", false);
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').hide();
|
||||
} else {
|
||||
$('#businesstrip-div').hide();
|
||||
$('.businesstrip-div').hide();
|
||||
$('#businesstrip').prop("checked", false);
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').hide();
|
||||
}
|
||||
|
||||
if (parseInt($(this).find(':selected').data('homeoffice')) === 1) {
|
||||
$('#homeoffice-div').show();
|
||||
$('#homeoffice').prop("checked", false);
|
||||
} else {
|
||||
$('#homeoffice').prop("checked", false);
|
||||
$('#homeoffice-div').hide();
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#enddate-div').css('display') === "block") {
|
||||
@@ -269,6 +277,12 @@ $(document).ready(function () {
|
||||
$('#businesstrip_info').val($(this).data('businesstripinfo'));
|
||||
$('#businesstrip_info').show();
|
||||
$('#businesstrip_info').prop('required', true);
|
||||
$('#homeoffice-div').hide();
|
||||
}
|
||||
if ($(this).data('homeoffice') == 1) {
|
||||
$('.businesstrip-div').hide();
|
||||
$('#homeoffice').prop("checked", true);
|
||||
$('#homeoffice-div').show();
|
||||
}
|
||||
$('.alert-success').remove();
|
||||
window.scrollTo(0, 0);
|
||||
@@ -278,6 +292,12 @@ $(document).ready(function () {
|
||||
$('#submit-button').text('Speichern');
|
||||
$('#cancel-button').hide();
|
||||
$('#id').val('');
|
||||
$('.businesstrip-div').hide();
|
||||
$('#businesstrip').prop("checked", false);
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').hide();
|
||||
$('#homeoffice').prop("checked", false);
|
||||
$('#timerecordingCategory_id').change();
|
||||
});
|
||||
|
||||
$("body").on("change", "#dataweek,#datamonth,#datayear", function () {
|
||||
@@ -312,15 +332,33 @@ $(document).ready(function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$('#businesstrip_info').show();
|
||||
$('#businesstrip_info').prop('required', true);
|
||||
$('#homeoffice').prop('checked', false);
|
||||
$('#homeoffice-div').hide();
|
||||
|
||||
} else {
|
||||
$('#businesstrip_info').hide();
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').prop('required', false);
|
||||
$('#timerecordingCategory_id').change();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
$("body").on("click", "#homeoffice", function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$('#businesstrip').prop('checked', false);
|
||||
$('.businesstrip-div').hide();
|
||||
$('#businesstrip_info').hide();
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').prop('required', false);
|
||||
|
||||
} else {
|
||||
$('#timerecordingCategory_id').change();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$("body").on("click", "#auto-workinghours-button", function () {
|
||||
var timestamp = $('#dataweek').val() * 1000
|
||||
const date = new Date(timestamp);
|
||||
@@ -363,9 +401,13 @@ $(document).ready(function () {
|
||||
e.preventDefault();
|
||||
$('#alert-box').remove();
|
||||
var businesstrip = false;
|
||||
var homeoffice = false;
|
||||
if ($('#businesstrip').prop('checked') == true) {
|
||||
businesstrip = 1;
|
||||
}
|
||||
if ($('#homeoffice').prop('checked') == true) {
|
||||
homeoffice = 1;
|
||||
}
|
||||
$.post(insertUrl, {
|
||||
id: $.trim($('#id').val()),
|
||||
timerecordingCategory_id: $.trim($('#timerecordingCategory_id').val()),
|
||||
@@ -376,6 +418,7 @@ $(document).ready(function () {
|
||||
comment: $.trim($('#comment').val()),
|
||||
businesstrip: businesstrip,
|
||||
businesstrip_info: $.trim($('#businesstrip_info').val()),
|
||||
homeoffice: homeoffice,
|
||||
hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
|
||||
@@ -139,7 +139,7 @@ table = $('#datatable').DataTable({
|
||||
_: "comment.comment",
|
||||
"sort": "comment.order"
|
||||
},
|
||||
className: "text-center"
|
||||
className: "text-left"
|
||||
}, {
|
||||
"data": {
|
||||
_: "edit.edit",
|
||||
@@ -195,7 +195,9 @@ $(document).ready(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("min", $('#date').val());
|
||||
$(this).val($('#date').val());
|
||||
})
|
||||
});
|
||||
$('#days-div').hide();
|
||||
$('#days').prop("required", false);
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 1) {
|
||||
$("#endtime-div").show();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
@@ -207,7 +209,9 @@ $(document).ready(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
});
|
||||
$('#days-div').hide();
|
||||
$('#days').prop("required", false);
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 3 || parseInt($(this).find(':selected').data('hourday')) === 4) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
@@ -220,7 +224,25 @@ $(document).ready(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
});
|
||||
$('#days-div').hide();
|
||||
$('#days').prop("required", false);
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 5) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("disabled", true);
|
||||
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
});
|
||||
$('#days-div').show();
|
||||
$('#days').prop("required", true);
|
||||
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#comment').prop("required", true);
|
||||
@@ -229,16 +251,24 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
if (parseInt($(this).find(':selected').data('businesstrip')) === 1) {
|
||||
$('#businesstrip-div').show();
|
||||
$('.businesstrip-div').show();
|
||||
$('#businesstrip').prop("checked", false);
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').hide();
|
||||
} else {
|
||||
$('#businesstrip-div').hide();
|
||||
$('.businesstrip-div').hide();
|
||||
$('#businesstrip').prop("checked", false);
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').hide();
|
||||
}
|
||||
|
||||
if (parseInt($(this).find(':selected').data('homeoffice')) === 1) {
|
||||
$('#homeoffice-div').show();
|
||||
$('#homeoffice').prop("checked", false);
|
||||
} else {
|
||||
$('#homeoffice').prop("checked", false);
|
||||
$('#homeoffice-div').hide();
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#enddate-div').css('display') === "block") {
|
||||
@@ -273,6 +303,7 @@ $(document).ready(function () {
|
||||
$('#date').val($(this).data('date'));
|
||||
$('#start').val($(this).data('start'));
|
||||
$('#end').val($(this).data('end'));
|
||||
$('#days').val($(this).data('days'));
|
||||
$('#enddate').val($(this).data('enddate'));
|
||||
$('#comment').val($(this).data('comment'));
|
||||
if ($(this).data('businesstrip') == 1) {
|
||||
@@ -280,18 +311,31 @@ $(document).ready(function () {
|
||||
$('#businesstrip_info').val($(this).data('businesstripinfo'));
|
||||
$('#businesstrip_info').show();
|
||||
$('#businesstrip_info').prop('required', true);
|
||||
$('#homeoffice-div').hide();
|
||||
}
|
||||
if ($(this).data('homeoffice') == 1) {
|
||||
$('.businesstrip-div').hide();
|
||||
$('#homeoffice').prop("checked", true);
|
||||
$('#homeoffice-div').show();
|
||||
}
|
||||
$('.alert-success').remove();
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
$("body").on("click", "#cancel-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-danger').addClass('btn-primary').show();
|
||||
$('#submit-button').text('Speichern');
|
||||
$('#cancel-button').hide();
|
||||
$('#user_id_select').prop('disabled', false);
|
||||
$('#user_id_input').prop('disabled', true);
|
||||
$('#user_id_select').change();
|
||||
$('#timerecordingCategory_id').val($(this).data('category')).change();
|
||||
$('#timerecordingCategory_id').change();
|
||||
$('#id').val('');
|
||||
$('.businesstrip-div').hide();
|
||||
$('#businesstrip').prop("checked", false);
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').hide();
|
||||
$('#homeoffice').prop("checked", false);
|
||||
$('#timerecordingCategory_id').change();
|
||||
});
|
||||
|
||||
$("body").on("change", "#dataweek,#datamonth,#datayear", function () {
|
||||
@@ -355,11 +399,28 @@ $(document).ready(function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$('#businesstrip_info').show();
|
||||
$('#businesstrip_info').prop('required', true);
|
||||
$('#homeoffice').prop('checked', false);
|
||||
$('#homeoffice-div').hide();
|
||||
|
||||
} else {
|
||||
$('#businesstrip_info').hide();
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').prop('required', false);
|
||||
$('#timerecordingCategory_id').change();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
$("body").on("click", "#homeoffice", function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$('#businesstrip').prop('checked', false);
|
||||
$('.businesstrip-div').hide();
|
||||
$('#businesstrip_info').hide();
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').prop('required', false);
|
||||
|
||||
} else {
|
||||
$('#timerecordingCategory_id').change();
|
||||
}
|
||||
|
||||
|
||||
@@ -382,9 +443,13 @@ $(document).ready(function () {
|
||||
var userid;
|
||||
userid = $('#user_id_select').val();
|
||||
var businesstrip = false;
|
||||
var homeoffice = false;
|
||||
if ($('#businesstrip').prop('checked') == true) {
|
||||
businesstrip = 1;
|
||||
}
|
||||
if ($('#homeoffice').prop('checked') == true) {
|
||||
homeoffice = 1;
|
||||
}
|
||||
$.post(insertUrl, {
|
||||
id: $.trim($('#id').val()),
|
||||
user_id: userid,
|
||||
@@ -393,9 +458,11 @@ $(document).ready(function () {
|
||||
enddate: $.trim($('#enddate').val()),
|
||||
start: $.trim($('#start').val()),
|
||||
end: $.trim($('#end').val()),
|
||||
days: $.trim($('#days').val()),
|
||||
comment: $.trim($('#comment').val()),
|
||||
businesstrip: businesstrip,
|
||||
businesstrip_info: $.trim($('#businesstrip_info').val()),
|
||||
homeoffice: homeoffice,
|
||||
hourday: $.trim($('#timerecordingCategory_id').find(':selected').data('hourday')),
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
|
||||
Reference in New Issue
Block a user