<?
session_start();
$user = $_SESSION['user'];
$brcode = $_SESSION['brcode'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
$code=$_REQUEST['code'];
include("../opendb.php");
if(isset($_POST['edit']))
{
    $code=$_REQUEST['code'];
    $supname=$_REQUEST['supname'];
    $addr1=$_REQUEST['addr1'];
    $addr2=$_REQUEST['addr2'];
    $city=$_REQUEST['city'];
    $dist=$_REQUEST['dist'];
    $stat=$_REQUEST['stat'];
    $pin=$_REQUEST['pin'];
    $phone1=$_REQUEST['phone1'];
    $phone2=$_REQUEST['phone2'];
    $tin=$_REQUEST['tin'];
    $cst=$_REQUEST['cst'];
    $email=$_REQUEST['email'];
    $web=$_REQUEST['web'];
    $suptype=$_REQUEST['suptype'];
    if(strlen($supname)<=0)
    {
        print "<script> alert('In sufficient entry'); history.back(1);  </script>";
        return;
    }
    $sql="update sup_master set supname='$supname',addr1='$addr1',addr2='$addr2',city='$city', dist='$dist', stat='$stat',pin='$pin',phone1='$phone1',phone2='$phone2', tin='$tin',cst='$cst', email='$email',web='$web' where code='$code' and branch='$brcode'";
    mysqli_query($db,$sql);
    include("supp-mast.php");
    return;
}

$sql="select * from sup_master where code='$code'";
$result=mysqli_query($db,$sql);
$row=mysqli_fetch_row($result);
?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
th{background-color:green;color:white}
.mnu{margin-left:5}
</style>
<body bgcolor='ivory'>

<CENTER>
<BR>
<FORM ACTION='<?print $PHP_SELF?>' METHOD='POST'>
<input type=hidden name='code' value='<?print $code?>'>
<table cellspacing=1 cellpadding=1 bgcolor=green>
<tr bgColor='c1d7bb'><td align=center>
<table>
<tr bgColor='GREEN'><td colspan=2 align=center><FONT COLOR='WHITE'><B>EDIT SUPPLIER MASTER</TD></TR>
<tr bgColor='c1d7bb'><td>Supplier Name </td><td><input type=text name='supname' readonly size=40 value='<?print $row[1]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Address1 </td><td><input type=text name='addr1' size=40 value='<?print $row[2]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Address2 </td><td><input type=text name='addr2' size=40 value='<?print $row[3]?>'></td></tr>
<tr bgColor='c1d7bb'><td>City </td><td><input type=text name='city' size=40 value='<?print $row[4]?>'></td></tr>
<tr bgColor='c1d7bb'><td>District </td><td><input type=text name='dist' size=40 value='<?print $row[5]?>'></td></tr>
<tr bgColor='c1d7bb'><td>State </td><td><input type=text name='stat' size=40 value='<?print $row[6]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Pin No </td><td><input type=text name='pin' size=40 value='<?print $row[7]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Phone1 </td><td><input type=text name='phone1' size=40 value='<?print $row[8]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Phone2 </td><td><input type=text name='phone2' size=40 value='<?print $row[9]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Tin NO </td><td><input type=text name='tin' size=40 value='<?print $row[10]?>'></td></tr>
<tr bgColor='c1d7bb'><td>CST No & Date </td><td><input type=text name='cst' size=40 value='<?print $row[11]?>'></td></tr>
<tr bgColor='c1d7bb'><td>Email_id </td><td><input type=text name='email' size=40 value='<?print $row[12]?>'></td></tr>
<tr bgColor='c1d7bb'><td>PAN</td><td><input type=text name='web' size=40 value='<?print $row[13]?>'></td></tr>
<TR bgColor='c1d7bb'><TD COLSPAN=2 ALIGN=CENTER><INPUT TYPE=SUBMIT NAME= 'edit' VALUE='  UPDATE  '>  <input type=button value='  CANCEL  ' onClick=history.back(1);> </TD></TR>

</table>
</td></tr>
</table>
</FORM>

