<? 
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
$jvno=$_REQUEST['jvno'];
include_once("../opendb.php");
include_once("../test.php");
$ad=mysqli_query($db,"select * from branch where brcode='$brcode'");
$brrow=mysqli_fetch_array($ad);
$brname=explode(',',$branch);
$re=mysqli_query($db,"select distinct jvno,j_type from journal2 where brcode='$brcode' and jvno='$jvno'  ");

print"<hr>";
$row1=mysqli_fetch_row($re);
//print $row1[1];
/*switch ($row1[1])
{
case 'BR':
$jtype="Bank Receipt";
break;

case 'BP':
$jtype="Bank Payment";
break;

case 'CR':
$jtype="Cash Receipt";
break;

case 'CP':
$jtype="Cash Payment";
break;

case 'JV':
$jtype="Journal Voucher";

//print $jtype;
break;

case 'V sale':
$jtype="Vehicle Sale";
break;
case 'V pur':
$jtype="Vehicle Purchase";
break;
case 'TDSJV':
$jtype="TDS Journal";
break;
case 'I pur':
$jtype="Item Purchase";
break;

case 'P Ret':
$jtype="Purchase Return";
break;

case 'sale ret':
$jtype="Sales Return";
break;


default:

print "";

}*/
?>
<body onload='window.print();'>
<br><br><br>
<center>
<table width=90%>
<tr><td align=center><p style={letter-spacing:2;font-size:15}><b><?print $brrow['brman']?></TD></TR>
<TR><TD ALIGN=CENTER><font size=2></td></TR>

<TR><TD ALIGN=CENTER><font size=2><?print strtoupper($brrow['braddr']).', '.strtoupper($brrow['brcity'])?></td></tr>

<tr><td align='center'>))<br><U><B><h3><? print $jtype?></h3> </B></U></TD></TR>
</table>
</center>
<?

//print $row1[1];
$re=mysqli_query($db,"select distinct jvno,j_type from journal2 where brcode='$brcode' and jvno='$jvno'  ");

print "<table bgcolor='ivory' border=0 cellspacing=3 cellpadding=1 width=100%> <font size=3><th><font size=3>Date<hr> <th><font size=3>Particulars <hr><th><font size=3>Debit<hr> <th><font size=3>Credit<hr> <th><font size=3>Narration <hr> ";
while($row=mysqli_fetch_array($re))

{
    $re2=mysqli_query($db,"select * from journal2 where jvno='$row[jvno]' and brcode='$brcode'") or die(mysqli_error($db));
    while($jvrow=mysqli_fetch_array($re2))
    {
        print "\n<tr><td><font size=2><b>".implode('-', array_reverse(explode('-', $jvrow['date'])))."</b></td><td>|<font size=2><b>$jvrow[partic]</b></td>";
        print "<td align=right><font size=2><b>".nozero($jvrow['dramt'])."|</b></td>";
        print "<td align=right><font size=2><b>".nozero($jvrow['cramt'])."|</b></td><td><font size=2><b>$jvrow[narr]</b></td></tr>";
  }
     print "<tr><td colspan=9 bgcolor=silver></td></tr></table>";

}
?>
<br><br>
<table width='100%'><tr><td align='left'>AUTHORIZED SIGNATURE:</td><td></td><td align='right'>SIGNATURE OF CUSTOMER:</td></tr></table>
