diff --git a/Layout/default/Timerecording/Index.php b/Layout/default/Timerecording/Index.php
index d4bbd8b9c..7a96f9097 100644
--- a/Layout/default/Timerecording/Index.php
+++ b/Layout/default/Timerecording/Index.php
@@ -95,6 +95,10 @@ $mindate = date("Y-m-d", strtotime("+ 1 Month", $closedmonth));
.holiday-text {
color: #d70000;
}
+ .height-unset
+ {
+ height: unset;
+ }
@@ -314,16 +318,12 @@ $mindate = date("Y-m-d", strtotime("+ 1 Month", $closedmonth));
@@ -332,19 +332,32 @@ $mindate = date("Y-m-d", strtotime("+ 1 Month", $closedmonth));
+
+
diff --git a/application/Timerecording/TimerecordingController.php b/application/Timerecording/TimerecordingController.php
index db4bcde7e..e1446ab49 100644
--- a/application/Timerecording/TimerecordingController.php
+++ b/application/Timerecording/TimerecordingController.php
@@ -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;
diff --git a/application/Timerecording/TimerecordingModel.php b/application/Timerecording/TimerecordingModel.php
index 1d7b16a17..b942f640e 100644
--- a/application/Timerecording/TimerecordingModel.php
+++ b/application/Timerecording/TimerecordingModel.php
@@ -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()
{
diff --git a/public/js/pages/timerecording/index.js b/public/js/pages/timerecording/index.js
index 8bebe8264..e159e2480 100644
--- a/public/js/pages/timerecording/index.js
+++ b/public/js/pages/timerecording/index.js
@@ -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 {