<? 
session_start();
include("test.php");
include("opendb.php");



if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
$qry=mysqli_query($db,"select * from jcardinvoice where invno='$invno' and brcode='$brcode'");
$qry1=mysqli_query($db,"select * from jcardinvoice where invno='$invno' and brcode='$brcode'");
$row=mysqli_fetch_array($qry);  
$jcno=$row[12]; 
?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>PSN Telcon</title>
<script type="text/javascript" src="number_to_word.js"></script>
<style>
#tbl2 td{
border:0px;
}
body{font-size:22px}
}
</style>






<body  onload='window.print();'  >


<br><br><br><br><br>
<table  id='tbl' align='center' width=100% border='0' >
<tr><td HEIGHT='20' colspan='5' align='left' style="border:1px solid black;border-style:ridge; font-size:30px;"><b>INVOICE</b></td></tr>
<input type='hidden' name='jcno' value='<? echo $row[12]; ?>' readonly>
<tr><td align='left' colspan='2' rowspan='2' valign='top'><? echo $row[2];?></td>
<td rowspan='5'  ></td><td ><b>Invoice No: </b><br></td><td ><? echo $invno;?></td></tr>

<tr>
<td ><b>Date : </b><br></td><td ><? echo $row[1]; ?></td></tr>
<tr><td align='left'>
<table width='50%' border='1' style="border-collapse:collapse; border:0 0 1px 0;">
<?
$qry2=mysqli_query($db,"select estno from jcard_est where jcno='$jcno' and brcode='$brcode'");
$row2=mysqli_fetch_array($qry2); 
?>  
<tr><td><b>Est No:</b><? echo $row2[0]; ?>
</td></tr>
<tr><td><b>A/c No:</b><? echo $row[4]; ?></td></tr>
</table></td><td></td>
<td  colspan='3' style="vertical-align:top;">
<table   width='100%' border='1' style="border-collapse:collapse;vertical-align:top; ">
<tr><td align='left'><b>File No:</b><? echo $row[3]; ?></td></tr></table></td></tr>


<tr><td align='left' colspan='7' style="border:1px;">
<table   width='100%' id='tbl2' border='1'   style="border-collapse:collapse; ">
<tr><td align='left' width='15%'>

<b>Vehicle:</b><br></td><td align='left' width='55%' ><? echo $row[5]; ?></td>
<td ><b>Reg No: </b><br></td><td ><? echo $row[6]; ?></td></tr>
<tr><td align='left'><b>Body Type:</b><br></td><td align='left'><? echo $row[7]; ?></td>
<td><b>Lpo No:</b><br></td><td ><? echo $row[8]; ?> </td></tr></table></td></tr>
<tr><td  colspan='5'>

</td></tr>

<tr><td colspan='5' >
<table id='myTable' border='1' style="border-collapse:collapse;" width=100%>
<th>Sl No.<th width='30%'>Description  <th>Qty<th>Amount
<?
$i=1;
$tot=0;
while($row1=mysqli_fetch_array($qry1))
{
print "<tr><td width='7%'>".$i."</td><td width='70%'>".$row1[14]."</td><td>".$row1[9]."</td><td align='right'>".$row1[10]."</td></tr>";
$tot+=$row1[10];
$i++;

}

?>




<tr><td colspan='3' align='right'>Total:</td><td id='tot' align='right' ><? echo putcoma($tot); ?></td></tr>
<?
if($row[17]>0)
{
?>
<tr><td colspan='4' >Depreciation</td></tr>
<tr><td>A</td><td colspan='2' ><? echo $row[16]; ?></td><td align='right'><? echo $row[17]; ?></td></tr>
<?
}
$ntot=$tot-$row[17];
?>
<tr><td colspan='3' align='right'>Net Total:</td><td id='ntot'  align='right'><? echo putcoma($ntot); ?></td></tr>
</table>
</td></tr>

<?
if($row[15]!='')
{
?>
<tr><td colspan='5'>
<font color='red'>*</font>Remark:
<?
echo $row[15];
?>
</td></tr>
<?
}

?>


<tr><td  height=60 id='totwd'>
<? print "<script>document.write(toWords($ntot));</script> only";
?>
<td align='right' colspan='3'> Net Total:</td><td  ><? echo $ntot; ?>
</td></tr></table>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;With Thanks and Regards, <br><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ACCOUNTS DEPT.

