<?
 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:white}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:white}
</style>
<center>
<H3>
<?print $branch;?>
<br>ITEM PURCHASE REGISTER</H3>
From <?print datetohtml($df)." To ".datetohtml($dt)?>
<br>&nbsp;
<?
   $tq=$tuni=$ttax=$tgtot=$tnet=0;

   $re=mysqli_query($db,"select * from item_purchase where curdate>='$df' and curdate<='$dt' and brcode='$brcode'");
    if(mysqli_num_rows($re)>0)
    {
     print "<table bgcolor=silver cellspacing=1 cellpadding=3 width=100%>";
     print "<th>P.No <th>Date<th>Item <th> Unit Amt. <th>Qty <th> Tax Amt <th>Tax% ";
     print "<th>Cess% <th>Cess Amt<th> Net Amt.<th>P.Inv. <th>Supplier";
        while($row=mysqli_fetch_array($re))
       {
   $ss=mysqli_query($db,"select itname from itemmaster where code='$row[item_code]'");
  $itrow=mysqli_fetch_array($ss);

   $ss=mysqli_query($db,"select supname from sup_master where code='$row[sup]'");
  $srow=mysqli_fetch_array($ss);

   print "<tr bgcolor='white'><td align=center>$row[pno]</td>";
   print "<td>".datetohtml($row[curdate])."</td>";
   print "<td>$itrow[itname]</td>";
   print "<td align=right>$row[net]</td><td align=center>$row[qty]</td>";
   print "<td align=right>$row[taxamt]</td><td align=right>$row[taxp]</td>";
  print "<td align=right>$row[cessp]</td>";
  print "<td align=right>".$row[cessamt]."</td>";
  print "<td align=right>".($row[gross])."</td>";

  print "<td align=right>$row[purinvoice]</td>";
   print "<td>$srow[supname]</td>";
  $tq+=$row[qty];
  $tuni+=$row[gross];
  $ttax+=$row[taxamt];
  $tgtot+=$row[gtot];
  $tnet+=($row[net]);
  $tcess+=$row[cessamt];
  }
   print "<tr bgcolor=white><td colspan=3 align=center><b>Total </td><td align=right>".putComa($tnet)."</td>";
   print "<td align=center>".($tq)."</td>";
   print "<td align=right>".putComa($ttax)."</td>";
   print "<td> &nbsp; </td>";
   print "<td align=right></td><td align=right>".putComa($tcess)."</td><td>".putComa($tuni)."</td>";
   
 }

?>


