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

//echo $rurl;
?>
<?php

	if($_REQUEST['action']=='delete' && !empty($_REQUEST['amcid']))
	{
		if($s->DeleteRecord('tpl_amc_billposting',"id=".$_REQUEST['amcid']))
		{
			
			$_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>AMC Entry Bill Posting</b></td>
        </tr>
       
   <tr>
	<td><table width="100%" border="1" cellspacing="1" cellpadding="5" align="center">
  	<tr>
  		<th><strong>Sl. No.</strong></th>
	  	<th><strong>Vendor</strong></th>
	  	<th><strong>Bill Date</strong></th>
	    <th><strong>AMC Ref No.</strong></th>
	    <th><strong>Amc Date</strong></th>
	   	<th><strong>Invoice No.</strong></th>
	   	<th><strong>Bill Reference Number</strong></th>
	   	<th><strong>Remarks</strong></th>
	   	<th colspan="2"><strong>Action</strong></th>
   </tr>
              <tr>
              	<?php 
              	$record=$s->GetRecordById('tpl_amc_billposting',1);
              	// $record=DB_query("select * from tpl_amc_billposting",$db);
  					$i=0;
					while($row=DB_fetch_array($record))
					{
						$i++;
						extract($row);
              	?>
	           	<td><?php  echo "<b>". $i." : </b>"; ?></td>
	            <td><?php  echo $vendor; ?> </td>
	            <td><?php  if($bill_date!='') echo date('d/m/y',strtotime($bill_date)); else echo ""; ?> </td>
                <td><?php  echo $amc_refno; ?> </td>
                <td><?php  if($amc_date!='') echo date('d/m/y',strtotime($amc_date)); else echo ""; ?> </td>
                <td><?php  echo $invoice_no; ?> </td>
				<td><?php  echo $bill_referenceno; ?> </td>
				<td><?php  echo $remarks; ?> </td>
				
                 <td><a href="<?php echo $url_add; ?>&action=edit&amcid=<?php echo $id; ?>"><img src="images/icon-edit.png" width="10" height="10" ></a> </td><td>
				<a href="<?php echo $url_cancel; ?>&action=delete&amcid=<?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']);
?>
