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

class ItemDetails extends CI_Model{
	
	public function ItemDetails_all_itemID($items){
		$this->db->select('a.*');
		$this->db->select('b.itemCode');
		$this->db->select('b.name');
		$this->db->select('c.code as locCode');
		$this->db->select('c.desc');
		$this->db->select('c.address');
		$this->db->select('c.postcode');
		$this->db->select('c.city');
		$this->db->select('d.code as umCode');
		$this->db->select('e.fldname as stateName');
		$this->db->where('a.companyID', element('compID', $this->session->userdata('logged_in')));
		$this->db->where('a.itemID', $items);
		$this->db->order_by('a.companyID');
		$this->db->order_by('a.itemID');
		$this->db->from('item_details a');
		$this->db->join('item b', 'b.ID = a.itemID');	
		$this->db->join('tbl_location c', 'c.fldid = a.locationID', 'LEFT OUTER');	
		$this->db->join('_sys_um d', 'd.fldid = a.umID', 'LEFT OUTER');	
		$this->db->join('_ref_state e', 'e.fldid = c.state', 'LEFT OUTER');	
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}
	public function ItemDetails_all(){
		$this->db->select('a.*');
		$this->db->select('b.itemCode');
		$this->db->select('b.name');
		$this->db->select('c.code as locCode');
		$this->db->select('c.desc');
		$this->db->select('c.address');
		$this->db->select('c.postcode');
		$this->db->select('c.city');
		$this->db->select('d.code as umCode');
		$this->db->select('e.fldname as stateName');
		$this->db->where('a.companyID', element('compID', $this->session->userdata('logged_in')));
		$this->db->order_by('a.companyID');
		$this->db->order_by('a.itemID');
		$this->db->from('item_details a');
		$this->db->join('item b', 'b.ID = a.itemID');	
		$this->db->join('tbl_location c', 'c.fldid = a.locationID', 'LEFT OUTER');	
		$this->db->join('_sys_um d', 'd.fldid = a.umID', 'LEFT OUTER');	
		$this->db->join('_ref_state e', 'e.fldid = c.state', 'LEFT OUTER');	
		$query = $this->db->get();
		if($query->num_rows() >= 1){
			return $query->result();
		}else{
			return FALSE;
		}
	}
	
}

/* End of file ItemDetails.php */
/* Location: ./application/models/ItemDetails.php */
/* Created By : Yahaya Abdollah */
