bbone/application/modules/Dashboard/models/Dashboard_model.php
suseendhiran17 1bfb74c79c suseendhiran
2023-01-13 15:18:47 +05:30

112 lines
3.0 KiB
PHP

<?php
class Dashboard_model extends MY_Model {
public function get_assets_count($business_id)
{
$this->db->select();
$this->db->from('asset');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function get_users_count($business_id)
{
$this->db->select();
$this->db->from('users');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function get_amc_count($business_id)
{
$this->db->select();
$this->db->from('amc');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$this->db->where('type', 3);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function get_expired_amc_count($business_id)
{
$this->db->select();
$this->db->from('amc');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$this->db->where('type', 3);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function get_insurance_count($business_id)
{
$this->db->select();
$this->db->from('amc');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$this->db->where('type', 4);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function get_expired_insurance_count($business_id)
{
$this->db->select();
$this->db->from('amc');
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$this->db->where('type', 4);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function get_amc($business_id)
{
$this->db->select('a.* , asset.name as asset_name' );
$this->db->from('amc a');
$this->db->join('asset', 'asset.id=a.asset_id', 'left');
$this->db->where('a.business_id', $business_id);
$this->db->where('a.is_active', 1);
$this->db->where('a.type', 3);
$this->db->order_by('asset_id', "ASC");
$query = $this->db->get();
$query = $query->result();
return $query;
}
public function get_insurence($business_id)
{
$this->db->select('a.* , asset.name as asset_name' );
$this->db->from('amc a');
$this->db->join('asset', 'asset.id=a.asset_id', 'left');
$this->db->where('a.business_id', $business_id);
$this->db->where('a.is_active', 1);
$this->db->where('a.type', 4);
$this->db->order_by('asset_id', "ASC");
$query = $this->db->get();
$query = $query->result();
return $query;
}
}