Zeiterfassung
* Feature Implementation Arbeitszeitänderungen mit History für alle möglichen historischen Berechnungen und Auswertung fertigstellung
This commit is contained in:
@@ -95,6 +95,8 @@ class TimerecordingReportController extends mfBaseController
|
||||
$workingHours[$workinghour->user_id][$workinghour->day] = $workingHours[$workinghour->user_id][$workinghour->day] + $whend - $whstart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->holidays as $holiday) {
|
||||
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
|
||||
}
|
||||
@@ -556,13 +558,32 @@ class TimerecordingReportController extends mfBaseController
|
||||
$workingHours[$workinghour->day] = $workingHours[$workinghour->day] + $whend - $whstart;
|
||||
}
|
||||
}
|
||||
|
||||
$workinghourshistory = TimerecordingEmployeeWorkingHourHistoryModel::search(['user_id' => $user_id]);
|
||||
if ($workinghourshistory) {
|
||||
$workingHoursHistory[9732489200]=$workingHours;
|
||||
foreach ($workinghourshistory as $workinghourhistory) {
|
||||
$whenddate = $workinghourhistory->enddate;
|
||||
$workinghourhistoryhours = json_decode($workinghourhistory->workinghours, true);
|
||||
foreach ($workinghourhistoryhours as $workinghourhistoryhour) {
|
||||
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghourhistoryhour['start'] . ":00");
|
||||
$whend = strtotime(date('Y-m-d', time()) . " " . $workinghourhistoryhour['end'] . ":00");
|
||||
if (!$workingHoursHistory[$whenddate][$workinghourhistoryhour['day']]) {
|
||||
$workingHoursHistory[$whenddate][$workinghourhistoryhour['day']] = $whend - $whstart;
|
||||
} else {
|
||||
$workingHoursHistory[$whenddate][$workinghourhistoryhour['day']] = $workingHoursHistory[$whenddate][$workinghourhistoryhour['day']] + $whend - $whstart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->holidays as $holiday) {
|
||||
$holiDay[date('Y-m-d', $holiday->timestamp)] = $holiday->timestamp;
|
||||
}
|
||||
|
||||
if ($datatype == 1) {
|
||||
$kw = date('W', $dataweek);
|
||||
$year = date(o, $dataweek);
|
||||
$year = date('o', $dataweek);
|
||||
$timestamp_montag = strtotime("{$year}-W{$kw}");
|
||||
$timestamp_sonntag = strtotime("{$year}-W{$kw}-7");
|
||||
$firstdate = strtotime(date("Y-m-d", $timestamp_montag) . " 00:00:00");
|
||||
@@ -579,6 +600,16 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
$dDate = date('Y-m-d', $timestamp + $WintertimeCompensation);
|
||||
$dDay = date('w', $timestamp + $WintertimeCompensation);
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
@@ -605,6 +636,17 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
$dDate = date('Y-m-d', $timestamp + $WintertimeCompensation);
|
||||
$dDay = date('w', $timestamp + $WintertimeCompensation);
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$holiDay[$dDate] && $dDate >= date('Y-m-d', $startdate) && $dDate <= date('Y-m-d', $enddate)) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
@@ -628,6 +670,16 @@ class TimerecordingReportController extends mfBaseController
|
||||
}
|
||||
$dDate = date('Y-m-d', $timestamp + $WintertimeCompensation);
|
||||
$dDay = date('w', $timestamp + $WintertimeCompensation);
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $timestamp)
|
||||
{
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$holiDay[$dDate]) {
|
||||
$mustSeconds = $mustSeconds + $workingHours[$dDay];
|
||||
}
|
||||
@@ -756,6 +808,16 @@ class TimerecordingReportController extends mfBaseController
|
||||
$sumdays = 0;
|
||||
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $i)
|
||||
{
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
$holidaycounter = $workingHours[date("w", $i)];
|
||||
$daycheck = date("Y-m-d", $i);
|
||||
if (!$holiDay[$daycheck]) {
|
||||
@@ -812,6 +874,16 @@ class TimerecordingReportController extends mfBaseController
|
||||
$summcounter = 0;
|
||||
$savecounter = 0;
|
||||
for ($i = $starttimecalc; $i <= $endtimecalc; $i = $i + 86400) {
|
||||
if ($workingHoursHistory)
|
||||
{
|
||||
foreach ($workingHoursHistory as $whkey => $whdata) {
|
||||
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
|
||||
if ($whtimestamp >= $i)
|
||||
{
|
||||
$workingHours = $whdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
$holidaycounter = $workingHours[date("w", $i)];
|
||||
$isSeconds = $isSeconds + $holidaycounter;
|
||||
$summcounter = $summcounter + $holidaycounter;
|
||||
|
||||
Reference in New Issue
Block a user