<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($bcode)<=0 && strlen($user)<=0)
{
 print "<script> alert('Please login again'); parent.document.location='ind.php'; </script>";
 return;
}

?>
<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:silver;}
 select
  {border-style:ridge;
   border-color:black;
   height:25px;
   border-size=1;
   font-family:verdana;
   color:black;
  }
 input
  {border-style:ridge;
   border-color:#22437f;
   background-color:white;
   height:25px;
   font-weight:bold;
   border-size=1;
   font-family:sans-serif;
   color:BLACK;
  }
</style>
<script>
function showexgrp(nat)
{
  nature=nat.value;
  if(nature!='')
   window.open('exgrp.php?nature='+nature,menubar=false,resizable=false);
}
function rnd1()
{
 window.open('chkrnd.php',menubar=false,resizable=false);
}
function chkey(abc)
{
 yy=abc.value
 if(yy.indexOf('  ')>-1) 
  {
    alert('Multiple space is not allowed');
    abc.value='';
  }
 if(yy.indexOf("'")>-1) 
  {
    alert("\' is not allowed");
    abc.value='';
  }

}
</script>
<?
include("opendb.php");
$us=mysqli_query($db,"select level from bruser where username='$user'")or die(mysqli_error());
$r=mysqli_fetch_row($us);
$user_level=$r[0];
 print "User Level:".$user_level;

if($user_level>='4'||$user=='admin')
{
?>
<body onLoad=document.f1.subgname.focus()>
<center>

<!-- <form name=f1 action="svacgroup.php" method=post>-->
<form name=f1 action="svacsubgroup.php" method=post>

<table>
<tr><td colspan=2 bgcolor=#5b5858 align=center><font color=white size=3>SUB GROUP CREATION</font></tr></td>
<tr><td>Sub Group Name</td><td><input type=text name=subgname size=40 onKeyDown=chkey(this)></td></tr>
<tr><td>Nature of Group </td><td>
<select name=nature onChange='showexgrp(this)'>
<option value=''></option>
<option value='Assets'>Assets</option>
<option value='Liabilities'>Liabilities</option>
<option value='Income'>Income</option>
<option value='Expenses'>Expenses</option>
</select>
Level <input type=text name=level size=3 value='100'>
</td></tr>
<tr><td>Under Group</td><td><input type=text readonly name=ungrp size=40 style={background-color:silver}></td></tr>
<tr><td colspan=2 align=center><input type=button value='R & D Aspect' onClick=rnd1() style={background-color:silver;border-style:ridge}>
<input type=text size=3 readonly name=rnd value='No'></td></tr>
<tr><td colspan=2 bgcolor=#5b5858 align=center>
<input type=submit value="Add"> <input type=button value="Cancel" onClick=document.location='blank.html'> <input type=reset value='Clear'>
</tr></td>
</table>
</form>
<?
}
include("listacgroups.php");
?>

