
PK 
<?php
session_start();
require_once 'common/common.php';
require_once 'common/secure.php';
//include("connexion.php");
if($_GET['action']=="accuntdetails"){
$_SESSION['action']="accuntdetails";
}
if($_SESSION['action']=="accuntdetails"){
include ("head_account.php");
}else{
include "head.php";
}
?>
</table>
<br><br>
<p align="left"><font color="#006699"> Monthly Statement for Client id # <?php echo"$clnt"; ?></font></p>
<table cellspacing="3" align="center" width="100%" border="4" cellpadding="3">
<tr>
<td><strong>Date</strong></td>
<td><strong>Inv. No.</strong></td>
<td><strong>Cert. No.</strong></td>
<td><strong>Desc.</strong></td>
<td><strong>Cont. no</strong></td>
<td><strong>Country</strong></td>
<td><strong>Status</strong></td>
<td><strong>Amount</strong></td>
<td><strong>Pay</strong></td>
<td><strong>Print</strong></td>
</tr>
<?php
//$sql="SELECT desgood,conslinkno,countrydes FROM certificate WHERE clnid='$_GET[clnt]' AND ajtid='0'";
if($_SESSION['city']=="ludhiana")
{
include("connexion1.php");
if($_GET['clnt']=='all')
{
$sql="SELECT desgood,conslinkno,countrydes FROM certificate";
}
else{
$sql="SELECT desgood,conslinkno,countrydes FROM certificate WHERE clnid='$_GET[clnt]'";
}
}
else{
//include("connexion2.php");
if($_GET['clnt']=='all')
{
$sql="SELECT desgood,conslinkno,countrydes FROM certificate";
}
else{
$sql="SELECT desgood,conslinkno,countrydes FROM certificate WHERE clnid='$_GET[clnt]'";
}
}
$result=mysql_query($sql) or die('error in fetch 1');
while($row=mysql_fetch_array($result))
{
$desc="{$row['desgood']}";
$container="{$row['conslinkno']}";
$county="{$row['countrydes']}";
?>
<?php
//******************ONLY COMMENT REMOVE*****************************************
//$sql="SELECT * FROM invoices Where clnid='$_GET[clnt]' AND (ajtid='0' or ajtid='') and branch='$_SESSION[city]'";
if($_SESSION['city']=="ludhiana")
{
include("connexion2.php");
$sql="SELECT * FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]'";
}
else
{
include("connexion2.php");
$sql="SELECT * FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]'";
}
$result=mysql_query($sql) or die('error in fetch 2');
if (mysql_num_rows($result) == 0)
{
echo "<tr>
<td colspan=8 align=center>
<font color=red><strong><br>No Due Invoice records Found </strong>. Please Select the another Client</font><br><br>
</td>
</tr>";
}
while($row=mysql_fetch_array($result))
{
$sno++;
//$c=$sno-1;
if($_SESSION['city']=="ludhiana")
{
include("connexion1.php");
$sql_crt="SELECT desgood,conslinkno,countrydes,cancel_reason,cancel_status FROM certificate WHERE certificateno='".$row['certid']."'";
}
else
{
include("connexion2.php");
$sql_crt="SELECT desgood,conslinkno,countrydes,cancel_reason,cancel_status FROM certificate WHERE certificateno='".$row['certid']."'";
}
$result_crt=mysql_query($sql_crt);
$row_crt=mysql_fetch_array($result_crt);
echo"<tr>
<td>{$row['dtd']}</td>
<td>{$row['invid']}</td>
<td>{$row['certid']}</td>
<td>{$row_crt['desgood']}</td>
<td>{$row_crt['conslinkno']}</td>
<td>{$row_crt['countrydes']}</td>
<td>";
echo $row['invstatus']." ";
if($_SESSION['city']=="ludhiana")
{
include("connexion1.php");
$sql_Balcrt="SELECT * FROM balance_amt WHERE invoice_id='".$row['invid']."' AND bm_status='pending'";
}
else
{
include("connexion2.php");
$sql_Balcrt="SELECT * FROM balance_amt WHERE invoice_id='".$row['invid']."' AND bm_status='pending'";
}
$result_balCrt=mysql_query($sql_Balcrt);
$num_balcrt=mysql_num_rows($result_balCrt);
if($num_balcrt!=0)
{
echo '<a href="pay.php?act=balamt&b_invid='.$row['invid'].'&cltid='.$_GET['clnt'].'">Balance</a>';
}
echo "</td>
<td>";
if($row['invstatus']=='pending')
{
echo '<span style="color: #F83A3A;">'.$row['grandtotal'].'</span>';
}
else
{
echo '<span style="color: #009600;">'.$row['grandtotal'].'</span>';
}
echo"</td>
<td>";
if($row_crt['cancel_status']=='0')
{
if($row['invstatus']=='pending')
{
//echo "<a href='pay.php?act=pay&id=".$row['invid']."&cid=".$_GET['clnt']."'>Pay</a>
//<input type='checkbox' name='paymore' value='id=".$row['invid']."&cid=".$_GET['clnt']."' />";
echo "<form action='pay.php' method='post'>
Pay<input type='checkbox' name='paymore[]' value='id/cid=".$row['invid']."/".$_GET['clnt']."' />";
}
else
{
$id_cid=$row['invid'].'/'.$_GET['clnt'];
echo '<a href="paid_detail.php?clint=search&act=pay&info='.$id_cid.'&clnt='.$_GET['clnt'].'">Received</a>';
}
}
else
{
echo "<a href='cert_canceled.php?id=".$row['invid']."'>Cancelled</a>";
}
echo "</td>
<td><a target='_blank' href='invoice_print.php?act=print&clnt_id=".$_GET['clnt']."&id=".$row['invid']."'>Print</a></td>
</tr>";
}
//<td><a href='printinvc3.php?act=print&clnt_id=".$_GET['clnt']."&id=".$row['invid']."'>Print</a></td>
?>
<tr>
<td colspan="6" align="center"></td>
<td>Total Dues</td>
<td><span style="color: #F83A3A;">
<?php
if($_SESSION['city']=="ludhiana")
{
include("connexion2.php");
$sql2="SELECT sum(grandtotal) FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]' AND invstatus='pending'";
}
else
{
include("connexion2.php");
$sql2="SELECT sum(grandtotal) FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]' AND invstatus='pending'";
}
$result2=mysql_query($sql2) or die('error in fetch 3');
$num_row=mysql_num_rows($result2);
if($num_row!=0)
{
$row2=mysql_fetch_array($result2);
$total_pendind=$row2['sum(grandtotal)'];
if($total_pendind==0){
echo 'No Dues';
}else{
echo $total_pendind;
}
}
?></span>
</td>
<td>
<?php
if($_SESSION['city']=="ludhiana")
{
include("connexion2.php");
$sql0="SELECT * FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]' AND invstatus='pending'";
}
else
{
include("connexion2.php");
$sql0="SELECT * FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]' AND invstatus='pending'";
}
$result0=mysql_query($sql0);
$num_row=mysql_num_rows($result0);
if($num_row!=0)
{
if($row_crt['cancel_status']=='0')
{
$frm_url=$_GET['clnt'];
echo '<input type="hidden" name="frm_url" value='.$frm_url.' />
<input type="hidden" name="act" value="pay" />
<input type="submit" name="submit" value="pay">';
}
}
?>
</form>
</td>
<td> </td>
</tr>
<tr>
<td colspan="6" align="center"></td>
<td>Received Total</td>
<td><span style="color: #009600;">
<?php
if($_SESSION['city']=="ludhiana")
{
include("connexion2.php");
$sql_rec="SELECT sum(grandtotal) FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]' AND invstatus='paid'";
}
else
{
include("connexion2.php");
$sql_rec="SELECT sum(grandtotal) FROM invoices Where clnid='$_GET[clnt]' AND branch='$_SESSION[city]' AND invstatus='paid'";
}
$result_rec=mysql_query($sql_rec) or die('error in fetch 4');
$row_rec=mysql_fetch_array($result_rec);
$total_rec=$row_rec['sum(grandtotal)'];
if($total_rec==0){
echo 'No Received';
}else{
echo $total_rec;
}
?></span>
</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="6" align="center"></td>
<td>Grand Total</td>
<td><strong>
<?php
echo $gtotal=$total_pendind+$total_rec;
?></strong>
</td>
<td> </td>
<td> </td>
</tr>
<tr><td colspan="10" align="center" height="80"><center><a href="search.php"><strong><u>Search again</u></strong></a></center></td></tr>
</table>
<?php
}
"foot.php";
?>


PK 99