<?php
class M_Item_price extends CI_Model {
    
	// deklarasi nama table
	public $table = "am_itemprice";
	
	function get_price_by_code($code) {
		$this->db->select('ItemPrice');
		$this->db->from($this->table);
		$this->db->where('ItemCode', $code); 
        $query = $this->db->get();    
        
		if ($query->num_rows() > 0) {
			foreach ($query->result() as $row) {
				$ItemPrice = $row->ItemPrice;
			}    

			return $ItemPrice;
		}
		else {
			return 0;
		}  	
	}
}