PK

ADDRLIN : /home/anibklip/pcfcindia.com/2025-26/form/
FLL :
Current File : /home/anibklip/pcfcindia.com/2025-26/form/insert_aus_new.php

<?php
session_start();
require_once '../common/common.php';
require_once '../common/secure.php';
include("../connexion.php");
include("../head.php");
// Certificate

// echo "<pre>"; print_r($_GET); echo "</pre>";die();

$din = date('D, d M Y + H:i:s a');
if ($_SESSION['formfive'] == 'inserted') {
	$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();

	if($_GET['desgood']){
		$desgood = implode(",", $_GET['desgood']);
	}else{
		$desgood = "";
	}

	$fields=" cert_aqis set 
		certificateno 				= '".$certno."',
		issuedate 					= '$_GET[issuedate]',
		desgood 					= '$_GET[desgood]',
		desgood_others		    	= '".$_GET['desgood_others']."',
		quantitydeclared 			= '$_GET[quantitydeclared]',
		conslinkno 					= '$_GET[conslinkno]',
		portcountry 				= '$_GET[portcountry]',
		nameship 					= '$_GET[nameship]',
		countrydes 					= '$_GET[countrydes]',
		declentry 					= '$_GET[declentry]',
		namefumigant 				= '$_GET[namefumigant]',
		dosagefumigant 				= '$_GET[dosagefumigant]',
		durationfumigantion 		= '$_GET[durationfumigantion]',
		airtemp 					= '$_GET[airtemp]',
		commodity 					= '$_GET[commodity]',
		perforated 					= '$_GET[perforated]',
		decla 						= '$_GET[deck]',
		nameaddress					= '".$_GET['nameaddress']."',
		declarednameaddress			= '".$_GET['declarednameaddress']."',
		ajtid 						= '$_GET[ajtname]',
		licetype 					= '$_GET[dtype]',
		certypo 					= '$_GET[formno]',
		sub_c 						= '$_GET[sub_c]',
		cancel_reason 				= '0',
		consignment_link 			= '$_GET[consignment_link]',
			
		enclosure_type				= '".$_GET['enclosure_type']."',
		enclosure_type_others	    = '".$_GET['enclosure_type_others']."',
		dosagefumigant_trmnt		= '".$_GET['dosagefumigant_trmnt']."',
		durationfumigantion_trmnt	= '".$_GET['durationfumigantion_trmnt']."',
		airtemp_trmnt				= '".$_GET['airtemp_trmnt']."',
		streetaddress_trmnt			= '".$_GET['streetaddress_trmnt']."',
		city_trmnt					= '".$_GET['city_trmnt']."',
		country_trmnt				= '".$_GET['country_trmnt']."',
		postcode_trmnt				= '".$_GET['postcode_trmnt']."',
		datefumigantion_start		= '".$_GET['datefumigantion_start']."',
		timefumigantion_start		= '".$_GET['timefumigantion_start']."',
		datefumigantion_end			= '".$_GET['datefumigantion_end']."',
		timefumigantion_end			= '".$_GET['timefumigantion_end']."',
		seal_no			            = '".$_GET['seal_no']."'
	";

	$sql="INSERT INTO $fields, certno='$certno' ";
	// echo "<pre>$sql</pre>";die();
	$result = mysql_query($sql) or die(mysql_error() . " - on line no: " . __LINE__);
	$certificateno = mysql_insert_id();
	$certino = "AUS-NEW$certificateno";
}

/*$sqlo="SELECT count(*) FROM certificate ";
$resulto=mysql_fetch_array(mysql_query($sqlo));
$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'];
}

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

	if ($_SESSION['city'] == "ludhiana") {
		$dat = date("Y-m-d");
		if ($_SESSION['formthree'] == '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();
		}

		if ($_SESSION['formfive'] == '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['formthree'] == '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();
		}

		if ($_SESSION['formfive'] == '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['formthree'] = 'wrong';
$_SESSION['formfive'] = 'wrong';

?>
<table align="center" width="100%" border="0">
	<tr>
		<td>New AUS Certificate Sucessfully Entered </td>
		<td>Certificate # <?php print $certificateno; ?> </td>
		<td>Invoice ID# <?php print $invoiceid; ?> </td>
	</tr>
	<tr>
		<td>        
			<form action="../print/aus_new.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="aus"> -->
				<input type="submit" value="Print Invoice">
			</form>
		</td>
		<td><a href="cretid_report.php?cid=<?php echo $certificateno; ?>" target="_blank">Fumigation Record</a></td>
	</tr>
</table>
<?php
include "../foot.php";
?>
<br><br><br>


PK 99