<?php
$PageSecurity = 11;
//echo $_SERVER['QUERY_STRING'];exit;
include('includes/DefineSuppTransClass.php');
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');

include('includes/session.inc');
?>

<?php 
		   	$type = $_GET['receive_type'];
		 	$q=$_GET['site_name'];
			$sql="Select loccode, locationname from locations Where loccode ='".$q."'";
 			$result = DB_query($sql,$db);
 			$myrow=DB_Fetch_array($result);
			$sitenamelocat =$myrow['locationname']; 
?> 
  <table width="100%" border="1">
  <tr>
   <td width="16%">From Site</td>
    <td width="16%">
	<input id="hidden_form_site" type="hidden" value="<?php echo $q;?>" />
	<input id="hidden_form_type" type="hidden" value="<?php echo $type;?>" />
	<?php
	      $sql = 'SELECT loccode, locationname FROM locations';
		$resultStkLocs = DB_query($sql,$db);
		?>
	<select name="sitecode" onchange="showsitename(this.value);"  >
      <option value="select">Select</option> 
	  <?php 
		while ($myrow=DB_fetch_array($resultStkLocs))
			{
			   
			     $p='';
			   if($myrow['loccode']==$q)
			   $p="selected";
 				?>
	  <option value="<?php echo $myrow['loccode']; ?>" <?php  echo $p; ?>><?php echo $myrow['loccode'];?></option>
      <?php  }	?>
    </select></td>
    <td width="17%" id="txtsite" >
	
	
	<input type="text" name="sitename"   value="<?php echo $sitenamelocat; ?>"  readonly="true"/></td>
  </tr>
  <tr>
  <td>PO/WO/MTO Ref # </td>
    <td colspan="2" >
<?php 
if($type=='PO'){
//echo "manvi 2";
 $sql="select orderno, PO_Orderno from purchorders Where Po_recive_status='Pending' and sitecode='".$q."'";
$result = DB_query($sql,$db);
?>
<select name="PO" id="PurchaseOrder" onchange="FiendPurchasenumber(this.value)"  style="width:210px">
 <option value="000">Select Purchase Order</option>
  <?php  
 while($myrow=DB_Fetch_array($result))
{
?>
  <option value="<?php echo $myrow['orderno']; ?>" <?php if($myrow['orderno']==$Ordernumber) { echo "Selected";  }  ?>><?php echo $myrow['PO_Orderno'];?> </option>
  <?php }?>
 </select>
<?php }
 else if($type=='Direct') { ?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"/>
<?php } else if($type=='APCM') {?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php $_REQUEST['PO'] ?>"/>
<?php } else if($type=='ACM') {?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"/>
<?php } else if($type=='AMSR') {?>
<input type="text"   id="PO" name="PO" size="15"  value="<?php echo $_REQUEST['PO'] ?>"select/>
<?php } else if($type=='AWO') {?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"/>
<?php } else{?>
<select id="PO" name="PO">
<option value="" >Select</option>
</select>
<?php }
?></td>
  </tr>
   <tr >
    <td>Store Code/Name </td>
    <td colspan="2" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        
		<td width="39%">	
		
		<?php
		 $sql_store = "select StoreCode, StoreName from storetype  where Store_Site='".$q."'Order BY ID ASC";
		$resultStkLocs = DB_query($sql_store,$db);
		?>
		<select name="storecode" onChange="changestorename(this.value)"  tabindex="12">
		<option value="000">Select</option> 
		<?php 
		while ($myrow=DB_fetch_array($resultStkLocs))
		{
				$p='';
				if($myrow['StoreCode']==$_REQUEST['storecode'])
				$p="selected";
		?>		
		<option Value="<?php echo $myrow['StoreCode']; ?>" <?php echo $p; ?>><?php echo $myrow['StoreCode']; ?></option>
		<?php }

		?>
		</select>			</td>
        <td width="61%" id="txtid"><input type="text" name="storename" id="storename" size="20" readonly="true" value="<?php echo $_REQUEST['storename'] ?>"  tabindex="13"></td>
      </tr>
    </table>&nbsp;</td>
  </tr>
</table>
 
 