Usage_reporting
This commit is contained in:
@@ -151,9 +151,34 @@ switch ($action) {
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
case 'report_usage_servicereports':
|
||||
$sql = 'SELECT YEAR(h.created) AS year, QUARTER(h.created) AS quarter, MONTH(h.created) as month, count(h.rowID) AS count FROM history h LEFT JOIN equipment e ON h.equipmentid = e.rowID where h.type = "ServiceReport" AND NOT e.productrowid = "31" GROUP BY YEAR(h.created), QUARTER(h.created), MONTH(h.created)';
|
||||
break;
|
||||
|
||||
case 'report_usage_firmware':
|
||||
$sql = 'SELECT YEAR(h.created) AS year,QUARTER(h.created) AS quarter, MONTH(h.created) as month, count(h.rowID) AS count FROM history h LEFT JOIN equipment e ON h.equipmentid=e.rowID where h.type="Firmware" AND NOT e.productrowid="31" GROUP BY YEAR(h.created),QUARTER(h.created), MONTH(h.created)';
|
||||
break;
|
||||
|
||||
case 'report_usage_warranty':
|
||||
$sql = 'SELECT YEAR(h.created) AS year, QUARTER(h.created) AS quarter, MONTH(h.created) as month, count(h.rowID) AS count FROM history h LEFT JOIN equipment e ON h.equipmentid = e.rowID where h.type = "Warranty" AND NOT e.productrowid = "31" GROUP BY YEAR(h.created), QUARTER(h.created), MONTH(h.created)';
|
||||
break;
|
||||
|
||||
case 'report_usage_other':
|
||||
$sql = 'SELECT YEAR(h.created) AS year, QUARTER(h.created) AS quarter, MONTH(h.created) as month, count(h.rowID) AS count FROM history h LEFT JOIN equipment e ON h.equipmentid = e.rowID where NOT h.type = "Warranty" OR NOT h.type = "Firmware" OR NOT h.type = "ServiceReport" GROUP BY YEAR(h.created), QUARTER(h.created), MONTH(h.created)';
|
||||
break;
|
||||
|
||||
case 'report_usage_equipment':
|
||||
$sql = 'SELECT YEAR(created) AS year, QUARTER(created) AS quarter, MONTH(created) as month, count(rowID) AS count FROM equipment GROUP BY YEAR(created), QUARTER(created), MONTH(created)';
|
||||
break;
|
||||
|
||||
case 'report_usage_changes':
|
||||
$sql = 'SELECT YEAR(created) AS year, QUARTER(created) AS quarter, MONTH(created) as month, count(rowID) AS count FROM changelog GROUP BY YEAR(created), QUARTER(created), MONTH(created)';
|
||||
break;
|
||||
|
||||
case 'report_usage_users':
|
||||
$sql = 'SELECT YEAR(created) AS year, QUARTER(created) AS quarter, MONTH(created) as month, count(id) AS count FROM users WHERE NOT view = "3" GROUP BY YEAR(created), QUARTER(created), MONTH(created)';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
@@ -192,20 +217,11 @@ switch ($action) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'serviceforecast':
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
break;
|
||||
|
||||
case 'warrantyforecast':
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
break;
|
||||
|
||||
case 'geolocation':
|
||||
default:
|
||||
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------
|
||||
//Encrypt results
|
||||
//------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user