127 lines
3.7 KiB
PHP
127 lines
3.7 KiB
PHP
<?php
|
|
|
|
class Tmc_model extends CI_Model {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
function get_user($con = null){
|
|
if($con)
|
|
$this->db->where($con);
|
|
return $this->db->get('users');
|
|
}
|
|
|
|
function get_corp($con=null,$c_id = null,$is_active = null){
|
|
if($c_id)
|
|
$con['c_id'] = $c_id;
|
|
if($is_active)
|
|
$con['c_isactive'] = 1;
|
|
return $this->db->get_where('corporates',$con);
|
|
}
|
|
|
|
function get_by_tmc($id)
|
|
{
|
|
$this->db->select();
|
|
$this->db->from('files');
|
|
$this->db->where('f_id', $id);
|
|
$query = $this->db->get();
|
|
$query = $query->result();
|
|
return $query;
|
|
}
|
|
|
|
public function get_tmc_count()
|
|
{
|
|
$this->db->select('SUM(td_tkt) as total_ticket , SUM(A.current_cost) as total_current_cost , categories.name as category_name ');
|
|
$this->db->group_by('A.category');
|
|
$this->db->from('asset A');
|
|
$this->db->where('A.business_id', $business_id);
|
|
$this->db->order_by('A.id','ASC');
|
|
$this->db->where('A.is_active', 1);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
//Tptal Inv received count
|
|
public function get_tmc_inv_count()
|
|
{
|
|
$this->db->select('inv_received');
|
|
$this->db->from('tmc_data');
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
//Inv received count
|
|
public function get_tmc_inv_received_count()
|
|
{
|
|
$this->db->select('inv_received');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('inv_received', 1);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
//Inv not count
|
|
public function get_tmc_inv_not_received_count()
|
|
{
|
|
$this->db->select('inv_received');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('inv_received', 0);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
//Inv par received count
|
|
public function get_tmc_inv_par_received_count()
|
|
{
|
|
$this->db->select('inv_received');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('inv_received', 2);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
public function get_inv_rec_1($from_date , $to_date)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('td_inv_date >=', $from_date);
|
|
$this->db->where('td_inv_date <=', $to_date);
|
|
$this->db->where('inv_received', 1);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
public function get_inv_rec_2($from_date , $to_date) //
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('td_inv_date >=', $from_date);
|
|
$this->db->where('td_inv_date <=', $to_date);
|
|
$this->db->where('inv_received', 2);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
public function total_count($from_date , $to_date)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('td_inv_date >=', $from_date);
|
|
$this->db->where('td_inv_date <=', $to_date);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
|
|
|
|
public function not_received_count($from_date , $to_date)
|
|
{
|
|
$this->db->select('*');
|
|
$this->db->from('tmc_data');
|
|
$this->db->where('td_inv_date >=', $from_date);
|
|
$this->db->where('td_inv_date <=', $to_date);
|
|
$this->db->where('inv_received', 0);
|
|
$query = $this->db->count_all_results();
|
|
return $query;
|
|
}
|
|
} |