<?php 
$PageSecurity = 4;
global  $db;
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/stockcalculation.php');

if(isset($_REQUEST['vendornameshow']))
{
	//echo "Select id,vendor_name from suppliers where id='".$_REQUEST['vendorcode']."'";
	
	$vendor_sql=DB_query("Select id,vendor_name from suppliers where id='".$_REQUEST['vendorcode']."'",$db);
	if(DB_num_rows($vendor_sql)>0)
	{
		while($vendor_res=DB_fetch_array($vendor_sql))
   		{?>
			<option value="<?php echo $vendor_res['id'];?>"><?php echo  str_replace(array("M/s ","M/S"),'',$vendor_res['vendor_name']); ?></option>
	<?php } 
	}
	else
	{?>
		<option value="000">---Select---</option>
		
	<?php 
	}
	exit;
}
if(isset($_REQUEST['vendorcodeshow']))
{
	//echo "Select id,vendor_name from suppliers where id='".$_REQUEST['vendorcode']."'";
	
	$vendor_sql=DB_query("Select id,vendor_code from suppliers where id='".$_REQUEST['vendorname']."'",$db);
	if(DB_num_rows($vendor_sql)>0)
	{
		while($vendor_res=DB_fetch_array($vendor_sql))
   		{?>
			<option value="<?php echo $vendor_res['id'];?>"><?php echo $vendor_res['vendor_code'];   ?></option>
	<?php } 
	}
	else
	{?>
		<option value="000">---Select---</option>
		
	<?php 
	}
	exit;
}
else
{
	$query = "select * from addmrn where site ='".$_REQUEST['site']."' and Grn_Type='Direct'";
	$sql = DB_query($query,$db); 
	
	if(DB_num_rows($sql)>0)
	{?>
		<option value="000">Select Site</option>
		<?php
		while($myrow=DB_fetch_array($sql))
		{?>
			<option value="<?php echo $myrow['id']; ?>"><?php echo $myrow['MRNNo']; ?></option>
		<?php 
		}
	}
	else
	{?>
		<option value="000">Select Site</option>
		
	<?php }
}



	
?>
