<?php 
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 * PHP version 5
 *
 * @category Admin_Tool
 * @package  Admin_Tool
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  ACE
 * @version  CVS:1.0.1
 * @link     http://auminfosys.com/
 * @filesource
 */
 
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 */
	require "../commonincludefiles.php";

	$action = Escape($_REQUEST['action']);

	if($action=='group'){
		$objGroup = new AccountGroupMgmt();	
		$limit=0;
		$start=0;
		$condition="";
		$order_field="";
		$order_type="";
		$result = $objGroup->getAllRecords($limit,$start,$condition,$order_field,$order_type);
		$total = dbRows($result);
		$i=0;
		$acmasterData = array("count" => $total, "rows1" => array());
		if(dbRows($result) > 0){
			$temparray = array();
			while($row = dbArray($result)){
				$temparray["account_groupid"]  = $row["account_groupid"];
				$temparray["account_groupname"]   = $row["account_groupname"];
				$acmasterData["rows1"][$i] = $temparray;   
				$i++;
			}										
		}				   		 
 		echo json_encode($acmasterData);	
	}
	else{
		$objSubGroup = new AccountSubGroupMgmt();	
		$limit=0;
		$start=0;
		$condition="";
		$order_field="";
		$order_type="";
		$result = $objSubGroup->getAllRecords($limit,$start,$condition,$order_field,$order_type);
		$total = dbRows($result);
		$i=0;
		$acmasterData = array("count" => $total, "rows1" => array());
		if(dbRows($result) > 0){
			$temparray = array();
			while($row = dbArray($result)){
				$temparray["subgroup_id"]   = $row["subgroup_id"];
				$temparray["subgroup_name"]   = $row["subgroup_name"];
				$acmasterData["rows1"][$i] = $temparray;   
				$i++;
			}										
		}				   		 
 		echo json_encode($acmasterData);	
	}
?>