<?
session_start();
if(strlen($user)<=0)
{
 print "<script> alert('You are not logged in') </script>";
 include("logout.php");
 return;
}
include("opendb.php");
if($upd)
{

print $sql1="update insmaster set web='$web' where code='$code'and acname='$acname' ";
return;
$re1=mysqli_query($db,$sql1)or die(mysqli_error($db));


}
$sql="select * from insmaster where code='$code'and acname='$acname' ";
$re=mysqli_query($db,$sql)or die(mysqli_error($db));
$row=mysqli_fetch_array($re);
$dt1=explode('-',$row[crdate]);
$dt2=explode('-',$row[dob]);

include("opendb.php");
?>
<link rel="stylesheet" href="style.css" type="text/css" />
<center>
<form action='updins.php' onSubmit="return valid()">

<input type=hidden name='code' value='<?print $code?>'>
<input type=hidden name=acname value='<?print $row[acname]?>'>
<table cellspacing=1 cellpadding=2 bgcolor='aliceblue'>
<tr height=21><td colspan=2 align=center bgcolor='steelblue'><FONT COLOR=IVORY><B>EDIT CUSTOMER DETAILS</td></tr>
<TR><TD>Creation Date </TD><TD><?print  $dt1[2].'-'.$dt1[1].'-'.$dt1[0]?></td></tr>
<tr><td>Customer Name</td><td><input type=text name='cname' size=40 value='<?print $row[cname]?>'></td></tr>



<tr bgColor='c1d7bb'><td><font color=red>Display Name<br><font color=blue>(A/c Head) 
</td><td><input type=text name='acname' readonly size=40  value='<?print $row[acname]?>' style="background-color:ivory">
<?if($level>=3){?>
<input type=button value='Edit' onClick=fn('<?print $code?>');>
<?
}
?>
</td></tr>

<tr><td colspan=2 align=center bgcolor='lightsteelblue'>INSURANCE MASTER</td></tr>
<tr><td>Address</td><td><input type=text name='addr1' size=40 value='<?print $row[addr1]?>'></td></tr>
<tr><td>District</td><td><input type=text name='dist1' size=40 value='<?print $row[dist1]?>'></td></tr>
<tr><td>State</td><td><input type=text name='state1' size=40 value='<?print $row[state1]?>'></td></tr>
<tr><td>pin</td><td><input type=text name='pin1' size=6 value='<?print $row[pin1]?>'></td></tr>
<tr><td>Phone</td><td><input type=text name='phone1' size=40 value='<?print $row[phone1]?>'></td></tr>


<tr><td colspan=2 align=center bgcolor='lightsteelblue'>OTHER</td></tr>
<tr><td>Mobile</td><td><input type=text name='mob' size=40 value='<?print $row[mob]?>'></td></tr>

<tr><td>Email_id </td><td><input type=text name='email' size=40 value='<?print $row[email]?>'></td></tr>
<tr><td>ShortName</td><td><input type=text name='web' size=40 value='<?print $row[web]?>'></td></tr>

<tr><td colspan=2>TIN <input type=text name='tin' size=10 value='<?print $row[tin]?>'>
CST <input type=text name='cst' size=10 value='<?print $row[cst]?>'>
KGST <input type=text name='kgst' size=10 value='<?print $row[kgst]?>'></td></tr>

<?if($level>=5)
{
?>
<tr><td colspan=2>Credit Amt <input type=text name='cramt' size=10 value='<?print $row[cramt]?>'>
Credit Days <input type=text name='crdays' size=10 value='<?print $row[crdays]?>'></td></tr>
<?
}
?>
<?if($level<=4)
{
?>
<tr><td colspan=2>Credit Amt <input type=text readonly name='cramt' size=10 value='<?print $row[cramt]?>'>
Credit Days <input type=text readonly name='crdays' size=10 value='<?print $row[crdays]?>'></td></tr>
<?
}
?>




<tr><td colspan=2 align=center bgcolor='lightsteelblue'>
<input type=submit value='Save' name='upd'> 
<input type=button value='Cancel' onClick=history.go(-1)>
</td></tr>
</table>
</form>

<script>
function fn(x)
{
 if(confirm('Do you want to edit ledger name ?'))
 {
   document.location='editinsled.php?code='+x;
 }
}
</script>

