From 61976ed1ea4439bf1b67a70b7a51114062d77384 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 13 Oct 2022 15:06:30 +0200 Subject: [PATCH] - pausen checks angepasst --- cis/private/tools/zeitaufzeichnung.php | 29 ++++++++-------- include/zeitaufzeichnung.class.php | 48 ++++++++------------------ 2 files changed, 28 insertions(+), 49 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index fd03045b2..ce354bf93 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1508,7 +1508,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) list($h1, $m1) = explode(':', $pausesumme); $pausesumme = $h1*3600+$m1*60; - $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s'))-3600; + $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format='Y-m-d H:i:s'))-$datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format='Y-m-d H:i:s')); foreach($extlehrearr as $el) { if ($el["start"] > $tagesbeginn && $el["ende"] < $tagesende) @@ -1516,17 +1516,16 @@ if ($projekt->getProjekteMitarbeiter($user, true)) } list($h2, $m2) = explode(':', $elsumme); $elsumme = $h2*3600+$m2*60; - if ($datum->formatDatum($tag, 'Y-m-d') >= '2019-11-06') + if ($datum->formatDatum($tag, 'Y-m-d') < '2019-11-06') { - $pausesumme = $pausesumme; - } - else if ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause==false && $elsumme == 0) - { - $pausesumme = $tagessaldo-18000; - } - else if ($tagessaldo>18000 && $pflichtpause==false && $elsumme == 0) - { - $pausesumme = $pausesumme+1800; + if ($tagessaldo > 21600 && $tagessaldo < 23400 && $pflichtpause == false && $elsumme == 0) + { + $pausesumme = $tagessaldo - 18000; + } + else if ($tagessaldo > 21600 && $pflichtpause == false && $elsumme == 0) + { + $pausesumme = $pausesumme + 1800; + } } if ($elsumme > 0){ @@ -1534,7 +1533,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $pflichtpause = true; } - $tagessaldo = $tagessaldo-$pausesumme; + $tagessaldo = $tagessaldo - $pausesumme; // fehlende Pausen berechnen $pausefehlt_str = ''; @@ -1560,7 +1559,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) } } - $tagessaldo = date('H:i', ($tagessaldo)); + $tagessaldo = gmdate('H:i', ($tagessaldo)); $colspan = ($za_simple)?6:8; echo ''; @@ -1583,7 +1582,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) '.$p->t("zeitaufzeichnung/arbeitszeit").': '.$datum->formatDatum($tagesbeginn, $format='H:i').'-'.$datum->formatDatum($tagesende, $format='H:i').' '.$p->t("eventkalender/uhr").'
'.$p->t("zeitaufzeichnung/pause").': - '.$tagessaldo.$erstr.'
'.date('H:i', ($pausesumme-3600)).' + '.$tagessaldo.$erstr.'
'.gmdate('H:i', ($pausesumme)).' '; if ($tag > $sperrdatum) echo '<-'; @@ -1599,7 +1598,7 @@ if ($projekt->getProjekteMitarbeiter($user, true)) $tagesbeginn = ''; $tagesende = ''; $pflichtpause = false; - $wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo ); + $wochensaldo = $datum_obj->sumZeit($wochensaldo,$tagessaldo); } // Nach jeder Woche eine Summenzeile einfuegen und eine neue Tabelle beginnen diff --git a/include/zeitaufzeichnung.class.php b/include/zeitaufzeichnung.class.php index 7f46d763a..08e204e05 100644 --- a/include/zeitaufzeichnung.class.php +++ b/include/zeitaufzeichnung.class.php @@ -887,22 +887,17 @@ or not exists $tagesbeginn = ''; $tagesende = ''; $pausesumme = 0; - $tagessaldo = ''; - $elsumme = '00:00'; - $pflichtpause = false; $blockingError = false; $datum = new datum(); - $this->getListeUserFromTo($uid, $datumday, $datumday, null); + $this->getListeUserFromTo($uid, $datumday, $datumday); foreach ($this->result as $row) { - $datumtag = $datum->formatDatum($row->datum, 'Y-m-d'); - - if (($tagesbeginn == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) > $datum->mktime_fromtimestamp($datum->formatDatum($row->start, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') + if (($tagesbeginn == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn)) > $datum->mktime_fromtimestamp($datum->formatDatum($row->start))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') $tagesbeginn = $datum->formatDatum($row->start, 'H:i'); - if (($tagesende == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) < $datum->mktime_fromtimestamp($datum->formatDatum($row->ende, $format = 'Y-m-d H:i:s'))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') + if (($tagesende == '' || $datum->mktime_fromtimestamp($datum->formatDatum($tagesende)) < $datum->mktime_fromtimestamp($datum->formatDatum($row->ende))) && $row->aktivitaet_kurzbz != 'LehreExtern' && $row->aktivitaet_kurzbz != 'Ersatzruhe') $tagesende = $datum->formatDatum($row->ende, 'H:i'); if ($row->aktivitaet_kurzbz == "Pause") @@ -912,38 +907,23 @@ or not exists } } - $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende, $format = 'Y-m-d H:i:s')) - $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn, $format = 'Y-m-d H:i:s')) - 3600; + $tagessaldo = $datum->mktime_fromtimestamp($datum->formatDatum($tagesende)) - $datum->mktime_fromtimestamp($datum->formatDatum($tagesbeginn)); - list($h2, $m2) = explode(':', $elsumme); - $elsumme = $h2 * 3600 + $m2 * 60; - - - if ($datum->formatDatum($datumday, 'Y-m-d') >= '2019-11-06') + if ($datum->formatDatum($datumday, 'Y-m-d') < '2019-11-06') { - $pausesumme = $pausesumme; + if ($tagessaldo > 21600 && $tagessaldo < 23400) + { + $pausesumme = $tagessaldo - 18000; + } + elseif ($tagessaldo > 21600) + { + $pausesumme = $pausesumme + 1800; + } } - elseif ($tagessaldo > 18000 && $tagessaldo < 19800 && $pflichtpause == false && $elsumme == 0) - { - $pausesumme = $tagessaldo - 18000; - } - elseif ($tagessaldo > 18000 && $pflichtpause == false && $elsumme == 0) - { - $pausesumme = $pausesumme + 1800; - } - - if ($elsumme > 0) - { - $pausesumme = $pausesumme + $elsumme; - $pflichtpause = true; - } - - $tagessaldo = $tagessaldo - $pausesumme; //check if blocking error - if (($tagessaldo >= 19800 && $pausesumme < 1800) || ($tagessaldo > 18000 && $tagessaldo < 19800 && $pausesumme < $tagessaldo - 18000)) - { + if ($tagessaldo > 21600 && $pausesumme < 1800) $blockingError = true; - } return $blockingError; }