Zeiterfassung Update
* Gesammtsumme bei Admin Only Mitarbeitern einfeführt
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user