Zeiterfassung neues Feature:
* Auswertungen nicht bebuchter Arbeitstage
This commit is contained in:
@@ -263,7 +263,7 @@ class TimerecordingController extends mfBaseController
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
$oldbpseconds=0;
|
||||
$oldbpseconds = 0;
|
||||
$enddate = $r->enddate;
|
||||
$hourday = $r->hourday;
|
||||
|
||||
@@ -530,7 +530,7 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$workinghourshistory = TimerecordingEmployeeWorkingHourHistoryModel::search(['user_id' => $userid]);
|
||||
if ($workinghourshistory) {
|
||||
$workingHoursHistory[2147483500]=$workingHours;
|
||||
$workingHoursHistory[2147483500] = $workingHours;
|
||||
foreach ($workinghourshistory as $workinghourhistory) {
|
||||
$whenddate = $workinghourhistory->enddate;
|
||||
$workinghourhistoryhours = json_decode($workinghourhistory->workinghours, true);
|
||||
@@ -547,13 +547,11 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
//check if holiday is already in the list
|
||||
foreach ($holidayDays as $key => $holidayDay) {
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
$timestamp = strtotime($key);
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
if ($whtimestamp >= $timestamp) {
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
@@ -672,7 +670,7 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
protected function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear, $startime = null, $endtime = null, $userid = null)
|
||||
public function getTimerecordingsApi($datatype, $dataweek, $datamonth, $datayear, $startime = null, $endtime = null, $userid = null, $ajax = 1)
|
||||
{
|
||||
$holidayrows = [];
|
||||
$mustSeconds = 0;
|
||||
@@ -680,7 +678,7 @@ class TimerecordingController extends mfBaseController
|
||||
$holiDays = 0;
|
||||
$plusHours = 0;
|
||||
$startdate = time();
|
||||
$allhours=0;
|
||||
$allhours = 0;
|
||||
if (!$userid) {
|
||||
$userid = $this->me->id;
|
||||
}
|
||||
@@ -699,8 +697,8 @@ class TimerecordingController extends mfBaseController
|
||||
|
||||
$overtime = $employee[0]->overtime_now;
|
||||
if ($employee[0]->only_admin) {
|
||||
$getAllHours=TimerecordingModel::getAllHours($userid);
|
||||
$getAllHours=$getAllHours[0]->gesamt_summe;
|
||||
$getAllHours = TimerecordingModel::getAllHours($userid);
|
||||
$getAllHours = $getAllHours[0]->gesamt_summe;
|
||||
}
|
||||
}
|
||||
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $userid]);
|
||||
@@ -718,7 +716,7 @@ class TimerecordingController extends mfBaseController
|
||||
|
||||
$workinghourshistory = TimerecordingEmployeeWorkingHourHistoryModel::search(['user_id' => $userid]);
|
||||
if ($workinghourshistory) {
|
||||
$workingHoursHistory[2147483500]=$workingHours;
|
||||
$workingHoursHistory[2147483500] = $workingHours;
|
||||
foreach ($workinghourshistory as $workinghourhistory) {
|
||||
$whenddate = $workinghourhistory->enddate;
|
||||
$workinghourhistoryhours = json_decode($workinghourhistory->workinghours, true);
|
||||
@@ -757,12 +755,10 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$dDate = date('Y-m-d', $timestamp + $WintertimeCompensation);
|
||||
$dDay = date('w', $timestamp + $WintertimeCompensation);
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
if ($whtimestamp >= $timestamp) {
|
||||
unset($workingHours);
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
@@ -792,12 +788,10 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$dDate = date('Y-m-d', $timestamp + $WintertimeCompensation);
|
||||
$dDay = date('w', $timestamp + $WintertimeCompensation);
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
if ($whtimestamp >= $timestamp) {
|
||||
unset($workingHours);
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
@@ -826,12 +820,10 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$dDate = date('Y-m-d', $timestamp + $WintertimeCompensation);
|
||||
$dDay = date('w', $timestamp + $WintertimeCompensation);
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
if ($whtimestamp >= $timestamp) {
|
||||
unset($workingHours);
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
@@ -859,12 +851,10 @@ class TimerecordingController extends mfBaseController
|
||||
if (date('I', $timestamp) == 0) {
|
||||
$WintertimeCompensation = 3600;
|
||||
}
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
if ($whtimestamp >= $timestamp) {
|
||||
unset($workingHours);
|
||||
$workingHours = $whdata;
|
||||
// echo date('Y-m-d 23:59:59', $whkey).PHP_EOL;
|
||||
@@ -908,6 +898,9 @@ class TimerecordingController extends mfBaseController
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
if ($ajax == 0) {
|
||||
$workdaycheck[] = $datadate;
|
||||
}
|
||||
} 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);
|
||||
@@ -931,12 +924,10 @@ class TimerecordingController extends mfBaseController
|
||||
$savecounter = 0;
|
||||
$sumdays = 0;
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $i)
|
||||
{
|
||||
if ($whtimestamp >= $i) {
|
||||
unset($workingHours);
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
@@ -944,6 +935,10 @@ class TimerecordingController extends mfBaseController
|
||||
}
|
||||
$holidaycounter = $workingHours[date("w", $i)];
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if ($ajax == 0) {
|
||||
$workdaycheck[] = $daycheck;
|
||||
}
|
||||
|
||||
if (!$holiDay[$daycheck]) {
|
||||
if ($holidaycounter) {
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
@@ -991,17 +986,19 @@ class TimerecordingController extends mfBaseController
|
||||
$savecounter = 0;
|
||||
// echo $starttimecalc."<br>";
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
if ($workingHoursHistory) {
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $i)
|
||||
{
|
||||
if ($whtimestamp >= $i) {
|
||||
unset($workingHours);
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ajax == 0) {
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
$workdaycheck[] = $daycheck;
|
||||
}
|
||||
$holidaycounter = $workingHours[$timerecording->user_id][date("w", $i)];
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
@@ -1049,6 +1046,10 @@ class TimerecordingController extends mfBaseController
|
||||
$sum = "-" . sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
$isSeconds = $isSeconds + $seconds;
|
||||
if ($ajax == 0) {
|
||||
$workdaycheck[] = $datadate;
|
||||
}
|
||||
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 7) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
@@ -1164,9 +1165,15 @@ class TimerecordingController extends mfBaseController
|
||||
$json['data'] = $rows;
|
||||
$json['recordsFiltered'] = $responsecount;
|
||||
$json['recordsTotal'] = $responsecount;
|
||||
$json = json_encode($json);
|
||||
echo trim($json);
|
||||
die();
|
||||
|
||||
if ($ajax == 1) {
|
||||
$json = json_encode($json);
|
||||
echo trim($json);
|
||||
die();
|
||||
} else {
|
||||
$json['workcheck'] = $workdaycheck;
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user