<?php
require "../commonincludefiles.php";
$objStudentScholarshipMgmt = new StudentScholarshipMgmt();
$i = 0;
$order_field = " studentscholarship_id ";
$order_type = " ASC ";
$where = "";

if (isset($_REQUEST['branch_name']) && $_REQUEST['branch_name'] != "") {
	$where .= " AND branch_id = " . Escape($_REQUEST['branch_name']);
}
if (isset($_REQUEST['semester_name']) && $_REQUEST['semester_name'] != "") {
	$where .= " AND semester_id = " . Escape($_REQUEST['semester_name']);
}
if (isset($_REQUEST['branchyear_name']) && $_REQUEST['branchyear_name'] != "") {
	$where .= " AND branchyear_id = " . Escape($_REQUEST['branchyear_name']);
}
if (isset($_REQUEST['student_name']) && $_REQUEST['student_name'] != "") {
	$where .= " AND student_id = " . Escape($_REQUEST['student_name']);
}

if($_REQUEST['student_id']!="" && $_REQUEST['student_id']!=NULL)
	{
		$condition .= " AND student_id = '".$_REQUEST['student_id']."'";		
		$rs =  $objStudentScholarshipMgmt->getAllRecords($limit=0,$start=0,$condition,$order_field="",$order_type="");		
	}	
	else
	{
		$rs =  $objStudentScholarshipMgmt->getAllRecords($limit=0,$start=0,$condition,$order_field="",$order_type="");	
	}
$total = dbRows($rs);
$ScholarshipData = array("count" => $total, "data" => array());
if (dbRows($rs) > 0) {
	while ($row = dbArray($rs)) {
		$temparray["studentscholarship_id"] = $row["studentscholarship_id"];
		$temparray["branch_id"] = $row["branch_id"];
		$temparray["branch_name"] = $row["branch_name"];
		$temparray["semester_id"] = $row["semester_id"];
		$temparray["semester_name"] = $row["semester_name"];
		$temparray["branchyear_id"] = $row["branchyear_id"];
	  $temparray["branchyear_name"] = $row["branchyear_name"];
	  $temparray["student_id"] = $row["student_id"];
	     $temparray["student_name"] = $row["student_name"];
		 $temparray["scholarship_id"] = $row["scholarship_id"]; 
	 $temparray["scholarship_name"] = $row["scholarship_name"];
	 $temparray["year_id"] = $row["year_id"];
	        $temparray["year_name"] = $row["year_name"];
			$temparray["financial_year"] = $row["financial_year"];
			
		$temparray["formfill_date"] = $row["formfill_date"];
		$temparray["scholarshipaprove_date"] = $row["scholarshipaprove_date"];
		$temparray["scholarshiprecive_date"] = $row["scholarshiprecive_date"];
		$temparray["scholarshiprecive_price"] = $row["scholarshiprecive_price"];
		$temparray["collegerecive_date"] = $row["collegerecive_date"];
		$temparray["collegerecive_price"] = $row["collegerecive_price"];

		$ScholarshipData["data"][$i] = $temparray;
		$i++;
	}
}
echo json_encode($ScholarshipData);
?>