bbone/application/modules/Dashboard/models/Dashboard_model.php
2023-01-13 10:28:44 +05:30

78 lines
2.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;
}
}