<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");
?>

<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:13}
th{background-color:brown;color:white}
.mnu{margin-left:5}
</style>
<body bgcolor='ivory'>
<form action='<?print $PHP_SELF?>'>

<table border=1>
<tr><td colspan=2 align=center><FONT COLOR=GREEN>------SEARCH-------</FONT></TD></TR>
<tr><td>Order No </td><td><input type=text name='ordno' size=10></td></tr>
<tr><td colspan=2 align=center>OR</td></tr>
<tr><td>Customer Name </td><td><input type=text name='na' size=40></td></tr>
<tr><td colspan=2 align=center><input type=submit name='submit' value='Show'>
</td></tr>
</table>
</form>


<?
if($submit)
{
 if($ordno)
   $sql="select * from orderform where formno='$ordno' and brcode='$brcode'";
 else
   $sql="select * from orderform where cust like'%$na%' and brcode='$brcode'";

 $result=mysqli_query($db,$sql)or die(mysqli_error());
 print "<table border=1><th>Ord No. <th>Date <th>Name <th>Address <th>Phone <th>Rep.";
print "<th>Model <th>Action";
 while($row=mysqli_fetch_array($result))
 {
  print "\n<form action='svadv.php?formno=$row[0]&name=$row[2]' method='post'>\n";
  print "<tr><td>$row[0]</td><td>".datetohtml($row[1])."</td>";
  print "<td>".strtoupper($row[2])."</td><td>$row[3]</td><td>$row[4]</td>";
  
 $rr=mysqli_query($db,"select repname from rep_master where code='$row[rname]'");
 $rep_row=mysqli_fetch_row($rr);
 print "<td>$rep_row[0]</td><td>$row[6]</td>";
  print "<td><input type=button value='Edit' name='edit' onClick=window.open('ofedit.php?code=$row[0]',menubar=false,resizable=false)> <input type=submit value='Receipt'></td></tr></form>";
 }
}
?>
</table>


