$result=$this->db->query("SELECT SUM(`quantity`) as count FROM `orders` WHERE status IN('2,3,4,5')")->row();
if($this->session->userdata('user_type')==1){
$result=$this->db->query("SELECT SUM(`quantity`) as count FROM `orders` WHERE status IN('2,3,4,5')")->row();
}else{
$id=$this->session->userdata('id');
$result=$this->db->query("SELECT SUM(`quantity`) as count FROM `orders` INNER JOIN products ON products.product_id = orders.product_id WHERE orders.status IN('2,3,4,5') AND products.created_by='$id'")->row();
$this->db->select("BUK.scheduled_date as date,BUK.scheduled_time as time,BUK.booking_id as service_id,CSTVEH.car_name,BUK.mileage,BUK.issues_selected,BUK.custom_issue_data,BUK.service_type as type,MCHBUK.amount as total_amount,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,CUST.phone as phone_number,CSTVEH.vehicle_data");
$this->db->select("BUK.scheduled_date as date,BUK.scheduled_time as time,BUK.booking_id as service_id,BUK.status,CSTVEH.car_name,BUK.mileage,BUK.issues_selected,BUK.custom_issue_data,BUK.service_type as type,MCHBUK.amount as total_amount,TRIM(CONCAT(CUST.first_name,' ' ,IFNULL(CUST.last_name,''))) as customer_name,CUST.phone as phone_number,CSTVEH.vehicle_data");
$this->db->from('bookings as BUK');
$this->db->from('bookings as BUK');
$this->db->join('customers as CUST','CUST.customer_id = BUK.customer_id');
$this->db->join('customers as CUST','CUST.customer_id = BUK.customer_id');
$this->db->join('customer_vehicle as CSTVEH','CSTVEH.customer_veh_id = BUK.customer_veh_id');
$this->db->join('customer_vehicle as CSTVEH','CSTVEH.customer_veh_id = BUK.customer_veh_id');
...
@@ -183,7 +177,7 @@ public function start_service($postData = array(),$type = 0){
...
@@ -183,7 +177,7 @@ public function start_service($postData = array(),$type = 0){