Zeiterfassung Update

* Gesammtsumme bei Admin Only Mitarbeitern einfeführt
This commit is contained in:
Daniel Spitzer
2025-02-14 12:30:21 +01:00
parent 5e8ec1d07d
commit d0404f515d
4 changed files with 46 additions and 8 deletions

View File

@@ -95,6 +95,10 @@ $mindate = date("Y-m-d", strtotime("+ 1 Month", $closedmonth));
.holiday-text {
color: #d70000;
}
.height-unset
{
height: unset;
}
</style>
<!-- start page title -->
@@ -314,16 +318,12 @@ $mindate = date("Y-m-d", strtotime("+ 1 Month", $closedmonth));
<div class="form-row">
<div class="col text-center">
<div class="input-group ">
<label class="col-form-label form-control"><span
class="text-bold">Sollzeit: </span><span id="must-time"
class="ml-1 text-normal"></span></label>
<label class="col-form-label form-control height-unset"><span class="text-bold">Sollzeit: </span><span id="must-time" class="ml-1 text-normal"></span></label>
</div>
</div>
<div class="col text-center">
<div class="input-group ">
<label class="col-form-label form-control"><span class="text-bold">Istzeit: </span><span
id="is-time"
class="ml-1 text-normal"></span></label>
<label class="col-form-label form-control height-unset"><span class="text-bold">Istzeit: </span><span id="is-time" class="ml-1 text-normal"></span></label>
</div>
</div>
</div>
@@ -332,19 +332,32 @@ $mindate = date("Y-m-d", strtotime("+ 1 Month", $closedmonth));
<div class="form-row">
<div class="col text-center">
<div class="input-group ">
<label class="col-form-label form-control fixed-state"><span
<label class="col-form-label form-control fixed-state height-unset"><span
class="text-bold">Urlaubstage: </span><span id="holidays"
class="ml-1 text-normal"></span></label>
</div>
</div>
<div class="col text-center">
<div class="input-group ">
<label id="plushours-label" class="col-form-label form-control fixed-state"><span
<label id="plushours-label" class="col-form-label form-control fixed-state height-unset"><span
class="text-bold">Gutzeit: </span><span
id="plushours"
class="ml-1 text-normal"></span></label>
</div>
</div>
</div>
</div>
<div class="col-lg-2" id="AllHours-div" style="display: none">
<div class="form-row">
<div class="col text-center">
<div class="input-group ">
<label class="col-form-label form-control height-unset"><span
class="text-bold">Gesamtzeit: </span><span id="AllHours"
class="ml-1 text-normal"></span></label>
</div>
</div>
</div>
</div>
</div>

View File

@@ -680,6 +680,7 @@ class TimerecordingController extends mfBaseController
$holiDays = 0;
$plusHours = 0;
$startdate = time();
$allhours=0;
if (!$userid) {
$userid = $this->me->id;
}
@@ -697,6 +698,10 @@ class TimerecordingController extends mfBaseController
}
$overtime = $employee[0]->overtime_now;
if ($employee[0]->only_admin) {
$getAllHours=TimerecordingModel::getAllHours($userid);
$getAllHours=$getAllHours[0]->gesamt_summe;
}
}
$workinghours = TimerecordingEmployeeWorkingHourModel::search(['user_id' => $userid]);
$holidays = TimerecordingHolidayModel::getAll();
@@ -1155,6 +1160,7 @@ class TimerecordingController extends mfBaseController
$json['time']['must'] = sprintf('%02dh:%02dm', floor($mustSeconds / 3600), floor($mustSeconds / 60 % 60));
$json['time']['holidays'] = $holiDays;
$json['time']['plushours'] = $plusHours;
$json['time']['AllHours'] = sprintf('%02dh:%02dm', floor($getAllHours / 3600), floor($getAllHours / 60 % 60));;
$json['data'] = $rows;
$json['recordsFiltered'] = $responsecount;
$json['recordsTotal'] = $responsecount;

View File

@@ -73,6 +73,21 @@ 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";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new Timerecording($data);
}
}
return $items;
}
public static function getAll()
{

View File

@@ -87,6 +87,10 @@ table = $('#datatable').DataTable({
$('#must-time').text(json.time.must);
$('#holidays').text(json.time.holidays);
$('#plushours').text(json.time.plushours);
if (json.time.AllHours>0) {
$('#AllHours-div').show();
$('#AllHours').text(json.time.AllHours);
}
if ($("#plushours").text().includes("-")) {
$('#plushours-label').css('background-color', '#fda7a7');
} else {