<?php
$PageSecurity = 2;
include('includes/session.inc');
include('includes/function_lib.php');
$data1=''; 
if($_REQUEST['type']=='code'){
	$sql=DB_query("Select id,item_name from item_master where id=".$_REQUEST['id']."",$db);
	while($row=DB_fetch_array($sql)){
		extract($row);
		$data1.='<option value="'.$id.'">'.$item_name.'</option>';
	}
}elseif($_REQUEST['type']=='name'){
	$sql=DB_query("Select id,StockID from item_master where id=".$_REQUEST['id']."",$db);
	while($row=DB_fetch_array($sql)){
		extract($row);
		$data1.='<option value="'.$id.'">'.$StockID.'</option>';
	}
}
$sql2=DB_query("Select mst_unitid from item_master where id=".$_REQUEST['id'],$db);
$data2='';
while($row2=DB_fetch_array($sql2)){
	extract($row2);
	$data2.='<option value="'.$mst_unitid.'">'.$s->getField('unitsofmeasure','unitid',$mst_unitid,'unitname').'</option>';
}
$itm_det=DB_fetch_assoc(DB_query("select dd.dispatchQty,d.party  from  dispatch d, dispatch_details dd where d.id=dd.parentId and d.id='".$_REQUEST['disp']."' and item='".$_REQUEST['id']."' ",$db));

$client_nm=DB_fetch_assoc(DB_query("SELECT c_name FROM clientmaster WHERE id='".$itm_det['party']."' ",$db));
$data3=$itm_det['dispatchQty'];
$data4=$client_nm['c_name'];
$data5="";
$data5.="<option value=''>Select</option>";
if($_REQUEST['branch']=="000")
$condtn= " and 1=1";
else
$condtn=" and branch_code='".$_REQUEST['branch']."' ";
$process_sql=DB_query("select  * from production_process_master where CompanyId='".$_SESSION['ACGCompanyId']."' and  manuf_process_name like '%".disp."%' ".$condtn,$db);
while($process=DB_fetch_assoc($process_sql)){
$data5.="<option value='".$process['id']."'>".$process['manuf_process_name']."</option>";
}
//echo $data5;
echo $data1."__".$data2."__".$data3."__".$data4."__".$data5;

?>