PK

ADDRLIN : /home/anibklip/pcfcindia.com/bkp2023-24/form/
FLL :
Current File : /home/anibklip/pcfcindia.com/bkp2023-24/form/insert_aqis.php

<?php
session_start();
require_once '../common/common.php';
require_once '../common/secure.php';

include("../connexion.php");
include("../head.php");
//print_r($_GET);

if($_GET[addition]=='on'){
	$deckl=".$_GET[deck]";
}else{
	$deckl="";
}

// Certificate
$din=date('D, d M Y + H:i:s a');
if($_SESSION['formtwo']=='inserted'){//only one insert for use session
	/*$q="select * from cert_aqis where certypo='b' order by certno desc";
	$q=mysql_query($q) or die(mysql_error());
	if($r=mysql_fetch_array($q)){
		if($r[certno]==0){
			$certno=100;
		}else{
			$certno=$r[certno]+1;
		}
	}*/

	$q="select certificateno from cert_nspm where 1 order by certificateno desc ";
	$q=mysql_query($q) or die(mysql_error());
	if($r=mysql_fetch_array($q)){
		$certno_n=$r[0];
	}

	$q="select certificateno from cert_aqis where 1 order by certificateno desc ";
	$q=mysql_query($q) or die(mysql_error());
	if($r=mysql_fetch_array($q)){
		$certno_p=$r[0];
	}

	if($certno_n >= $certno_p){
		$certno=$certno_n;
	}else{
		$certno=$certno_p;
	}
	$certno=$certno+1;
	//echo $certno; die();

	$sql="INSERT INTO cert_aqis(certificateno, issuedate, desgood, quantitydeclared, distmarks, conslinkno, portcountry, nameship, countrydes, declentry, nameaddress, declarednameaddress, namefumigant, datefumigantion, placefumigantion, dosagefumigant, durationfumigantion, airtemp, contype, presstest, airspace, discharge, enclosure, commodity, consignment, wrapping, perforated, height, cstatus, ctime, decla, clnid, ajtid, licetype, certypo, sub_c, cancel_reason, consignment_link, container20feet)
	VALUES(".$certno.",'".$_GET['issuedate']."', '".$_GET['desgood']."', '".$_GET['quantitydeclared']."', '".$_GET['distmarks']."', '".$_GET['conslinkno']."', '".$_GET['portcountry']."', '".$_GET['nameship']."', '".$_GET['countrydes']."', '".$_GET['declentry']."', '".$_GET['nameaddress']."', '".$_GET['declarednameaddress']."', '".$_GET['namefumigant']."', '".$_GET['datefumigantion']."', '".$_GET['placefumigantion']."', '".$_GET['dosagefumigant']."', '".$_GET['durationfumigantion']."', '".$_GET['airtemp']."', '".$_GET['contype']."', '".$_GET['presstest']."', '".$_GET['airspace']."', '".$_GET['discharge']."', '".$_GET['enclosure']."', '".$_GET['commodity']."', '".$_GET['consignment']."', '".$_GET['wrapping']."', '".$_GET['perforated']."', '".$_GET['height']."', '0', '".$din."', '".$deckl."', '".$_GET['clntid']."', '".$_GET['ajtname']."', '".$_GET['dtype']."', '".$_GET['formno']."', '".$_GET['sub_c']."', '0', '$_GET[consignment_link]', '$_GET[container20feet]')";
	
	$result=mysql_query($sql) or die(mysql_error()." - on line no: ".__LINE__);
	
	$certificateno=mysql_insert_id();
	$certino="AQIS$certificateno";
}

/*$sqlo="SELECT count(*) FROM certificate ";
$sqq=mysql_query($sqlo) or die(mysql_error());
$resulto=mysql_fetch_array($sqq);
$count=$resulto[0];
//$certificateno="$count";
*/

// Invoice
if($_GET[stax]=='yes'){
	$srtax=$_GET[srtax];
}else{
	$srtax=0;
}

$dis_test=$_GET[discount];
if($dis_test==''){
	$dis_amt=0;
}else{
	$dis_amt=$_GET[discount];
}

include("../connexion2.php");


if($_GET[famount]>0){
if($_SESSION['city']=="ludhiana"){
	if(!$_GET[finalone]){
		$_GET[finalone]=0;
	}
	if(!$_GET[gst_combine]){
		$_GET[gst_combine]=0;
	}
	if(!$_GET[qty]){
		$_GET[qty]=0;
	}

	$dat=date("Y-m-d");
	if($_SESSION['formtwo']=='inserted'){
		$dat=date("Y-m-d");
		$sql="INSERT INTO invoices(clnid,ajtid, certid, dtd, famount, tamount, mamount, amount, discount, servicetax, grandtotal, invstatus, cmntz, branch, hsn,  uom, gst_combine, qty, product)
		VALUES('$_GET[clntid]', '$_GET[ajtname]', '$certino', '$dat', '$_GET[famount]', '$_GET[tamount]', '$_GET[mamount]', '$_GET[amount]', '$_GET[discount]', '$srtax', '$_GET[finalone]', 'pending', '$_GET[particular]', '$_SESSION[city]', '$_GET[hsn]', '$_GET[uom]', '$_GET[gst_combine]', '$_GET[qty]', '$_GET[product]')";
		$result=mysql_query($sql) or die(mysql_error()." - on line no: ".__LINE__);
		$invoiceid=mysql_insert_id();
	}
}else{
	$dat=date("Y-m-d");
	if($_SESSION['formtwo']=='inserted'){
		$dat=date("Y-m-d");
		$sql="INSERT INTO invoices(clnid, ajtid, certid, dtd, famount, tamount, mamount, amount, discount, servicetax, grandtotal, invstatus, cmntz, branch, hsn, uom, gst_combine, qty, product)
		VALUES('$_GET[clntid]','$_GET[ajtname]','$certino','$dat','$_GET[famount]','$_GET[tamount]','$_GET[mamount]','$_GET[amount]','$_GET[discount]','$srtax','$_GET[finalone]','pending','$_GET[particular]','$_SESSION[city]', '$_GET[hsn]', '$_GET[uom]', '$_GET[gst_combine]', '$_GET[qty]', '$_GET[product]')";
		$result=mysql_query($sql) or die(mysql_error()." - on line no: ".__LINE__);
		$invoiceid=mysql_insert_id();
	}	
}
}
$_SESSION['formtwo']='wrong';
?>

<table align="center" width="100%" border="0">
	<tr>
		<td>New AQIS Certificate Sucessfully Entered </td>
		<td>Certificate # <?php print $certificateno; ?>  </td>
		<td>Invoice ID# <?php print $invoiceid; ?> </td>
	</tr>
	<tr>
		<td>
			<form action="../print/aqis.php" method="get" target="_blank">
				<input type="hidden" name="id" value="<?php echo "$certificateno"; ?>">
				<input type="submit" value="Print Certificate">
			</form>
		</td>
		<td align=center><a href=certificate.php>Click here to Get Back Home</a></td>
		<td align=right>
			<form action="../print/printinvc.php" method="get" target="_blank">
				<input type="hidden" name="iid" value="<?php echo"$invoiceid";?>">
				<input type="hidden" name="cype" value="aqis">
				<input type="submit" value="Print Invoice">
			</form>
		</td>
	</tr>
</table>
<?php
include"../foot.php";
?>
<br><br><br>


PK 99