%PDF- %PDF-
Direktori : /home/ugotscom/public_html/dg/application/modules/bdashboard/models/ |
Current File : /home/ugotscom/public_html/dg/application/modules/bdashboard/models/Bdashboard_model1.php |
<?php class Bdashboard_model extends CI_Model{ public function get_count() { $branch_id =$_SESSION['branch_id']; $this->db->select('*'); $this->db->from('leads'); $this->db->where('branch_id',$branch_id); $query = $this->db->get(); return $query->num_rows(); } public function hot_leads() { $branch_id =$_SESSION['branch_id']; $this->db->select('*'); $this->db->from('leads'); $this->db->where('lead_type_id',1); $this->db->where('branch_id',$branch_id); $query = $this->db->get(); return $query->num_rows(); } public function closed_leads() { $branch_id =$_SESSION['branch_id']; $this->db->select('*'); $this->db->from('leads'); $this->db->where('lead_type_id',4); $this->db->where('branch_id',$branch_id); $query = $this->db->get(); return $query->num_rows(); } public function todaysfollowup() { $branch_id =$_SESSION['branch_id']; $today = date("Y-m-d"); $this->db->select('*'); $this->db->from('leads'); $this->db->where('followup_date',$today); $this->db->where('branch_id',$branch_id); $query = $this->db->get(); return $query->num_rows(); } public function totalno(){ $branch_id =$_SESSION['branch_id']; $this->db->select('leads.added_by,users.name, COUNT(added_by) as total'); $this->db->from('leads'); $this->db->join('users',"users.user_id=leads.added_by","left"); $this->db->where('leads.branch_id',$branch_id); $this->db->group_by('added_by'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); $row = $query->result_array(); return $row; } public function closedtotalno(){ $branch_id =$_SESSION['branch_id']; $this->db->select('leads.added_by,users.name, COUNT(added_by) as total'); $this->db->from('leads'); $this->db->join('users',"users.user_id=leads.added_by","left"); $this->db->where('leads.branch_id',$branch_id); $this->db->where('leads.lead_type_id',4); $this->db->group_by('added_by'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); $row = $query->result_array(); return $row; } public function enquirytotal(){ $branch_id =$_SESSION['branch_id']; $this->db->select('leads.enquiry_source,enquiry_source.source, COUNT(enquiry_source) as total'); $this->db->from('leads'); $this->db->join('enquiry_source',"enquiry_source.enquiry_id=leads.enquiry_source","left"); $this->db->where('leads.branch_id',$branch_id); $this->db->group_by('enquiry_source'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); $row = $query->result_array(); return $row; } }