CMXX - Healthindex. Added healthindex flag to product to include and exclude products from healthindex
This commit is contained in:
@@ -121,8 +121,61 @@ if (isset($criterias['totals']) && $criterias['totals'] ==''){
|
||||
$sql = 'SELECT count(*) as count FROM products p JOIN equipment e ON p.rowID = e.productrowid JOIN equipment_data ed1 ON e.rowID = ed1.equipmentid LEFT JOIN equipment_data ed2 ON (ed1.equipmentid = ed2.equipmentid AND ed1.rowID < ed2.rowID) '.$whereclause.' AND ed2.rowID IS NULL';
|
||||
}
|
||||
else {
|
||||
|
||||
// GET SORT INDICATOR
|
||||
$sort_indicator = $criterias['sort'] ?? '';
|
||||
|
||||
/*
|
||||
1 accounthierarchy ASC
|
||||
2 accounthierarchy DESC
|
||||
3 Status ASC
|
||||
4 Status DESC
|
||||
5 Warranty ASC
|
||||
6 Warranty DESC
|
||||
7 Service ASC
|
||||
8 Service DESC
|
||||
9 Healthindex ASC
|
||||
10 Healthindex DESC
|
||||
*/
|
||||
|
||||
switch ($sort_indicator){
|
||||
case 1:
|
||||
$sort = ' e.accounthierarchy ASC ';
|
||||
break;
|
||||
case 2:
|
||||
$sort = ' e.accounthierarchy DESC ';
|
||||
break;
|
||||
case 3:
|
||||
$sort = ' e.status ASC ';
|
||||
break;
|
||||
case 4:
|
||||
$sort = ' e.status DESC ';
|
||||
break;
|
||||
case 5:
|
||||
$sort = ' e.warranty_date ASC ';
|
||||
break;
|
||||
case 6:
|
||||
$sort = ' e.warranty_date DESC ';
|
||||
break;
|
||||
case 7:
|
||||
$sort = ' e.service_date ASC ';
|
||||
break;
|
||||
case 8:
|
||||
$sort = ' e.service_date DESC ';
|
||||
break;
|
||||
case 9:
|
||||
$sort = ' ed1.healthindex DESC ';
|
||||
break;
|
||||
case 10:
|
||||
$sort = ' ed1.healthindex ASC ';
|
||||
break;
|
||||
default:
|
||||
$sort = ' e.accounthierarchy ';
|
||||
break;
|
||||
}
|
||||
|
||||
//SQL for Paging
|
||||
$sql ='SELECT p.productcode,p.productname,e.productrowid,e.created,e.status,e.accounthierarchy,e.serialnumber,e.hw_version,e.sw_version,e.service_date,e.warranty_date, e.order_ref,e.geolocation, ed1.* FROM products p JOIN equipment e ON p.rowID = e.productrowid JOIN equipment_data ed1 ON e.rowID = ed1.equipmentid LEFT JOIN equipment_data ed2 ON (ed1.equipmentid = ed2.equipmentid AND ed1.rowID < ed2.rowID) '.$whereclause.' AND ed2.rowID IS NULL ORDER BY e.accounthierarchy LIMIT :page,:num_products';
|
||||
$sql ='SELECT p.productcode,p.productname,e.productrowid,e.created,e.status,e.accounthierarchy,e.serialnumber,e.hw_version,e.sw_version,e.service_date,e.warranty_date, e.order_ref,e.geolocation, ed1.* FROM products p JOIN equipment e ON p.rowID = e.productrowid JOIN equipment_data ed1 ON e.rowID = ed1.equipmentid LEFT JOIN equipment_data ed2 ON (ed1.equipmentid = ed2.equipmentid AND ed1.rowID < ed2.rowID) '.$whereclause.' AND ed2.rowID IS NULL ORDER BY '.$sort.' LIMIT :page,:num_products';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
Reference in New Issue
Block a user