<? 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:c1d7bb;font-size:13}
.mnu{margin-left:5}
</style>
<center>

<?
$i=1;
$gtot1=0;
print "<table cellspacing=1 cellpadding=3 bgcolor='gray'>";
print "<th>S.No <th>Entry date <th>AMC No <th>Chasis <th>Reg <th>Config <th>Amount <th>From <th>To";
print "<th>Customer<th>AMC Raised<br>FromBranch<th>AMC Claimed<th>Balance";
$re=mysqli_query($db,"select * from amcmast order by entrydate");
while($row=mysqli_fetch_array($re))
{
//
$jpres1=mysqli_query($db,"select * from psndms.amctrans where amcno='$row[amcno]' and grp!='labour Charges'");
if(mysqli_num_rows($jpres1)>0)

 {
  $gtot1=0;
while($jprow1=mysqli_fetch_array($jpres1))
{
$tot1=$jprow1[rate]*$jprow1[qty];
$tax1=$tot1*12.5/100;
$cess1=$tax1*1/100;
$total1=$tot1+$tax1+$cess1;
$gtot1+=$total1;
}
}
?>
<?
$jsres2=mysqli_query($db,"select * from psndms.amctrans where amcno='$row[amcno]' and grp='labour Charges'");
if(mysqli_num_rows($jsres2)>0)
{
while($jsrow2=mysqli_fetch_array($jsres2))

{
$tot2=$jsrow2[rate]*$jsrow2[qty];
$tax2=0;
$cess2=0;
$total2=$tot2+$tax2+$cess2;
$gtot1+=$total2;
}
}
//



$x=$row[6]-$gtot1;
$y+=$row[6];
$z+=$gtot1;
$b+=$x;
 print "<tr bgcolor='white'><td>".$i++."</td><td>".datetohtml($row[1])."</td> <td>$row[2]</td><td>$row[3]</td>";
 print "<td>$row[4]</td><td>$row[5]</td><td>$row[6]</td><td>".datetohtml($row[7])."</td><td>".datetohtml($row[8])."</td>";
 print "<td>$row[9]</td>";
 print "<td>".getbrname($row[brcode])."</td>";
 print "<td>".round($gtot1)."</td>";
 print "<td>".round($x)."</td>";

}
print "<tr bgcolor=c1d799><td colspan=6 align=center><font size=3><b>G Total</td><td  align=left><font size=3><b>".putComa($y)."</td><td></td><td></td><td></td><td></td><td><font size=3><b> ".round($z)."</td><td><b><font size=3>".round($b)."</td>";

print "</table>";

?>

