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

include("../opendb.php");
include("../test.php");
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
th{background-color:lightsteelblue;color:black}
//tr{background-color:white}
</style>
<center>


<?
print "<font size=3><b>WARRANTY PENDING REPORT <br>As on ".date("d-m-Y")."</FONT></b><br>";
$brres=mysqli_query($db,"select brcode,brname from branch");
while($brrow=mysqli_fetch_array($brres))
{
print "<fieldset> <legend>$brrow[1]</legend>";
$tbl="spareinvwar".$brrow[0];

$re=mysqli_query($db,"select * from $tbl where trans='n'");
if(mysqli_num_rows($re)<=0)
{
 print "Record does not exist";
}

if(mysqli_num_rows($re)>0)
{
print "<table cellspacing=1 cellpadding=2 bgcolor='steelblue' width=90%>";
print "<th>No <th>Warno <th width=500>Part Name <th>PSN Qty <th>Telc Qty <th>Price <th>Amount <th width=85>Date";
 $i=1;
 while($row=mysqli_fetch_array($re))
 {
   print "<tr bgcolor=white><td>".$i++."</td><td>$row[warno]</td><td>$row[partname]</td>";
   print "<td align=right>$row[psnqty]</td><td align=right>$row[telcqty]</td>";
   print "<td align=right>$row[price]</td>";
   $amt=($row[psnqty]*$row[price]);
   print "<td align=right>".putComa($amt)."</td>";
   print "<td align=right>".datetohtml($row[date])."</td></tr>";
   $tprice+=$row[price];
   $tamt+=$amt;
 }
}
$tq+=$tamt;
print "<tr><td colspan=5><center><b><font color=white>Total</font></b></td>";
print "<td align=right></td>";
print "<td align=right><font color=white><b>".putComa($tamt)."</b></font></td>";
print "</tr>";
print "</table></fieldset><br>";
$tprice=0;
$tamt=0;
}
print "<h2>Grand total :".putComa($tq);
?>

