<? 
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
$jvno=$_REQUEST['jvno'];
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);

?>
<br>
<center>
<table width=90% >
<tr><td align=center><p style={letter-spacing:2;font-size:15}><b>PSN AUTOMOTIVE MARKETING PRIVATE LTD</TD></TR>
<TR><TD ALIGN=CENTER><font size=2>AUTHORISED DEALER FOR EICHER VEHICLES
</td></TR>
<TR><TD ALIGN=CENTER><font size=2>
Regd.Off. 2/330, CHERANALLOOR,</td></TR>
<TR><TD ALIGN=CENTER><font size=2> ERNAKULAM, PIN.682 034</td></TR>

<TR><TD ALIGN=CENTER><font size=2><?print strtoupper($brrow['braddr'])?><br><?print strtoupper($brrow[4])?><br>Phone :<?print strtoupper($brrow[5])?></td></tr>
<tr><td align=center><br><U>DEBIT NOTE </U></TD></TR>
</table>
</center>

<br>
<left>

</left>
<table width=100%><tr><td >&nbsp&nbsp</td><td >
<?

//print $row1[1];
$re=mysqli_query($db,"select distinct jvno,j_type from journal2 where brcode='$brcode' and jvno='$jvno'  ");
$re3=mysqli_query($db,"select * from dbnote where dbno='$jvno' and brcode='$brcode'") or die(mysqli_error($db));
  $rsrow=mysqli_fetch_array($re3);

print "<table bgcolor='' border=0 cellspacing=0 cellpadding=5 width=90%> <font size=2><tr><td>Debit Note  No :&nbsp;$jvno</td><td align='center'>&nbsp&nbsp&nbsp&nbspDate :&nbsp;".datetohtml($rsrow['date'])."</td> </tr></table><br>";
?>

<table  width=90%>
<tr><td align=left><p style={letter-spacing:2;font-size:15}><b>Eicher Truck And Buses</TD></TR>
<TR><TD ALIGN=left><font size=2></td></TR>
<TR><TD ALIGN=left>Plot No. 102,Industrial Area No.</td></tr>
<tr><td align=left>District Dhar(MP), Pithampur 454775</TD></TR>
</table><br>

<?

print "<table bgcolor='ivory' border=1 cellspacing=1 cellpadding=0 width=90%> <font size=2><tr><b> <td width=20><font size=2>Sr.No </td> <td width=200><font size=2>Account Head </td><td width=300><font size=2>Details</td><td width=100 ><font size=2>Amount</td></b></tr></table> ";
print "<table bgcolor='ivory' border=0 cellspacing=1 cellpadding=1 width=90%>";

    $re2=mysqli_query($db,"select * from dbnote where dbno='$jvno' and brcode='$brcode'") or die(mysqli_error($db));
    while($jvrow=mysqli_fetch_array($re2))
    {
        print "\n<tr><td width=20><font size=3>1 </td><td width=200><font size=3>$jvrow[partic] </td>";
        print "<td width=1></td><td width=300 align=left><font size=3>$jvrow[narr]</td>";
        print "<td width=1></td><td width=100 align=left><font size=3>".nozero($jvrow['dramt'])."</td></tr>";
  }
  
     //print "<tr><td colspan=9 bgcolor=''></td></tr>";
print "<tr><td colspan=9 ></td></tr></table>";
print "<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><hr>";
print "<table bgcolor='' border=0 cellspacing=3 cellpadding=1 width=100%> <font size=2><tr></tr><tr><br> <td width=300></td><td align=center>Grand Total:&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<font size=3>".nozero($rsrow['dramt'])."</td></tr></table>";

?>

<font size=3>( <?print word($rsrow['dramt'])?> Only)</font>

<?
print "<table bgcolor='' border=0 cellspacing=3 cellpadding=1 width=100%> <font size=2><tr></tr><tr><br><br> <td width=400></td><td align=center>For Psn Automotive Marketing Private Ltd</td><br><br><td width=50></tr></table>";


print "<table bgcolor='' border=0 cellspacing=3 cellpadding=1 width=100%> <font size=2><tr></tr><tr><br><br> <td width=400></td><td align=center>Authorised Signatory</td><td width=50></tr></table><hr>";


?>
</td></tr></table>