<?
 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:c1d799;font-size:13}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<center>
<H3>
<?print $branch?> <br>PURCHASE RETURN REGISTER</H3>
<?
   $result=mysqli_query($db,"select * from veh_purchreturn where date>='$df' and date<='$dt' and brcode='$brcode'") or die(mysqli_error());
   if(mysqli_num_rows($result)>0)
   {
?>
<table bgcolor=silver cellspacing=1 cellpadding=1 width=100%>
<th>No.<th>Date<th>To <th>Ret NO.<th>Pur_invoice <th>Pur Date<th>DA <th>MCode <th>Config <th>Net Amt.
<th>Tax <th>Tax% <th>Before Tax
<?
$i=1;
     while($row=mysqli_fetch_array($result))
     {
 $pres=mysqli_query($db,"select entrydate from veh_purchase where da='$row[da]' and brcode='$brcode'");
 $prow=mysqli_fetch_array($pres);
 if(mysqli_num_rows($pres)<=0)
 $dt='1-4-2008(OP)';
 else
  $dt=datetohtml($prow[0]);
       print "<tr bgcolor=white><td>".$i++."</td><td>".datetohtml($row[date])."</td><td>$row[retto]</td><td>$row[ret_num]</td><td>$row[pur_invoice]</td>";
 print "<td>". $dt."</td>";
       print "<td>$row[da]</td><td>$row[mcode]</td><td>$row[config]</td><td align=right>$row[netamt]</td>";
       print "<td align=right>$row[tax]</td><td align=right>$row[taxp]</td><td align=right>$row[amt2]</td></tr>";
     }
 }
 else
   print "<font color=red size=3>Record does note exist";

?>
</table>
<br>

