<?
session_start();
include_once('includes/top.php');
include_once('opendb.php');
include_once("test.php");
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$code=$_REQUEST['code'];
//$br=$_SESSION['branch'];
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
$re=mysqli_query($db,"select * from groupmaster where code='$code'");
$rerow=mysqli_fetch_array($re);

if(isset($_POST['save']))
{
$code=$_REQUEST['code'];
$gr_tax=$_REQUEST['gr_tax'];
$gr_commi=$_REQUEST['gr_commi'];
$gr_strbt=$_REQUEST['gr_strbt'];
$gr_kvic=$_REQUEST['gr_kvic'];
$gr_reduct=$_REQUEST['gr_reduct'];
$gr_kvspcl=$_REQUEST['gr_kvspcl'];
$tax_chk=$_REQUEST['tax_chk'];
$strbt_chk=$_REQUEST['strbt_chk'];
$kvic_chk=$_REQUEST['kvic_chk'];
$reduct_chk=$_REQUEST['reduct_chk'];
$kvspl_chk=$_REQUEST['kvspl_chk'];
$sql="update groupmaster set grp_tax='$gr_tax',grp_comsion='$gr_commi',stat_rbt='$gr_strbt',grp_kvic='$gr_kvic',reduct='$gr_reduct',grp_kvicspl='$gr_kvspcl',tax_aply='$tax_chk',rebt_aply='$strbt_chk',kvic_aply='$kvic_chk',redct_aply='$reduct_chk',kvspl_aply='$kvspl_chk' where code='$code'";
mysqli_query($db,$sql) or die('Insert Err:'.mysqli_error($db));
print "<script> document.location='grmaster.php'; </script>";
return;
}

?>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="scripts/jquery-latest.js"></script>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link rel="stylesheet" href="css/form.css" type="text/css" />
<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
</script>
<style>
#txt{
font-family: Arial, Helvetica;
background-color: #F2F2F2;

}
th{background-color:steelblue;color:white}
table.form{
font-weight: normal;
} 
</style>
<script>
this.resizeTo(750,170);
function valid()
{
 
 /*if(document.f1.tax.value.length<=0)
 {
   alert("Invalid Tax.");
   document.f1.tax.focus();
   return false;
 }*/

}
</script>
<table class='container'><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >> Group Master >> Edit Group Master</font>
<br>
<center>
<table cellspacing=1 cellpadding=1 bgcolor=black>
<tr><td align=center bgcolor='white'>
<form name='f1' action='<?print $PHP_SELF?>' method='post' onSubmit="return valid()">
<input type=hidden name=code value='<?print $code?>'>
<table cellspacing=1 cellpadding=3 width='400' class=form>
<th colspan=4><font size=3>EDIT GROUP MASTER</th>
<tr><td>Group Name</td><td><input type=text name='gname' value='<?print $rerow[gname]?>'  readonly></td></tr>
<tr><td>Tax</td><td>
<?
$sql="select * from taxmaster";
$rs=mysqli_query($db,$sql);
?>
<select name='gr_tax'>
<option><? echo $rerow[grp_tax] ?></option>
<?

while($row=mysqli_fetch_array($rs))
{
?>
<option><? echo $row[2] ?></option>
<?
}
?>
</select>
</td><td>Apply<input type='checkbox' name='tax_chk' value='1' <?php if($rerow[tax_aply] === '1') echo 'checked="checked"';?>></td></tr>
<tr><td>MDA</td><td><input type=text name='gr_strbt' value='<?print $rerow[stat_rbt]?>'></td><td>Apply<input type='checkbox' name='strbt_chk' value='1' <?php if($rerow[rebt_aply] === '1') echo 'checked="checked"';?>></td></tr>
<tr><td>State Rebate</td><td><input type=text name='gr_kvic' value='<?print $rerow[grp_kvic]?>'></td><td>Apply<input type='checkbox' name='kvic_chk' value='1' <?php if($rerow[kvic_aply] === '1') echo 'checked="checked"';?>></td></tr>
<tr><td>State Rebate Special</td><td><input type=text name='gr_kvspcl' value='<?print $rerow[grp_kvicspl]?>'></td><td>Apply<input type='checkbox' name='kvspl_chk' value='1' <?php if($rerow[kvspl_aply] === '1') echo 'checked="checked"';?>></td></tr>
<th colspan=4><input type=submit value='Save' name='save'></td></tr>
</table>
</form>
</td></tr>
</table>
