<?php
	include "../../include/config.php";
    include "../../function/inc_function.php";    
	#variable
	$return_arr = array();
	$data = mysql_query("SELECT a.*, b.mtp_price, b.mtp_currency, b.mtp_nett, b.mtp_gross, b.mtp_box, b.mtp_pallet   
	        FROM product a LEFT JOIN master_price b ON b.mtp_prodid=a.id
	        WHERE a.prod_cat <>100 AND a.prod_code LIKE '%" . mysql_real_escape_string($_GET['term']) . "%' ");
	while($line = mysql_fetch_array($data, MYSQL_ASSOC)){
		$row_array["value"]        = $line["prod_code"]." => ".$line["prod_name"];
		$row_array["prod_id"] 	   = $line["id"];
		$row_array["prod_sat"]     = $line["prod_sat"];
		$row_array["prod_stock"]   = 0;
		$row_array["prod_price"]   = $line["mtp_price"];
		$row_array["prod_curr"]    = $line["mtp_currency"];
		$row_array["prod_nett"]    = $line["mtp_nett"];
		$row_array["prod_gross"]    = $line["mtp_gross"];
		$row_array["prod_box"]    = $line["mtp_box"];
		$row_array["prod_pallet"]    = $line["mtp_pallet"];
		array_push($return_arr, $row_array);
	}
	echo json_encode($return_arr);
?>