CIM77 - Service reports alleen laatste 5

This commit is contained in:
“VeLiTi”
2024-05-16 15:56:20 +02:00
parent 7612073a5f
commit e4cc9f4ef3
6 changed files with 50 additions and 11 deletions

View File

@@ -119,9 +119,26 @@ elseif (isset($criterias['totals']) && $criterias['totals'] =='' && isset($crite
//Request for total rows for history reports
$sql ='SELECT count(*) as count from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.'';
}
elseif (isset($criterias['history']) && $criterias['history'] ==''){
elseif (isset($criterias['history']) && $criterias['history'] != ''){
//History INDICATOR
/*
0 Show All
1 Created DESC, LIMIT 5
*/
switch ($criterias['history']) {
case 1:
$sort = ' ORDER BY h.created DESC LIMIT 0,'.$page_rows_equipment_servicereporst;
break;
default:
$sort = '';
break;
}
//request history
$sql ='SELECT h.rowID as historyID, e.rowID as equipmentID, h.equipmentid as h_equipmentid, e.serialnumber, h.type, h.description, h.created, h.createdby from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.'';
$sql ='SELECT h.rowID as historyID, e.rowID as equipmentID, h.equipmentid as h_equipmentid, e.serialnumber, h.type, h.description, h.created, h.createdby from history h LEFT JOIN equipment e ON h.equipmentid = e.rowID '.$whereclause.$sort;
}
else {
// GET SORT INDICATOR
@@ -205,6 +222,14 @@ if (!empty($criterias)){
}
}
}
//------------------------------------------
// Debuglog
//------------------------------------------
if (debug){
$message = $date.';'.$sql.';'.$username;
debuglog($message);
}
//------------------------------------------
//Add paging details
//------------------------------------------
@@ -213,7 +238,7 @@ if(isset($criterias['totals']) && $criterias['totals']==''){
$messages = $stmt->fetch();
$messages = $messages[0];
}
elseif ((isset($criterias['history']) && $criterias['history'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){
elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['download']) && $criterias['download'] =='')){
//Excute Query
$stmt->execute();
//Get results