%PDF- %PDF-
Direktori : /home/ugotscom/public_html/dg/application/modules/target/models/ |
Current File : /home/ugotscom/public_html/dg/application/modules/target/models/Sales_model - Copy (2).php |
<?php class Sales_model extends CI_Model{ public function get_count($date1,$date2) { $this->db->select('*'); $this->db->from('leads'); $this->db->where('DATE(added_date)>=',$date1); $this->db->where('DATE(added_date)<=',$date1); $query = $this->db->get(); return $query->num_rows(); } public function hot_leads($date1,$date2) { $this->db->select('*'); $this->db->from('leads'); $this->db->where('DATE(added_date)>=',$date1); $this->db->where('DATE(added_date)<=',$date1); $this->db->where('lead_type_id',1); $query = $this->db->get(); return $query->num_rows(); } public function closed_leads($date1,$date2) { $date = new DateTime("now"); $curr_date = $date->format('Y-m-d '); $this->db->select('*'); $this->db->from('leads'); $this->db->where('DATE(added_date)>=',$date1); $this->db->where('DATE(added_date)<=',$date1); $this->db->where('lead_type_id',4); $query = $this->db->get(); return $query->num_rows(); } public function totalno($date1,$date2){ $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($date1,$date2){ $date = new DateTime("now"); $curr_date = $date->format('Y-m-d '); $this->db->select('added_by, COUNT(added_by) as total'); $this->db->from('leads'); $this->db->where('DATE(added_date)>=',$date1); $this->db->where('DATE(added_date)<=',$date1); $this->db->where('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($date1,$date2){ $this->db->select('enquiry_source, COUNT(enquiry_source) as total'); $this->db->from('leads'); $this->db->where('DATE(added_date)>=',$date1); $this->db->where('DATE(added_date)<=',$date1); $this->db->group_by('enquiry_source'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); $row = $query->result_array(); return $row; } public function get_salescount($date1,$date2) { $this->db->select('*'); $this->db->from('leads'); $this->db->where('DATE(added_date)>=',$date1); $this->db->where('DATE(added_date)<=',$date1); $query = $this->db->get(); return $query->num_rows(); } }