<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Count_sheet extends CI_Model{

	//Get location wise item list
	public function get_loc_items($compID,$locID = ''){
		
		
		if($locID != ''){
			$query = $this->db->select('i.itemCode,i.name as itemName,um.desc as UOM,i.quantity')
					->from('item as i')
					->join('_sys_um as um','um.fldid = i.unitOfMeasureID','left')
					->where(array('companyID'=>$compID,'locationID'=>$locID))
					->get();
		}else{
			$query = $this->db->select('i.itemCode,i.name as itemName,um.desc as UOM,i.quantity')
					->from('item as i')
					->join('_sys_um as um','um.fldid = i.unitOfMeasureID','left')
					->where(array('companyID'=>$compID))
					->get();
		}
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return false;	
		}
	}
}