<?
 session_start();
if(strlen($brcode)<=0)
{
  print "<script> alert('Invalid User'); parent.document.location='ind.php' </script>";
  return;
}
include("../opendb.php");
include("../test.php");
$sql="select * from oldinvoice where date='$date' and invoiceno='$invno' and brcode='$brcode'";
$re=mysqli_query($db,$sql);
$row=mysqli_fetch_array($re);
if($upd)
{
 mysqli_query($db,"update oldinvoice set area='$area',phone='$phone' where date='$date' and invoiceno='$invno'") or die(mysqli_error());
print "<script> history.go(-2)</script>";
}
?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:14}
//tr{background-color:white} 
th{background-color:c1d799;font-size:14}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<!-- <p align=right> <input type=button value='Print' onClick=window.open('')> </p> -->
<center>
<h2>EDIT CUSTOMER </H2>
<form action='<?print $PHP_SELF?>'>
<TABLE cellspacing=1 cellpadding=1>
<tr><td>Date </td><td><input type=text readonly name='date' value='<?print $row[date]?>'></td></tr>
<tr><td>Invoice No </td><td><input type=text readonly name='invno' value='<?print $row[1]?>'></td></tr>
<tr><td>Name </td><td><input type=text readonly name=na value='<?print $row[2]?>' size=50></td></tr>
<tr><td>Address 1 </td><td><textarea cols=50 readonly><?print $row[3]?></textarea></td></tr>
<tr><td>Address 2 </td><td><textarea cols=50 readonly><?print $row[4]?></textarea></td></tr>
<tr><td>Address 3 </td><td><textarea cols=50 readonly><?print $row[5]?></textarea></td></tr>
<tr bgColor='c1d7bb'><td>Current Owner </td><td><input type=text  name=na1 value='<?print $row[2]?>' size=50></td></tr>
<tr bgColor='c1d7bb'><td>Current Address</td><td><textarea cols=50 name='txtadd'></textarea></td></tr>
<tr bgColor='c1d7bb'><td>District </td><td>
<select name='dist'>
<?
$re=mysqli_query($db,"select * from dist_master where brcode='$brcode' order by dist");
print "<option> </option>";
while($row=mysqli_fetch_row($re))
{
 print "<option>$row[1]</option>";
}
print "<option>Sold out</option>";
?>
 </select>

<tr bgcolor='silver'><td>Area </td><td><input type=text name='area' value='<?print $row[6]?>'></td></tr>
<tr><td>District </td><td><input type=text readonly name=na value='<?print $row[7]?>' size=50></td></tr>
<tr bgcolor='silver'><td>Phone </td><td><input type=text  name='phone' value='<?print $row[8]?>' size=50></td></tr>
<tr><td>Chasis </td><td><input type=text readonly name=na value='<?print $row[9]?>' size=50></td></tr>

<tr><td>Engine </td><td><input type=text readonly name=na value='<?print $row[10]?>' size=50></td></tr>
<tr><td>Config </td><td><input type=text readonly name=na value='<?print $row[11]?>' size=50></td></tr>
<tr><td>Financer </td><td><input type=text readonly name=na value='<?print $row[12]?>' size=60></td></tr>
<tr><td>Executive </td><td><input type=text readonly name=na value='<?print $row[13]?>' size=50></td></tr>
<tr bgcolor='silver'><td colspan=2 align=center><input type=submit value='Save' name='upd'></td></tr>
</table>
</form>

