Merge branch 'spidev' into 'master'

Zeiterfassung Ersatzruhe Implementierung

See merge request fronk/thetool!1419
This commit is contained in:
Daniel Spitzer
2025-06-06 07:35:29 +00:00
5 changed files with 68 additions and 35 deletions

View File

@@ -292,7 +292,7 @@ class TimerecordingController extends mfBaseController
} else if ($hourday == 3) {
$starttime = strtotime($r->date . " 00:00:00");
$endtime = NULL;
} else if ($hourday == 5) {
} else if ($hourday == 5 || $hourday == 9) {
$starttime = strtotime($r->date . " 00:00:00");
$endtime = strtotime($r->date . " 23:59:00");
} else if ($hourday == 8) {
@@ -300,7 +300,7 @@ class TimerecordingController extends mfBaseController
$endtime = strtotime($r->date . " 23:59:00");
}
if ($hourday != 5 && $hourday != 7 && $hourday != 8) {
if ($hourday != 5 && $hourday != 7 && $hourday != 8 && $hourday != 9) {
$result = $this->checkTimerecording($starttime, $endtime, $id);
}
if ($result['state'] == "error") {
@@ -342,9 +342,14 @@ class TimerecordingController extends mfBaseController
if ($hourday == 8) {
$data['days'] = 0;
$data['hours_bpa'] = $r->days * 60 * 60;
} else if ($hourday == 9) {
$data['days'] = 0;
$data['hours'] = $r->days * 60 * 60;
$data['hours'] = 0 - $data['hours'];
} else {
$data['days'] = $r->days;
}
$data['timerecordingCar_id'] = $r->timerecordingCar_id;
$data['mileage_start'] = $r->mileage_start;
$data['mileage_end'] = $r->mileage_end;

View File

@@ -74,12 +74,13 @@ class TimerecordingModel
}
return $item;
}
public static function getAllHours($user_id)
{
$items = [];
$db = FronkDB::singleton();
$sql="SELECT SUM(`end` - `start`) AS gesamt_summe FROM Timerecording where user_id=$user_id AND `timerecordingCategory_id` =1";
$sql = "SELECT SUM(`end` - `start`) AS gesamt_summe FROM Timerecording where user_id=$user_id AND `timerecordingCategory_id` =1";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
@@ -185,7 +186,7 @@ class TimerecordingModel
if (array_key_exists("start", $filter) && array_key_exists("hours", $filter)) {
$start = $filter['start'];
if (is_numeric($start)) {
$where .= " AND `start` >= $start AND (`hours`>0 or `hours_overtime`>0) ORDER by start ASC";
$where .= " AND `start` >= $start AND (`hours`>0 or `hours`<0 or `hours_overtime`>0) ORDER by start ASC";
}
}
if (array_key_exists("start", $filter) && array_key_exists("days", $filter)) {

View File

@@ -10,7 +10,7 @@ class TimerecordingCategoryModel
private $only_admin;
private $businesstrip;
private $unpaid;
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum", 5 => "Anzahl Tage", 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)");
public static $approval_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");

View File

@@ -333,6 +333,22 @@ class TimerecordingReportController extends mfBaseController
} else {
$sum = $hoursbpa . " St";
}
} else if ($timerecording->timerecordingCategory->hourday == 9) {
$date = date("d.m.Y", $timerecording->start);
$start = "-";
$end = "-";
$datadate = date("Y-m-d", $timerecording->start);
$day = $daysgerm[date("w", $timerecording->start)];
// $hours = number_format($timerecording->hours_bpa / 60 / 60, "2", ",", '');
$timerecording->hours = $timerecording->hours * -1;
$hoursbpa = round($timerecording->hours / 60 / 60, 2);
$hoursbpa = str_replace(".", ",", $hoursbpa);
if ($timerecording->hours > 0) {
$sum = "+" . $hoursbpa . " St";
} else {
$sum = $hoursbpa . " St";
}
} else if ($timerecording->timerecordingCategory->hourday == 6) {
$date = date("d.m.Y", $timerecording->start);
$datadate = date("Y-m-d", $timerecording->start);
@@ -389,6 +405,9 @@ class TimerecordingReportController extends mfBaseController
$ddays = $timerecording->days;
if ($timerecording->timerecordingCategory->hourday == 8) {
$ddays = round($timerecording->hours_bpa / 60 / 60, 2);
} elseif ($timerecording->timerecordingCategory->hourday == 9) {
$ddays = round($timerecording->hours / 60 / 60, 2);
// $ddays = $ddays * -1;
}
$edit = '<i class="far fa-edit edit-button" data-id="' . $timerecording->id . '"
@@ -561,7 +580,7 @@ class TimerecordingReportController extends mfBaseController
$workinghourshistory = TimerecordingEmployeeWorkingHourHistoryModel::search(['user_id' => $user_id]);
if ($workinghourshistory) {
$workingHoursHistory[9732489200]=$workingHours;
$workingHoursHistory[9732489200] = $workingHours;
foreach ($workinghourshistory as $workinghourhistory) {
$whenddate = $workinghourhistory->enddate;
$workinghourhistoryhours = json_decode($workinghourhistory->workinghours, true);
@@ -600,14 +619,12 @@ class TimerecordingReportController 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)
{
$workingHours = $whdata;
}
$whtimestamp = strtotime(date('Y-m-d 23:59:59', $whkey));
if ($whtimestamp >= $timestamp) {
$workingHours = $whdata;
}
}
}
@@ -636,12 +653,10 @@ class TimerecordingReportController 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) {
$workingHours = $whdata;
}
}
@@ -670,12 +685,10 @@ class TimerecordingReportController 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) {
$workingHours = $whdata;
}
}
@@ -778,13 +791,10 @@ class TimerecordingReportController extends mfBaseController
} else {
$overtimes = $this->checkOvertime($timerecording);
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
if ($employee->only_admin!=1)
{
if ($employee->only_admin != 1) {
}
else
{
$isSeconds = $isSeconds - $overtimes['sum'];
} else {
$isSeconds = $isSeconds - $overtimes['sum'];
}
$O100pfl = $O100pfl + $overtimes['O100pfl'];
$O100free = $O100free + $overtimes['O100free'];
@@ -815,12 +825,10 @@ class TimerecordingReportController extends mfBaseController
$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) {
$workingHours = $whdata;
}
}
@@ -881,12 +889,10 @@ class TimerecordingReportController extends mfBaseController
$summcounter = 0;
$savecounter = 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) {
$workingHours = $whdata;
}
}

View File

@@ -310,6 +310,7 @@ $(document).ready(function () {
$('#days-div').show();
$('#days-div').find('label').text('Anzahl Tage');
$('#days-div').find('input').attr("step", "1");
$('#days-div').find('input').attr("min", "");
$('#days-div').find('input').val("");
$('#days').prop("required", true);
@@ -346,6 +347,26 @@ $(document).ready(function () {
$('#days-div').show();
$('#days-div').find('label').text('Anzahl Stunden');
$('#days-div').find('input').attr("step", "0.01");
$('#days-div').find('input').attr("min", "");
$('#days').prop("required", true);
$('#days-div').find('input').val("");
} else if (parseInt($(this).find(':selected').data('hourday')) === 9) {
$("#endtime-div").hide();
$("#endtime-div").find('input').each(function () {
$(this).prop("required", false);
$(this).prop("disabled", true);
});
$("#enddate-div").hide();
$("#enddate-div").find('input').each(function () {
$(this).prop("required", false);
$(this).prop("min", '');
$(this).val('');
});
$('#days-div').show();
$('#days-div').find('label').text('Anzahl Stunden');
$('#days-div').find('input').attr("step", "0.01");
$('#days-div').find('input').attr("min", "0");
$('#days').prop("required", true);
$('#days-div').find('input').val("");
}