<?php 
/**
 * This file is used for loading feeshead data in feeshead grid
 *
 * 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
 */
 

require "../commonincludefiles.php";


$out = "";
$xaction = "";
$data = "";

$where = '';
$qs = '';
$order_field = "";
$order_type  = "";

$start   = isset($_REQUEST['start'])  ? $_REQUEST['start']  :  0;
$limit   = isset($_REQUEST['limit'])  ? $_REQUEST['limit']  : 30;
$sort    = isset($_REQUEST['sort'])   ? $_REQUEST['sort']   : '';
$dir     = isset($_REQUEST['dir'])    ? $_REQUEST['dir']    : 'ASC';

if ($sort != "") 
{
     $order_field = $sort;
	 $order_type  = $dir;		
}
if($_SESSION["VedantnrSchoolId"]!="" && isset($_SESSION["VedantnrSchoolId"]))
{
				
	$feesreceive_id = $_REQUEST['feesreceive_id'];				
	$condtion="";
	$condtion .= " and sd.feesreceive_id = '$feesreceive_id'";
	
	$order_field1 = "sf.head_name";
	$order_type1  = "ASC";
	$objFeesRecDetail = new StudentFeesRecDetailMgmt();	
	$outFeesDetail = $objFeesRecDetail -> getAllRecords("","",$condtion,$order_field1,$order_type1); 
	
	$total = dbRows($outFeesDetail);
	$i=0;
	$feesHeadData = array("total" => $total, "data" => array());						
	if	(dbRows($outFeesDetail) > 0) 
	{	
		$temparray = array();
		while($rowFeesDetail = dbArray($outFeesDetail))
		{								
			if ($rowFeesDetail["recdetail_amt"] > 0) {
                $temparray["head_name"]   = $rowFeesDetail["head_name"];
                $temparray["recdetail_amt"]  = $rowFeesDetail["recdetail_amt"];
                $temparray["head_id"]     = $rowFeesDetail["head_id"];
                
                $feesHeadData["data"][$i] = $temparray;   
                $i++;
            }
		}
	}		
    echo json_encode($feesHeadData);												
}	

?>