<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");
$no=$_REQUEST['no'];
$re=mysqli_query($db,"select * from bnkrec where brno='$no' and type='Cr' and brcode='$brcode'");
$row=mysqli_fetch_array($re);

$cusre=mysqli_query($db,"select * from cust_master where acname='$row[partic]' and branch='$brcode'")or die(mysqli_error());
 $cus_row=mysqli_fetch_array($cusre);

$ad=mysqli_query($db,"select * from branch where brcode='$brcode'");
$brrow=mysqli_fetch_array($ad);
?>
<style>
td,body{font-family:sans;letter-spacing:1;}
.x{line-height:1.5}
</style>

<table width=90%>

<?
 $brname=explode(',',$branch);
?>
<tr><td align=center><p style={letter-spacing:9;font-size:15}><b><?print strtoupper($brrow['brname'])?></TD></TR>
<?if($brcode=='PSN236')
{
?>
<TR><TD ALIGN=CENTER><font size=2>AUTHORISED DEALER FOR EICHER VEHICLES</td></TR>
<?
}
elseif($brcode=='PSN672')
{
?>
<TR><TD ALIGN=CENTER><font size=2>AUTHORISED DEALER FOR EICHER GENSET</td></TR>
<?
}
?>
<TR><TD ALIGN=CENTER><font size=2><?print strtoupper($brrow['braddr']).', '.strtoupper($brrow['brcity'])?></td></tr>
<tr><td align=center><br><U>R E C E I P T </U></TD></TR>
</table>
<center>
<?
  $cnr=mysqli_query($db,"select * from bnkrec where brno='$no' and type='Cr'")or die(mysqli_error());
   $cno=mysqli_fetch_row($cnr) or die("Error - Enter receipt No.".mysqli_error());
print "<table width=90%><tr><td>NO: ".$cno[1]."</td><td align=right>Date: ".implode('-', array_reverse(explode('-', $row['date'])))."</span></td></tr></table>";
?>
<center>
<table width=90%>
<tr><td class=x><hr> RECEIVED with thanks from <u>
<?
if(strpos($row['narr'],"(INV NO.")>0)
{
    $minvno = substr($row['narr'],strpos($row['narr'],"(INV NO.")+8,13);
    $adfin=mysqli_query($db,"select fin from veh_invoice where brcode='$brcode' and invno= '$minvno' ");
    
    $adrow=mysqli_fetch_array($adfin);
    print strtoupper($adrow[0])." FOR THE CUSTOMER OF ".strtoupper($row['partic']).", ".$cus_row['addr1'].', '.$cus_row['dist'].', '.$cus_row['pin'];
}
else
{
    print strtoupper($row['partic']).'('.$row['no'].') '.$row['cus_ac'].', '.$cus_row['addr1'].', '.$cus_row['city'];
}
?> 

</u> sum of <u><?print word($row['cramt'])?></u> Only towards our Invoice No.<?echo $minvno;?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <? print $type?>

<!-- </u> Only towards our Invoice No. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Delivery Order No. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; by <? print $type?>;
-->

<?
if(strpos($row['narr'],"(INV NO.")<=0)
{
 print $row['narr'];
}
?> on <?print implode('-', array_reverse(explode('-', $row['date'])))?>
<?if(strlen($minvno)>0){?>
at our SBI Account as per <?echo $row['no'];?> <?}?></td></tr>
<tr><td align=right> <br>For <?print $brrow['brname']?></td></tr>
<tr><td><b>Rs.<?print $row['cramt']?>/-</b><br>
<?if(strpos($row['narr'],"(INV NO.")<=0)
{?>
(subject to realisation)&nbsp;<?}?></td></tr>
<tr><td align=right>Authorised Signatory</td></tr>
</table>

 
