<?php
if($_REQUEST['action']=='delete' && !empty($_REQUEST['opn']))
{
	if($s->DeleteRecord('subcontractor_rabill_posting',"id=".$_REQUEST['opn']))
	{
	
	$_SESSION['success_msg']="Delete Successfully";	
	echo "<script>location.href='index.php?route=SubContractors/RaBill/ra_bill_posting_entry_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";	
	}
}

?>

	
				



<link rel="stylesheet" type="text/css" href="SubContractors/css/paginate.css" />
<link href="css/tender_project.css" rel="stylesheet" type="text/css" />
<div class="tender_main_page">
<h3>RA Bill Posting</h3>
<a href="index.php?route=SubContractors/RaBill/ra_bill_posting_entry_add&amp;modid=<?php echo $_REQUEST['modid'];?>&amp;frmid=<?php echo $_REQUEST['frmid'];?>">Add New</a>
<div><br></div>

<div id="tableContainer" class="tableContainer">
<table class="scrollTable" width="100%" border="0" cellpadding="0" cellspacing="0">

	<tr>
		
		<td class="tabledata"><strong>Vouchar Date</strong></td>
		
		<td class="tabledata">Delete</td>
		
	</tr>
	
	<?php 
          	$sql = "SELECT * FROM subcontractor_rabill_posting";
			$rpp = 10; // results per page
			$adjacents = 5;
			
			$page = intval($_GET["page"]);
			if($page<=0) $page = 1;
			
			$reload ="index.php?route=SubContractors/RaBill/ra_bill_posting_entry_index".$rurl;
			
			
			// select appropriate results from DB:
			
			
			//$sql = "SELECT * FROM sub_rabill_opening";
			$result =DB_query($sql,$db);
			
			// count total number of appropriate listings:
			$tcount = DB_num_rows($result);
			
			// count number of pages:
			$tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number
			
			$count = 0;
			$i = ($page-1)*$rpp;
			while(($count<$rpp) && ($i<$tcount)) {
				DB_data_seek($result,$i);
				$query = DB_fetch_array($result);
				extract($query);
	
	?>
	
	<tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#fffeb3'; this.style.color='#00f';" onMouseOut="this.style.backgroundColor='#FFF'; this.style.color='#000000';">
		
		<td width="30%"><a href="index.php?route=SubContractors/RaBill/ra_bill_posting_entry_add<?php echo $rurl;?>&amp;action=edit&amp;opn=<?php echo $id; ?>" style="color:#000000"><?php echo ConvertSQLDate($vouchar_date); ?></a></td>
			
		<td width="5%"><a href="index.php?route=SubContractors/RaBill/ra_bill_posting_entry_index<?php echo $rurl;?>&amp;action=delete&amp;opn=<?php echo $id; ?>" onclick="return confirm('Are you sure you want to delete?')"> <img src="images/Icon_Delete.png" /></a></td>
	</tr>
	
	<?php  $i++;  $count++; }
	// call pagination function:

echo paginate_two($reload, $page, $tpages, $adjacents);
 ?>
</table>
 <font color="#FF0000"><?php echo $masg; ?></font>





</div>

<div><br></div>
</div>

<script>
//$(document).ready(function(){
 //   $('table tr').click(function(){
    //    window.location = $(this).attr('href');
    //    return false;
   // });
//});


</script>
<?php if(isset($_SESSION['success_msg']))
{ ?>
	<script> alert("<?php echo ($_SESSION['success_msg']);?>");</script>
<?php 
unset($_SESSION['success_msg']);
}

?>



