
PK 
<?php
include".././includes/dbconnect.php";
include".././includes/functions.php";
include".././include/constants.php";
$sql1="SELECT * FROM invoices WHERE invid='$_GET[id]'";
$result1=mysql_query($sql1) or die('error in fetch');
$row1=mysql_fetch_array($result1);
/************************************************************************/
$arr=explode(",",$row1[certid]);
foreach($arr as $k=>$v){
$whr.=" certificateno='$v' or ";
}
$whr=substr($whr,0,-3);
$sqlu1="SELECT * FROM certificates WHERE $whr";
$resultu1=mysql_query($sqlu1) or die('error in fetch');
while($cert_row=mysql_fetch_array($resultu1)){
$certid.=$cert_row[certificateno].",";
if($cert_row['certypo']=="a"){
$ctype="AQIS";
}elseif($cert_row['certypo']=="b"){
$ctype="AUS";
}elseif($cert_row['certypo']=="c"){
$ctype="PPQ";
}
$certno.=$ctype."/".$cert_row[certno]." | ";
$conslinkno.=$cert_row[conslinkno]." | ";
$quantitydeclared.=$cert_row[quantitydeclared]." | ";
$portcountry.=$cert_row[countrydes]." | ";
$nameaddress=str_replace("<br>","xxxxx",$cert_row[nameaddress]);
//echo $cert_row[nameaddress]."-<br><br>-".$nameaddress;
$parr=explode(",",$nameaddress);
$qq="SELECT * from certificates where parent_cert='$cert_row[certificateno]' ";
$qq=mysql_query($qq) or die('Error in getting Certificates');
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
$cert_no=getColumn("certificates","certificateno", $r1['parent_cert'],"certno");
if($r1['sub_certno']==1){
$sub_certno="/A";
}elseif($r1['sub_certno']==2){
$sub_certno="/B";
}elseif($r1['sub_certno']==3){
$sub_certno="/C";
}elseif($r1['sub_certno']==4){
$sub_certno="/D";
}elseif($r1['sub_certno']==5){
$sub_certno="/E";
}elseif($r1['sub_certno']==6){
$sub_certno="/F";
}elseif($r1['sub_certno']==7){
$sub_certno="/G";
}elseif($r1['sub_certno']==8){
$sub_certno="/H";
}
$certno.=$ctype."/".$cert_no.$sub_certno." | ";
$conslinkno.=$r1[conslinkno]." | ";
$quantitydeclared.=$r1[quantitydeclared]." | ";
$portcountry.=$r1[portcountry]." | ";
$parr="";//explode(",",$r1[nameaddress]);
}
$party.=$cert_row[nameaddress]." | ";
//$party=$parr[0].",".$parr[1].",".$parr[2]." ".$parr[3]." ".$parr[4]." ".$parr[3];
}
$certno=substr($certno,0,-3);
$conslinkno=substr($conslinkno,0,-3);
$quantitydeclared=substr($quantitydeclared,0,-3);
$party=substr($party,0,-3);
$portcountry=substr($portcountry,0,-3);
$certid=substr($certid,0,-1);
/************************************************************************/
if($row1['invstatus'] == 'Dues'){
//$bk = mysql_select_db('vpgldh_backup17-18') or die('Database NOT SELECTED');
//$sql="SELECT * FROM certificates WHERE certificateno='$row1[certid]'";
//$result=mysql_query($sql) or die('error in fetch');
//mysql_close($bk);
//mysql_select_db('vpgldh_17-18') or die('Database NOT SELECTED');
}else{
$sql="SELECT * FROM certificates WHERE certificateno='$row1[certid]'";
$result=mysql_query($sql) or die('error in fetch');
}
//$sql="SELECT * FROM certificates WHERE certificateno='$row1[certid]'";
//$result=mysql_query($sql) or die('error in fetch');
$row=mysql_fetch_array($result);
?>
<head>
<style type="text/css">
table td{
padding:3px;
}
.printo {
border: solid
}
.cancel_div {
z-index: 1;
position: absolute;
opacity: 0.2;
padding: 140px 8px;
}
body {
margin-left: 70px;
}
#maintbl {
border-collapse: collapse;
}
#maintbl td {
font-family: arial;
font-size: 13px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body onLoad1="window.print(); window.close();">
<table border="1" width="95%" id="maintbl" cellpadding="0" style="">
<tr>
<td colspan="4" align="center"><img src="../img/letterhead.jpg" width="100%" border="0" alt="" /></td>
</tr>
<tr>
<td colspan="4" valign="middle" align="center">
<h2>TAX INVOICE</h2>
</td>
</tr>
<tr>
<td colspan="2" align="left">
Invoice No. :
<strong>
<?php
$sqlu="SELECT * FROM signature";
$resultu=mysql_query($sqlu) or die('error in fetch');
$rowu=mysql_fetch_array($resultu);
echo "AFPMS/".trim($rowu['year']."/".$_GET[id]);
?>
</strong>
<br /><br />
<strong>
M/s. <?php
if(trim($row1[ajtid])){
$parr=explode(",",$row1[ajtid]);
$ajtid=$parr[0];
for($i=1;$i<=sizeof($parr);$i++){
echo $parr[$i].", ";
}
//echo nl2br($row1[ajtid]);
echo "<br />GST: ".getColumn("agents","ajid",$ajtid,"ajdec");
}else{
$parr=explode(",",$row1[clnid]);
$clnid=$parr[0];
for($i=1;$i<=sizeof($parr);$i++){
echo $parr[$i].", ";
}
echo "<br />GST: ".getColumn("parties","headid",$clnid,"gst");
}
//echo "<br /><br /><br />".$clnid."<br />-----".$row1[clnid]."<br>";
?>
</strong><br />
<!-- Certificate No: <?php echo $row[certno]?> --> <br />
</td>
<td colspan="2" align="right" valign="top">
Invoice Date: <strong><?php echo date("d-m-Y", strtotime($row1[dtd]))?></strong>
</td>
</tr>
<tr>
<th>Fumigation of</th>
<th>Destination Port</th>
<th>Particulars</th>
<th>Amount</th>
</tr>
<tr>
<td valign="top" style="height:100px !important;">
<?php
if($conslinkno){
echo "Container No: ".$conslinkno;
}elseif($row1['quantitydeclared']){
echo "Quantity Declared: ".$row1['quantitydeclared'];
}
?>
</td>
<td valign="top">
<?php echo($row1['portcountry']); ?>
</td>
<td valign="top" align="left">
<div style="border-bottom:1px solid #000000;">Fumigation Charges<br><br /><br /><br /><br /></div>
SAC(998531)
</td>
<td valign="top" align="right">
<?php echo($row1['amount']); ?>
</td>
</tr>
<?php
if($row1['ajtid']!=""){
?>
<tr>
<td colspan="3" align="center">
<div align="left">
A/C:<?php
$row1['clnid']=str_replace("<BR>"," ", $row1['clnid']);
$row1['clnid']=str_replace("<br>"," ", $row1['clnid']);
$exp1 = explode(',',$row1['clnid']);
$ln1 = count($exp1);
for($i=1; $i<$ln1; $i++){
if($i==1){
echo "<strong>".$exp1[$i]."</strong>";
}else{
echo ", ".$exp1[$i];
}
}
?>
</div>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="4"><strong>Additional Declaration:</strong>
<?php echo $row1[particular]?>
</td>
</tr>
<tr>
<td>
<?php
if($row['conslinkno']==""){
?>
<strong> Charges for Fumigation Export Cargo<br /><br /><strong> as per your :</strong>
<?php echo $row['distmarks'];?>
<?php
}else{
?>
<!-- <strong> Charges of Fumigation Container No.</strong>
<?php echo $row['conslinkno'];?>
<br /><br /> -->
<strong>as per your:</strong>
<?php
//echo $row['distmarks'];
$qq="SELECT * from certificates where parent_cert='$row[certificateno]' ";
$qq=mysql_query($qq) or die('Error in getting Certificates');
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
echo "$r1[distmarks] | ";
}
$arr=explode(",",$row1[certid]);
foreach($arr as $k=>$v){
$whr.=" certificateno='$v' or ";
}
$whr=substr($whr,0,-3);
$qq="SELECT * from certificates where $whr ";
$qq=mysql_query($qq) or die('Error in getting Certificates');
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
echo "$r1[distmarks] | ";
}
}
$amount=$row1['amount']+$row1['travel_exp']+$row1['other_exp'];
$tax=($amount/100)*$row1['servicetax'];
?>
</td>
</tr>
<?php
$qq="SELECT * from certificates where parent_cert='$row[certificateno]' ";
$qq=mysql_query($qq) or die('Error in getting Certificates');
if(mysql_num_rows($qq)){
?>
<tr>
<td colspan="4"><strong>A/C: </strong>
<?php
$ac=explode(",",$row[nameaddress]);
echo "$ac[1] $ac[2] $ac[3] | ";
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
$ac=explode(",",$r1[nameaddress]);
echo "$ac[1] $ac[2] $ac[3] | ";
}
?>
</td>
</tr>
<?php
}
?>
<tr>
<td rowspan="<?php echo ($row1[gst_combine]==1?" 4 ":"6 ")?>" colspan="2">
<strong>Total Invoice Amount in words</strong><br /><br />
<?php echo ucwords(numberTowords($row1['amount']+$tax));?> Only.
</td>
<!-- <td>Total Amount Before Tax</td>
<td align="right"><strong><?php echo $row1['amount']?></strong></td> -->
<td>Travel Expenses </td>
<td align="right"><?php echo $row1['travel_exp']?></td>
</tr>
<tr>
<td>Other Expenses</td>
<td align="right"><?php echo $row1['other_exp'];?></td>
</tr>
<?php
if($row1[gst_combine]==0){
?>
<tr>
<td>Add: CGST 9%</td>
<td align="right"><?php echo $tax/2;?></td>
</tr>
<tr>
<td>Add: SGST 9%</td>
<td align="right"><?php echo $tax/2;?></td>
</tr>
<?php
}
?>
<tr>
<td>Tax Amount:<?php echo ($row1[gst_combine]==1?"I":"")?>GST 18%</td>
<td align="right"><?php echo $tax;?></td>
</tr>
<tr>
<td><strong>Total Amount <!-- After Tax --></strong></td>
<td align="right"><strong><?php echo $row1['amount']+$tax;?></strong></td>
</tr>
<tr>
<td colspan="2">
<strong>Bank Details</strong>
<br />
<br /> Bank Name: INDUSIND Bank, LDH
<br /> Bank Account Number: 201001129008
<br /> Bank Branch IFSC: INDB0000520
<br /> PAN No.: ABHFA3554H
<br />
<strong> GST NO.:</strong>
<br /> 03ABHFA3554HIZQ <br /><br />
E. & O E.
</td>
<td colspan="2" align="right">
<!-- <center><small>Certified that the Particulars Given Above are true and correct:</small></center> -->
<br />
<br />
<strong>For, ARYAN FUMIGATION & PEST MANAGEMENT SERVICES<br /><br /><br /><br /><br />Authorised Signatory</strong>
</td>
</tr>
</table>
</body>


PK 99