<? 
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");
$result=mysqli_query($db,"select * from veh_invoice where invno='$invno' and brcode='$brcode' and taxtype='VAT'");
$row=mysqli_fetch_array($result);

$re=mysqli_query($db,"select * from branch where brcode='$brcode'");
$brow=mysqli_fetch_array($re);
?>
<style>
td,body{font-family:arial;background-color:white;font-size:12}
</style>
<table width=100% BORDER=0>
<tr><td>&nbsp;<BR>&nbsp;
<?
$brname=explode(',',$branch);
?>
</td><td align=right>&nbsp;</td></tr>
<tr><td align=center COLSPAN=2><span style={letter-spacing:5}><b>&nbsp;</b> </span> <br>&nbsp;<BR>
&nbsp;<BR>
&nbsp;
</td></tr>

<!-- <tr><td align=center COLSPAN=2>FORM NO 8A</TD></TR> -->
<tr><td align=center COLSPAN=2><span style={letter-spacing:5}> 
<?
if($row[taxtype]=='VAT')

?>
&nbsp;
&nbsp;
</span></TD></TR>
<tr><td align=center COLSPAN=3><span style={letter-spacing:5}> 
<br>
<br>

<?
if($row[taxtype]=='VAT' && $row[tp]=='8b')
{
print "FORM 8B";
}
else
{
print "FORM 8";
}

?>
&nbsp;


</TABLE>
<br>
<br>
<blockquote>
&nbsp;
<tr><td align=center> <font size=3><?print $invno.'<br>'.datetohtml($row[invdate])?> </font></td>
&nbsp;
</blockquote>
<?
if($row[type]=='d')
$r=mysqli_query($db,"select * from sup_master where supname='$row[cust]' and branch='$brcode'");
else
$r=mysqli_query($db,"select * from cust_master where code='$row[cust]' and branch='$brcode'");
$cus_row=mysqli_fetch_array($r);
?>
<?
?>
&nbsp;
<blockquote>
<? print $cus_row[1].'<br>'.str_replace(',','<br>',$cus_row[2]).'<br>'.$cus_row[3].''.$cus_row[4].' Pin:'.$cus_row[pin].'<br>'?>
<?
if($row[type]=='d' || $row[tp]!='8b')
print "Tin : ".$cus_row[tin];
?>
</blockquote>

&nbsp;
<blockquote>
<?
 $fff=mysqli_query($db,"select city from fin_master where finname='$row[fin]' and branch='$brcode'")or die(mysqli_error());
 $fi_row=mysqli_fetch_row($fff);
print $row[fin].','.$fi_row[0]?>
</blockquote>
<TABLE CELLSPACING=1 CELLPADDING=1 BGCOLOR=BLACK width=95% border=1>
<tr align=center><td>SL<br>No.</td><td>Description </td><td>ITem Code </td><td>Tax<br>Rate
<td>Unit Price </td><td>Qty</td><td>Gross Value</td><td>Cash<br>Disc</td><td>Net Value</td>
<td>Tax Amount</td>
<td>Grand Total</td><td>Discount<br>Gifts Free</td></tr>

<tr valign=top><td>1</td><td><?print $row[config]?></td><td>&nbsp;</td>
<td><?print $row[taxp].'%'?></td><td align=right><?print $row[amt2]+$row[disc]?></td><td align=right>1</td>
<td align=right><?print $row[amt2]+$row[disc]?></td><td><?print $row[disc]?></td>
<td align=right><?print $row[amt2]?></td><td align=right><?print $row[tax]?></td>
<td align=right><?print $row[netamt]?></td><td align=center>-<br><br><br></td></tr>

<tr><td>&nbsp;</td><td>T O T A L</TD><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>
<td align=right><?print $row[amt2]+$row[disc]?></td><td><?print $row[disc]?></td><td align=right><?print $row[amt2]?>
<td align=right><?print $row[tax]?></td>
<td align=right><font size=3><?print $row[netamt]?></td>
<td align=center>- </td></tr>
</table>
<font size=3>(RUPEES <?print word($row[netamt])?> ONLY)</font>
<br><BR>
<table border=0 width=90%>
<tr><td width=115>EMLDA NO</TD><TD>: <font size=3><?print $row[da]?></td></tr>
<tr><td>ENGINE NO</TD><TD>:<font size=3> <?print $row[engno]?></td></tr>
<tr><td>CHASSIS NO</TD><TD>:<font size=3> <?print $row[chasis]?></td></tr>
<tr><td>COLOR</TD><TD>:<font size=3> <?print $row[color]?></td></tr>

</TABLE>

<BR>&nbsp;
