<?php
	require "../commonincludefiles.php";
 	$arr = array();
 	$total = 0;
	$sql = "SELECT 
				 distinct(emp.employee_id),
				 employee_name 
				 FROM 
				 cms_employeemaster emp,
				 cms_subject_allocation asm 
				 WHERE 
				 asm.lectype=1
		         AND emp.employee_id = asm.employee_id 
				  AND emp.employee_active = 'YES'  ";
				
		if($_REQUEST['subject_id']!=""){
					$sql.= " AND asm.subject_id = '".Escape($_REQUEST['subject_id'])."' ";
		}
		
		if($_REQUEST['branch_id']!=""){
					$sql.= " AND asm.branch_id = '".Escape($_REQUEST['branch_id'])."' ";
		}
		if($_REQUEST['semester_id']!=""){
					$sql.= " AND asm.semester_id = '".Escape($_REQUEST['semester_id'])."' ";
		}
		if($_REQUEST['branchyear_id']!=""){
					$sql.= " AND asm.branchyear_id = '".Escape($_REQUEST['branchyear_id'])."' ";
		}
		
		if($_SESSION["Employee_Id"]!=""){
					$sql.= " AND asm.employee_id = '".$_SESSION["Employee_Id"]."' ";
		}
		$sql.= " order by employee_name ASC";
		$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;
?>