<?php
$PageSecurity = 1;
include('config.php');
include('includes/ConnectDB.inc');
include('includes/function_lib.php');
include('includes/LanguageSetup.php');
include('includes/DateFunctions.inc');

	$sql = "SELECT T.*, L.locationname FROM tpl_asset_transfer_request T INNER JOIN locations L on L.loccode=T.requested_site";
	$result = DB_query($sql,$db);
	$row = DB_fetch_array($result);
	
?>
<title>Fixed Asset Transfer Request</title>
<link rel="stylesheet" href="css/purchase_requision_print.css">
<div style="width:1000px;" class="body_contain">
<div class="tab_div">
<div style="width:1000px">
<table width='90%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td align='left'><img src='images/cloud_logo.jpg' /></td>
<td align='right'><img src='images/right_img.jpg' /></td>
</tr>
<tr>
<td colspan='2'><h1>Fixed Asset Transfer Request</h1></td>
</tr>
</table>
</div>
<div id="foo">
  <p align="center"><input type="button" onclick="javascript:toggle_visibility('foo');" value="Print" /></p>
</div>
<br />
<div>

<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr class="row1">
	<td class="tabledata1" colspan="4">
		<h3>General Details</h3>
	</td>
</tr>
<tr class="row1">
	<td width="153" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Requested Site</strong></td>
	<td width="139" class="jjrs_tablehead"><?php echo $row['locationname'];?></td>
	<td width="144" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Request No.</strong></td>
	<td width="108" class="jjrs_tablehead"><?php echo $row['request_no'];?></td>
</tr>
<tr class="row1">
	<td class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Request Date</strong></td>
	<td class="jjrs_tablehead"><?php echo date('d/m/Y',strtotime($row['request_date'])); ?></td>
	<td class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Purpose</strong></td>
	<td class="jjrs_tablehead"><?php echo $row['purpose'];?></td>
</tr>
<tr class="row1">
	<td class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Requested By</strong></td>
	<td class="jjrs_tablehead"><?php echo $s->GetFieldValue('empmaster',"id='".$row['requested_by']."'",'emp_name');?></td>
	<td class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Returnable</strong></td>
	<td class="jjrs_tablehead"><?php echo $row['returnable'];?></td>
</tr>
<tr class="row1">
	<td class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Remarks</strong></td>
	<td colspan="3" class="jjrs_tablehead"><?php echo $row['remarks']; ?></td>
</tr>
<tr class="row1">
	<td colspan="4" valign="middle" class="tabledata1">
		<h3>Assets Details</h3>
	</td>
</tr>
<tr class="row1">
	<td class="tabledata1" colspan="4" style="padding:0px;">
	<table width="100%" border="1" cellpadding="3" cellspacing="0">
		<tr class="row1">
			<td width="4%" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Sl. No.</strong></td>
			<td width="10%" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Asset Code</strong></td>
			<td width="10%" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Asset Name</strong></td>
			<td width="10%" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Asset Group</strong></td>
			<td width="10%" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Request Qty</strong></td>
			<td width="18%" bgcolor="#CCCCCC" class="jjrs_tablehead"><strong>Expected Transfer Date</strong></td>
			<td width="17%" class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Expected Return Date</strong></td>
			<td class="jjrs_tablehead" bgcolor="#CCCCCC"><strong>Purpose</strong></td>
		</tr> 
   
<?php 
$s=new db_query();
$result2=DB_query("select * from tpl_asset_transfer_request_details where asset_req_id='".$_REQUEST['rid']."'",$db);
$i=1;
while($myrow2=DB_fetch_array($result2))
{

$asset_code=$s->GetFieldValue('machine_center',"id='".$myrow2['asset_code']."'",'code');
$asset_name=$s->GetFieldValue('machine_center',"id='".$myrow2['asset_code']."'",'name');
?>
<tr class="row1">
	<td style="width:1%"><?php echo $i;?></td>
	<td><?php echo $asset_code;?></td>

	<td><?php echo $asset_name;?></td>
	<td><?php echo $myrow2['asset_group'];?></td>
	<td><?php echo $myrow2['required_qty'];?></td>
	<td><?php echo ConvertSQLDate($myrow2['exp_transfer_date']);?></td>
	<td><?php echo ConvertSQLDate($myrow2['exp_return_date']);?></td>
	<td><?php echo $myrow2['purpose'];?></td>
</tr>
<?php $i++;
}  ?>
</table>
</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>

<tr>
<td colspan="2">Created By </td>
<td colspan="2" align="right">Approved By </td>
</tr>
<tr>
<td colspan="2"><?php echo $s->GetFieldValue('www_users','id="'.$row['created_by'].'"','realname');?></td>
<td colspan="2" align="right">&nbsp; </td>
</tr>

</table>
<script type="text/javascript" language="javascript">
  function toggle_visibility(id) {
  var msg=confirm("Please Use Mozilla Firefox And Print In Landscape Mode");
  if(msg){
       var e = document.getElementById(id);
	      e.style.display = 'none';
		       //alert(e.style.display);
			   window.print();
    }
	}
</script>
