Merge branch 'spidev' into 'master'
Zeiterfassung Update/Bugfixes See merge request fronk/thetool!445
This commit is contained in:
@@ -41,7 +41,7 @@ class TimerecordingBillingController extends mfBaseController
|
||||
protected function overviewAction()
|
||||
{
|
||||
$timerecordingBillings = TimerecordingBillingModel::getAll();
|
||||
$timerecordingBillingsEmployees = TimerecordingBillingEmployeeModel::getAll();
|
||||
$timerecordingBillingsEmployees = TimerecordingBillingEmployeeModel::getAllOrderbyNameDate();
|
||||
$this->layout()->setTemplate("TimerecordingBilling/Overview");
|
||||
$this->layout()->set("timerecordingbillings", $timerecordingBillings);
|
||||
$this->layout()->set("timerecordingbillingsemployees", $timerecordingBillingsEmployees);
|
||||
@@ -224,9 +224,9 @@ class TimerecordingBillingController extends mfBaseController
|
||||
$file = fopen("php://output", 'w');
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename=' . $filename);
|
||||
$monthunix=(strtotime("01." .$month));
|
||||
$monthunix = (strtotime("01." . $month));
|
||||
$monthbmd = date("n", $monthunix);
|
||||
$monthend = date("d.m.Y", strtotime("last day of this month",$monthunix));
|
||||
$monthend = date("d.m.Y", strtotime("last day of this month", $monthunix));
|
||||
$companybmd = "1";
|
||||
if ($nlz == 0) {
|
||||
$headerarray = ["Monat", "Firma", "Mitarbeiter", "Lohnart", "Menge", "Satz", "Betrag", "Kostenstelle", "NLZ-Kennzeichen", "NLZ Von-Datum", "NLZ Bis-Datum"];
|
||||
@@ -333,16 +333,16 @@ class TimerecordingBillingController extends mfBaseController
|
||||
} else {
|
||||
if ($timerecordingBillingEmployee->nlz_detail) {
|
||||
foreach (json_decode($timerecordingBillingEmployee->nlz_detail, true) as $nlztime) {
|
||||
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
if ($nlztime['categoryshort'] != "99") {
|
||||
$bodyarray = [$companybmd, $employee_number, 1, $nlztime['categoryshort'], $nlztime['catExtended'], "3", $nlztime['start'], $nlztime['end'], $nlztime['time'], $nlztime['pay']];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($timerecordingBillingEmployee->holidays>0) {
|
||||
if ($timerecordingBillingEmployee->holidays > 0) {
|
||||
//last day of month
|
||||
|
||||
|
||||
|
||||
$bodyarray = [$companybmd, $employee_number, 1, "1", "", "4", $monthend, $monthend, $timerecordingBillingEmployee->holidays, '0'];
|
||||
fputcsv($file, $bodyarray, ";");
|
||||
|
||||
@@ -584,11 +584,8 @@ class TimerecordingBillingController extends mfBaseController
|
||||
if ($timerecording['homeoffice']) {
|
||||
$data['homeoffice'] = $timerecording['homeoffice'];
|
||||
}
|
||||
|
||||
|
||||
if (!$data['diet']) {
|
||||
$data['diet'] = 0;
|
||||
|
||||
}
|
||||
|
||||
$timerecordingbillingemployee = TimerecordingBillingEmployeeModel::create($data);
|
||||
|
||||
@@ -93,6 +93,22 @@ class TimerecordingBillingEmployeeModel
|
||||
|
||||
}
|
||||
|
||||
public static function getAllOrderbyNameDate()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingBillingEmployee", "*", "1=1 ORDER by `timerecordingEmployee_id`,`timerecordingBilling_id` DESC ");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingBillingEmployee($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
@@ -157,7 +157,7 @@ private $holidays ;
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
$day = "";
|
||||
$enddatecend="";
|
||||
$enddatecend = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
@@ -225,7 +225,7 @@ private $holidays ;
|
||||
$enddatetemp = date("Y-m-d", time());
|
||||
$enddatetemp = strtotime($enddatetemp . " 23:59:59");
|
||||
$enddate = date("Y-m-d", $enddatetemp + 7200);
|
||||
$enddatecend= date("Y-m-d", $enddatetemp + 1216800);
|
||||
$enddatecend = date("Y-m-d", $enddatetemp + 1216800);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
@@ -266,6 +266,7 @@ private $holidays ;
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
if ($timerecording->days > 0) {
|
||||
if ($timerecording->days == 1) {
|
||||
@@ -357,9 +358,8 @@ private $holidays ;
|
||||
endif;
|
||||
if ($datatype == 3 && ($timerecording->timerecordingCategory->hourday == 1 || $timerecording->timerecordingCategory->hourday == 7 || $timerecording->timerecordingCategory->hourday == 5)) {
|
||||
} else {
|
||||
if (!$enddatecend)
|
||||
{
|
||||
$enddatecend=$enddate;
|
||||
if (!$enddatecend) {
|
||||
$enddatecend = $enddate;
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
@@ -588,7 +588,7 @@ private $holidays ;
|
||||
$O100pfl = 0;
|
||||
$O50free = 0;
|
||||
$O50pfl = 0;
|
||||
$Osum=0;
|
||||
$Osum = 0;
|
||||
foreach ($timerecordings as $timerecording):
|
||||
|
||||
$state = "";
|
||||
@@ -599,9 +599,10 @@ private $holidays ;
|
||||
if ($oldday != date('Y-m-d', $timerecording->start)) {
|
||||
|
||||
if ($homeoffice == 1) {
|
||||
$homeofficesum++;
|
||||
$homeofficesum ++;
|
||||
$homeoffice = false;
|
||||
}
|
||||
$homeoffice = false;
|
||||
if ($diet > 10800) {
|
||||
if ($diet >= 43200) {
|
||||
$diet = 43200;
|
||||
@@ -613,14 +614,13 @@ private $holidays ;
|
||||
$diet = 0;
|
||||
|
||||
}
|
||||
|
||||
if ($timerecording->homeoffice == 1 && (!$homeoffice || $homeoffice == 1)) {
|
||||
|
||||
$homeoffice = 1;
|
||||
} else {
|
||||
$homeoffice = 0;
|
||||
} else if ($timerecording->timerecordingCategory_id != '9') { //Speziallösung für Arztbesuch (zusätzlich Homeoffice erlaubt)
|
||||
$homeoffice = 'NOK';
|
||||
}
|
||||
|
||||
|
||||
if ($timerecording->businesstrip == 1 && $timerecording->timerecordingCategory->hourday == 1) {
|
||||
$diet = $diet + $timerecording->end - $timerecording->start;
|
||||
}
|
||||
@@ -664,7 +664,7 @@ private $holidays ;
|
||||
$O100free = $O100free + $overtimes['O100free'];
|
||||
$O50free = $O50free + $overtimes['O50free'];
|
||||
$O50pfl = $O50pfl + $overtimes['O50pfl'];
|
||||
$Osum=$Osum+$overtimes['sum'];
|
||||
$Osum = $Osum + $overtimes['sum'];
|
||||
}
|
||||
} 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);
|
||||
@@ -760,7 +760,8 @@ private $holidays ;
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 5) {
|
||||
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
@@ -770,7 +771,12 @@ private $holidays ;
|
||||
} else {
|
||||
$daysum[$timerecording->timerecordingCategory->name] = $daysum[$timerecording->timerecordingCategory->name] + $timerecording->days;
|
||||
}
|
||||
|
||||
$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]['unpaid'] = $timerecording->timerecordingCategory->unpaid;
|
||||
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
|
||||
$nlzTimes[$timerecording->id]['categoryshort'] = '99';
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 6) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
@@ -826,7 +832,6 @@ private $holidays ;
|
||||
endforeach;
|
||||
if ($homeoffice == 1) {
|
||||
$homeofficesum++;
|
||||
$homeoffice = 0;
|
||||
}
|
||||
if ($diet > 10800) {
|
||||
if ($diet >= 43200) {
|
||||
@@ -883,7 +888,7 @@ private $holidays ;
|
||||
$json['time']['daysum'] = $daysum;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl,'Osum'=>$Osum];
|
||||
$json['time']['overtimes'] = ['O100free' => $O100free, 'O100pfl' => $O100pfl, 'O50free' => $O50free, 'O50pfl' => $O50pfl, 'Osum' => $Osum];
|
||||
|
||||
if ($ajax == 1) {
|
||||
$json = json_encode($json);
|
||||
|
||||
Reference in New Issue
Block a user