
PK 
<?php
include "templatic/head.php";
include "templatic/header.php";
?>
<div class="dataGrid">
<h2><?php echo($_GET[typ]=="sub"?"Sub":"")?> Certificates</h2>
<form method="get" action="">
<input type="hidden" name="typ" value="<?php echo $_GET[typ]?>" />
Search:
<select name="type">
<option value="">Type</option>
<option value="a" <?php echo ($_GET[type]=="a"?"selected":"")?>>AQIS</option>
<option value="b" <?php echo ($_GET[type]=="b"?"selected":"")?>>AUS</option>
<option value="c" <?php echo ($_GET[type]=="c"?"selected":"")?>>PPQ</option>
<option value="d" <?php echo ($_GET[type]=="d"?"selected":"")?>>AUS-BK</option>
<option value="e" <?php echo ($_GET[type]=="e"?"selected":"")?>>PPQ-BK</option>
<option value="f" <?php echo ($_GET[type]=="f"?"selected":"")?>>NSPM</option>
<option value="g" <?php echo ($_GET[type]=="g"?"selected":"")?>>NSPM-BK</option>
</select>
<input type="text" name="certno" value="<?php echo $_GET[certno]?>" placeholder="Certificate No"/>
<input type="text" name="container" value="<?php echo $_GET[container]?>" placeholder="Container No"/>
<select style="width:250px;" name="clntid">
<option value="">All Exporters</option>
<?php
$rs = mysql_query('select headid, headname, headaddress from parties where status="active" && headname like "'. mysql_real_escape_string($_REQUEST['term']) .'%" order by headname ', $dblink);
$data = array();
if ( $rs && mysql_num_rows($rs) ){
while( $row = mysql_fetch_array($rs, MYSQL_ASSOC) ){
$headid = strip_tags($row['headid']);
$headname = strip_tags($row['headname']);
$headaddress = $row['headaddress'];
if($_GET['clntid']==$headid){
$sel="selected";
}else{
$sel="";
}
?>
<option <?php echo $sel?> value="<?php echo $headid?>"><?php echo $headname?> <?php echo $headaddress?></option>
<?php
}
}
?>
</select>
<input type="submit" value="Search"/>
</form>
<table>
<thead>
<tr>
<th>#</th>
<th>Date of Issue</th>
<th>Certificate Type</th>
<th>Department of Goods</th>
<th>Quantity Declared</th>
<th style="width:20px;">Name of Country</th>
<th>Place of Fumigant</th>
<th>Party</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php
//$whr=1;
if($_GET[typ]=="bk"){
$whr.=" and (certypo='d' or certypo='e' or certypo='g') ";
}else{
if($_GET[type]!=""){
$whr.=" and certypo='$_GET[type]' ";
}else{
$whr.=" and (certypo='a' or certypo='b' or certypo='c' or certypo='f') ";
}
}
if($_GET[certno]!=""){
$whr.=" and certno='$_GET[certno]' ";
}
if($_GET[container]!=""){
$whr.=" and conslinkno='$_GET[container]' ";
}
if($_GET[clntid]!=""){
$whr.=" and nameaddress='$_GET[clntid]' ";
}
if($_GET[typ]=="sub"){
$sql="SELECT * from certificates where parent_cert!='' order by certificateno DESC ";
}else{
$sql="SELECT * from certificates where parent_cert=0 $whr order by certificateno DESC ";
}
//echo "$sql <br>";
$result=mysql_query($sql) or die(mysql_error().' - Error in getting Certificates');
$totl_rows=mysql_num_rows($result);
if($totl_rows == 0) {
echo "<tr><td colspan='9' align=center colour=black><br>No Result found in Certificates, try again later.<br></td></tr>";
}
$cnt=$totl_rows+1;
while($row=mysql_fetch_array($result)){
$cnt--;
if($row[cancel]){
$sts=0;
$can="Active";
}else{
$sts=1;
$can="Cancel";
}
//echo $row['certypo'];
if($row['certypo']=="a"){
$ctype="AQIS";
}elseif($row['certypo']=="b"){
$ctype="AUS";
}elseif($row['certypo']=="c"){
$ctype="PPQ";
}elseif($row['certypo']=="d"){
$ctype="AUS-BK";
}elseif($row['certypo']=="e"){
$ctype="PPQ-BK";
}elseif($row['certypo']=="f"){
$ctype="NSPM";
}elseif($row['certypo']=="g"){
$ctype="NSPM-BK";
}
if($_GET[typ]=="sub"){
$certificateno=getColumn("certificates","certificateno", $row['parent_cert'],"certno");
}else{
$certificateno=$row['certno'];
}
if($row['sub_certno']==1){
$sub_certno="/A";
}elseif($row['sub_certno']==2){
$sub_certno="/B";
}elseif($row['sub_certno']==3){
$sub_certno="/C";
}elseif($row['sub_certno']==4){
$sub_certno="/D";
}elseif($row['sub_certno']==5){
$sub_certno="/E";
}elseif($row['sub_certno']==6){
$sub_certno="/F";
}elseif($row['sub_certno']==7){
$sub_certno="/G";
}elseif($row['sub_certno']==8){
$sub_certno="/H";
}
echo "
<tr>
<td nowrap><b>{$cnt}</b></td>
<td>".date("d-m-Y", strtotime($row['issuedate']))."</td>
<td>{$ctype}-{$certificateno}{$sub_certno}</td>
<td>{$row['desgood']}</td>
<td>{$row['quantitydeclared']}</td>
<td>{$row['countrydes']}</td>
<td>{$row['placefumigantion']}</td>
";
?>
<td>
<?php
$qc="select headid, headname, headaddress from parties where headid='$row[nameaddress]' ";
$rsp = mysql_query($qc) or die(mysql_erorr());
if( $rp = mysql_fetch_array($rsp, MYSQL_ASSOC) ){
echo "<b>$rp[headname]</b><br>$rp[headaddresszzzzz]";
}
?>
</td>
<td nowrap>
<a title='Edit' href="certificate-form.php?cert_id=<?php echo $row['certificateno']?>"><img src='./img/edit.png' alt='Edit' /></a>
<a target='_blank' href="./print/form_print.php?id=<?php echo $row['certificateno']?>"><img src='./img/printer.png' alt='Print' /></a>
</td>
<td><a target='_blank' href="./print/cretid_report.php?id=<?php echo $row['certificateno']?>">Print Report</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
include "templatic/footer.php";
?>


PK 99