Zeiterfassung
Neue Features: * BP Stunden Aufbuchen/Mindern * Spezialbuchungen ohne Verechnungstechnische relevanz
This commit is contained in:
@@ -55,9 +55,13 @@
|
||||
<label class="col-lg-2 col-form-label" for="hourday">Buchungszeitraum</label>
|
||||
<div class="col-lg-2">
|
||||
<select id="hourday" name="hourday" class="select2 form-control">
|
||||
<?php foreach ($timerecordingcategorieshourday as $key => $value) : ?>
|
||||
<option value="<?= $key ?>" <?= ($key == $timerecordingcategoriess->hourday) ? "selected='selected'" : "" ?>><?= $value ?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($timerecordingcategorieshourday as $key => $value) :
|
||||
if (($me->superexpertEnabled() && $key == 8) || $key!= 8):
|
||||
?>
|
||||
<option value="<?= $key ?>" <?= ($key == $timerecordingcategoriess->hourday) ? "selected='selected'" : "" ?>><?= $value ?></option>
|
||||
<?php
|
||||
endif;
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -59,7 +59,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingcategoriess as $timerecordingcategories): ?>
|
||||
<?php foreach ($timerecordingcategoriess as $timerecordingcategories):
|
||||
if (($me->superexpertEnabled() && $timerecordingcategories->hourday==8) || $timerecordingcategories->hourday!=8):
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $timerecordingcategories->name ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategories->short ?></td>
|
||||
@@ -76,7 +78,9 @@
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
endif;
|
||||
endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ $daysSelect .= "</select>";
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="user_id">Mitarbeiter *</label>
|
||||
<div class="col-lg-3">
|
||||
@@ -146,7 +147,7 @@ $daysSelect .= "</select>";
|
||||
<div class="form-group row" style="display:none">
|
||||
<label class="col-lg-2 col-form-label" for="holidays">Initiale Urlaubstage</label>
|
||||
<div class="col-lg-1">
|
||||
<input type="number" id="holidays" name="holidays"
|
||||
<input type="number" id="holidays" name="holidays"
|
||||
class="form-control"
|
||||
value="<?= $timerecordingemployees->holidays ?>"/>
|
||||
</div>
|
||||
@@ -191,6 +192,19 @@ $daysSelect .= "</select>";
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="bmd_active">Nur im Admin-Mode sichtbar</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="only_admin"
|
||||
class="form-check-input" <?php if ($timerecordingemployees->only_admin) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="only_admin" value="1"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="workinghours_div">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="workinghours">Sollzeiten
|
||||
|
||||
@@ -5,7 +5,8 @@ $type[3] = "Lehrling";
|
||||
?>
|
||||
<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"
|
||||
<link href="<?= self::getResourcePath() ?>datatables/DataTables-2x/datatables.min.css?<?= $git_merge_ts ?>"
|
||||
rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
.border-dark {
|
||||
@@ -92,6 +93,9 @@ $type[3] = "Lehrling";
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingusers as $timerecordinguser):
|
||||
if ($timerecordingemployees[$timerecordinguser->id]['only_admin'] == 1 && !$me->superexpertEnabled()) {
|
||||
continue;
|
||||
}
|
||||
if ($timerecordingworkinghours) {
|
||||
$seconds = $timerecordingworkinghours[$timerecordinguser->id]['secondcounter'];
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
@@ -160,11 +164,11 @@ $type[3] = "Lehrling";
|
||||
src="<?= self::getResourcePath() ?>datatables/DataTables-2x/datatables.min.js?<?= $git_merge_ts ?>"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [ 6, 7, 8, 9, 10,13];
|
||||
var columnfilter = [0,11,12];
|
||||
var hidesearch = [6, 7, 8, 9, 10, 13];
|
||||
var columnfilter = [0, 11, 12];
|
||||
<?php if ($me->superexpertEnabled()): ?>
|
||||
var columnfilter = [0,12,13];
|
||||
hidesearch = [ 6, 7, 8, 9, 10, 11,14];
|
||||
var columnfilter = [0, 12, 13];
|
||||
hidesearch = [6, 7, 8, 9, 10, 11, 14];
|
||||
<?php endif; ?>
|
||||
|
||||
var columnoptions = '<option value=""></option><option value="Ja">Ja</option><option value="Nein">Nein</option>';
|
||||
|
||||
@@ -15,6 +15,9 @@ $monthger[12] = "Dezember";
|
||||
$time = time();
|
||||
|
||||
foreach ($timerecordingusers as $timerecordinguser) {
|
||||
if ($timerecordingEmployees[$timerecordinguser->id] && $timerecordingEmployees[$timerecordinguser->id]['only_admin'] == 1 && !$me->superexpertEnabled()) {
|
||||
continue;
|
||||
}
|
||||
$timerecordingUsers[$timerecordinguser->name] = $timerecordinguser->id;
|
||||
}
|
||||
ksort($timerecordingUsers);
|
||||
@@ -30,6 +33,8 @@ for ($i = 1; $i <= 25; $i++) {
|
||||
}
|
||||
$time = time();
|
||||
$timenow = $time;
|
||||
|
||||
$time = strtotime('first day of this month', $time);
|
||||
$time = strtotime('+3 month', $time);
|
||||
for ($i = 1; $i <= 15; $i++) {
|
||||
$mon = date('n', $time);
|
||||
@@ -143,14 +148,18 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
<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
|
||||
<?php foreach ($timerecordingCategoriess as $timerecordingCategories):
|
||||
if (($me->superexpertEnabled() && $timerecordingCategories->hourday == 8) || $timerecordingCategories->hourday != 8):
|
||||
?>
|
||||
<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
|
||||
endif;
|
||||
|
||||
endforeach; ?>
|
||||
</select>
|
||||
|
||||
@@ -313,7 +322,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<div class="input-group">
|
||||
<select id="datamonth" class="form-control select2">
|
||||
<?php foreach ($month as $key => $Month): ?>
|
||||
<option <?= ($timenow == $key) ? 'selected="selected"' : '' ?>
|
||||
<option <?= (date("Y-m",$timenow) == date("Y-m",$key)) ? 'selected="selected"' : '' ?>
|
||||
value="<?= $key ?>"><?= $Month ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
@@ -263,6 +263,7 @@ class TimerecordingController extends mfBaseController
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
$oldbpseconds=0;
|
||||
$enddate = $r->enddate;
|
||||
$hourday = $r->hourday;
|
||||
|
||||
@@ -286,9 +287,12 @@ class TimerecordingController extends mfBaseController
|
||||
} else if ($hourday == 5) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
} else if ($hourday == 8) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = strtotime($r->date . " 23:59:00");
|
||||
}
|
||||
|
||||
if ($hourday != 5 && $hourday != 7) {
|
||||
if ($hourday != 5 && $hourday != 7 && $hourday != 8) {
|
||||
$result = $this->checkTimerecording($starttime, $endtime, $id);
|
||||
}
|
||||
if ($result['state'] == "error") {
|
||||
@@ -304,6 +308,7 @@ class TimerecordingController extends mfBaseController
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordings = new Timerecording($id);
|
||||
$oldbpseconds = $timerecordings->hours_bpa;
|
||||
if (!$timerecordings->id) {
|
||||
$this->layout()->setFlash("Buchungen nicht gefunden", "error");
|
||||
$this->redirect("Timerecording");
|
||||
@@ -326,7 +331,12 @@ class TimerecordingController extends mfBaseController
|
||||
$data['businesstrip'] = $r->businesstrip;
|
||||
$data['businesstrip_info'] = $r->businesstrip_info;
|
||||
$data['homeoffice'] = $r->homeoffice;
|
||||
$data['days'] = $r->days;
|
||||
if ($hourday == 8) {
|
||||
$data['days'] = 0;
|
||||
$data['hours_bpa'] = $r->days * 60 * 60;
|
||||
} else {
|
||||
$data['days'] = $r->days;
|
||||
}
|
||||
$data['timerecordingCar_id'] = $r->timerecordingCar_id;
|
||||
$data['mileage_start'] = $r->mileage_start;
|
||||
$data['mileage_end'] = $r->mileage_end;
|
||||
@@ -456,6 +466,9 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$this->updatePlushours($data['user_id']);
|
||||
TimerecordingCarModel::calcMileage();
|
||||
if ($data['hours_bpa']) {
|
||||
$this->updateBpHours($data['user_id'], $data['hours_bpa'], $oldbpseconds);
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
@@ -537,6 +550,21 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function updateBpHours($userid, $seconds, $oldseconds = 0)
|
||||
{
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
if (!$employee) {
|
||||
return;
|
||||
}
|
||||
$employee = $employee[0];
|
||||
$bpHours = $employee->bpahours;
|
||||
$employeeupdate = new TimerecordingEmployee($employee->id);
|
||||
$data = [];
|
||||
$data['bpahours'] = $bpHours + $seconds - $oldseconds;
|
||||
$employeeupdate->update($data);
|
||||
$employeeupdate->save();
|
||||
}
|
||||
|
||||
public function updatePlushours($userid, $enddate = null)
|
||||
{
|
||||
$employee = TimerecordingEmployeeModel::search(['user_id' => $userid]);
|
||||
@@ -957,7 +985,7 @@ class TimerecordingController extends mfBaseController
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
} else {
|
||||
} else if ($timerecording->timerecordingCategory->hourday != 8) {
|
||||
$rows[] = array(
|
||||
'date' => array('date' => $state . $day . " " . $date, 'order' => $orderdate),
|
||||
'start' => array('start' => $start, 'order' => $start),
|
||||
@@ -1102,10 +1130,14 @@ class TimerecordingController extends mfBaseController
|
||||
$id = $this->request->id;
|
||||
$timerecordings = new Timerecording($id);
|
||||
$userid = $timerecordings->user_id;
|
||||
$oldbpseconds = $timerecordings->hours_bpa;
|
||||
if (!$timerecordings->id || $timerecordings->id != $id) {
|
||||
$this->layout()->setFlash("Buchung nicht gefunden.", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
if ($timerecordings->timerecordingCategory->hourday == 8) {
|
||||
$this->updateBpHours($userid, 0, $oldbpseconds);
|
||||
}
|
||||
$timerecordings->delete();
|
||||
$this->updateHolidays($userid);
|
||||
$this->updatePlushours($userid);
|
||||
|
||||
@@ -7,6 +7,7 @@ class TimerecordingModel
|
||||
private $end;
|
||||
private $hours;
|
||||
private $hours_overtime;
|
||||
private $hours_bpa;
|
||||
private $days;
|
||||
private $timerecordingCategory_id;
|
||||
private $businesstrip;
|
||||
|
||||
@@ -10,7 +10,7 @@ class TimerecordingCategoryModel
|
||||
private $only_admin;
|
||||
private $businesstrip;
|
||||
private $unpaid;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)");
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)",8 => "BP Stunden (Anzahl Stunden)");
|
||||
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");
|
||||
|
||||
@@ -150,6 +150,13 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['bpahours_value'] = $bpahours_value;
|
||||
}
|
||||
}
|
||||
if ($this->me->superexpertEnabled()) {
|
||||
if ($r->only_admin) {
|
||||
$data['only_admin'] = $r->only_admin;
|
||||
} else {
|
||||
$data['only_admin'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$data['overtime']) {
|
||||
$data['overtime'] = 0;
|
||||
|
||||
@@ -20,6 +20,7 @@ class TimerecordingEmployeeModel
|
||||
private $enddate;
|
||||
private $bmd_active;
|
||||
private $jobbike;
|
||||
private $only_admin;
|
||||
private $birthday;
|
||||
public static $employeetypesbmd = array('1' => '1000', '2' => '1200', '3' => '1400');
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$this->layout()->setTemplate("TimerecordingReport/Index");
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$timerecordingEmployees = TimerecordingEmployeeModel::getAllArray();
|
||||
$this->layout()->set("timerecordingEmployees", $timerecordingEmployees);
|
||||
$timerecordingusers = UserModel::search(['employee' => 'true']);
|
||||
$this->layout()->set("timerecordingusers", $timerecordingusers);
|
||||
$timerecordings = TimerecordingModel::getAll();
|
||||
@@ -81,6 +83,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
$plusHours = $employee[0]->plushours;
|
||||
|
||||
}
|
||||
$employeeArray = TimerecordingEmployeeModel::getAllArray();
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::getAll();
|
||||
foreach ($workinghours as $workinghour) {
|
||||
|
||||
@@ -164,6 +167,9 @@ class TimerecordingReportController extends mfBaseController
|
||||
$timerecordings = TimerecordingModel::search($searchArray);
|
||||
$responsecount = count($timerecordings);
|
||||
foreach ($timerecordings as $timerecording):
|
||||
if ($employeeArray[$timerecording->user_id]['only_admin'] == 1 && !$this->me->superexpertEnabled()) {
|
||||
continue;
|
||||
}
|
||||
$hiderecording = 0;
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
@@ -310,6 +316,21 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 8) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
// $hoursbpa = number_format($timerecording->hours_bpa / 60 / 60, "2", ",", '');
|
||||
$hoursbpa = round($timerecording->hours_bpa / 60 / 60, 2);
|
||||
$hoursbpa = str_replace(".", ",", $hoursbpa);
|
||||
|
||||
if ($timerecording->hours_bpa > 0) {
|
||||
$sum = "+" . $hoursbpa . " St";
|
||||
} else {
|
||||
$sum = $hoursbpa . " St";
|
||||
}
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 6) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
@@ -363,6 +384,11 @@ class TimerecordingReportController extends mfBaseController
|
||||
|
||||
if ($timerecording->completed == 0):
|
||||
if ($timerecording->approved == 0) :
|
||||
$ddays = $timerecording->days;
|
||||
if ($timerecording->timerecordingCategory->hourday == 8) {
|
||||
$ddays = round($timerecording->hours_bpa / 60 / 60, 2);
|
||||
}
|
||||
|
||||
$edit = '<i class="far fa-edit edit-button" data-id="' . $timerecording->id . '"
|
||||
data-date="' . $datadate . '"
|
||||
data-category="' . $timerecording->timerecordingCategory->id . '"
|
||||
@@ -374,7 +400,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
data-businesstrip="' . $timerecording->businesstrip . '"
|
||||
data-businesstripinfo="' . $timerecording->businesstrip_info . '"
|
||||
data-homeoffice="' . $timerecording->homeoffice . '"
|
||||
data-days="' . $timerecording->days . '"
|
||||
data-days="' . $ddays . '"
|
||||
data-car="' . $timerecording->timerecordingCar_id . '"
|
||||
data-mileagestart="' . $timerecording->mileage_start . '"
|
||||
data-mileageend="' . $timerecording->mileage_end . '"
|
||||
@@ -384,9 +410,9 @@ class TimerecordingReportController extends mfBaseController
|
||||
endif;
|
||||
$edit .= '<i data-id="' . $timerecording->id . '" class="fas fa-trash text-danger delete-item" ></i>';
|
||||
endif;
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5 || $timerecording->timerecordingCategory->hourday == 8)) {
|
||||
} else if ($hiderecording == 1) {
|
||||
} else {
|
||||
} else if (($timerecording->timerecordingCategory->hourday == 8 && $this->me->superexpertEnabled()) || $timerecording->timerecordingCategory->hourday != 8) {
|
||||
if (!$enddatecend) {
|
||||
$enddatecend = $enddate;
|
||||
}
|
||||
|
||||
@@ -308,6 +308,10 @@ $(document).ready(function () {
|
||||
$(this).val('');
|
||||
});
|
||||
$('#days-div').show();
|
||||
$('#days-div').find('label').text('Anzahl Tage');
|
||||
$('#days-div').find('input').attr("step", "1");
|
||||
$('#days-div').find('input').val("");
|
||||
|
||||
$('#days').prop("required", true);
|
||||
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 7) {
|
||||
@@ -326,6 +330,24 @@ $(document).ready(function () {
|
||||
$('#businesstrip_info').show();
|
||||
$('.car-div-car').show();
|
||||
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 8) {
|
||||
$("#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-div').find('label').text('Anzahl Stunden');
|
||||
$('#days-div').find('input').attr("step", "0.01");
|
||||
$('#days').prop("required", true);
|
||||
$('#days-div').find('input').val("");
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#comment').prop("required", true);
|
||||
|
||||
Reference in New Issue
Block a user