%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/ugotscom/public_html/dg/application/modules/agent/models/
Upload File :
Create Path :
Current File : /home/ugotscom/public_html/dg/application/modules/agent/models/Agent_model.php

<?php
class Agent_model extends CI_Model{


 public function todayget_count() {
$branch_id =$_SESSION['branch_id'];	
$today = date("Y-m-d");
$this->db->select('*');
$this->db->from('leads');
$this->db->where('branch_id',$branch_id);
$this->db->where('DATE(added_date)',$today);
$query = $this->db->get();  
return $query->num_rows();
         
    }
 public function todayhot_leads() {
 	$branch_id =$_SESSION['branch_id'];	
$today = date("Y-m-d");
$this->db->select('*');
$this->db->from('leads');
$this->db->where('lead_type_id',1);
$this->db->where('branch_id',$branch_id);
$this->db->where('DATE(added_date)',$today);
$query = $this->db->get();  
return $query->num_rows();
         
    }
 public function todaywarm_leads() {
 	$branch_id =$_SESSION['branch_id'];	
$today = date("Y-m-d");
$this->db->select('*');
$this->db->from('leads');
$this->db->where('lead_type_id',2);
$this->db->where('branch_id',$branch_id);
$this->db->where('DATE(added_date)',$today);
$query = $this->db->get();  
return $query->num_rows();
         
    }
     public function todayclosed_leads() {
 	$branch_id =$_SESSION['branch_id'];	
$today = date("Y-m-d");
$this->db->select('*');
$this->db->from('leads');
$this->db->where('lead_type_id',4);
$this->db->where('branch_id',$branch_id);
$this->db->where('DATE(added_date)',$today);
$query = $this->db->get();  
return $query->num_rows();
         
    }

 public function get_count($user_id,$searchdate) {
$this->db->select('*');
$this->db->from('leads');
$this->db->where('added_by',$user_id);
 $this->db->where('DATE(added_date)',$searchdate);
$query = $this->db->get();  
return $query->num_rows();
         
    }

 public function hot_leads($user_id,$searchdate) {
$this->db->select('*');
$this->db->from('leads');
$this->db->where('lead_type_id',1);
$this->db->where('added_by',$user_id);
 $this->db->where('DATE(added_date)',$searchdate);
$query = $this->db->get();  
return $query->num_rows();
         
    }
     public function warm_leads($user_id,$searchdate) {
$this->db->select('*');
$this->db->from('leads');
$this->db->where('lead_type_id',2);
$this->db->where('added_by',$user_id);
 $this->db->where('DATE(added_date)',$searchdate);
$query = $this->db->get();  
return $query->num_rows();
         
    }
 public function closed_leads($user_id,$searchdate) {
$this->db->select('*');
$this->db->from('leads');
$this->db->where('lead_type_id',4);
$this->db->where('added_by',$user_id);
 $this->db->where('DATE(added_date)',$searchdate);
$query = $this->db->get();  
return $query->num_rows();
         
    }

 public function todaysfollowup() {
$user_id=$_SESSION['user_id'];
$today = date("Y-m-d");
$this->db->select('*');
$this->db->from('leads');
$this->db->where('followup_date',$today);
$this->db->where('added_by',$user_id);
$query = $this->db->get();  
return $query->num_rows();
         
    }



public function totalno(){
 $branch_id =$_SESSION['branch_id'];
 $today = date("Y-m-d");
 $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.added_date',$today);
 $this->db->group_by('added_by'); 
 $this->db->order_by('total', 'desc'); 
 $query = $this->db->get();
 $row = $query->result_array();
 return $row;
 print_r($row);
 exit();
 return $row;		

}
public function closedtotalno(){
 $this->db->select('added_by, COUNT(added_by) as total');
 $this->db->from('leads');
 $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(){
 $this->db->select('enquiry_source, COUNT(enquiry_source) as total');
 $this->db->from('leads');
 $this->db->group_by('enquiry_source'); 
 $this->db->order_by('total', 'desc'); 
 $query = $this->db->get();
 $row = $query->result_array();
 return $row;	

}



  function get_salesdetails($user_id,$searchdate) {
   $this->db->select('leads.lead_id,leads.customer_name,leads.enquiry_source,leads.added_by,leads.added_date,leads.remarks,lead_type.Lead_type');
       $this->db->from('leads');
       $this->db->join('lead_type',"lead_type.lead_type_id=leads.lead_type_id","left");
       $this->db->where('added_by',$user_id);
       $this->db->where('DATE(added_date)',$searchdate);
     $query = $this->db->get();
     $row = $query->result_array();

	return $row;	
   
  }


 function get_users(){
      $result=$this->db->get('users');
      return $result;

  }
      function get_location(){
      $result=$this->db->get('locations');
      return $result;
  }
}

Zerion Mini Shell 1.0