<?
session_start();
$brcode=$_SESSION['brcode'];
include_once('opendb.php');
$code=$_REQUEST['code'];
if(isset($_POST['save']))
{
$code=$_REQUEST['code'];

$addr1=$_REQUEST['slsysno'];
$addr2=$_REQUEST['addr1'];
$city=$_REQUEST['addr2'];
$district=$_REQUEST['addr3'];
$state=$_REQUEST['district'];
$pin=$_REQUEST['state'];
$phone1=$_REQUEST['pin1'];
$tin=$_REQUEST['phone1'];
$email=$_REQUEST['email'];
$suptype=$_REQUEST['crlimit'];
$dislimit=$_REQUEST['dislimit'];
$sql="update khadistaff set slsyn='$addr1',addr1='$addr2',addr2='$city',addr3='$district',dist1='$state',state1='$pin',pin1='$phone1',phone1='$tin',email='$email',cramt='$suptype',pin2='$dislimit' where code='$code' and brcode='$brcode'";
mysqli_query($db,$sql) or die('Insert Err:'.mysqli_error($db));
print "<script> document.location='khadistaff.php';</script>";
return;
}
//$re=mysqli_query($db,"select * from configmaster");
//$row=mysqli_fetch_array($re);
?>
<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>
<script>
this.resizeTo(750,170);
function valid()
{
 
 /*if(document.f1.tax.value.length<=0)
 {
   alert("Invalid Tax.");
   document.f1.tax.focus();
   return false;
 }*/

}
</script>
<style>
#txt{
font-family: Arial, Helvetica;
background-color: #F2F2F2;

}
th{background-color:steelblue;color:white}
</style>
<?php include('includes/top.php'); ?>
<table class='container'><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px;">  &nbsp;&nbsp;Master >> Khadistaff >> Edit Khadistaff</font>
<br>
<center>

<?
$re=mysqli_query($db,"select * from khadistaff where code='$code' and brcode='$brcode'");
$rerow=mysqli_fetch_array($re);
?>
<form method='POST'>
<table cellspacing=1 cellpadding=2 class='form'>
<tr height=21><td colspan=2 align=center bgcolor='steelblue'><FONT COLOR=white><B>KHADI STAFF DETAILS</td></tr>
                <input type=hidden name='code' value='<?print $code?>'>
<tr><td>Staff Name</td><td><input type=text name='cname' value='<? echo $rerow[3] ?>' readonly class='ent' onKeyPress="return handleEnter(this, event)" size=40 onKeyDown=chkey(this);></td></tr>
<tr><td>Sales Staff</td><td><select name='slsysno' onKeyPress="return handleEnter(this, event)">
<option value='<? echo $rerow[13] ?>'><? echo $rerow[13] ?></option>
<option value='NO'>NO</option><option value='YES'>YES</option></select></td></tr>
<tr><td>Designation</td><td><input type=text name='addr1' size=40 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[6] ?>'></td></tr>
<tr><td>Address1</td><td><input type=text name='addr2' size=40 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[11] ?>'></td></tr>
<tr><td>Address2</td><td><input type=text name='addr3' size=40 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[12] ?>'></td></tr>
<tr><td>District</td><td><input type=text name='district' size=6 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[7] ?>'></td></tr>
<tr><td>State</td><td><input type=text name='state' size=6 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[8] ?>'></td></tr>
<tr><td>Pin</td><td><input type=text name='pin1' size=6 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[9] ?>'></td></tr>
<tr><td>Phone</td><td><input type=text name='phone1' size=40 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[10] ?>'></td></tr>
<tr><td>Email_id </td><td><input type=text name='email' size=40 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[20] ?>'></td></tr>
<tr><td>Credit Limit </td><td><input type=text name='crlimit' size=6 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[25] ?>'></td></tr>
<tr><td>Discount Limit </td><td><input type=text name='dislimit' size=6 onKeyPress="return handleEnter(this, event)" value='<? echo $rerow[14] ?>' onKeyDown=chdislmt(this);></td></tr> 
<tr><td colspan=2 align=center bgcolor='lightsteelblue'>
<input type=submit value='Save' name='save'> <input type=button value='Cancel' onclick='window.location="khadistaff.php"'>
</td></tr>
</table>
</form>
</td></tr>
</table>
