Zeiterfassung Update
* Neues Kategorie Feature (Arbeitszeitverschiebung)
This commit is contained in:
@@ -154,6 +154,44 @@ class TimerecordingController extends mfBaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getWorkingHours($ajax = 0)
|
||||||
|
{
|
||||||
|
$r = $this->request;
|
||||||
|
$date = $r->date;
|
||||||
|
$starttime = strtotime($date . " 08:00:00");
|
||||||
|
if ($r->user_id) {
|
||||||
|
$userid = $r->user_id;
|
||||||
|
}
|
||||||
|
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $userid]);
|
||||||
|
$realHolidays = TimerecordingHolidayModel::getAll();
|
||||||
|
foreach ($realHolidays as $realHoliday) {
|
||||||
|
$realholiDay[date('Y-m-d', $realHoliday->timestamp)] = $realHoliday->timestamp;
|
||||||
|
}
|
||||||
|
if ($realholiDay[$date]) {
|
||||||
|
$result['state'] = "error";
|
||||||
|
$result['error'] = "Keine Arbeitszeitverschiebung an einem Feiertag möglich";
|
||||||
|
echo json_encode($result);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
foreach ($workinghours as $workinghour) {
|
||||||
|
$whstart = strtotime(date('Y-m-d', time()) . " " . $workinghour->start . ":00");
|
||||||
|
$whend = strtotime(date('Y-m-d', time()) . " " . $workinghour->end . ":00");
|
||||||
|
if (!$workingHours[$workinghour->day]['time']) {
|
||||||
|
$workingHours[$workinghour->day]['time'] = $whend - $whstart;
|
||||||
|
$workingHours[$workinghour->day]['start'] = $workinghour->start;
|
||||||
|
} else {
|
||||||
|
$workingHours[$workinghour->day]['time'] = $workingHours[$workinghour->day]['time'] + $whend - $whstart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$workingHours[date("w", $starttime)]) {
|
||||||
|
$result['state'] = "error";
|
||||||
|
$result['error'] = "Keine Arbeitszeitverschiebung außerhalb von Arbeitstagen möglich";
|
||||||
|
echo json_encode($result);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
return $workingHours[date("w", $starttime)];
|
||||||
|
}
|
||||||
|
|
||||||
protected function checkWorkingHours($ajax = 0)
|
protected function checkWorkingHours($ajax = 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -298,6 +336,10 @@ class TimerecordingController extends mfBaseController
|
|||||||
} else if ($hourday == 8) {
|
} else if ($hourday == 8) {
|
||||||
$starttime = strtotime($r->date . " 00:00:00");
|
$starttime = strtotime($r->date . " 00:00:00");
|
||||||
$endtime = strtotime($r->date . " 23:59:00");
|
$endtime = strtotime($r->date . " 23:59:00");
|
||||||
|
} else if ($hourday == 10) {
|
||||||
|
$data = $this->getWorkingHours();
|
||||||
|
$starttime = strtotime($r->date . " " . $data['start'] . ":00");
|
||||||
|
$endtime = $starttime + $data['time'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hourday != 5 && $hourday != 7 && $hourday != 8 && $hourday != 9) {
|
if ($hourday != 5 && $hourday != 7 && $hourday != 8 && $hourday != 9) {
|
||||||
@@ -473,9 +515,7 @@ class TimerecordingController extends mfBaseController
|
|||||||
$email->setFrom(TT_TIMERECORDING_EMAIL, TT_TIMERECORDING_EMAIL_NAME);
|
$email->setFrom(TT_TIMERECORDING_EMAIL, TT_TIMERECORDING_EMAIL_NAME);
|
||||||
$email->setTo(TT_TIMERECORDING_EMAIL);
|
$email->setTo(TT_TIMERECORDING_EMAIL);
|
||||||
$email->send();
|
$email->send();
|
||||||
}
|
} else if ($timerecordingCategoriess[0]->approval_fibu == "1" && !$r->user_id) {
|
||||||
else if ($timerecordingCategoriess[0]->approval_fibu == "1" && !$r->user_id)
|
|
||||||
{
|
|
||||||
$body = 'Beantrag von: ' . $this->me->name . '
|
$body = 'Beantrag von: ' . $this->me->name . '
|
||||||
';
|
';
|
||||||
$body .= 'Buchungsart: ' . $timerecordingCategoriess[0]->name . '
|
$body .= 'Buchungsart: ' . $timerecordingCategoriess[0]->name . '
|
||||||
@@ -1117,6 +1157,16 @@ class TimerecordingController extends mfBaseController
|
|||||||
} else {
|
} else {
|
||||||
$sum = $hoursbpa . " St";
|
$sum = $hoursbpa . " St";
|
||||||
}
|
}
|
||||||
|
} else if ($timerecording->timerecordingCategory->hourday == 10) {
|
||||||
|
$date = date("d.m.Y", $timerecording->start);
|
||||||
|
$datadate = date("Y-m-d", $timerecording->start);
|
||||||
|
$start = "-";
|
||||||
|
$end = "-";
|
||||||
|
$seconds = $timerecording->end - $timerecording->start;
|
||||||
|
$minutes = floor(($seconds % 3600) / 60);
|
||||||
|
$hours = floor($seconds / 3600);
|
||||||
|
$sum = "-" .sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||||
|
$day = $daysgerm[date("w", $timerecording->start)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
|
if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) || ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ class TimerecordingCategoryController extends mfBaseController
|
|||||||
if (!$data['approval']) {
|
if (!$data['approval']) {
|
||||||
$data['approval'] = 0;
|
$data['approval'] = 0;
|
||||||
}
|
}
|
||||||
|
if (!$data['approval_fibu']) {
|
||||||
|
$data['approval_fibu'] = 0;
|
||||||
|
}
|
||||||
if (!$data['require_comment']) {
|
if (!$data['require_comment']) {
|
||||||
$data['require_comment'] = 0;
|
$data['require_comment'] = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class TimerecordingCategoryModel
|
|||||||
private $only_admin;
|
private $only_admin;
|
||||||
private $businesstrip;
|
private $businesstrip;
|
||||||
private $unpaid;
|
private $unpaid;
|
||||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 9 => "Anzahl Stunden", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)",8 => "BP Stunden (Anzahl Stunden)");
|
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 9 => "Anzahl Stunden", 6 => "ZA Uhrzeit (von/bis)", 7 => "Fahrtenbuch (von/bis)",8 => "BP Stunden (Anzahl Stunden)",10 => "Arbeitstag");
|
||||||
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||||
public static $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
public static $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
||||||
|
|||||||
@@ -431,6 +431,16 @@ class TimerecordingReportController extends mfBaseController
|
|||||||
$hours = floor($seconds / 3600);
|
$hours = floor($seconds / 3600);
|
||||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||||
$day = $daysgerm[date("w", $timerecording->start)];
|
$day = $daysgerm[date("w", $timerecording->start)];
|
||||||
|
} else if ($timerecording->timerecordingCategory->hourday == 10) {
|
||||||
|
$date = date("d.m.Y", $timerecording->start);
|
||||||
|
$datadate = date("Y-m-d", $timerecording->start);
|
||||||
|
$start = "-";
|
||||||
|
$end = "-";
|
||||||
|
$seconds = $timerecording->end - $timerecording->start;
|
||||||
|
$minutes = floor(($seconds % 3600) / 60);
|
||||||
|
$hours = floor($seconds / 3600);
|
||||||
|
$sum = "-" .sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||||
|
$day = $daysgerm[date("w", $timerecording->start)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0 )|| ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
|
if (($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0 )|| ($timerecording->timerecordingCategory->approval_fibu == 1 && $timerecording->approved == 0)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user