<?php
include_once 'db_functions.php';     
$db = new DB_Functions();  

$order_no = $_REQUEST['orderNo'];    
$users = $db->salesOrderItems($order_no);     
$a = array();     
$b = array(); 
 
 if ($users != false){ 
   while($row = mysql_fetch_array($users)) {
	   
	$b["po_no"] = $row["po_no"];
  	$b["prod_code"] = $row["prod_code"];
	//// retailer name
	$res_prod = $db->productDetail($row["prod_code"]);
    $row_prod = mysql_fetch_array($res_prod);
	$b["pname"] = $row_prod["productname"];
  	$b["pcode"] = $row_prod["productcode"];
  	$b["pcolor"] = $row_prod["productcolor"];
	$b["pcat"] = $row_prod["productcat"];
	
	$res_brand = $db->brandName($row_prod["brand"]);
    $row_brand = mysql_fetch_array($res_brand);
	
	$b["pbrand"] = $row_brand["make"];
  	$b["qty"] = $row["req_qty"];
  	$b["po_price"] = $row["po_price"];
	$b["po_value"] = $row["po_value"];	
	array_push($a,$b);
   }	
	echo json_encode($a);
 }

?>