
<?php

	if($_REQUEST['site']!='0')
	{	
		$filter[]="A.location='".$_REQUEST['site']."'";
	}
	
	
	$filter[]="A.date <'".FormatDateFORSQL(date('d-m-Y'))."' and A.date !='0000-00-00'";
	
	if($filter!='')
	{			
	$filter1 = implode(" and ",$filter);	
	}
	if($filter1=='')
	{
	$filter1 ="A.CompanyId='".$_SESSION['ACGCompanyId']."'";
	}
	
	$sql1 = "SELECT A.code, A.name, A.sr_no, A.vehicle_no, A.model_no, A.purchase_date,
			A.date, M.asset_capitalisation
			FROM machine_center A
			INNER JOIN tpl_materialcategorydefinition M ON(M.id=A.under_group) 
			WHERE $filter1";
			
	$_SESSION['misc_sql']=$sql1;
	$sql=DB_query($sql1,$db);
	

	$s=new db_query();
?>

<table width="100%"  border="1" cellspacing="0" cellpadding="3" style="border:#808080 1px solid; border-collapse:collapse;">
  	<tr>
  		<th width="4%">S.No.</th>
	  	<th width="10%">Asset Code</th>
	  	<th>Asset Name</th>
	  	<th width="13%">Asset Group</th>
	  	<th width="8%">Model No.</th>
	  	<th width="12%">Vehicle No.</th>
	    <th width="14%">Serial No.</th>
		<th width="10%">Purchase Date</th>
	   	<th width="10%">Insurance Expired Date</th>
   	</tr>
<?php 
$i=1;
$num=DB_num_rows($sql);
if($num>0)
{
while($row=DB_fetch_array($sql))
{

?>
<tr bgcolor="#fff">
	<td><?php echo $i; ?></td>
	<td><?php echo $row['code'];?></td>
	<td><?php echo $row['name'];?></td>
	<td><?php echo $row['asset_capitalisation'];?></td>
	<td><?php echo $row['model_no'];?></td>
	<td><?php echo $row['vehicle_no'];?></td>
	<td><?php echo $row['sr_no'];?></td>
	<td><?php echo ($row['purchase_date'] !='') ? ConvertSQLDate($row['purchase_date']) : ""; ?></td>
	<td><?php echo ($row['date'] !='') ? ConvertSQLDate($row['date']) : ""; ?></td>	
</tr>
<?php $i++; }} else { ?>
	<tr bgcolor="#fff"><td colspan="10" style="text-align: center;"><font color="#FF0000"><?php echo "No records found"; ?></font></td></tr>	 
<?php }?> 
</table>


