
PK 
<?php
include "templatic/head.php";
include "templatic/header.php";
$clnt=$_POST['client'];
$cl=explode(',',$clnt);
//print $cl['0'];
echo "<h3>$clnt</h3>";
?>
<table width="100%">
<?php
echo "<tr> <td>Certificate No.</td> <td>EXPO Invoice No.</td> <td>Commodity</td> <td>Date of Issue</td> <td>Certificate Type</td> <td>Invoice No.</td> <td>Invoice Amount</td>";
//echo $sql="SELECT * From certificates WHERE nameaddress='$cl[0]' || nameaddress='$clnt' order by certificateno DESC";
$whr=1;
if($_POST[st_date]){
$whr.=" and dtd >= '$_POST[st_date]' ";
}
if($_POST[en_date]){
$whr.=" and dtd <= '$_POST[en_date]' ";
}
$sql="SELECT * From invoices WHERE $whr and clnid like '%$clnt%' order by invid DESC";
//echo "$sql <br>";
$result=mysql_query($sql) or die('error in Certificates');
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)){
if($row['certypo']=='a'){
$ctype="ALP";
}
if($row['certypo']=='b'){
$ctype="AFAS";
}
if($row['certypo']=='c'){
$ctype="NSPM";
}
echo"<tr><td><b>{$row['certid']}</b></td> <td>{$row['distmarks']}</td> <td>{$row['desgood']}</td> <td>{$row['dtd']}</td> <td>$ctype</td>";
$invid ="--";
$round ="--";
/*$sql1="SELECT * FROM invoices WHERE certid='$row[certificateno]'";
$result1=mysql_query($sql1) or die('error in invoiceno');
while($row1=mysql_fetch_array($result1)){
$round=round($row1['grandtotal']);
$invid= $row1['invid'];
}
echo" <td>$invid</td> <td>$round</td>";
*/
echo" <td>$row[invid]</td> <td>$row[amount]</td>";
print $row1;
if($row1==" "){
echo "<td>0</td>";
}
echo "</tr>";
}
?>
</table>
<?php
include"templatic/footer.php";
?>


PK 99