<?php
require_once("../include/config.php");	
require_once("../include/startup.php");

$obj1  = new Company();

if($G_memberid > 0)
{
	$memberid = $G_memberid;
	$companyid = $_GET['companyid'];
	
	$sql = "select * from user_company where membercompanyid = $companyid ";
	$sqllist = $obj1->getCompany('','',$sql);
	if(is_array($sqllist))
	{
		$rowcount = count($sqllist);
	}
	
	for($i=0;$i<$rowcount;$i++)
	{
		$companyname = $sqllist[$i]['companyname'];
		$gstno 		 = $sqllist[$i]['gstno'];
		$panno 	    = $sqllist[$i]['panno'];
		$Tan_No 	    = $sqllist[$i]['Tan_No'];
		$head_Email  = $sqllist[$i]['head_Email'];
		$head_TelNo  = $sqllist[$i]['head_TelNo'];
		$Address	 	 =	$sqllist[$i]['Addline1']."<br>".$sqllist[$i]['Addline2']."<br>".$sqllist[$i]['head_CityName']."<br>".$sqllist[$i]['head_StateidName']."-".$sqllist[$i]['head_Pin']."<br>".$sqllist[$i]['Country'];
		$status		 = $sqllist[$i]['memberapprovalstatus'];
		if($status == '1')
		{
			$memberapprovalstatus = "Active";
		}
		else
		{
			$memberapprovalstatus = "Inactive";
		}
	}
	
		$sql1 = "select * from mstmember x
				  inner join trninvoicetomember a on x.memberid = a.memberid 
				  inner join trninvoicetomemberdetails b on a.memberinvoicesid = b.memberinvoicesid
				  where x.memberid = $memberid and a.billing_membercompanyid = $companyid  and quotes_proforma_invoice = 2 group by a.memberinvoicesid";
		$sqllist1 = $obj1->getCompany('','',$sql1);
		if(is_array($sqllist1))
		{
			$rowcount1 = count($sqllist1);
		}
		
		
		$sql2 = "select * from mstmember x
				  inner join trninvoicetomember a on x.memberid = a.memberid 
				  inner join trninvoicetomemberdetails b on a.memberinvoicesid = b.memberinvoicesid
				  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 a.billing_membercompanyid = $companyid  and quotes_proforma_invoice = 2  GROUP by memberpaymentdetailID";
		$sqllist2 = $obj1->getCompany('','',$sql2);
		if(is_array($sqllist2))
		{
			$rowcount2 = count($sqllist2);
		}
	
	require_once("header1.html");
	require_once("leftnav.html");
	require_once("company-details1.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;
}   	
	
?>
