<style>
 td{font-family:verdana;font-size:14;color:black;}
 th{font-family:verdana;font-size:14;color:white;background-color:#5b5858}
 body{background-color:ivory}
</style>
<br>

<table border=0 width=100%>
<tr><td>
<center>
<font face=verdana size=3 >Current Groups</b></font>
<table border=0 cellspacing=1 cellpadding=1 bgcolor=black align=center >
<tr bgcolor='silver'><td width=5><center><b>No.</td><td width=300><center><b>Group Name </td><td><center><b>Nature</td></tr>
<?
include("opendb.php");
$result=mysqli_query($db,"select distinct headgroup,nature from acgroups order by ghlevel")or die(mysqli_error($db));
$i=1;
while($row=mysqli_fetch_array($result))
{
print "\n<tr bgcolor='#fffcd6' onMouseOver=bgColor='#f7dbd4'; onMouseOut=bgColor='#fffcd6'>";
print "<td>".$i++."</td><td>$row[0]</td><td>$row[1]</td></tr>";
//<td><input type=button value='Edit' onClick=show('".str_replace(' ','-',$row[0])."')></tr>";
}
print "</table><br>";
print "<table border=0 cellspacing=1 cellpadding=1 bgcolor=black> <tr bgcolor='silver'><TD>NO.</TD><td align=center>CURRENT SUB-GROUPS</td><td align=center>GROUPS</td><td>TB Level</td><td>P&L Level</td>";
 if($user=='ANOOP'||$user=='anoop')
  {
    print "<TD colspan=2 align=center>Action</TD>";
  }
print "</tr>";
$result=mysqli_query($db,"select gname,headgroup,level,type,ghlevel from acgroups where gname!='-' order by gname") or die(mysqli_error($db));
$i=1;
while($row=mysqli_fetch_array($result))
{
$gname=str_replace('&','^',$row[0]);
$gname=str_replace(' ','%20',$gname);
 if($row[type]!='pdf')
{	
print "\n<tr bgcolor='#fffcd6' onMouseOver=bgColor='#f7dbd4'; onMouseOut=bgColor='#fffcd6'>";
print "<td>".$i++."</td><td><a href='groupdet.php?gname=$gname' target='_blank'>$row[0]</a></td><td>$row[1]</td><td>$row[2]</td><td>$row[4]</td>";
 if($user=='anoop'||$user=='ANOOP')
 {
  print "<td><input type=button value='Edit' onClick=show1('".str_replace(' ','-',$row[0])."')></td>";
  print "<td><input type=button value='Delete' onClick=show2('".$gname."')></td></tr>";
 }
}
else
{	
print "\n<tr bgcolor='#fffcd6' onMouseOver=bgColor='#f7dbd4'; onMouseOut=bgColor='#fffcd6'>";
print "<td>".$i++."</td><td><a href='groupdet.php?gname=$gname' target='_blank'>$row[0]</a></td><td>$row[1]</td><td>$row[2]</td>";
 if($user=='admin')
  print "<td colspan=2>Program defined</td>";
print "</tr>";
}

}
?>
</tr></td>
</table>
<p>&nbsp;
<script>
function show(x)
{
 document.location='editacgroups.php?cde='+x;
}
function show1(x)
{
 document.location='editacgroups.php?cde='+x+'&type='+'sub';
}
function show2(x)
{
 document.location='delsubgroup.php?cde='+x;
// window.open('delsubgroup.php?cde='+x);
}

</script>
