<?
 session_start();
if(strlen($brcode)<=0)
{
  print "<script> alert('Invalid User'); parent.document.location='ind.php' </script>";
  return;
}
include("opendmsdb.php");
include("test.php");
?>
<link rel="stylesheet" href="style.css" type="text/css" />
<style type="text/css" media="print">
.dontprintme { display: none; }
</style>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:.9em}
th{background-color:c1d799;font-size:.9em}
.mnu{margin-left:5}
</style>
<center>
<form action="<?print $PHP_SELF?>">
<table class=dontprintme bgcolor='c1d799' width=99%>
<tr><td align=center colspan=2><h3>DMS TRIAL BALANCE</TD></tr>
<tr bgcolor=white><td align=center>Select Branch </td><td> <select name='brn'>
<?
$br=mysqli_query($db,"select distinct a.brcode,b.brname,date_format(a.upddate,'%d %M %Y') from debt2 a, branch b where a.brcode=b.brcode") or die(mysqli_error());
print $br;
while($brrow=mysqli_fetch_array($br))
{
 $ff=$brrow[1];
 print "<option value='$brrow[0]'>$brrow[1]</option>";
}
?>
</select>

<input type=hidden name='bra' value='<?print $ff?>'>
</td></tr>
<tr><td colspan=2 align=center><input type=submit value='Show' name='show'>
<input type=button value='Close this window' onClick=window.close()>
</td></tr>
</table>
</form>



<?
if($show)
{
$i=1;
$result=mysqli_query($db,"select *,date_format(upddate,'%W %d %M %Y %r')dt  from tb1 where brcode='$brn'");

$row=mysqli_fetch_array($result);
$result1=mysqli_query($db,"select brname from branch where brcode='$brn'");
$row1=mysqli_fetch_array($result1);

print "TRIAL BALANCE OF <b>$row1[0]</b> <BR> As on ".$row[dt];
?>
<table>
<th>Ledger <th>Opening <br>Dr  <th>Opening <br>Cr <th>Dr <th>Cr 
<th>Closing <br>Dr. <th>Closing <br>Cr.
<?
do
{
 if($i%2==0)
   print "<tr bgcolor='aliceblue'> ";
 else
   print "<tr>";

 print "<td>$row[0]</td><td align=right>$row[1]</td><td align=right>$row[2]</td><td align=right>$row[3]</td><td align=right>$row[4]</td>";
 print "<td align=right>$row[5]</td><td align=right>$row[6]</td>";
 $i++;
}while($row=mysqli_fetch_array($result));
}
?>
