<?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');
 $reqno = $_GET['req_number'];
?>
<?php 
     $Reqsql="select * from materialrequisitions Where requisitionno ='".$reqno."'";
    $Reqresult = DB_query($Reqsql,$db);
	$myreqrow=DB_Fetch_array($Reqresult);
	$requsitiondate =$myreqrow['prdate']; 
	 $expdate = explode("-",$requsitiondate);
	  $reqyear =$expdate['0'];
	  $reqmonth =$expdate['1'];
	  $reqday =$expdate['2']; 
	
	echo $reqdate=$reqday."/".$reqmonth."/".$reqyear;



 ?>@@##@
<div id="txtdetail">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td width="6%">S.No.</td>
    <td width="11%">Item Code</td>
    <td width="11%">Description</td>
    <td width="6%">Make</td>
    <td width="6%">Color</td>
    <td width="6%">Grade</td>
    <td width="6%">UOM</td>
    <td width="15%">Stock Balance </td>
    <td width="8%">Required Qty </td>
    <td width="12%">Issue Qty </td>
	<td>Balance </td>
  </tr>
  <?php 
	$Sql="Select * from requisitionorderdetails Where requsitionno='".$reqno."'";
	$result = DB_query($Sql,$db);
	$i =1;
	while($myrow=DB_Fetch_array($result))
	{  
      ?>
   <tr>
    <td><?php echo $i; ?></td>
    <td><?php echo $myrow['product_id']; ?><input type="hidden" name="product_id" value="<?php echo $myrow['product_id']; ?>" /></td>
    <td><?php echo $myrow['product_description']; ?><input type="hidden" name="product_description" value="<?php echo $myrow['product_description']; ?>" /></td>
    <td><?php echo $myrow['make']; ?><input type="hidden" name="make" value="<?php echo $myrow['make']; ?>" /></td>
    <td><?php  echo $myrow['color']; ?><input type="hidden" name="color" value="<?php  echo $myrow['color']; ?>" /> </td>
    <td><?php echo $myrow['grade']; ?> <input type="hidden" name="grade" value="<?php  echo $myrow['grade']; ?>" /></td>
    <td><?php echo $myrow['uom']; ?><input type="hidden" name="uom" value="<?php  echo $myrow['uom']; ?>" /></td>
	<?php 
	$StockSql="SELECT *FROM stockmaster WHERE stockid ='".$myrow['product_id']."'";
	$Stockresult = DB_query($StockSql,$db);	
	while($mystockrow=DB_Fetch_array($Stockresult))
	{
	?>
    <td> <input type="text" readonly="readonly" name="stockbalance"  id="stockbal" size="5" value="<?php echo $mystockrow['maxlevel']; ?>"/></td>
	<?php } ?>
    <td><?php echo $myrow['req_quantity']; ?></td>
	
    <td>
      <input type="text" name="issueqty[]"  id="issueqty" size="10" onblur="showbalance(this.value)"/></td>
	<td width="13%"><input type="text" readonly="readonly" name="balance"  id="remaningbalance" size="5" value="" /></td>
  </tr>
  <?php  $i++; } ?>
  
</table>
</div>