PK

ADDRLIN : /home/anibklip/pcfcindia.com/bkp20-21/
FLL :
Current File : /home/anibklip/pcfcindia.com/bkp20-21/paid_detail.php

<?php
	session_start();
	require_once 'common/common.php';
	require_once 'common/secure.php';
	//include "head.php";
	//include("connexion.php");
	
	if($_SESSION['action']=="accuntdetails"){
		include ("head_account.php");	
	}else{
		include "head.php";	
	}
	
	/*echo '<pre>';
		print_r($_POST);
	echo '</pre>';	*/
//exit;
?>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
	// ** START **
  if (form.pamount.value == "") {
    alert( "Please enter Amount Recieve here.");
    form.pamount.focus();
    return false ;
  }
  // ** END **
  return true ;
}
//-->
</script>
</head>
	<!--<h2 id="icon_pick"><a href="billing.php" class="titletext">Manage Payments </a> 
   &gt;&gt; Add New Payment</h2><br> 
	-->
	<?php
		if($_GET['place']=='agent')
		{
			$d=$_GET['clnt'];
			echo "<a href='agentdetail.php?clnt=".$d."'>Back</a>";		
		}
		if($_GET['clint']=='search')
		{
			$d=$_GET['clnt'];
			echo "<a href='statement.php?clnt=".$d."'>Back</a>";
		} 
	?>
		
	<strong > &nbsp;Receceived Payment Details:</strong> 
	<table cellspacing="3" align="center" width="100%" border="4" cellpadding="3">
		
<?php
	if($_GET['act']=='pay')
	{
		for($i=0;$i<1;$i++)
		{
			$get_info=$_GET['info'];
			$result_pay1=explode('/',$get_info);

			if($_SESSION['city']=="ludhiana")
			{
				include("connexion2.php");
				$sql_total="SELECT * FROM invoices WHERE invid='".$result_pay1[0]."' AND clnid='".$result_pay1[1]."'";	
			}
			else
			{
				include("connexion2.php");
				$sql_total="SELECT * FROM invoices WHERE invid='".$result_pay1[0]."' AND clnid='".$result_pay1[1]."'";
			}
			$result_total=mysql_query($sql_total);
			$row_total=mysql_fetch_array($result_total);
			
			
			
			if($_SESSION['city']=="ludhiana")
			{
				include("connexion1.php");
				$sql_pay="SELECT * FROM payments WHERE invoice='".$row_total['invid']."'";	
			}
			else
			{
				include("connexion2.php");
				$sql_pay="SELECT * FROM payments WHERE invoice='".$row_total['invid']."'";
			}
			
			$result_pay=mysql_query($sql_pay);
			$row_pay=mysql_fetch_array($result_pay);
			
			
			
			$amount[]=$row_total['sum(amount)'];
			if($_POST['act']=='by_ajent')
			{
				if($_SESSION['city']=="ludhiana")
				{
					include("connexion2.php");
					$sql="SELECT * FROM invoices WHERE clnid='".$result_pay1[1]."' AND invid='".$result_pay1[0]."' AND ajtid='".$_POST['agent_id']."'";
				}
				else
				{
					include("connexion2.php");
					$sql="SELECT * FROM invoices WHERE clnid='".$result_pay1[1]."' AND invid='".$result_pay1[0]."' AND ajtid='".$_POST['agent_id']."'";
				}
			}
			else
			{
				if($_SESSION['city']=="ludhiana")
				{
					include("connexion2.php");
					$sql="SELECT * FROM invoices WHERE clnid='".$result_pay1[1]."' AND invid='".$result_pay1[0]."'";
				}
				else
				{
					include("connexion2.php");
					$sql="SELECT * FROM invoices WHERE clnid='".$result_pay1[1]."' AND invid='".$result_pay1[0]."'";
				}
			}
			$result_sql=mysql_query($sql);
			while($row_result=mysql_fetch_array($result_sql))
			{
				$cert_nos1[]=$row_result['certid'];
				$clnt_id_all[]=$row_result['clnid'];
			}
		}	
	}
	else
	{
		include("connexion2.php");
		$sql="SELECT * FROM invoices WHERE invid='$_GET[id]'";
	}
	if($_GET['serh_by_ajt']=='true')
	{
		$sql="SELECT * FROM invoices WHERE invid='".$_GET['id']."' AND ajtid='".$_GET['sech_by_ajt']."'";
	}
$result=mysql_query($sql) or die ('error');
while($row=mysql_fetch_array($result))
{
?>
<tr>
	<td colspan="2">
		Payment Invoice #<strong><?php echo $id=$row_total['invid'];  ?></strong>
	</td>
</tr>
<tr>
	  <td><strong>Client Id :</strong> 
        <?php echo "{$row['clnid']}"; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td><strong>Certificate No: </strong>
		<?php echo"{$row['certid']}";?><br />
	</td>
</tr>
<tr>
	<td><strong>Dated:</strong> 
        <?php echo"{$row_pay['pdate']}";?></td>
	<td><strong>Amount : </strong>
		<?php echo $row['grandtotal'].'/-';
		?><br/>
	</td>
</tr>


<tr>
	<td valign="top"><strong>Amount Received</strong>:</td>
	<td> 
	<?php
		if($_SESSION['city']=="ludhiana")
		{
			include("connexion1.php");
			$sql_balAmt="SELECT * FROM balance_amt WHERE invoice_id=".$row_total['invid']." AND bm_status='pending'";
		}
		else
		{
			include("connexion2.php");
			$sql_balAmt="SELECT * FROM balance_amt WHERE invoice_id=".$row_total['invid']." AND bm_status='pending'";
		}
		
		$row_balAmt=mysql_query($sql_balAmt);
		$num_rowbal=mysql_num_rows($row_balAmt);
		if($num_rowbal!=0)
		{
			$result_balAmt=mysql_fetch_array($row_balAmt);
			$balAmt=$result_balAmt['bal_amt'];
			echo $rec_amt=$row_pay['pamount']-$result_balAmt['bal_amt'].",&nbsp;&nbsp;<strong>Balance&nbsp;:-&nbsp;</strong>".$result_balAmt['bal_amt']."/-";
		}
		else
		{
			echo $row_pay['pamount']."/-";
		}
	?><br/></td>
</tr>

<tr>
<td valign="top"><strong>TDS</strong>:</td><td> <?php echo $row_pay['tds']."/-";?></td>
</tr>
<tr><td><strong><br/>Mode</strong>:</td><td> <!--<select name="pmode">

<option value="cash	">Cash</option>
<option value="cheque">Cheque</option>
</select><br/>-->
 <?php echo ucfirst($row_pay['pmode']);?>	
</td></tr>
<tr><td><strong>Details/recipt no.</strong>:</td><td><?php echo ucfirst($row_pay['pdetail']);?></td></tr>
</table>

<?php
}
include "foot.php";
?>


PK 99