<?php 
$url_cancel= "index.php?route=ToolPlants/maintenance/asset_maintenance_bill_entry_index".$rurl;
$url_add= "index.php?route=ToolPlants/maintenance/asset_maintenance_bill_entry".$rurl;

//echo $rurl;
?>
<?php

	if($_REQUEST['action']=='delete' && !empty($_REQUEST['amid']))
	{
		if($s->DeleteRecord('tpl_asset_maintenace_bill',"id=".$_REQUEST['amid']))
		{			
			$_SESSION['success_msg']="Delete Successfully";
		
		}
	}

if($_REQUEST['Cancel']!='')
{
	unset($_REQUEST);
}
?>

<table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td style="padding:5px"><!-- General details -->
      <table width="100%" cellspacing="0" cellpadding="0" border="0" class="small">
        <tr>
          <td style="padding:5px; text-align:right;" colspan="4" align="center">
	<div align="center">
		
		<a href="<?php echo $url_add;?>">Add New</a></div>
        </tr>
        <tr>
          <td class="detailedViewHeader"  style="text-align:center;" colspan="4"><b>Fixed Asset Maitenance Bill Posting</b></td>
        </tr>
       
   <tr>
	<td><table width="100%" border="1" cellspacing="1" cellpadding="5" align="center">
  	<tr>
  		<th><strong>Sr. No.</strong></th>
	  	<th><strong>Project</strong></th>
	  	<th><strong>Bill No.</strong></th>
	  	<th><strong>Vendor </strong></th>
	  	<th><strong>Bill Date</strong></th>	   
	   	<th colspan="2"><strong>Action</strong></th>
   </tr>
              <tr>
              	<?php 
              	$record=$s->GetRecordById('tpl_asset_maintenace_bill',1);
              	// $record=DB_query("select * from tpl_asset_maintenace_bill",$db);
  					$i=0;
					while($row=DB_fetch_array($record))
					{
						$i++;
						extract($row);
						$vendorrecord=DB_fetch_array($s->GetRecordById('suppliers','id='."'$vendor'"));
						
              	?>
              	<td><?php  echo "<b>". $i." : </b>";?></td>
              	<td><?php  echo $project;?> </td>
	            <td><?php  echo $bill_no;?> </td>
   				<td><?php  echo $vendorrecord['vendor_name'];?> </td>
	            <td><?php  if($bill_date!='') echo date('d/m/y',strtotime($bill_date)); else echo ""; ?> </td>
                 <td><a href="<?php echo $url_add;?>&action=edit&amid=<?php echo $id;?>"><img src="images/icon-edit.png" width="10" height="10" ></a> </td><td>
				<a href="<?php echo $url_cancel;?>&action=delete&amid=<?php echo $id;?>" onClick="return confirm('Are you sure you wish to delete this Record?')"><img src="images/Icon_Delete.png" width="10" height="10"></a></td>
              </tr><?php 
				} 
              ?>
            
            </table></td>
        </tr>
        <tr>
          <td style="padding:5px; text-align:right;" colspan="4" align="right"></td>
        </tr>
      </table></td>
  </tr>
</table>
<?php if(isset($_SESSION['success_msg']))
{ ?>
	<script> alert("<?php echo ($_SESSION['success_msg']);?>");</script>
<?php 
}	unset($_SESSION['success_msg']);
?>
