MINI Sh3ll
<?php
class report {
private $objdb;
public function __construct(){
$this->objdb=new database;
return true;
}
function getOrderSummary($user_id, $usertype){
if($user_id == '') return false;
$sql = "SELECT SUM(case when o.`status` = 0 then 1 ELSE 0 END) pending_orders,
SUM(case when o.`status` = 1 then 1 ELSE 0 END) processed_orders,
SUM(case when o.`status` = 2 then 1 ELSE 0 END) cancelled_orders,
COUNT(o.id) total_orders
FROM orders o
WHERE o.`status` IN (0,1,2)";
if($usertype == 'USER')
$sql .= " and o.user_id = '".$user_id."'";
$sql .= " limit 1";
//x($sql);
$result = $this->objdb->get_records($sql);
if($result == false)
return false;
else
return $result[0];
}
function getActiveProductsCount(){
$sql = "SELECT COUNT(p.id) active_products FROM products p WHERE p.`status` = 1";
//x($sql);
$result = $this->objdb->get_records($sql);
if($result == false)
return false;
else
return $result[0]['active_products'];
}
}
?>
OHA YOOOO