policybot/application/models/Dashboard_model.php

119 lines
3.3 KiB
PHP
Raw Permalink Normal View History

2021-11-30 10:56:55 +00:00
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Dashboard_model extends CI_Model {
public function __construct() {
parent::__construct();
}
function get_quotes()
{
$this->db->select('count(id) as quotecount');
$this->db->from('quotes');
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_request()
{
$this->db->select('count(id) as requestcount');
$this->db->from('quotes');
$this->db->where("status",0);
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_response()
{
$this->db->distinct();
$this->db->select('quote_id');
$this->db->from('quote_response');
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_onboard()
{
$this->db->select('count(id) as oncount');
$this->db->from('quotes');
$this->db->where(array('status!='=>2));
$this->db->where(array('status!='=>0));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_completed()
{
$this->db->select('count(id) as comcount');
$this->db->from('quotes');
$this->db->where(array('status'=>2));
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_quotes_details()
{
$this->db->select('a.*,b.name as policyname,b.permalink,b.category');
$this->db->from('quotes as a');
$this->db->join('policies as b','b.id=a.policy_id','inner');
$this->db->where(array('a.policy_id!='=>0));
$this->db->order_by('a.id','desc');
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_request_details()
{
$this->db->select('a.*,b.name as policyname,b.permalink,b.category');
$this->db->from('quotes as a');
$this->db->join('policies as b','b.id=a.policy_id','inner');
$this->db->where(array('a.policy_id!='=>0,'a.status'=>0));
$this->db->order_by('a.id','desc');
$query = $this->db->get();
//echo $this->db->last_query();exit;
return $query;
}
function get_onboard_details()
{
$this->db->select('a.*,b.name as policyname,b.permalink,b.category');
$this->db->from('quotes as a');
$this->db->join('policies as b','b.id=a.policy_id','inner');
$this->db->where(array('a.status!='=>2));
$this->db->where(array('a.status!='=>0));
$this->db->order_by('a.id','desc');
$query = $this->db->get();
// echo $this->db->last_query();exit;
return $query;
}
function get_response_details()
{
$this->db->select('a.*,b.name as policyname,b.permalink,b.category,qr.mobile,qr.email,qr.message');
$this->db->from('quotes as a');
$this->db->join('quote_response as qr','qr.quote_id=a.id','inner');
$this->db->join('policies as b','b.id=a.policy_id','inner');
$this->db->order_by('a.id','desc');
$query = $this->db->get();
// echo $this->db->last_query();exit;
return $query;
}
function get_complete_details()
{
$this->db->select('a.*,b.name as policyname,b.permalink,b.category');
$this->db->from('quotes as a');
$this->db->join('policies as b','b.id=a.policy_id','inner');
$this->db->where(array('a.status'=>2));
$this->db->order_by('a.id','desc');
$query = $this->db->get();
// echo $this->db->last_query();exit;
return $query;
}
}