<?php
require_once("../include/config.php");
require_once("../include/startup.php");
$invoice_obj					=	new Invoice();

if($G_memberid > 0)
{
			//$membercompanyid						= $G_membercompanyid;
		//	echo $membercompanyid;
		//	die();
		$memberid = $G_memberid;

		$sql_invoice = "SELECT invoiceno,invoicedate,companyname,membercompanyid
		FROM trninvoicetomember a 
		inner join user_company b on a.memberid = b.memberid 
				  
		ORDER BY `memberinvoicesid`,`membercompanyid` ASC limit 0,1";
		$sqllist_invoice = $invoice_obj->getInvoice('',$sql_invoice);
		if(is_array($sqllist_invoice))
		{
			 $rowcount_invoice = count($sqllist_invoice);
		}

		
				 	$invoiceno  				= $sqllist_invoice[0]['invoiceno'];
				 	$invoicedate  				= $sqllist_invoice[0]['invoicedate'];
				 	$invoice_fromcompanyname  				= $sqllist_invoice[0]['companyname'];
				 	$invoice_fromcompanyid  				= $sqllist_invoice[0]['membercompanyid'];

				

		require_once("header1.html");
		require_once("leftnav.html");
		require_once("create_invoice1.html");
		//require_once("create_invoice1-15-4-20-pooja.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;
}   
?>
