<div style="width:1246px; overflow:auto;">
<table width="1800" border="1" cellspacing="0" cellpadding="3">
<tr class="row1">
<td colspan="12"><strong>Approved Request</strong></td>
</tr>
<tr bgcolor="#CCCCCC" height="25">
	<td width="3%"><strong>S. No.</strong></td>
	<td width="10%"><strong>Branch</strong></td>
	<td width="6%"><strong>ATR No.</strong></td>
	<td width="4%"><strong>ATR Date</strong></td>
	<td width="10%"><strong>Requested By</strong></td>
	<td width="150"><strong>Asset Code</strong></td>
	<td><strong>Asset Name </strong></td>
	<?php 
   $title1=DB_query("select * from tbl_title_master order by serial_no ASC limit 0,3",$db);
   while($r=DB_fetch_array($title1))
   { 
    ?>
    <td width="150"><strong><?php echo $r['title_name'];?></strong></td>
    <?php } ?>
	<td width="100"><strong>status </strong></td>
	<td width="100"><strong>Action</strong></td>
</tr>
<?php 
$SQLA = "SELECT * FROM tpl_asset_transfer_request WHERE CompanyId='".$_SESSION['ACGCompanyId']."' 
 AND request_date BETWEEN '".$_SESSION['financialYrStart']."' AND '".$_SESSION['financialYrEnd']."' AND approved_status='Approved'";
$recordA = DB_query($SQLA,$db);
$i=0;
if(DB_num_rows($recordA)>0){
while($rowA=DB_fetch_array($recordA))
{
$i++;
extract($rowA);

?>
<tr bgcolor="#FFFFFF">
<td><?php  echo $i;?></td>
<td><?php  echo $s->GetFieldValue('locations','loccode="'.$requested_site.'"','loccode');;?> </td>
<td><?php  echo $request_no;?> </td>
<!--  <td><?php  //echo $unit_of_measurement;?> </td>
<td><?php  echo $asset_location;?> </td>
<td><?php  if($purchase_date!='') echo date('d/m/y',strtotime($purchase_date)); else echo ""; ?> </td>
<td><?php  echo $asset_capitalization;?> </td>-->
<td><?php  if($request_date!='') echo date('d/m/y',strtotime($request_date)); else echo ""; ?> </td>
<td><?php  echo $s->GetFieldValue('empmaster','id="'.$requested_by.'"','emp_name');?></td>
<td colspan="6" style="padding:0px;" valign="top">
	<table width="100%" border="0" cellpadding="3" cellspacing="0">
	<?php
		$reqDet_sql = "SELECT R.required_qty, R.status AS RS, A.* FROM tpl_asset_transfer_request_details R
					   INNER JOIN machine_center A ON A.id=R.asset_code
					   WHERE R.asset_req_id='".$id."'";
		$result = DB_query($reqDet_sql,$db);
		if(DB_num_rows($result)>0){
			while($assetRow = DB_fetch_array($result)){?>
				<tr>
					<td width="149" style="border-right:#808080 1px solid;"><?php  echo $assetRow['code'];?></td>
					<td style="border-right:#808080 1px solid;"><?php  echo $assetRow['name'];?></td>
					<?php 
   $title1=DB_query("select * from tbl_title_master order by serial_no ASC limit 0,3",$db);
   while($r=DB_fetch_array($title1))
   { 
    ?>
    <td width="150" style="border-right:#808080 1px solid;"><?php echo $assetRow[$r['db_field_name']];?></td>
    <?php } ?>
					<td width="99"><?php  echo $assetRow['RS'];?></td>
				</tr>
		<?php	}
		}
	?>
	
	</table>
</td>
<td><a href="atr_approve_print.php?rid=<?php echo $id;?>" target="_blank"><img width="18" height="18" src="images/icon_print.jpg"></a> </td>

</tr><?php 
} 
}else{?>
<tr>
<td colspan="12"><font color="#FF0000">No Record Found</font></td>
</tr>
<?php }?>
</table>
</div>