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';
|
$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 {
|
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 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);
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|||||||
@@ -2250,7 +2250,7 @@ function traintotalMeasurement(){
|
|||||||
$pdo = dbConnect($dbname);
|
$pdo = dbConnect($dbname);
|
||||||
|
|
||||||
//GET DATA
|
//GET DATA
|
||||||
$sql = 'SELECT h.rowID, h.description,h.equipmentid,p.productcode,e.hw_version FROM history h JOIN equipment e ON h.equipmentid = e.rowID JOIN products p ON e.productrowid = p.rowID where type="Maintenance_Test" and description like "%doubletestvalues%"';
|
$sql = 'SELECT h.rowID, h.description,h.equipmentid,p.productcode,e.hw_version FROM history h JOIN equipment e ON h.equipmentid = e.rowID JOIN products p ON e.productrowid = p.rowID where p.healthindex = 1 and h.type="Maintenance_Test" and h.description like "%doubletestvalues%"';
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
@@ -2465,7 +2465,7 @@ function storeMeasurementProduct($total_results, $token){
|
|||||||
|
|
||||||
//Version level
|
//Version level
|
||||||
//Check version exist
|
//Check version exist
|
||||||
$sql = 'SELECT p.*, pv.rowID as versionID, pv.productrowid as productID FROM products p JOIN products_versions pv ON p.rowID = pv.productrowid WHERE p.productcode = ? and version = ?;';
|
$sql = 'SELECT p.*, pv.rowID as versionID, pv.productrowid as productID FROM products p JOIN products_versions pv ON p.rowID = pv.productrowid WHERE p.healthindex = 1 and p.productcode = ? and version = ?;';
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$versions = ($versions != 'blank')? $versions : '';
|
$versions = ($versions != 'blank')? $versions : '';
|
||||||
$stmt->execute([$products,$versions]);
|
$stmt->execute([$products,$versions]);
|
||||||
|
|||||||
@@ -210,6 +210,10 @@ $view .= '<div class="content-block">
|
|||||||
<td style="width:25%;">'.$product_build.'</td>
|
<td style="width:25%;">'.$product_build.'</td>
|
||||||
<td>'.(($responses->build == 1)? $enabled : $disabled).'</td>
|
<td>'.(($responses->build == 1)? $enabled : $disabled).'</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="width:25%;">'.$view_asset_data_ranking.'</td>
|
||||||
|
<td>'.(($responses->healthindex == 1)? $enabled : $disabled).'</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ $product = [
|
|||||||
'status' => 1,
|
'status' => 1,
|
||||||
'build' => 1,
|
'build' => 1,
|
||||||
'partnerhierarchy' => '',
|
'partnerhierarchy' => '',
|
||||||
'sn' =>''
|
'sn' =>'',
|
||||||
|
'healthindex' =>''
|
||||||
];
|
];
|
||||||
|
|
||||||
if (isset($_GET['id'])) {
|
if (isset($_GET['id'])) {
|
||||||
@@ -185,6 +186,11 @@ $view .= '<div class="content-block tab-content">
|
|||||||
<option value="1" '.($product['salesflag']==1?' selected':'').'>'.$enabled.'</option>
|
<option value="1" '.($product['salesflag']==1?' selected':'').'>'.$enabled.'</option>
|
||||||
<option value="0" '.($product['salesflag']==0?' selected':'').'>'.$disabled.'</option>
|
<option value="0" '.($product['salesflag']==0?' selected':'').'>'.$disabled.'</option>
|
||||||
</select>
|
</select>
|
||||||
|
<label for="sales">'.$view_asset_data_ranking.'</label>
|
||||||
|
<select id="status" name="healthindex">
|
||||||
|
<option value="1" '.($product['healthindex']==1?' selected':'').'>'.$enabled.'</option>
|
||||||
|
<option value="0" '.($product['healthindex']==0?' selected':'').'>'.$disabled.'</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,25 @@ $view .= '
|
|||||||
<button type="submit">'.$button_apply.'</button>
|
<button type="submit">'.$button_apply.'</button>
|
||||||
<a class="cancel_link" style="color: #FFFFFF;text-decoration: none;" href="index.php?page=report_healthindex">'.$general_filters_clear.'</a>
|
<a class="cancel_link" style="color: #FFFFFF;text-decoration: none;" href="index.php?page=report_healthindex">'.$general_filters_clear.'</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sort">
|
||||||
|
<a href="#"><i class="fa-solid fa-sort"></i>'.$general_sort.'</a>
|
||||||
|
<div class="list">
|
||||||
|
<select name="sort">
|
||||||
|
<option value="" disabled selected>'.$general_sort.'</option>
|
||||||
|
<option value="1"'.($sort==1?' selected':'').'>'.$equipment_label2.' '.$general_sort_type_1.'</option>
|
||||||
|
<option value="2"'.($sort==2?' selected':'').'>'.$equipment_label2.' '.$general_sort_type_2.'</option>
|
||||||
|
<option value="3"'.($sort==3?' selected':'').'>'.$equipment_label3.' '.$general_sort_type_1.'</option>
|
||||||
|
<option value="4"'.($sort==4?' selected':'').'>'.$equipment_label3.' '.$general_sort_type_2.'</option>
|
||||||
|
<option value="5"'.($sort==5?' selected':'').'>'.$warranty_status.' '.$general_sort_type_1.'</option>
|
||||||
|
<option value="6"'.($sort==6?' selected':'').'>'.$warranty_status.' '.$general_sort_type_2.'</option>
|
||||||
|
<option value="7"'.($sort==7?' selected':'').'>'.$service_status.' '.$general_sort_type_1.'</option>
|
||||||
|
<option value="8"'.($sort==8?' selected':'').'>'.$service_status.' '.$general_sort_type_2.'</option>
|
||||||
|
<option value="9"'.($sort==9?' selected':'').'>'.$view_asset_data_ranking .' '.$general_sort_type_2.'</option>
|
||||||
|
<option value="10"'.($sort==10?' selected':'').'>'.$view_asset_data_ranking .' '.$general_sort_type_1.'</option>
|
||||||
|
</select>
|
||||||
|
<button type="submit">'.$button_apply.'</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|||||||
@@ -2,19 +2,19 @@
|
|||||||
/*Standard*/
|
/*Standard*/
|
||||||
define('standard_profile','dashboard,profile,equipments,equipment,histories,history,firmwaretool,servicereports,servicereport,application');
|
define('standard_profile','dashboard,profile,equipments,equipment,histories,history,firmwaretool,servicereports,servicereport,application');
|
||||||
/*Superuser*/
|
/*Superuser*/
|
||||||
define('superuser_profile','dashboard,profile,sales,contracts,contract,contract_manage,assets,equipments,equipment,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,marketing,application');
|
define('superuser_profile','dashboard,profile,assets,equipments,equipment,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,marketing,application');
|
||||||
/*Service*/
|
/*Service*/
|
||||||
define('service','dashboard,profile,assets,equipments,equipment,equipment_manage,histories,history,history_manage,firmwaretool,servicereports,servicereport,admin,partners,partner,marketing,application');
|
define('service','dashboard,profile,assets,equipments,equipment,equipment_manage,histories,history,history_manage,firmwaretool,servicereports,servicereport,admin,partners,partner,marketing,application');
|
||||||
/*Admin*/
|
/*Admin*/
|
||||||
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,report_usage,application');
|
define('admin_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,application');
|
||||||
/*AdminPlus*/
|
/*AdminPlus*/
|
||||||
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,report_usage,config,settings,logfile,changelog,language,application,maintenance,profiles');
|
define('adminplus_profile','dashboard,profile,buildtool,sales,accounts,account,contracts,contract,contract_manage,cartests,cartest,cartest_manage,assets,equipments,equipment,equipment_healthindex,equipment_data,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,buildtool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,communications,communication,communication_send,marketing,reporting,report_build,report_healthindex,report_usage,config,settings,logfile,changelog,language,application,maintenance,profiles');
|
||||||
/*Build*/
|
/*Build*/
|
||||||
define('build','buildtool,buildtool,application');
|
define('build','buildtool,buildtool,application');
|
||||||
/*Distribution*/
|
/*Distribution*/
|
||||||
define('distribution','');
|
define('distribution','dashboard,profile,assets,equipments,equipment,equipment_manage,equipment_manage_edit,equipments_mass_update,histories,history,history_manage,firmwaretool,products,products_versions,product,product_manage,servicereports,servicereport,admin,partners,partner,users,user,user_manage,marketing,application');
|
||||||
/*Firmware*/
|
/*Firmware*/
|
||||||
define('firmware','firmwaretool,application');
|
define('firmware','firmwaretool,application');
|
||||||
/*Interface*/
|
/*Interface*/
|
||||||
define('interface','equipments,firmwaretool,products_versions,application');
|
define('interface','equipments,equipment_manage,firmwaretool,products_versions,application');
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user