<?php
require "../commonincludefiles.php";

$account_subgroupid = Escape($_POST['account_subgroupid']);

//$member_id=implode(',',json_decode(stripslashes($_POST['member_id'])));

$present="";

if($account_subgroupid != ""){
	
	$qry = "SELECT subgroup_id FROM ams_accountsubgroup WHERE company_id = '".$_SESSION["cCompany_id"]."'  
				AND subgroup_id = $account_subgroupid ";
	$result = dbQuery($qry);
/*	if(dbRows($result)>0){
		$present .="Account Subgroup,";
	}
	else
	{
		$present .="";
	}
*/	
	$rec = dbArray($result);
	$account_id = $rec['account_id'];
	dbFreeResult($result);
	
	$qry1 = "SELECT am.account_id 
			FROM ams_accountmaster am,ams_accountsubgroup asg
			WHERE am.company_id = '".$_SESSION["cCompany_id"]."' 
				AND asg.company_id = '".$_SESSION["cCompany_id"]."' 
				AND am.subgroup_id=asg.subgroup_id 
				AND asg.subgroup_id = $account_subgroupid ";
	$result = dbQuery($qry1);
	if(dbRows($result)>0){
		$present .="Account Master,";
	}
	else
	{
		$present .="";
	}
	
	$rec = dbArray($result);
	$account_id = $rec['account_id'];
	dbFreeResult($result);
	
	if($account_id!=""){
		$qry2 = "SELECT vd.account_id 
				FROM ams_accountmaster am,ams_voucherdetail vd
				WHERE am.company_id = '".$_SESSION["cCompany_id"]."' 
					AND vd.company_id = '".$_SESSION["cCompany_id"]."' 
					AND am.account_id = vd.account_id 
					AND vd.account_id = $account_id ";
		$result = dbQuery($qry2);
		if(dbRows($result)>0){
			$present .=" Voucher Master,";
		}
		else
		{
			$present .="";
		}
		dbFreeResult($result);
	}
	
	$present = substr($present, 0, strlen($present)-1);
	if($present != ""){
		$present .= ".";
	}
}	
echo $present;	
?>