<?
session_start();
$brcode = $_SESSION['brcode'];
?>

<style>
 th,td{font-family:sans-serif;color:black; font-size:13}
 body{background-color:silver;font-family:sans-serif;color:black;}
</style>

<center>
<?
include ("opendb.php");
include("test.php");
$y = $_REQUEST['y'];
$m = $_REQUEST['m'];
$d = $_REQUEST['d'];
$y1 = $_REQUEST['y1'];
$m1 = $_REQUEST['m1'];
$d1 = $_REQUEST['d1'];
$dtfrom=$y.'-'.$m.'-'.$d;
$dtto=$y1.'-'.$m1.'-'.$d1;
?>
<table border=1 width=100%>
<tr><td align=right><input type=button value=print onClick=window.open('prnjour.php?dt1=<?print $dtfrom?>&dt2=<?print $dtto?>&brc=<?print $brcode?>')></td></tr>
</table>
<FONT SIZE=4>JOURNAL ENTRIES</FONT><BR>&nbsp;

<?
$re=mysqli_query($db,"select distinct jvno,date from journal2 where j_type='JV' and brcode='$brcode'  and date>='$dtfrom' and date<='$dtto' order by date");
print "<table bgcolor='ivory' border=0 cellspacing=3 cellpadding=1 width=100%> <th>Tr. No <th>Date <th>Particulars <th>Debit <th>Credit <th>Narration <th width=50>Type<th>Ref <th>No";
while($row=mysqli_fetch_array($re))
{
  print "\n<tr bgcolor='silver'><td>$row[jvno]</td><td>".implode('-', array_reverse(explode('-', $row['date'])))."</td><td></td>";
  print "<td></td><td></td><td></td><td></td><td></td><td></td></tr>";
  $re2=mysqli_query($db,"select * from journal2 where jvno='$row[jvno]' and brcode='$brcode'") or die(mysqli_error());
    while($jvrow=mysqli_fetch_array($re2))
    {
        print "\n<tr><td>&nbsp;</td><td>&nbsp;</td><td>$jvrow[partic]</td>";
        print "<td align=right>".nozero($jvrow['dramt'])."</td>";
        print "<td align=right>".nozero($jvrow['cramt'])."</td><td>$jvrow[narr]</td><td>$jvrow[j_type]</td><td>$jvrow[against]</td><td>$jvrow[no]</td></tr>";
  }
     print "<tr><td colspan=9 bgcolor=silver></td></tr>";

}
?>
</table>
<br>


