
PK 
<?php
session_start();
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]." | ";
if($cert_row[conslinkno]){
$conslinkno.=$cert_row[conslinkno]." | ";
}
$quantitydeclared.=$cert_row[quantitydeclared]." | ";
if($cert_row[certypo]=="b"){
$portcountry.=$cert_row[countrydes]." | ";
}else{
$declentry.=$cert_row[declentry]." | ";
}
$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[conslinkno]){
$conslinkno.=$r1[conslinkno]." | ";
}
$quantitydeclared.=$r1[quantitydeclared]." | ";
if($r1[certypo]=="b"){
$portcountry.=$r1[countrydes]." | ";
}else{
$declentry.=$r1[declentry]." | ";
}
//$portcountry.=$r1[portcountry]." | ";
//$declentry.=$r1[declentry]." | ";
$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);
$declentry=substr($declentry,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: 30px;
margin-right: 30px;
}
#maintbl {
border-collapse: collapse;
}
#maintbl td {
font-family: arial;
font-size: 12px;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
</head>
<body onLoad="window.print(); window.close();">
<table border="1" width="95%" id="maintbl" cellpadding="0" style="">
<tr>
<td colspan="4" align="center"><img src="../img/<?php echo ($row1[user_id]=="1"?"letterhead_delhi":"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 "APM/".trim($rowu['year']."/".$_GET[id]);
?>
</strong>
<br /><br />
<strong style="text-transform:uppercase;">
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");
$qc="select * from agents where ajid='$row1[ajtid]' ";
$rsp = mysql_query($qc) or die(mysql_erorr());
if( $rp = mysql_fetch_array($rsp, MYSQL_ASSOC) ){
echo "<b>$rp[ajcomp]</b><br>$rp[ajaddress] <br>";
echo "<br />GST: ".$rp[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");*/
$qc="select * from parties where headid='$party' ";
$rsp = mysql_query($qc) or die(mysql_erorr());
if( $rp = mysql_fetch_array($rsp, MYSQL_ASSOC) ){
echo "<b>$rp[headname]</b><br>$rp[headaddress] <br>";
echo "<br />GST: ".$rp[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:340px !important;">
<?php
if($conslinkno){
echo "Container No: ".$conslinkno;
}elseif($row1[container]){
echo "Container No: ".$row1[container];
}elseif($quantitydeclared){
echo "Quantity Declared: ".$quantitydeclared;
}
?>
</td>
<td valign="top">
<?php echo $declentry ?>
<?php echo $portcountry ?>
<?php //echo $row1['countrydes'] ?>
</td>
<td valign="top" align="left" nowrap>
Fumigation Charges<br>
<div style="margin-top:10px; border-bottom:1px solid #000000; border-top:1px solid #000000; padding:3px 0px;">SAC(998531)</div>
<br>
<?php
if($row1['travel_exp']){
echo "Lashing Charges of container HSN(996719)<br>";
}
if($row1['other_exp']){
echo "Visiting Charges SAC(998531)";
}
?>
</td>
<td valign="top" align="right">
<i class="fas fa-rupee-sign"></i> <?php echo number_format($row1['amount'],0,'.',''); ?> <br /><br /><br /><br />
<?php
if($row1['travel_exp']){
echo '<i class="fas fa-rupee-sign"></i> '.$row1['travel_exp']."";
}
?><br />
<?php
if($row1['other_exp']){
echo '<i class="fas fa-rupee-sign"></i> '.$row1['other_exp'];
}
?>
</td>
</tr>
<?php
if($row1['ajtid']!=""){
//echo $qq="select * from certificates where certificateno='$row[certificateno]' ";
$arr=explode(",",$row1[certid]);
$whr="";
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('zzzzzzzz Error in getting Certificates');
if(mysql_num_rows($qq)){
?>
<tr>
<td colspan="4"><strong>A/C: </strong>
<?php
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
$qc="select headid, headname, headaddress from parties where headid='$r1[nameaddress]' ";
//echo "$qc <br>";
$rsp = mysql_query($qc) or die(mysql_erorr());
if($rp = mysql_fetch_array($rsp, MYSQL_ASSOC) ){
echo "<b>$rp[headname]</b>";// $rp[headaddress] <br>";
}
}
?>
</td>
</tr>
<?php
}
$qq="SELECT * from certificates where parent_cert='$row[certificateno]' group by nameaddress";
$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] | ";
}*/
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
$qc="select headid, headname, headaddress from parties where headid='$r1[nameaddress]' ";
$rsp = mysql_query($qc) or die(mysql_erorr());
if($rp = mysql_fetch_array($rsp, MYSQL_ASSOC) ){
echo "<b>$rp[headname]</b> | ";// $rp[headaddress] <br>";
}
}
?>
</td>
</tr>
<?php
}
}else{
$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 colspan="4"><strong>Additional Declaration:</strong>
<?php echo $row1[particular]?>
</td>
</tr>
<tr>
<td colspan="4">
<?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(mysql_error().' - Error in getting Certificates');
while($r1=mysql_fetch_array($qq, MYSQL_ASSOC)){
echo "$r1[distmarks] / ";
}
$whr="";
$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(mysql_error().' - 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>
<tr>
<td rowspan="<?php echo ($row1[gst_combine]==1?" 3 ":"5 ")?>" colspan="2">
<strong>Total Invoice Amount in words:</strong><br /><br />
<?php echo ucwords(numberTowords($row1['amount']+$tax+$row1['travel_exp']+$row1['other_exp']));?> Only.
</td>
<td>Total Amount Before Tax</td>
<td align="right"><i class="fas fa-rupee-sign"></i> <strong><?php echo $row1['amount']+$row1['travel_exp']+$row1['other_exp']?></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"><i class="fas fa-rupee-sign"></i> <?php echo $tax/2;?></td>
</tr>
<tr>
<td>Add: SGST 9%</td>
<td align="right"><i class="fas fa-rupee-sign"></i> <?php echo $tax/2;?></td>
</tr>
<?php
}
?>
<tr>
<td>Tax Amount:<?php echo ($row1[gst_combine]==1?"I":"")?>GST 18%</td>
<td align="right"><i class="fas fa-rupee-sign"></i> <?php echo $tax;?></td>
</tr>
<tr>
<td><strong>Total Amount <!-- After Tax --></strong></td>
<td align="right"><strong><i class="fas fa-rupee-sign"></i> <?php echo $amount+$tax;?></strong></td>
</tr>
<tr>
<td colspan="2">
<strong>Bank Details</strong>
<br />
<br /> Bank Name:-HDFC Bank, Rewari
<br /> Account no- 50200011500640
<br /> Bank IFSC Code:-HDFC0000250
<br />
<strong> GST NO.:</strong>
06BRYPK7268L1ZQ <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, AARAV PEST MANAGEMENT <br /><br /><br /><br /><br />Authorised Signatory</strong>
</td>
</tr>
</table>
</body>


PK 99