<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../../index.html'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");


$sql="select date,jvno,sum(dramt)-sum(cramt),brcode from journal2  group by jvno,brcode order by brcode";
//print $sql;
$re=mysqli_query($db,"select date,jvno,sum(dramt)-sum(cramt),brcode from journal2  group by jvno,brcode order by brcode")or die(mysqli_error($db));
print "<table border=1>";
while($row=mysqli_fetch_array($re))
{
    print $row[2];
 if(abs($row[2])!=0)
 {
     print $sql;
    print "<tr><td></td><td>$row[1]</td><td>".putComa($row[2])."</td><td>$row[brcode]</td></tr>";
 }
}
print "</table>";
?>
