<?php
	if($_REQUEST['action']=='delete' && !empty($_REQUEST['opn']))
	{
		if($s->DeleteRecord('sub_activity_defination',"id=".$_REQUEST['opn']))
		{						
			$_SESSION['success_msg']="Delete Successfully";	
			echo "<script>location.href='index.php?route=SubContractors/Masters/activity_defination_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";	
		}
	}
?>
<link rel="stylesheet" type="text/css" href="SubContractors/css/paginate.css" />
<h3>Activity  Definations </h3>

<p>&nbsp;</p>
<div><br></div>

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

	<tr>
		<th><strong>Activity Name</strong></th>
		<th><strong>Activity Group</strong></th>
		<th><strong>Activity Group Code</strong></th>		
		<th><strong>Activity Code</strong></th>
		<th><strong>Display Order</strong></a></th>
		<th><strong>Status</strong></th>
		
		<th>Delete</th>
		
	</tr>
	
	<?php 
          	$sql = "SELECT * FROM sub_activity_defination";
			$rpp = 10; // results per page
			$adjacents = 5;
			
			$page = intval($_GET["page"]);
			if($page<=0) $page = 1;
			
			$reload ="index.php?route=SubContractors/Masters/activity_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);
		$groupdata=DB_query("select group_name from sub_activity_group where id='".$group_name."'",$db);	
		$grouprow=DB_fetch_array($groupdata);	
	
	?>
	
	<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_defination<?php echo $rurl;?>&amp;action=edit&opn=<?php echo $id; ?>" style="color:#000000"><?php echo $activity_name; ?></a></td>
		<td><?php echo $grouprow['group_name']; ?></td>
		<td ><?php echo $group_code; ?></td>
		<td ><?php echo $activity_code; ?></td>
		<td ><?php echo $display_order; ?></td>
		
		<td><input type="checkbox" name="status" value="" <?php  if($status=='Active')  {?> checked="checked" <?php } ?> ></td>
		
		<td ><a href="index.php?route=SubContractors/Masters/activity_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>
<p align="left"><input type="button" name="Print" value="Print" onclick="popup('print_activity_defination.php',700,400)">
&nbsp;&nbsp;&nbsp;	
	<a href="index.php?route=SubContractors/Masters/activity_defination&amp;modid=<?php echo $_REQUEST['modid'];?>&amp;frmid=<?php echo $_REQUEST['frmid'];?>"><input type="button" name="AddNew" value="Add New" />
	</a>
</p>
<?php if(isset($_SESSION['success_msg']))
{ ?>
	<script> alert("<?php echo ($_SESSION['success_msg']);?>");</script>
<?php 
unset($_SESSION['success_msg']);
}

?>



