PK

ADDRLIN : /home/anibklip/pcfcindia.com/19-20/
FLL :
Current File : /home/anibklip/pcfcindia.com/19-20/agentdetail.php

<?php
	session_start();
	require_once 'common/common.php';
	require_once 'common/secure.php';
include("connexion.php");
include "head.php";
	
/*echo '<pre>';
	print_pre($_GET);
echo '</pre>';*/
?>

<br><br>
<p align="left"><font color="#006699">&nbsp;&nbsp;Monthly Statement for Agent </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>Status</strong></td>
  <td><strong>Amount</strong></td>
  <td><strong>Pay</strong></td>
  <td><strong>Print</strong></td>
</tr>
<?php
$sql="SELECT * FROM invoices Where ajtid='$_GET[clnt]'";
$result=mysql_query($sql) or die('error in fetch');
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 agent</font><br><br></td></tr>";
}
while($row=mysql_fetch_array($result))
{
	echo"<tr>
	  <td>{$row['dtd']}</td>       
	  <td>{$row['invid']}</td> 
	  <td>{$row['certid']}</td>     
	  <td>";
			echo $row['invstatus']."&nbsp;";
			$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['invstatus']=='pending')
		{
			echo "<form action='pay.php' method='post'>
				Pay<input type='checkbox' name='paymore[]' value='id/cid=".$row['invid']."/".$row['clnid']."' />
				<input type='hidden' name='agent_id' value='".$_GET['clnt']."' />
				<input type='hidden' name='act' value='by_ajent' />
				";
		}
		else
		{
			$id_cid=$row['invid'].'/'.$row['clnid'];
			echo '<a href="paid_detail.php?place=agent&act=pay&info='.$id_cid.'&clnt='.$_GET['clnt'].'">Received</a>';
		}
			
			
			
	  echo "</td>
	  <td><a href='invoice_print.php?act=print_ajent&clnt_id=".$row['clnid']."&sech_by_ajt=".$_GET['clnt']."&id=".$row['invid']."'>Print</a>
	  </td>
	</tr>";
}
//<td><a href='printinvc3.php?act=print_ajent&clnt_id=".$row['clnid']."&sech_by_ajt=".$_GET['clnt']."&invid=".$row['invid']."'>Print</a>
?>
<tr>
	<td colspan="3">&nbsp;</td>
	<td>Total Dues</td>
	<td><span style="color: #F83A3A;">
	<?php 
		$sql_pending="SELECT sum(grandtotal) FROM invoices Where ajtid='$_GET[clnt]' AND invstatus='pending'";
		$result_pending=mysql_query($sql_pending) or die('error in fetch');
		$num_row=mysql_num_rows($result_pending);
		if($num_row!=0)
		{
			$row_pending=mysql_fetch_array($result_pending);
			$total_pdg=$row_pending['sum(grandtotal)'];
			if($total_pdg==0)
			{
				echo 'No Dues';
			}else{
				echo $total_pdg;	
			}
			
			
			
		}
	?></span>
	</td>
	<td>
		<?php 
			$sql0="SELECT * FROM invoices Where ajtid='$_GET[clnt]' AND invstatus='pending'";
			$result0=mysql_query($sql0);
			$num_row0=mysql_num_rows($result0);
			if($num_row0!=0)
			{
				echo "<input type='hidden' name='act' value='pay' />
				<input type='submit' name='submit' value='pay'>";
			}
		?>
		</form>
	
	</td>
	<td>&nbsp;</td>
</tr>
<tr>
	<td colspan="3">&nbsp;</td>
	<td>Received Total</td>
	<td><span style="color: #009600;">
	<?php 
		$sql_rec="SELECT sum(grandtotal) FROM invoices Where ajtid='$_GET[clnt]' AND invstatus='paid'";
		$result_rec=mysql_query($sql_rec) or die('error in fetch');
		$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>&nbsp;</td>
	<td>&nbsp;</td>
</tr>
<tr>
	<td colspan="3">&nbsp;</td>
	<td>Grand Total</td>
	<td><strong>
	<?php
		echo $grdtotal=$total_rec+$total_pdg;
	?></strong>
	</td>
	<td>&nbsp;</td>
	<td>&nbsp;</td>
</tr>
<tr><td colspan="9" 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