
PK 
<?php
include("connexion.php");
include"head.php";
?>
<style>
.tr_head{
background-color:#dfdfdf; font-size:14px;
}
.tr_head td{
border-left:1px solid #efefef; font-size:14px;
}
.tr_data td{
border-left:1px solid #efefef; font-size:14px;
}
</style>
<?php
$city = $_SESSION[city];
?>
<table width="100%" border="0" cellpadding="2" cellspacing="1">
<?php
switch($_GET[status]){
case"certificateno":
?>
<tr class="tr_head">
<td>Certificate No.</td>
<?php
if($city=='amritser'){
print "<td>Record No.</td>";
}
?>
<td>Type</td>
<td>Date of Issue</td> <td>Department of good</td> <td>Quantity declared:</td> <td>Name of fumigant:</td> <td>Date of fumigant:</td> <td>Place of fumigant:</td> <td>Dosage rate of fumigant:</td> <td>Update:</td> <td>Print Cer.</td> <td>Print fumigant.</td></tr>
<?php
$whr=1;
$cype=$_GET['ctype'];
if($cype=="aus"){
$table="cert_aqis";
}else{
$table="cert_$cype";
}
if($cype=="aus"){
$typ='d';
$whr.=" and certypo='$typ' ";
}elseif($cype=="aqis"){
$typ ='b';
$whr.=" and certypo='$typ' ";
}elseif($cype=="ppq"){
$typ ='c';
$whr.=" and certypo='$typ' ";
}
//$cype = strtoupper($cype);
$ido = $_GET['id'];
$certificateno = "$cype$ido";
if($_GET[id]==''){
$query = "Select * from $table where $whr";
}else{
$query = "Select * from $table WHERE certificateno='$_GET[id]'";
//$sql="SELECT * From certificate ";
}
//echo $query;
if($_GET[per_page]){
$noprd=$_GET[per_page];
}else{
$noprd=15000;
}
$cpage=$_REQUEST['page'];
if ($cpage == 0){
$cpage=1;
$cnt=1;
}else{
$cnt=($cpage * $noprd) - $noprd + 1;
}
$frm=($cpage * $noprd) - $noprd;
$orderby=" order by certificateno desc";
$sql=$query;
$query.=" $orderby LIMIT $frm, $noprd";
//$sql="SELECT * From certificate ORDER BY certificateno DESC";
$result=mysql_query($query) or die('Please provide Correct Certificate Type and/or Number.');
if(mysql_num_rows($result) == 0) {
echo "<tr><td colspan=11 align=center colour=black><br>No Result found in Certificates for the mentioned number, try again with some other number.<br><br></td></tr>";
}
while($row=mysql_fetch_array($result)){
if($row[certypo]=="a"){
$typ="ALP";
}elseif($row[certypo]=="b"){
$typ="AQIS";
$cype1="aqis";
$cype="aqis";
}elseif($row[certypo]=="c"){
$typ="PPQ";
$cype="ppq";
$cype1="aqis";
}elseif($row[certypo]=="d"){
$typ="AUS";
$cype="aus";
}elseif($row[certypo]=="e"){
$typ="AUS";
}
if($city=='amritser'){
echo"<tr><td>{$row['certificateno']}</td> <td><form action='update/updatereco.php'><input type='hidden' name='table' value='$table'><input type='hidden' name='certno' value='{$row['certificateno']}'><input type='text' name='recordno' size='2' value='{$row['reco']}'><input name='updatereco' type='submit' value='»'></form></td> <td><a target='_blank' href=print/$cype.php?id={$row['certificateno']}&certificateno={$row['certificateno']}&printype=reco>{$typ}</a></td> <td>{$row['issuedate']}</td> <td>{$row['desgood']}</td> <td>{$row['quantitydeclared']}</td> <td>{$row['namefumigant']}</td> <td>{$row['datefumigantion']}</td> <td>{$row['placefumigantion']}</td> <td>{$row['dosagefumigant']}</td> <td><a href=updetail.php?id={$row['certificateno']}&ctype=$typ>Update</a></td> <td><a target='_blank' href=print/$cype.php?id={$row['certificateno']}&certificateno={$row['certificateno']}>Print</a></td> <td><a href='print/report.php?cid={$row['certificateno']}&ctype=$cype' target='_blank'>Print</a></td> </tr>";
}else{
echo"<tr><td>{$row['certificateno']}</td> <td>{$typ}</td> <td>{$row['issuedate']}</td> <td>{$row['desgood']}</td> <td>{$row['quantitydeclared']}</td> <td>{$row['namefumigant']}</td> <td>{$row['datefumigantion']}</td> <td>{$row['placefumigantion']}</td> <td>{$row['dosagefumigant']}</td> <td><a href=updetail.php?id={$row['certificateno']}&ctype=$typ>Update</a></td> <td><a target='_blank' href=print/$cype.php?id={$row['certificateno']}&certificateno={$row['certificateno']}>Print</a></td> <td><a href='print/report.php?cid={$row['certificateno']}&ctype=$cype1' target='_blank'>Print</a></td> </tr>";
}
}
?>
<tr><td colspan="15">
</td></tr>
<?
break;
// Search by Container Begins
case "containerno":
?>
<tr class="tr_head">
<td>Certificate No.</td>
<td>Type</td>
<td>Date of Issue</td> <td>Department of good</td> <td>Quantity declared:</td> <td>Name of fumigant:</td> <td>Date of fumigant:</td> <td>Place of fumigant:</td> <td>Dosage rate of fumigant:</td> <td>Update:</td> <td>Print Cer.</td> <td>Print fumigant.</td></tr>
<?php
$cype=$_GET['ctype'];
if($cype=="aus"){$table="cert_aqis";}
else{$table="cert_$cype";}
//$cype = strtoupper($cype);
$ido = $_GET['id'];
$certificateno = "$cype$ido";
if($_GET[id]==''){
$query = "Select * from $table";
}else{
$query = "Select * from $table WHERE conslinkno='$_GET[id]'";
//$sql="SELECT * From certificate ";
}
if($_GET[per_page]){
$noprd=$_GET[per_page];
}else{
$noprd=15;
}
$cpage=$_REQUEST['page'];
if ($cpage == 0){
$cpage=1;
$cnt=1;
}else{
$cnt=($cpage * $noprd) - $noprd + 1;
}
$frm=($cpage * $noprd) - $noprd;
$orderby=" order by certificateno desc";
$sql=$query;
$query.=" $orderby LIMIT $frm, $noprd";
//$sql="SELECT * From certificate ORDER BY certificateno DESC";
$result=mysql_query($query) or die('error in date');
if(mysql_num_rows($result) == 0) {
echo "<tr><td colspan=11 align=center colour=black><br>No Result found in Certificates for the mentioned number, try again with some other number.<br><br></td></tr>";
}
while($row=mysql_fetch_array($result)){
if($row[certypo]=="a"){
$typ="ALP";
}elseif($row[certypo]=="b"){
$typ="AQIS";
}elseif($row[certypo]=="c"){
$typ="PPQ";
}elseif($row[certypo]=="d"){
$typ="AUS";
}elseif($row[certypo]=="e"){
$typ="AUS";
}
echo"<tr><td>{$row['certificateno']}</td> <td>{$typ}</td> <td>{$row['issuedate']}</td> <td>{$row['desgood']}</td> <td>{$row['quantitydeclared']}</td> <td>{$row['namefumigant']}</td> <td>{$row['datefumigantion']}</td> <td>{$row['placefumigantion']}</td> <td>{$row['dosagefumigant']}</td> <td><a href=updetail.php?id={$row['certificateno']}&ctype=$typ>Update</a></td> <td><a target='_blank' href=print/$cype.php?id={$row['certificateno']}&certificateno={$row['certificateno']}>Print</a></td> <td><a href='print/report.php?cid={$row['certificateno']}&ctype=$cype' target='_blank'>Print</a></td> </tr>";
}
?>
<tr><td colspan="15">
<!-- Pagging -->
<div class="paging">
<div class="right">
<?php
include('ps_pagination.php');
$pager = new PS_Pagination($conn, $sql, $noprd, 6, "status=$_GET[status]&id=$_GET[id]");
$pager->setDebug(false);
$pager->total_rows=$result;
$rs = $pager->paginate();
//echo $pager->renderFullNav();
echo $pager->renderFirst();
echo $pager->renderPrev("Back");
echo $pager->renderNav('<span>', '</span>');
echo $pager->renderNext("Next");
echo $pager->renderLast();
?>
</div>
</div>
<!-- End Pagging -->
</td></tr>
<?
break;
// Search by Container Ends
case"invoiceno":
echo "<tr><td>Invoice No.</td> <td>Certificate No.</td> <td>Date of Issue</td> <td>GST</td> <td>Amount</td> <td>Status</td> <td>Print Invoice</td>";
if($_GET[id]==''){
include("connexion2.php");
//$sql="SELECT * From invoices where branch='$_SESSION[city]' ORDER BY invid DESC ";
$sql="SELECT * From invoices ORDER BY invid DESC ";
$result=mysql_query($sql) or die('error in invoiceno');
if(mysql_num_rows($result) == 0) {
echo "<tr><td colspan=9 align=center colour=black><br>No Result found in Invoices for the mentioned number, try again with some other number.<br><br></td></tr>";
}
while($row=mysql_fetch_array($result)){
$round=round($row['grandtotal']-$row['amount']);
echo"<tr><td><b>{$row['invid']}</b></td> <td>{$row['certid']}</td> <td>{$row['dtd']}</td> <td>$round</td> <td>{$row['amount']}</td> <td>{$row['invstatus']}</td> <td><a target='_blank' href=print/printinvc.php?iid={$row['invid']}>Print Invoice</a> </td></tr>";
}
}else{
include("connexion2.php");
//$sql="SELECT * From invoices WHERE invid='$_GET[id]' and branch='$_SESSION[city]'";
$sql="SELECT * From invoices WHERE invid='$_GET[id]'";
$result=mysql_query($sql) or die('error in invoiceno');
if
(mysql_num_rows($result) == 0) {
echo "<tr><td colspan=9 align=center colour=black><br>No Result found in Invoices for the mentioned number, try again with some other number.<br><br></td></tr>";
}
while($row=mysql_fetch_array($result)){
$round=round($row['grandtotal']-$row['amount']);
echo"<tr><td><b>{$row['invid']}</b></td> <td>{$row['certid']}</td> <td>{$row['dtd']}</td> <td>$round</td> <td>{$row['amount']}</td> <td>{$row['invstatus']}</td> <td><a target='_blank' href=print/printinvc.php?iid={$row['invid']}>Print Invoice</a> </td></tr> ";
}
}
break;
case"certificateno_sub":
echo "<tr><td>Certificate No.</td> <td>Sub-Certificate No.</td> <td>Date of Issue</td> <td>Department of good</td> <td>Quantity declared:</td> <td>Name of fumigant:</td> <td>Date of fumigant:</td> <td>Place of fumigant:</td> <td>Dosage rate of fumigant:</td> <td>Update:</td> <td>Print Cer.</td></tr>";
if($_GET[id]==''){
$cype = $_GET['ctype'];
$cype = strtoupper($cype);
$ido = $_GET['id'];
$certificateno = "$cype$ido";
$sql="SELECT * From certificate_sub ORDER BY sub_certificateno DESC";
$result=mysql_query($sql) or die('error in date');
if(mysql_num_rows($result) == 0) {
echo "<tr><td colspan=11 align=center colour=black><br>No Result found in Certificates for the mentioned number, try again with some other number.<br><br></td></tr>";
}
while($row=mysql_fetch_array($result)){
$pcert = $row['certificateno'];
$certypo = $row['certypo'];
if($certypo=="a"){$certypo = "alp";}
elseif($certypo=="b"){$certypo = "aqis";}
elseif($certypo=="c"){$certypo = "ppq";}
elseif($certypo=="d"){$certypo = "aus";}
echo"<tr> <td> $pcert</td> <td>{$row['sub_certificateno']}</td> <td>{$row['issuedate']}</td> <td>{$row['desgood']}</td> <td>{$row['quantitydeclared']}</td> <td>{$row['namefumigant']}</td> <td>{$row['datefumigantion']}</td> <td>{$row['placefumigantion']}</td> <td>{$row['dosagefumigant']}</td> <td><a href=sub_updetail.php?id={$row['sub_certificateno']}&pid=$pcert>Update</a></td> <td><a target='_blank' href=print/$certypo.php?id={$row['sub_certificateno']}&pid=$pcert>Print</a></td> </tr>";
}
}else{
$cype = $_GET['ctype'];
$cype = strtoupper($cype);
$ido = $_GET['id'];
$certificateno = "$cype$ido";
//print $certificateno;
$sql="SELECT * From certificate_sub WHERE certificateno='$certificateno'";
$result=mysql_query($sql) or die('error in date');
if(mysql_num_rows($result) == 0) {
echo "<tr><td colspan=11 align=center colour=black><br>No Result found in Certificates for the mentioned number, try again with some other number.<br><br></td></tr>";
}
while($row=mysql_fetch_array($result)){
$pcert = $row['certificateno'];
$certypo = $row['certypo'];
if($certypo=="a"){$certypo = "alp";}
elseif($certypo=="b"){$certypo = "aqis";}
elseif($certypo=="c"){$certypo = "ppq";}
elseif($certypo=="d"){$certypo = "aus";}
echo"<tr> <td>{$row['sub_certificateno']}</td> <td>{$row['issuedate']}</td> <td>{$row['desgood']}</td> <td>{$row['quantitydeclared']}</td> <td>{$row['namefumigant']}</td> <td>{$row['datefumigantion']}</td> <td>{$row['placefumigantion']}</td> <td>{$row['dosagefumigant']}</td> <td><a href=sub_updetail.php?id={$row['sub_certificateno']}>Update</a></td><td><a target='_blank' href=print/$certypo.php?id={$row['sub_certificateno']}&pid=$pcert>Print</a></td><td><a href='print/report.php?cid={$row['certificateno']}' target='_blank'>Print</a></td> </tr>";
}
}
break;
}
?>
<tr><td colspan="15" align="center" height="80"><center><a href="search.php"><strong><u>Search again</u></strong></a></center></td></tr>
</table>
<?php
include"foot.php";
?>


PK 99