<? 
session_start();
$brcode = $_SESSION['brcode'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
$invno= $_REQUEST['invno'];
include("../opendb.php");
include("../test.php");
$result=mysqli_query($db,"select * from profinv where invno='$invno' and brcode='$brcode'");
$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%>
<tr><td align=center><span style={letter-spacing:5}><u>  </u></span></TD></TR>

<?
$brname=explode(',',$branch);
?>

</TABLE>

<br><br><br><br></br><br><br><br>

<center>
<TABLE width=100% border=0>
<tr><td width=30% align=right> </td><td><br><br><font size='3'><b> <?print $invno?></b></font></td><td align=center width=40%></td><td> <?print implode('-', array_reverse(explode('-', $row['invdate']))); ?></td><TD width=10%></TD>
</table>
</center>


To:
<blockquote>&nbsp;&nbsp;&nbsp;
<?

if($invno== 1032 || $invno== 1033|| $invno== 1034 || $invno== 1035 ){
    print "<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Permanent Address:
<br>&nbsp;&nbsp;&nbsp;&nbsp;";
    print 'Stork Foods Pvt. Ltd.
Near Parathottu Kadavu
Ooramana P.O, Kayanad
Ernakulam-686663<br>';
}
else
{
    
print $row['cust'].'<br>&nbsp;&nbsp;&nbsp;&nbsp;'.str_replace('-','<br>&nbsp;&nbsp;&nbsp;&nbsp;',$row['addr']);
}
?>

<?
if($invno== 7 || $invno== 10 || $invno== 146 || $invno== 147  ){
    print "<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Shipped to: (Registration Address)
<br>&nbsp;&nbsp;&nbsp;&nbsp;";
    print $row['cust'].'<br>&nbsp;&nbsp;&nbsp;&nbsp;S/O A. Kuttappan
Valutharayil House, Karanma
Vallikunnam Post
Alappuzha 690501<br>
&nbsp;&nbsp;&nbsp;&nbsp';
}
/*if($invno== 497 || $invno== 498 || $invno== 694 || $invno== 695 || $invno== 696|| $invno== 697 || $invno== 1255 || $invno== 1256){
    print "<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Shipped to: (Registration Address)
<br>&nbsp;&nbsp;&nbsp;&nbsp;";
    print 'Mr. K. S Kumar<br>&nbsp;&nbsp;&nbsp;&nbsp;S/O A. Kuttappan Valutharayil House, Karanma Vallikunnam Post Alappuzha 690501<br>
&nbsp;&nbsp;&nbsp;&nbsp';
}*/

if($invno== 1032 || $invno== 1033|| $invno== 1034 || $invno== 1035 ){
    print "<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Temp. Address:
<br>&nbsp;&nbsp;&nbsp;&nbsp;";
    print 'The Managing Director
M/S Stork Foods Pvt. Ltd., Puthuparambil, Mundakayam
31 st Mile, Munjikkumvayal
Kottayam 686513<br>
&nbsp;&nbsp;&nbsp;&nbsp';
}

?>
<br>&nbsp;&nbsp;&nbsp;&nbsp;<?if($row['type']>'') print "GSTIN :".$row['type']?>&nbsp;&nbsp;&nbsp;&nbsp;
</blockquote>
<TABLE align = center CELLSPACING=1 CELLPADDING=1 BGCOLOR=BLACK width=90% border=1>
<?if($invno==328)
{?>
    <tr align=center><td>SL<br>No.</td><td>Description </td>
    <td>Unit Price </td><td>Qty</td><td>Gross Value</td><td>Disc / unit</td><td>Basic Price</td><td>IGST%</td><td>IGST Amt</td>
    <td>Grand Total</td></tr>
<?}
else{?>
    <tr align=center><td>SL<br>No.</td><td>Description </td>
    <td>Unit Price </td><td>Qty</td><td>Gross Value</td><td>Disc / unit</td><td>Basic Price</td><td>IGST%</td><td>IGST Amt</td><?
    if($row['cessamt']>0)
    {?>
        <td>Cess</td>
    <?}?>
<td>Grand Total</td></tr>
<?}?>
<tr valign=top><td>1</td><td><?print $row['config']?></td>
<td align=right><?print $row['unit']?></td><td align=right><?print $row['qty']?></td>
<td align=right><?print $row['unit']*$row['qty']?></td><td align='right'><?print $row['disc']?></td>
<?$cgstper = $row['taxp'];?>


<?if($invno==328){
    $net = $row['unit']-$row['disc'];?>
    <td align=right><?print $net?></td>
    <td align='right'><?print '0%'?></td>
    <?$cgstamt = 0;?>
    <td align=right><?print $cgstamt?></td>
    <td align=right><?print $net?></td><br><br></td></tr>
<?
}
else
{?>
<td align=right><?print $row['amt2']?></td>
<td align='right'><?print $cgstper.'%'?></td>
    <?$cgstamt = round($row['amt2']*($row['taxp']/100),2);?>
    <td align=right><?print $cgstamt?></td>
    <?if($row['cessamt']>0)
    {
    ?>
        <td align=right><?print $row['cessamt']?></td>
    <?}
    $net = $row['amt2']+$row['tax']+$row['cessamt']
    ?>
    <td align=right><?print $net?></td><br><br></td></tr>
<?    
}
$tcsamt=($row['amt2']+$row['tax']+$row['cessamt'])*$row['tcsamt']/100;
$tcsamt=number_format($tcsamt, 2, '.', '');
$tcsamt=round($tcsamt);
$netamount=round($net+$tcsamt,0);


$tcsamt=number_format($tcsamt, 2, '.', '');
if($tcsamt>0)
{
    if($row['cessamt']>0)
    {?>
        <tr><td>&nbsp;</td><td colspan=9 align=center>Tax Collected at Source (TCS) @<?print $row['tcsamt'];?>%</TD>        
    <?}
    else
    {
        if($invno==328){?>
    
            <tr><td colspan=9 align=center>Tax Collected at Source (TCS) @<?print $row['tcsamt'];?>% </TD>
            <?}else{?>
            <tr><td>&nbsp;</td><td colspan=8 align=center>Tax Collected at Source (TCS) @<?print $row['tcsamt'];?>%</TD>
    <?}}?>
    
    <td align=right><?print $tcsamt ?></td>
    </tr>
    <?
}
if($invno==328){?>
    <tr><td>&nbsp;</td><td>T O T A L</TD><td>&nbsp;</td><td>&nbsp;</td>
<td align=right><?print $row['unit']*$row['qty']?></td><td align='right'><?print $row['disc']?></td><td align=right><?print $net?><td align=right><?print $cgstamt?></td>

<?if($row['cessamt']>0)
{
?>
    <td align=right><?print $row['cessamt']?></td>
<?}?>
<td align=right><font size=3><?print $netamount ?></td>
</tr><?}else{?>
<tr><td>&nbsp;</td><td>T O T A L</TD><td>&nbsp;</td><td>&nbsp;</td>
<td align=right><?print $row['unit']*$row['qty']?></td><td align='right'><?print $row['disc']?></td><td align=right><?print $row['amt2']?><td></td><td align=right><?print $cgstamt?></td>

<?if($row['cessamt']>0)
{
?>
    <td align=right><?print $row['cessamt']?></td>
<?}?>
<td align=right><font size=3><?print $netamount ?></td>
</tr>
<?}?>
</table>


<?
$gtot=$netamount+$row['regis_permit_amt']+$row['insurenceamt']+$row['speedgvr'];
?>

<table width=100% cellspacing=4 border=0>
<?if($invno==328){?>   
    <tr><td align='center' colspan=8>IGST exempted under section 16(1) of IGST Act 2017</td></tr><?}?>
<?if($invno==1555){?>  
<tr><td>GVW :</td><td><b><? print $row['gvw'] ?></b></td><td>Insurance charges :</td><td><b>Offer</b></td><td width=160></td></tr>
<?}else{?>
<tr><td>GVW :</td><td><b><? print $row['gvw'] ?></b></td><td>Insurance charges :</td><td><b><? print $row['insurenceamt'] ?></b></td><td width=160></td></tr>
<?}?>
<tr><td>Wheel Base :</td><td><b><? print $row['wheel'] ?></b></td><td></td><td></td><td width=160></td></tr>
<tr><td>Tyre size :</td><td><b><? print $row['tyre'] ?></b></td><td>
<? if($invno==28 || $invno ==29 || $invno ==116 || $invno == 145 || $invno== 152 || $invno== 153 || $invno== 157 || $invno== 158 || $invno== 159 || $invno== 163 || $invno== 166 || $invno== 167 || $invno== 216 || $row['segment']=='BUS'|| $invno =='326'){?>
    GPS,Registration<?}else{?>
    Tax,Registration
<?}?>
    <br> and Other expenses :</td><td><b>
<?if($invno==1555){?>          
        By Customer
<?}else{?>
   <? print $row['regis_permit_amt'] ?>
<?}?>
        </b></td><td width=160></td><td><b>Total</b></td><td><font size='3'><b><? print $gtot ?></font></td></tr>
<?//<tr><td></td><td><b></b></td><td colspan=4 align='right'><b>Cost for FASTAG (will be extra)</td><td><font size='3'><b><? if($row[fastag]>0){ print $row[fastag].'/Veh.';}else { print '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp/Veh'; }?></font></td></tr>

</table>
<table  width=100% cellspacing=4 border=0>
<tr><td width=100 valign=top>&nbsp;&nbsp;Remarks :</td><td><b><? print $row['remark'] ?></b></td></tr>
<tr><td width=100 valign=top>&nbsp;&nbsp;Warranty :</td><td><? print $row['warranty'] ?></td></tr>
<tr><td width=50 valign=top>&nbsp;&nbsp;&nbsp;Note :</td><td>
<?
$brname=explode(',',$branch);
?>
 
 <?
if($brcode=='Aut141')
{

print"<font size=1>1. The Full payment in advance by Electronic transfer to our </font><b><u> Bank A/c no.30440302994 </u>of SBI,SSI Branch Ernakulam<b> (IFSC Code.SBIN0005387)</b> <font size=1>or crossed Bank draft in favour of</font> <font size=1> <?print $brname[0]?>,</font><b><u> A/c No. 30440302994</u></b> payable at Ernakulam.";
}
else
{


print"<font size=1>1. The Full payment in advance by Electronic transfer to our </font><b><u> Bank A/c no.30728155988 </u>of SBI,SSI Branch Ernakulam<b> (IFSC Code.SBIN0005387)</b> <font size=1>or crossed Bank draft in favour of</font> <font size=1> <?print $brname[0]?>,</font><b><u> A/c No. 30728155988</u></b> payable at Ernakulam.";
  }
?>
</td></tr>
<tr><td></td><td><font size=1>2. Prices prevailing at the date of delivery will be applicable.</font></td></tr>
<tr><td></td><td><font size=1>3. The delivery of the vehicle will be effected within two weeks from the date of receipt of full payment for standard configuration. For builtups and non standard configurations, delivery will be effected in 4 to 6 weeks from the date of receipt of full payment. </font></td></tr>
<tr><td></td><td><font size=1>4. Arranging finance for new vehicle will be the sole responsibility of the customer.</font></td></tr>
<tr><td></td><td><font size=1>5. Advance payment will be refunded only after deducting Rs5000/- as Cancellation Charge, if the order is cancelled by the customer.</font></td></tr>
<tr><td></td><td><font size=1>6. In case of cancellation, cancellation request letter has to be forwarded along with the original order booking form and original receipt. Refund will be made with in one month with out  any interest</font></td></tr>
<tr><td></td><td><font size=1>7. In the case of exchange deal, Exchange price will be as per terms & conditions mentioned in the exchange vehicle agreement signed by customer and exchange vehicle in charge of the  company.</font></td></tr>
<tr><td></td><td><font size=1>8. Price allowed for exchanging old vehicle will be valid only if customer takes delivery of new vehicle from PSN.</font></td></tr>
<tr><td></td><td><font size=1>9. Vehicle once sold will not be taken back.</font></td></tr>
<tr><td></td><td><font size=1>10. Subject to Force Majeure clause</font></td></tr>
<tr><td></td><td><font size=1>11. Subject to jurisdiction of Courts at Ernakulam.</font></td></tr>
<tr><td></td><td><font size=1>12. The customer shall not be entitled to transfer the booking effected into the name of any other person and the vehicle. would be delivered, and invoiced only in the Name &Address of the person specified in the Delivery Order of the Financier.</font></td></tr>
<tr><td></td><td><font size=1>13. For registering vehicles under Company name, D&O license  issued by the local Government body is required and kindly submit the same during registration process.</font></td></tr>
<?if($invno==328){?> 
<tr><td></td><td><font size=1>14. GST applicability is as per IGST Act 2017.</font></td></tr>
<?}?>
</table>

