<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Dashboard_model extends Ci_Model
{

    public function __construct()
    {
        parent::__construct();
    }
    
    function getclaims($company_id) {
        $sql = "SET SQL_BIG_SELECTS=1";
		$this->db->query($sql);

		$where = array(
            'admin_id'		=> $company_id,
        );
        

		$query = $this->db
            ->select("ca.message as message
					",FALSE)
			->from("claim_alert ca")
			->join("claims AS c","c.refno=ca.refno","left")
			->where($where)
			->order_by('c.date_added DESC')
			->get();
			//echo $this->db->last_query();
			if(!$query) return false;
			if($query->num_rows()>0) return $query->result();
			else return false;
    }

    function getdocus($refno) {
        $sql = "SET SQL_BIG_SELECTS=1";
		$this->db->query($sql);

		$where = array(
            'refno'		=> $refno,
        );
        

		$query = $this->db
            ->select("cd_id as id, dt.type as doc
					",FALSE)
            ->from("claim_docus cd")
            ->join("doc_types AS dt","cd.doc_id=dt.id","left")
			->where($where)
			->order_by('dt.id ASC')
			->get();
			//echo $this->db->last_query();
			if(!$query) return false;
			if($query->num_rows()>0) return $query->result();
			else return false;
    }

}
