<?php
$PageSecurity = 2;
ob_start();
include('includes/DefinePOClass.php');
$title = _('View Material Receipt Note');
$time = date('G:ia');
$date = date($_SESSION['DefaultDateFormat']);

$recedit=DB_fetch_array($s->GetRecordById('transfer_receipt',"id=".$_REQUEST['id']));
extract($recedit);

?>
<h2 align="center"><strong>Site to Site Transfer Issue Receive</strong></h2>

<div style="width:810px; margin-left:auto; margin-right:auto;">

<h3 align="left">GENERAL DETAILS</h3>
<table width="100%" border="1" cellspacing="0" cellpadding="3" style="border-collapse:collapse;">
  <tr>
    <th><strong>STST No. </strong></th>
    <td><?php echo $MRNNo;?></td>
    <th><strong>Receipt Date </strong></th>
    <td><?php echo ConvertSQLDate($MRNDate);?></td>
  </tr>
  
  <tr>
    <th><strong>Issue Site </strong></th>
    <td><?php 
	$site_sql=DB_query("Select locationname from locations where loccode='".$Issue_From."'",$db);
	$site_row=DB_fetch_array($site_sql);
	echo $myrow['OrderFromSite']." - ".$site_row['locationname'];?></td>
    <th><strong> Issue Store</strong></th>
    <td><?php
    	
    	 $sql_store = "select StoreName from storetype where id='".$Issue_store."'";
		$resultStkLocs = DB_query($sql_store,$db);
		$store_name=DB_fetch_array($resultStkLocs);
    	
    	echo $store_name['StoreName'];?></td>
  </tr>
  <tr>
    <th><strong>Recevied Site </strong></th>
    <td><?php 	
		$vendor_sql=DB_query("Select locationname from locations where loccode='".$Received_to."'",$db);
		$vendor_row=DB_fetch_array($vendor_sql);
		echo $vendor_row['locationname'];
	?>
	</td>
    <th><strong>Issue Slip No. </strong></th>
    <td><?php echo $issue_slipno ;?></td>
  </tr>
 
   <tr>
   	  <th><strong> Recevied Store:</strong></th>
   	  <td>
   	  	<?php    	
    	 $sql_store = "select StoreName from storetype where id='".$Received_store."'";
		$resultStkLocs = DB_query($sql_store,$db);
		$store_name=DB_fetch_array($resultStkLocs);    	
    	echo $store_name['StoreName'];?>   	  	
   	  </td>
   	  <td colspan="2"></td>
   	</tr>
  
  
  <tr>
    <th><strong>Document Type </strong></th>
    <td><?php echo $DocumentType;?></td>
    <th><strong>Document No. </strong></th>
    <td><?php echo $BillNo;?></td>
  </tr>
  
  <tr>
    <th><strong>Voucher Date</strong></th>
    <td><?php echo ConvertSQLDate($MRNVoucherDate);?></td>
    <th><strong>Inwards Gate Pass No. </strong></th>
    <td><?php echo $GetPassNo;?></td>
  </tr>
  
  <tr>
    <th><strong>Date</strong></th>
    <td><?php echo ConvertSQLDate($Inwardsdate);?></td>
    <th><strong>Transporter Name </strong></th>
    <td><?php echo $Transp_name;?></td>
  </tr>
  
  <tr>
    <th><strong>Vehicle No. </strong></th>
    <td><?php echo $VehicleNo;?></td>
    <th><strong>Time IN or Out</strong></th>
    <td><?php echo $TimeIn;?> <?php echo $Timeout;?></p></td>
  </tr>
  
  <tr>
    <th><strong>L R No.</strong></th>
    <td><?php echo $LRno;?></td>
    <th><strong>L R Date </strong></th>
    <td><?php echo ConvertSQLDate($LRdate);?></td>
  </tr>

  <tr>
    <th><strong>Total Weight </strong></th>
    <td><?php echo $TotalWeight;?></td>
    <th><strong>Form Type</strong></th>
    <td><?php echo $form_type;?></td>
  </tr>

  <tr>
    <th><strong>Form No</strong></th>
    <td><?php echo $form_no;?></td>
    <td colspan="2"></td>
  </tr>

  <tr>
    <th><strong>Remarks If Any </strong></th>
    <td colspan="3"><?php echo $RemarksIfAny;?></td>

  </tr>
</table>
</div>
<h3 align="left">ITEM DETAILS</h3>
<div style="overflow:auto; width:810px ; height:auto">
<table width="100%" border="1" cellspacing="0" cellpadding="3" style="border-collapse:collapse;">
  <tr>
	<th><strong>ITEM CODE </strong></th>
    <th><strong>DESCRIPTION</strong></th>
    <th><strong>UOM</strong></th>
    <th><strong>ISSUE QTY  </strong></th>
    <th><strong>QTY ACCEPTED </strong></th>
	<th><strong>SHORT QUANTITY </strong></th>
    <th><strong>REMARKS</strong></th>
  </tr>
  <?php $x=0;
  $recedit2=$s->GetRecordById('transfer_receipt_details',"transfer_receipt_id=".$_REQUEST['id']);

  while($myrow2 = DB_fetch_array($recedit2)) 
  {
  $itemcode=$s->getField('item_master','id',$myrow2['itemid'],'StockID');
$desc=$s->getField('item_master','id',$myrow2['itemid'],'item_name');
$unit1=$s->getField('item_master','id',$myrow2['itemid'],'unit');
$unit=$s->getField('unitsofmeasure','unitid',$unit1,'unitname');
  	
  if($x%2==0)
{$bg="#CCCCCC";}
else
$bg="#C8BECB";
  ?>  
<tr bgcolor="<?php echo $bg;?>">
<td><?php echo $itemcode; ?></td>
<td><?php echo $desc; ?></td> 
<td><?php echo $unit; ?></td>
<td><?php echo $myrow2['issue_qty']; ?></td>
<td><?php echo $myrow2['reciveqty']; ?></td>
<td><?php echo $myrow2['short_accessid']; ?></td>

<td><?php echo $myrow2['remarks']; ?></td>
</tr>
<?php $x++; } ?>
</table>

</div>

<p align="center"> <a href="index.php?route=Inventory/transation/site_transfer_receipt_index&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&NewReturn=yes"><input type="button" value="Cancel" name="Back" /></a></p>