<link href="../css/form.css" type="text/css" rel="stylesheet" media="screen"  />
<html>
<body>

<? 
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}

include("../opendb.php");
include("../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,date,narr 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 "";

}
?>
<br>
<center>
<table width=90%>
<tr><td align=center><p style={letter-spacing:2;font-size:15}><b>PSN AUTOMOBILES Pvt Ltd</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><font size=2><? print $jtype?> </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='' border=0 cellspacing=3 cellpadding=1 width=100%> <font size=2><tr><td></td><td align='right'>Date :&nbsp;".datetohtml($row1[2])."</td> </tr></table><br>";

print "<table border=1 cellspacing=5 cellpadding=0 width=100%> <font size=2><tr> <td width=400><font size=2>Particulars </td><td width=1></td><td><font size=2>Debit Amount</td><td><font size=2>Credit Amount</td></tr></table> ";
while($row=mysqli_fetch_array($re))
{
print "<table  border=0 cellspacing=1 cellpadding=1 width=100%>";

    $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 width=400>|<font size=1>$jvrow[partic] </td>";
        print "<td width=1>|</td><td align=right><font size=1>".nozero($jvrow[dramt])."|</td>";
        print "<td align=right><font size=1>".nozero($jvrow[cramt])."|</td></tr>";
  }
	
     //print "<tr><td colspan=9 bgcolor=''></td></tr>";
print "<tr><td colspan=9 ></td></tr></table>";
print "<hr>";
print "<table border=0 width=100%><tr><td>|<font size=2 >Narration : $row1[3]</td></tr>";

print "</table>";
print"<hr>";
print "<table bgcolor='' border=0 cellspacing=3 cellpadding=1 width=100%> <font size=2><tr></tr><tr><br><br><td>Prepared By</td></tr></table><hr>";

}
?>
