<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../index.html'; </script>";
 return;
}
?>
<link rel="stylesheet" href="../style.css" type="text/css" />
<style>
th{background-color:steelblue;color:white}
</style>
<center>
<h3>JOB CARD REPORT</H3>
<?
include("../opendb.php");
include("../test.php");
$res=mysqli_query($db,"select * from jobcardamc where brcode='$brcode' order by date,invno");
print "<table border=1><th>No <th> Inv No <th>Date <th>Customer <th>MSNO <th>Engineer<th>Trans No";
print "<th>Amount";
$i=1;
while($row=mysqli_fetch_array($res))
{
 if($row[jvno]>0)
 {
	 print "<tr bgcolor='ivory'>";
   $amtres=mysqli_query($db,"select sum(dramt) from journal2 where jvno='$row[jvno]' and brcode='$brcode'");
    $amtrow=mysqli_fetch_row($amtres);
    $amt=$amtrow[0];
 }
 else
 {
	 print "<tr bgcolor='pink'>";
   	 $amt=0;
 }
 print "<td>".$i++."</td><td>$row[invno]</td><td>$row[date]</td><td>$row[cname]</td>";
 print "<td>$row[msno]</td><td>$row[engineer]</td><td  align=right>$row[jvno]</td>";
 print "<td align=right>".putComa($amt)."</td></tr>";

}
?>
</table>
