Zeiterfassungs Update
* Implementerung Fahrzeugverwaltung * neue Buchungsart Fahrtenbuch * Diverse Bugfixes * Exportfunktionen für BMD * Neue Bauchungsarteigenschaft unbezahlt *
This commit is contained in:
122
Layout/default/TimerecordingBilling/Detail.php
Normal file
122
Layout/default/TimerecordingBilling/Detail.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- 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</th>
|
||||
<th class="text-center">Personal Nr.</th>
|
||||
<th class="text-center">Sollstunden</th>
|
||||
<th class="text-center">Iststunden</th>
|
||||
<th class="text-center">Sollabweichung</th>
|
||||
<th class="text-center">Akuelle Überstunden</th>
|
||||
<th class="text-center">Nichtleistungszeiten</th>
|
||||
<th class="text-center">Diäten</th>
|
||||
<th class="text-center">Homeoffice Tage</th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordings as $timerecording):
|
||||
if (!empty($timerecording['data']['time']['daysum'])) {
|
||||
$offdays = "";
|
||||
$counter = 1;
|
||||
foreach ($timerecording['data']['time']['daysum'] as $category => $value) {
|
||||
if ($counter > 1) {
|
||||
$offdays .= "<br>";
|
||||
}
|
||||
$offdays .= $category . ": " . $value . " Tag(e) ";
|
||||
$counter++;
|
||||
}
|
||||
} else {
|
||||
$offdays = "keine";
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $timerecording['user_name'] ?></td>
|
||||
<td class="text-center edit-width-large"><?= $timerecording['employee_number'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['mustorder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['must'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['isorder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['is'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['summsecondsorder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['summseconds'] ?></td>
|
||||
<td data-order="<?= $timerecording['data']['time']['overtime_noworder'] ?>"
|
||||
class="text-center"><?= $timerecording['data']['time']['overtime_now'] ?></td>
|
||||
<td class=""><?= $offdays ?></td>
|
||||
<td class="text-center"><?= number_format($timerecording['data']['time']['diet'], 2, ',', '.') ?>
|
||||
€
|
||||
</td>
|
||||
<td class="text-center"><?= $timerecording['data']['time']['homeoffice'] ?> Tag(e)</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [2, 3, 4, 5, 6, 7, 8, 9];
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.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' => 'generatebmdexport']) ?>&month=' + $('#month').data('month'), '_blank');
|
||||
});
|
||||
$('body').on('click', '#bmd-export-nlz', function () {
|
||||
|
||||
window.open('<?= self::getUrl("TimerecordingBilling", "api", ['do' => 'generatebmdexportnlz']) ?>&month=' + $('#month').data('month'), '_blank');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
77
Layout/default/TimerecordingBilling/Index.php
Normal file
77
Layout/default/TimerecordingBilling/Index.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<!-- 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 class="page-title">Zeiterfassung Verrechnung/Abrechnung</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 Abrechnungsmonate</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Monat</th>
|
||||
<th class="text-center">Abgeschlossen</th>
|
||||
<th class="text-center">Abgeschlossen am</th>
|
||||
<th class="text-center">Abgeschlossen von</th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($months as $month): ?>
|
||||
<tr>
|
||||
<td class="text-center"><a href="<?= self::getUrl("TimerecordingBilling", "detail", ["month" => $month]) ?>"> <?= $month ?></a></td>
|
||||
<td class="text-center"></td>
|
||||
<td class="text-center"></td>
|
||||
<td class="text-center"></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [7];
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -93,6 +93,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label"
|
||||
for="businesstrip">Unbezahlt</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="businesstrip"
|
||||
class="form-check-input" <?php if ($timerecordingcategoriess->unpaid) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="unpaid" 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>
|
||||
|
||||
@@ -155,7 +155,7 @@ class TimerecordingModel
|
||||
$start = $filter['start'];
|
||||
$end = $filter['end'];
|
||||
if (is_numeric($start) && is_numeric($end)) {
|
||||
$where .= " AND ((`start` >= $start AND `start` <= $end) OR (`end` >= $start AND `end` <= $end) OR `end` is NULL) ORDER by user_id ASC";
|
||||
$where .= " AND ((`start` >= $start AND `start` <= $end) OR (`end` >= $start AND `end` <= $end) OR `end` is NULL) ORDER by user_id,start ASC";
|
||||
}
|
||||
}
|
||||
if (array_key_exists("start", $filter) && array_key_exists("timerecordingCategory_id", $filter)) {
|
||||
@@ -199,9 +199,9 @@ class TimerecordingModel
|
||||
$id = $filter['id'];
|
||||
if (is_numeric($starttime) && is_numeric($endtime)) {
|
||||
if ($id && is_numeric($id)) {
|
||||
$where .= " AND `id` != $id";
|
||||
$where .= " AND `id` != $id AND `days`='0'";
|
||||
}
|
||||
$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";
|
||||
$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,start ASC";
|
||||
|
||||
//var_dump($where);exit;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
$startdate = 1709254800;
|
||||
$today = time();
|
||||
$months = [];
|
||||
$month = $startdate;
|
||||
while ($month < $today) {
|
||||
$months[] = date("m.Y", $month);
|
||||
$month = strtotime("+1 month", $month);
|
||||
}
|
||||
$this->layout()->set("months", $months);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Index");
|
||||
}
|
||||
|
||||
protected function detailAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$month = $r->get("month");
|
||||
if (!$month) {
|
||||
$this->redirect("TimerecordingBilling");
|
||||
}
|
||||
$month = strtotime("01." . $month);
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['user_id'] = $timerecordingsEmolyee->user_id;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['user_name'] = $timerecordingsEmolyee->user->name;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['employee_number'] = $employee_number;
|
||||
$timerecordings[$timerecordingsEmolyee->user_id]['data'] = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
}
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Detail");
|
||||
$this->layout()->set("month", date("m.Y", $month));
|
||||
}
|
||||
|
||||
protected function apiAction()
|
||||
{
|
||||
$do = $this->request->do;
|
||||
$month = $this->request->month;
|
||||
|
||||
$data = [];
|
||||
|
||||
switch ($do) {
|
||||
case "generatebmdexport":
|
||||
$return = $this->generateBmdExport($month);
|
||||
break;
|
||||
case "generatebmdexportnlz":
|
||||
$return = $this->generateBmdExport($month, 1);
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
if (!is_array($return) || !count($return)) {
|
||||
$data = ["status" => "error"];
|
||||
$this->returnJson($data);
|
||||
}
|
||||
$data['status'] = "OK";
|
||||
$data['result'] = $return;
|
||||
$this->returnJson($data);
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function generateBmdLine()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function generateBmdExport($month, $nlz = 0)
|
||||
{
|
||||
//create and download csv file
|
||||
$filename = "BMDExport_" . $month . ".csv";
|
||||
$file = fopen("php://output", 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename=' . $filename);
|
||||
if ($nlz == 0) {
|
||||
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
} else {
|
||||
$headerarray = ["Firma", "Mitarbeiter", "DV-Nr", "Art", "Sonderzeit", "Verarbeitungs-KZ", "Von", "Bis", "Verwaltung", "Bezahlt"];
|
||||
fputcsv($file, $headerarray, ";");
|
||||
}
|
||||
$month = strtotime("01." . $month);
|
||||
$monthbmd = date("n", $month);
|
||||
$companybmd = "1";
|
||||
$timerecordingsEmolyees = TimerecordingEmployeeModel::getAll();
|
||||
foreach ($timerecordingsEmolyees as $timerecordingsEmolyee) {
|
||||
$user = new User($timerecordingsEmolyee->user_id);
|
||||
$employee_number = (string)$user->getFlag('employee_number');
|
||||
$employeetypesbmd = TimerecordingEmployeeModel::$employeetypesbmd;
|
||||
$employee_type = $employeetypesbmd[$timerecordingsEmolyee->type];
|
||||
$timerecordingReport = new TimerecordingReportController();
|
||||
$timerecording = $timerecordingReport->getTimerecordingsTimes('2', $month, $month, $month, $timerecordingsEmolyee->user_id, 0);
|
||||
|
||||
foreach ($timerecording['time']['isclean'] as $key => $value) {
|
||||
$hours = $value;
|
||||
//calc ishours in hours
|
||||
$hours = $hours / 3600;
|
||||
$hours = round($hours, 2);
|
||||
$hours = str_replace(".", ",", $hours);
|
||||
if (strpos($key, ',') !== false && $nlz == 0) {
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, $employee_type, $hours, "", "", "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
} else if (strpos($key, ',') === false && $nlz == 1) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($timerecording['time']['diet'] > 0 && $nlz == 0) {
|
||||
$dietsum = round($timerecording['time']['diet'], 2);
|
||||
$dietsum = str_replace(".", ",", $dietsum);
|
||||
$bodyarray = [$monthbmd, $companybmd, $employee_number, "2500", "", "", $dietsum, "", "", "", ""];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
if (!empty($timerecording['time']['nlztimes']) && $nlz == 1) {
|
||||
foreach ($timerecording['time']['nlztimes'] as $nlztime) {
|
||||
if ($nlztime['minutes']) {
|
||||
$time = $nlztime['minutes'] / 60;
|
||||
$time = round($time, 2);
|
||||
$time = str_replace(".", ",", $time);
|
||||
} else {
|
||||
$time = "";
|
||||
}
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], "", "3", $nlztime['start'], $nlztime['end'], $time, $hours];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingBillingModel
|
||||
{
|
||||
public static $dieatBase = 26.4;
|
||||
public static $excludeEmployees = [1000, 1001, 9999, 4, 5, 6, 7, 8, 9, 10];
|
||||
|
||||
}
|
||||
@@ -87,6 +87,7 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
$data['require_comment'] = trim($r->require_comment);
|
||||
$data['only_admin'] = trim($r->only_admin);
|
||||
$data['businesstrip'] = trim($r->businesstrip);
|
||||
$data['unpaid'] = trim($r->unpaid);
|
||||
|
||||
|
||||
if (!$data['name']) {
|
||||
@@ -107,6 +108,9 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
if (!$data['businesstrip']) {
|
||||
$data['businesstrip'] = 0;
|
||||
}
|
||||
if (!$data['unpaid']) {
|
||||
$data['unpaid'] = 0;
|
||||
}
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
@@ -9,6 +9,7 @@ class TimerecordingCategoryModel
|
||||
private $require_comment;
|
||||
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 $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
@@ -17,6 +17,7 @@ class TimerecordingEmployeeModel
|
||||
private $bpahours;
|
||||
private $startdate;
|
||||
private $birthday;
|
||||
public static $employeetypesbmd = array('1' => '1000', '2' => '1200', '3' => '1400');
|
||||
|
||||
|
||||
public static function find($data)
|
||||
|
||||
@@ -392,8 +392,10 @@ class TimerecordingReportController extends mfBaseController
|
||||
$r = $this->request;
|
||||
$mustSeconds = 0;
|
||||
$isSeconds = 0;
|
||||
$isSecondscleanarray = array();
|
||||
$holiDays = 0;
|
||||
$plusHours = 0;
|
||||
$nlzTimes = array();
|
||||
$daysum = array();
|
||||
if (!$user_id) {
|
||||
$user_id = $r->user_id;
|
||||
@@ -405,6 +407,7 @@ class TimerecordingReportController extends mfBaseController
|
||||
if ($employee) {
|
||||
$holiDays = $employee[0]->holidays;
|
||||
$plusHours = $employee[0]->plushours;
|
||||
$overtime_now = $employee[0]->overtime_now;
|
||||
$auto_workinghours = $employee[0]->auto_workinghours;
|
||||
$startdate = $employee[0]->startdate;
|
||||
}
|
||||
@@ -451,6 +454,10 @@ class TimerecordingReportController extends mfBaseController
|
||||
$lastdate = strtotime(date("Y-m-t", $datamonth));
|
||||
$daycount = date("t", $datamonth);
|
||||
$lastdate = strtotime(date("Y-m-d", $lastdate) . ' 23:59:59');
|
||||
//Lastdate staticmust deleted
|
||||
// $lastdate = strtotime("2024-03-22 23:59:59");
|
||||
// $daycount=22;
|
||||
|
||||
$searchArray = ['user_id' => $user_id, 'start' => $firstdate, 'end' => $lastdate];
|
||||
$timestamp = $firstdate;
|
||||
|
||||
@@ -493,13 +500,50 @@ class TimerecordingReportController extends mfBaseController
|
||||
$timerecordings = TimerecordingModel::search($searchArray);
|
||||
|
||||
$responsecount = count($timerecordings);
|
||||
$oldday = "";
|
||||
$homeoffice = false;
|
||||
$homeofficesum = 0;
|
||||
$dietsum = 0;
|
||||
$diet = 0;
|
||||
$dietbase = TimerecordingBillingModel::$dieatBase;
|
||||
|
||||
foreach ($timerecordings as $timerecording):
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
$day = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($oldday != date('Y-m-d', $timerecording->start)) {
|
||||
|
||||
if ($homeoffice == 1) {
|
||||
$homeofficesum++;
|
||||
$homeoffice = false;
|
||||
}
|
||||
if ($diet > 10800) {
|
||||
if ($diet >= 43200) {
|
||||
$diet = 43200;
|
||||
}
|
||||
$calcdiet = $dietbase / 12;
|
||||
$calcdiet = ($diet / 3600) * $calcdiet;
|
||||
$dietsum = $dietsum + $calcdiet;
|
||||
}
|
||||
$diet = 0;
|
||||
|
||||
}
|
||||
if ($timerecording->homeoffice == 1 && (!$homeoffice || $homeoffice == 1)) {
|
||||
|
||||
$homeoffice = 1;
|
||||
} else {
|
||||
$homeoffice = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($timerecording->businesstrip == 1 && $timerecording->timerecordingCategory->hourday == 1) {
|
||||
$diet = $diet + $timerecording->end - $timerecording->start;
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
@@ -510,6 +554,18 @@ class TimerecordingReportController extends mfBaseController
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
if ($isSecondscleanarray[$timerecording->timerecordingCategory->short]) {
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] + $seconds;
|
||||
} else {
|
||||
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $seconds;
|
||||
}
|
||||
if ($timerecording->timerecordingCategory->short != "1000,1200,1400") {
|
||||
$nlzTimes[$timerecording->id]['start'] = date("d.m.Y", $timerecording->start);
|
||||
$nlzTimes[$timerecording->id]['end'] = date("d.m.Y", $timerecording->end);
|
||||
$nlzTimes[$timerecording->id]['minutes'] = $seconds / 60;
|
||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
||||
}
|
||||
} 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);
|
||||
@@ -558,11 +614,17 @@ class TimerecordingReportController extends mfBaseController
|
||||
$sum = $sumdays . " Tage";
|
||||
}
|
||||
|
||||
if (!$daysum[$timerecording->timerecordingCategory->short]) {
|
||||
$daysum[$timerecording->timerecordingCategory->short] = $sumdays;
|
||||
if (!$daysum[$timerecording->timerecordingCategory->name]) {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $sumdays;
|
||||
} else {
|
||||
$daysum[$timerecording->timerecordingCategory->short] = $daysum[$timerecording->timerecordingCategory->short] + $sumdays;
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $daysum[$timerecording->timerecordingCategory->name] + $sumdays;
|
||||
}
|
||||
$nlzTimes[$timerecording->id]['start'] = date("d.m.Y", $timerecording->start);
|
||||
$nlzTimes[$timerecording->id]['end'] = date("d.m.Y", $timerecording->end);
|
||||
$nlzTimes[$timerecording->id]['days'] = $sumdays;
|
||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
|
||||
|
||||
} 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);
|
||||
@@ -653,13 +715,52 @@ class TimerecordingReportController extends mfBaseController
|
||||
} else {
|
||||
|
||||
}
|
||||
$oldday = date('Y-m-d', $timerecording->start);
|
||||
endforeach;
|
||||
if ($homeoffice == 1) {
|
||||
$homeofficesum++;
|
||||
$homeoffice = 0;
|
||||
}
|
||||
if ($diet > 10800) {
|
||||
if ($diet >= 43200) {
|
||||
$diet = 43200;
|
||||
}
|
||||
$calcdiet = $dietbase / 12;
|
||||
$calcdiet = ($diet / 3600) * $calcdiet;
|
||||
$dietsum = $dietsum + $calcdiet;
|
||||
}
|
||||
|
||||
$summseconds = $isSeconds - $mustSeconds;
|
||||
$isorder = $isSeconds;
|
||||
if ($isSeconds < 0) {
|
||||
$isSeconds = $isSeconds * -1;
|
||||
$isSeconds = "-" . sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
} else {
|
||||
$isSeconds = sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
}
|
||||
$summsecondsorder = $summseconds;
|
||||
if ($summseconds < 0) {
|
||||
$summseconds = $summseconds * -1;
|
||||
$summseconds = "-" . sprintf('%02dh:%02dm', floor($summseconds / 3600), floor($summseconds / 60 % 60));
|
||||
} else {
|
||||
$summseconds = sprintf('%02dh:%02dm', floor($summseconds / 3600), floor($summseconds / 60 % 60));
|
||||
}
|
||||
$json['success'] = true;
|
||||
$json['time']['auto_workinghours'] = $auto_workinghours;
|
||||
$json['time']['is'] = sprintf('%02dh:%02dm', floor($isSeconds / 3600), floor($isSeconds / 60 % 60));
|
||||
$json['time']['is'] = $isSeconds;
|
||||
$json['time']['isorder'] = $isorder;
|
||||
$json['time']['isclean'] = $isSecondscleanarray;
|
||||
$json['time']['must'] = sprintf('%02dh:%02dm', floor($mustSeconds / 3600), floor($mustSeconds / 60 % 60));
|
||||
$json['time']['mustorder'] = $mustSeconds;
|
||||
$json['time']['holidays'] = $holiDays;
|
||||
$json['time']['plushours'] = sprintf('%02dh:%02dm', floor($plusHours / 3600), floor($plusHours / 60 % 60));
|
||||
$json['time']['overtime_now'] = sprintf('%02dh:%02dm', floor($overtime_now / 3600), floor($overtime_now / 60 % 60));
|
||||
$json['time']['overtime_noworder'] = $overtime_now;
|
||||
$json['time']['homeoffice'] = $homeofficesum;
|
||||
$json['time']['summseconds'] = $summseconds;
|
||||
$json['time']['summsecondsorder'] = $summsecondsorder;
|
||||
$json['time']['nlztimes'] = $nlzTimes;
|
||||
$json['time']['diet'] = $dietsum;
|
||||
$json['time']['daysum'] = $daysum;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCategoryAddFieldUnpaid extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingCategory", ["signed" => true]);
|
||||
$table->addColumn("unpaid", "integer", ["null" => false, "default" => '0', "after" => "businesstrip"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCategory")->removeColumn("unpaid")->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user