%PDF- %PDF-
Direktori : /home/ugotscom/www/Mantra/application/modules/chart/models/ |
Current File : /home/ugotscom/www/Mantra/application/modules/chart/models/Chart_model.php |
<?php /** * */ class Chart_model extends CI_Model { public function getPersonas(){ $this->db->select('name,user_id'); $this->db->from('users'); $query = $this->db->get(); return $query->result(); } // $query = $this->db->query("SELECT COUNT(id) as count,MONTHNAME(created_at) as month_name FROM users WHERE YEAR(created_at) = '" . date('Y') . "' //GROUP BY YEAR(created_at),MONTH(created_at)"); public function totalno(){ $this->db->select('issues,COUNT(issues) as total'); $this->db->from('sa_feedback_latest'); $this->db->where('questions',16); $this->db->group_by('issues'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); return $query->result(); } public function enquirytotal(){ $branch_id =$_SESSION['branch_id']; $this->db->select('answer,COUNT(answer) as total'); $this->db->from('sa_feedback_latest'); $this->db->where('questions',12); //$this->db->where('shopid',12); $this->db->group_by('answer'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); $row = $query->result_array(); return $row; } public function leadsstatus(){ // $query = $this->db->query("SELECT COUNT(id) as count,MONTHNAME(created_at) as month_name FROM users WHERE YEAR(created_at) = '" . date('Y') . "' // GROUP BY YEAR(created_at),MONTH(created_at)"); $branch_id =$_SESSION['branch_id']; $this->db->select('leads.lead_type_id,lead_type.Lead_type, COUNT(leads.lead_type_id) as total'); $this->db->from('leads'); $this->db->join('lead_type',"lead_type.lead_type_id=leads.lead_type_id","left"); $this->db->where('leads.branch_id',$branch_id); $this->db->group_by('MONTH(added_date), YEAR(added_date)'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); $row = $query->result_array(); return $row; } public function closedno(){ $branch_id =$_SESSION['branch_id']; $this->db->select('leads.added_by,leads.branch_id,leads.lead_type_id,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.lead_type_id',4); $this->db->where('leads.branch_id',$branch_id); $this->db->group_by('added_by'); $this->db->order_by('total', 'desc'); $query = $this->db->get(); return $query->result(); } }