<?php
class Temple_inventory_report_model extends CI_Model {
    
    function __construct() {
        parent::__construct();
        $this->temple = TBL_INV_TEMPLE;
    }
    
    public function list_type(){
        $this->db->where('status',1);
        return $this->db->get($this->temple)->result();
    }
    
    public function get_data($start_date='',$end_date='',$type=''){
        if(!empty($start_date) && !empty($end_date)) {
            $this->db->where('created_on >=',date('Y-m-d 00:00:00',strtotime($start_date)));
            $this->db->where('created_on <=',date('Y-m-d 23:59:59',strtotime($end_date)));
        } else {
            $this->db->where('created_on >=',date('Y-m-d 00:00:00'));
            $this->db->where('created_on <=',date('Y-m-d 23:59:59'));
        } 
        if(!empty($type)) {
            $this->db->where('type',$type);
        }
        return $this->db->get($this->temple)->result();
    }
}
?>


