<?php
	require "../commonincludefiles.php";
 	$arr = array();
 	$total = 0;
	$sql = "SELECT 
				 distinct(emp.employee_id),
				 employee_name 
				 FROM 
				 cms_employeemaster emp
				
				 WHERE 
				 emp.employee_active = 'YES' ";
				
			
		if($_REQUEST['branch_name']!=""){
					$sql.= " AND emp.branch_name = '".Escape($_REQUEST['branch_name'])."' ";
		}
		
		
		if($_SESSION["Employee_Id"]!="" && $_SESSION["VedantnrUserRole"] !='Hod'  && $_SESSION["VedantnrUserRole"] !='PowerUser'){
					$sql.= " AND emp.employee_id = '".$_SESSION["Employee_Id"]."' ";
		}
		$sql.= " order by employee_name ASC";
		
	//	echo $sql; exit;
		
		$rs = dbQuery($sql);		
		$total=dbRows($rs);
		$i = 0;
		$SubjectData = array("count" => $total, "data" => array());
		if(dbRows($rs) > 0){
			while($row = dbArray($rs)){
				$temparray["employee_id"]  	= $row["employee_id"];
				$temparray["employee_name"]	= $row["employee_name"];
				$SubjectData["data"][$i] 	= $temparray;   
				$i++;
			}
		}
	echo json_encode($SubjectData);	
	exit;
?>