<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
include("../opendb.php");
if($save)
{
 $celres=mysqli_query($db,"select * from celmast where brcode='$brcode'");
 $celrow=mysqli_fetch_array($celres);

if(mysqli_num_rows($celres)<=0)
 mysqli_query($db,"insert into celmast values('$pf','$pfp','$esi','$esip','$brcode','$ptax', '$ptaxp','$emppfp','$empesip')")or die(mysqli_error($db));
else
 mysqli_query($db,"update celmast set pf='$pf',pfp='$pfp', esi='$esi',esip='$esip',ptax='$ptax',ptaxp='$ptaxp', emppfp='$emppfp',empesip='$empesip' where brcode='$brcode'")or die('err:'.mysqli_error($db));
}
 $celres=mysqli_query($db,"select * from celmast where brcode='$brcode'");
 $celrow=mysqli_fetch_array($celres);

?>

<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
tr{background-color:e3ecd2}
th{background-color:c1d799}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>

<center>
<form action='<?print $PHP_SELF ?>'>
<table width=40% cellpadding=2>
<th colspan=2>CIELING MASTER</th>
<tr><td> PF Amount</td><td><input type=text name='pf' size=10 onKeyDown=chkey(this) value='<?print $celrow[pf]?>'></td>
<tr><td> PF %</td><td><input type=text name='pfp' size=4 onKeyDown=chkey(this) value='<?print $celrow[pfp]?>'>%</td>
<tr><td> PF Employer share %</td><td><input type=text name='emppfp' size=4 onKeyDown=chkey(this) value='<?print $celrow[emppfp]?>'>%</td>



<tr><td> ESI Amount</td><td><input type=text name='esi' size=10 onKeyDown=chkey(this) value='<?print $celrow[esi]?>'></td>

<tr><td> EsI %</td><td><input type=text name='esip' size=4 onKeyDown=chkey(this) value='<?print $celrow[esip]?>'>%</td>
</tr>
<tr><td> ESI employer share %</td><td><input type=text name='empesip' size=4 onKeyDown=chkey(this) value='<?print $celrow[empesip]?>'>%</td>
</tr>

<tr><td> P Tax </td><td><input type=text name='ptax' size=10 onKeyDown=chkey(this) value='<?print $celrow[ptax]?>'></td>
</tr>
<tr><td> P Tax % </td><td><input type=text name='ptaxp' size=4 onKeyDown=chkey(this) value='<?print $celrow[ptaxp]?>'>%</td>
</tr>

<tr><td colspan=2 align=center><input type=submit value='Save / Update' name='save'> </td></tr>
</table>
</form>
<?
 $celres=mysqli_query($db,"select * from celmast where brcode='$brcode'");
 $celrow=mysqli_fetch_array($celres);
?>
<table width=40% cellpadding=2>
<th colspan=2>CIELING MASTER DATA</th>
<tr><td> PF Amount</td><td><?print $celrow[pf]?></td>
<tr><td> PF %</td><td><?print $celrow[pfp]?>%</td>
<tr><td> PF Employer share %</td><td><?print $celrow[emppfp]?>%</td>

<tr><td> ESI Amount</td><td><?print $celrow[esi]?></td>
<tr><td> ESI %</td><td><?print $celrow[esip]?>%</td>
<tr><td> ESI Employer share %</td><td><?print $celrow[empesip]?>%</td>

<tr><td> P Tax</td><td><?print $celrow[ptax]?></td>
<tr><td> P Tax %</td><td><?print $celrow[ptaxp]?>%</td>
</tr>
</table>
