<?php
require_once("../include/config.php");
require_once("../include/startup.php");
$invoice_obj					=	new Invoice();
if($G_memberid > 0)
{
	
		$billed_membercompanyid	= $_GET['companyid'];
		$memberinvoicesid			= $_GET['memberinvoicesid'];
		$memberid 					= $G_memberid;
	
		
/*echo $sql_payment = "select * from mstmember x
				  inner join trninvoicetomember a on x.memberid = a.memberid 
				  inner join trninvoicetomemberdetails b on a.memberinvoicesid = b.memberinvoicesid
				  inner join mstclients c on a.billed_membercompanyid = c.clientcompanyid
				  inner join user_company_payment_header d on a.memberinvoicesid = d.memberinvoicesid
				  inner join user_company_payment_detail e on d.memberpaymentheaderid = e.memberpaymentheaderid
				  where x.memberid = $memberid  and quotes_proforma_invoice = 2 and a.memberinvoicesid=$memberinvoicesid";*/
				  
		$sql_payment = "SELECT head_receipt_no FROM `user_company_payment_header` ORDER BY `memberpaymentheaderid` DESC limit 0,1";
		$sqllist_payment = $invoice_obj->getInvoice('',$sql_payment);
		if(is_array($sqllist_payment))
		{
			 $rowcount_payment = count($sqllist_payment);
		}

		
				 	$head_receipt_no  				= $sqllist_payment[0]['head_receipt_no'];
				
			require_once("create_payment1.html");
		require_once("header1.html");
		require_once("leftnav.html");
		require_once("footer1.html");	
 
	
}
else if (!headers_sent($filename, $linenum)) 
{
				$redirect_url = DOC_ROOT."login.php";
				header("Location: $redirect_url");
    			exit;
					// You would most likely trigger an error here.
}
else 
{
				echo "Headers already sent in $filename on line $linenum\n" .
          			"Cannot redirect, for now please click this <a ";
    			exit;
}   

?>
