<?
 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}
.mnu{margin-left:5}
</style>
<center>
<H3><?print $branch?> <br>PURCHASE REGISTER<br>
From <?print datetohtml($df).' To '.datetohtml($dt)?>
</H3>
<?
//   $df=$y.'-'.$m.'-'.$d;
//   $dt=$y1.'-'.$m1.'-'.$d1;
$tnet=0;
$ttax=0;
$tb=0;
   $result=mysqli_query($db,"select * from veh_purchase where entrydate>='$df' and entrydate<='$dt' and brcode='$brcode' and tax>0 and oldornew='-' order by entrydate") or die(mysqli_error());
   if(mysqli_num_rows($result)>0)
   {
?>
<table bgcolor=silver cellspacing=1 cellpadding=1>
<th>No.<th>From <th>Inv NO.<th>Inv. Date <th>Entry Date<th>DA <th>MCode <th>Config 
<th>Before Tax  <th>Tax <th>Tax% <th>Cess% <th>Cess<th>Net Amt.
<?
$i=1;
     while($row=mysqli_fetch_array($result))
     {
      print "<tr bgcolor=white><td>".$i++."</td><td>$row[ledger]</td><td>$row[invno]</td><td>".datetohtml($row[invdate])."</td><td>".datetohtml($row[entrydate])."</td>";
      print "<td>$row[da]</td><td>$row[mcode]</td><td>$row[config]</td>";
      print "<td align=right>$row[amt2]</td>";
      print "<td align=right>$row[tax]</td><td align=right>$row[taxp]</td>";
    print "<td align=right>$row[cessp]</td><td align=right>$row[cessamt]</td>";
    print "<td align=right>$row[netamt]</td>";
$tnet+=$row[netamt];
$ttax+=$row[tax];
$tb+=$row[amt2];
$cesstot+=$row[cessamt];
    }
  print "<tr><td colspan=8 align=center><b>Total</td><td align=right><b>".putComa($tb)."</td>";
  print "<td align=right><b>".putComa($ttax)."</td><td>&nbsp;</td>";
  print "<td></td><td align=right><b>".putComa($cesstot)."</td><td align=right><b>".putcoma($tnet)."</td></tr>";
}
else
 print "Record does not exist";

?>
</table>
