<?php

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

if($G_memberid > 0)
{
	$obj  = new Company();
	$memberid = $G_memberid;

	
	// All members 
	$sql = "select * 
			from user_company a
			inner join mstrepresentative  b on a.membercompanyid = b.membercompanyid
			where a.memberid = $memberid and b.isdeleted = 0";
	
			//echo $sql;
			//die();
	$sqllist = $obj->getCompany('','',$sql);
	if(is_array($sqllist))
	{
		$rowcount = count($sqllist);
	}
	
	// Active members 
	$sql1 = "select * 
			from user_company a
			inner join mstrepresentative  b on a.membercompanyid = b.membercompanyid
			where a.memberid = $memberid and a.memberapprovalstatus = 1  and b.isdeleted = 0";
	
	$Activesqllist = $obj->getCompany('','',$sql1);
	if(is_array($Activesqllist))
	{
		$Activerowcount = count($Activesqllist);
	}
	
	
	
	// Inactive members 
	$sql2 = "select * 
			from user_company a
			inner join mstrepresentative  b on a.membercompanyid = b.membercompanyid
			 where a.memberid = $memberid  and a.memberapprovalstatus = 0";

	
	$Inactivesqllist = $obj->getCompany('','',$sql2);
	if(is_array($Inactivesqllist))
	{
		$Inactiverowcount = count($Inactivesqllist);
	}
 	
	
	require_once("header1.html");
	require_once("leftnav.html");
	require_once("manage_represent1.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;
}   	
	
?>
