<?php
ob_start();
$PageSecurity = 4;
$PageName = 'View Purchase Requisition';
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
include('includes/DefineSuppTransClass.php');
$title = _('View Purchase Requisition');
$req_sql=DB_query("Select * from materialrequisitions where requisitionno='".$_REQUEST['RequisitionNo']."'",$db);
$req_row=DB_fetch_array($req_sql);
?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Purchase Requisition</h1>	
<!--<fieldset style="width:650px"><legend><h3 align="center"><strong>Requisition Details</strong></h3></legend>-->
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr class="row1">
	<td width="13%" align="right"><strong>Branch :</strong></td>
    <td width="35%"><?php echo $s->GetFieldValue('locations',"loccode='".$req_row['sitecode']."'",'locationname');?></td>
	<td width="13%" align="right"><strong>Requisition No. :</strong></td>
    <td><?php echo $req_row['Reqno'];?></td>
</tr>
<tr class="row1">
    <td align="right"><strong>Requisition By :</strong></td>
    <td><?php  echo $s->GetFieldValue('empmaster',"id='".$req_row['requition_by']."'",'emp_name');?></td>
	<td align="right"><strong>Requisition Date :</strong></td>
    <td><?php  echo ConvertSqlDate($req_row['prdate']);?></td>
</tr>
<tr class="row1">
	<td align="right"><strong>Category :</strong></td>
    <td><?php  echo $req_row['category']; ?></td> 
	<td align="right"><strong>Remarks :</strong></td>
    <td><?php  echo $req_row['comments']; ?></td>    
</tr>
</table>
<br>
<h3><strong>Item Details</strong></h3>
<table width="100%" border="0" cellspacing="0" cellpadding="3" class="thborder">
<thead>
<tr>
	<th width="12%">Item Code</th>
	<th>Item Name</th>
	<th width="5%">Unit</th>
	<th width="12%">Current Stock</th>
	<th width="10%">Requisition Qty.</th>
	<th width="10%">Material Required Date</th>
	<!--<th class="tabledata">Approved Qty</th>-->
	<th width="18%">Remarks</th>
</tr>
</thead>
<tbody>
<?php 
 $get_sql="Select * from requisitionorderdetails where requsitionno='".$_REQUEST['RequisitionNo']."'";
$get_result=DB_query($get_sql,$db);
$i=0;
while($get_row=DB_fetch_array($get_result))
{
if($get_row['requisition_qty']!=0)
{	
$item_sql="Select * from item_master where id='".$get_row['mst_itemid']."'";
$item_result=DB_query($item_sql,$db);
$item_row=DB_fetch_array($item_result);?>
  <tr>
    <td><?php echo $get_row['product_id'];?></td>      
    <td><?php echo $get_row['product_description'];?></td>
    <td><?php echo $s->GetFieldValue('unitsofmeasure',"unitid='".$get_row['uom']."'",'unitname');?></td>
    <td><?php echo $get_row['stock_qty']  ?></td>
    <td><?php echo $get_row['requisition_qty'];?></td>
	<td><?php echo ConvertSQLDate($get_row['material_required_by']); ?></td>
	<?php /*?><td><?php echo $get_row['App_quantity'];?></td><?php */?>
	<td><?php echo $get_row['Remarks'];?></td>
		 	<!--<td><?php //echo ($get_row['status']);?></td>-->
  </tr>
  <?php $i++; } }?>
  <input type="hidden" name="ctr" value="<?php echo $i;?>" />
</tbody>
</table>
</div>
</div>
