<?php
	if($_REQUEST['action']=='delete' && !empty($_REQUEST['opn']))
	{
		if($s->DeleteRecord('sub_activity_group',"id=".$_REQUEST['opn']))
		{						
			$_SESSION['success_msg']="Delete Successfully";	
			echo "<script>location.href='index.php?route=SubContractors/Masters/activity_group_defination_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";	
		}
	}
?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Activity Group Definations</h1>

<p align="left"><a href="index.php?route=SubContractors/Masters/activity_group_defination&amp;modid=<?php echo $_REQUEST['modid'];?>&amp;frmid=<?php echo $_REQUEST['frmid'];?>" style="text-decoration:none;"><input type="button" align="left" class="search" value="Add" style="cursor:pointer;corsor:hand;"/></a>
</p>

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

	<tr>
		<th><strong>Activity Group</strong></th>
		<th><strong>Activity Group Code</strong></th>
		<th><strong>Status</strong></th>
		
		<th>Delete</th>
		
	</tr>
	
	<?php 
          	$sql = "SELECT * FROM sub_activity_group";
			$rpp = 10; // results per page
			$adjacents = 5;
			
			$page = intval($_GET["page"]);
			if($page<=0) $page = 1;
			
			$reload ="index.php?route=SubContractors/Masters/activity_group_defination_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><a href="index.php?route=SubContractors/Masters/activity_group_defination<?php echo $rurl;?>&amp;action=edit&opn=<?php echo $id; ?>" style="color:#000000"><?php echo $group_name; ?></a></td>
		<td><?php echo $group_code; ?></td>
		
		<td><?php  if($status=='Active')  echo "Active"; else echo "InActive"; ; ?></td>
		
		<td ><a href="index.php?route=SubContractors/Masters/activity_group_defination_index<?php echo $rurl;?>&amp;action=delete&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>

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

?>



