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

$total = 0;
$condition="";
$div_id_post="";
if($_SESSION["VedantnrCollegeId"]!="" ){

	$date=date('Y-m-d',strtotime(Escape($_REQUEST['day_date'])));
  
  if($_REQUEST["branch_name"]!="" && $_REQUEST["branch_name"]!=0){
		$condition.= " and pm.branch_id= '".Escape($_REQUEST["branch_name"])."'";
	}
	if($_REQUEST["year_name"]!="" && $_REQUEST["year_name"]!=0){
		$condition.= " and pm.year_id= '".Escape($_REQUEST["year_name"])."'";
	}

	if($_REQUEST["branchyear_name"]!="" && $_REQUEST["branchyear_name"]!=0){
		$condition.= " and pm.branchyear_id= '".Escape($_REQUEST["branchyear_name"])."'";
	}
	if($_REQUEST["semester_name"]!="" && $_REQUEST["semester_name"]!=0){
		$condition.= " and pm.semester_id= '".Escape($_REQUEST["semester_name"])."'";
	}
	

	
	$condition.= " and lec_id != 7";
	
	$objPresentMasterMgmt = new PresentMasterMgmt();
	$order_field = " pm.branch_id";
	$order_type = " ASC ";
	$j=0;
	$rs = $objPresentMasterMgmt->getAllabsentData($limit,$start,$condition,$order_field,$order_type);
	$total=dbRows($rs);
	$HeadData = array("count" => $total, "data" => array());
	if(dbRows($rs) > 0){
		while($row = dbArray($rs)){
			
			
				
				$branch_id = $row["branch_id"];
				$semester_id = $row["semester_id"];
				$year_id = $row["year_id"];
							$branchyear_id = $row["branchyear_id"];
				$lec_id = $row["lec_id"];
				$getDate = $date;
				
				$rsPresentLect = $objPresentMasterMgmt->getabsentdetailscount($branch_id,$semester_id,$year_id,$branchyear_id,$lec_id,$getDate);
				if($rsPresentLect == 0)
				{
					//echo "AAAAAA ";
					$temparray["branch_name"]    = $row["branch_name"];
		      		$temparray["semester_name"]  = $row["semester_name"];
		      		$temparray["year_name"]         =$row["year_name"];
			 		$temparray["branchyear_name"]         =$row["branchyear_name"];
		      		$temparray["lec_name"]       = $row["lec_name"];
					$HeadData["data"][$j] = $temparray;
					$j++;
				}
			}
		
	}
}
//echo "<pre>";
//print_r($HeadData);
//exit;
echo json_encode($HeadData);
?>
