<?php
 require "../commonincludefiles.php";
 if($_SESSION["aCollegeId"]!="" && isset($_SESSION["aCollegeId"]))
 {
	$branch_name     	= isset($_REQUEST['branch_name2'])  		   ? Escape($_REQUEST['branch_name2'])  :  0;
	$employee_salaryno  = isset($_REQUEST['txtemployee_salaryno'])   ? Escape($_REQUEST['txtemployee_salaryno'])   :  0;
	$employee_name      = isset($_REQUEST['txtemployee_name'])       ? Escape($_REQUEST['txtemployee_name'] )      :  0;	
	$condition="";
	$arr = array();
    $total = 0;	
	
	
			if($branch_name != ""){
				$condition .= " and em.branch_name='$branch_name' ";
			}
			if($employee_salaryno != ""){
				$condition .= " and em.employee_salaryno='$employee_salaryno' ";
			}
			if($employee_name != ""){
				$condition .= " and em.employee_name like '%$employee_name%'";
			}
			$condition .= " and em.employee_active='Yes' ";
			
			$objEmployeeMgmt = new EmployeeMgmt();	
			$result = $objEmployeeMgmt -> getAllRecords(0,0,$condition,"","");
			$total = dbRows($result);
		    
			$i=0;
		    $employeeData = array("count" => $total, "employee" => array());
			
			if	(dbRows($result) > 0) {
					$temparray = array();
					while($row = dbArray($result)){
						
						$temparray["employee_name"]  = $row["employee_name"];
						$temparray["employee_id"]   = $row["employee_id"];
					    $temparray["employee_salaryno"] = $row["employee_salaryno"];
						$temparray["branch_name"] = $row["branch_name"];
						$temparray["employee_designation"] = $row["employee_designation"];
						$temparray["employee_category"] = $row["employee_category"];
						
						
						$employeeData["employee"][$i] = $temparray;   
         				$i++;
					}										
		}				   		 
		 echo json_encode($employeeData);				
	
   	
	
}
?>