<?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>';
}
	
if(isset($_REQUEST['mrn'])){
	$data3='';
$sql2=DB_fetch_array(DB_query("Select * from addmrnqty where issue_id=".$_REQUEST['mrn']." and mst_itemid=".$_REQUEST['id'],$db));
	extract($sql2);
	//**********************//
	$vendor_id=$s->getField('addmrn','id',$_REQUEST['mrn'],'ReceivedFrom');
	$x='<option value="'.$vendor_id.'">'.$s->getField('suppliers','id',$vendor_id,'vendor_name').'</option>';
	//**********************//
	$sql3=DB_query("Select id, method_no from qc_product_parameter where process_id=".$_REQUEST['pid']." and mst_itemid=".$_REQUEST['id']." and CompanyId=".$_SESSION['ACGCompanyId'],$db);
	$y='';
	$y.='<option value="">Select Method</option>';
	while($row3=DB_fetch_array($sql3)){
		extract($row3);
		$y.='<option value="'.$id.'">'.$method_no.'</option>';
	}
	//**********************//
	$data3.=$batch_no."__".$reciveqty."__".$x."__".$y;
	echo $data1."__".$data2."__".$data3;
}else{
	echo $data1."__".$data2;
}
?>