<?php
class EmployeeMgmt
{
	public $employee_id;
	public $college_id;
	public $employee_salaryno;
	public $employee_no;
	public $employee_name;
	public $branch_name;
	public $employee_designation;
	public $employee_category;
	public $employee_ishandicap;
	public $employee_birthdate;
	public $employee_regularorfixpay;
	public $employee_panno;
	public $employee_gpfacno;
	public $employee_bankacno;
	public $employee_deptjoindate;
	public $employee_schooljoindate;
	public $employee_payscale;
	public $employee_basicsalary;
	public $employee_incrdate;
	public $employee_pension;
	public $employee_eduqualification;
	public $employee_edusub;
	public $employee_eduuni;
	public $employee_eduyear;
	public $employee_eduobtclass;
	public $employee_profqualification;
	public $employee_profsub;
	public $employee_profuni;
	public $employee_profyear;
	public $employee_profobtclass;
	public $employee_otherqualification;
	public $employee_othersub;
	public $employee_otheruni;
	public $employee_otheryear;
	public $employee_otherobtclass;
	public $employee_retddate;
	public $employee_nominee;
	public $employee_active;
	public $employee_isteaching;
	public $employee_curaddress;
	public $employee_contactnores;
	public $employee_mobile;
	public $employee_permaddress;
	public $employee_phone;
	public $employee_emailid;
	public $employee_bloodgroup;
	public $employee_gender;
	public $employee_photo;
	public $login_id;
	public $createdon;
	public $employee_msg;
	public $employee_count;
	public $employee_redirectfile;
	public $arractiveIds;
	public $inactiveIds;
	public $deleteemployee_Id;
	public $bullet;
	public $user_id;
	public $employee_sign;

	function getAllRecords($limit = 0, $start = 0, $condition, $order_field = "", $order_type = "")
	{
		$this->employee_count = 0;
		$qry = "SELECT  em.*,
			
				(select branch_name from cms_branchmaster as bm where bm.branch_id = em.branch_id) as BranchName,
				sd.designation_nameeng AS employee_designation1,
				sd.designation_id,
				(SELECT CONCAT(current_payscale,'/',payband,'/',gradepay) FROM cms_payscalemaster  WHERE 
			    	payscale_id=em.employee_payscale) AS payscale
					
					FROM 
				cms_employeemaster em LEFT JOIN	cms_designation sd 
				ON sd.designation_id=em.employee_designation			  
				WHERE    							
				 em.employee_active = 'Yes' AND
				em.college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' ";
		/*$qry = "SELECT em.*
					  FROM cms_employeemaster em			  
						WHERE em.college_id = '".$_SESSION["VedantnrCollegeId"]."' "; */
		if ($condition != "") {
			$qry .= $condition;
		}
		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}
		if (intval($limit) > 0 && intval($start) >= 0) {
			$qry .= " Limit $start , $limit";
		}
			//echo $qry; exit;
		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}
	function getAllRecords2($limit = 0, $start = 0, $condition, $order_field = "", $order_type = "")
	{
		$this->employee_count = 0;
		$qry = "SELECT  em.*,
			
				(select branch_name from cms_branchmaster as bm where bm.branch_id = em.branch_id) as BranchName,
				sd.designation_nameeng AS employee_designation1,
				sd.designation_id,
				(SELECT CONCAT(current_payscale,'/',payband,'/',gradepay) FROM cms_payscalemaster  WHERE 
			    	payscale_id=em.employee_payscale) AS payscale
					
					FROM 
				cms_employeemaster em LEFT JOIN	cms_designation sd 
				ON sd.designation_id=em.employee_designation			  
				WHERE    							
				
				em.college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' ";
	
		if ($condition != "") {
			$qry .= $condition;
		}
		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}
		if (intval($limit) > 0 && intval($start) >= 0) {
			$qry .= " Limit $start , $limit";
		}
		//	echo $qry; exit;
		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}

	function getAllRecords1($limit = 0, $start = 0, $condition, $order_field = "", $order_type = "")
	{
		$this->employee_count = 0;
		$qry = "SELECT * FROM cms_employeemaster Where college_id= '" . $_SESSION["VedantnrCollegeId"] . "' ";
		/*$qry = "SELECT em.*
					  FROM cms_employeemaster em			  
						WHERE em.college_id = '".$_SESSION["VedantnrCollegeId"]."' "; */
		if ($condition != "") {
			$qry .= $condition;
		}
		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}

		//	echo $qry;
		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}
	/**
	 * This is a function for getting the all records with/without condition
	 *
	 * @param integer $limit This is the limit of number or records.
	 * @param integer $start This is the starting location of records.
	 * @param string  $condition This is the condition for fetching records.	 
	 * @param string  $order_field This is the field for fetching records orderby.	 
	 * @param string  $order_type This is the order direction to fetch records orderby.	 	 
	 *
	 * @return Mix Result Set
	 */
	function getSalaryRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "")
	{
		$this->employee_count = 0;

		$qry = "SELECT em.employee_id,
				em.branch_id,
				em.employee_no,
				em.employee_name,
				em.employee_basicsalary,
				em.employee_payscale,
				em.loan_amount,
				em.employee_loan,
				em.loan_date,
				em.loan_month
				
				FROM 
					cms_employeemaster em 			  
			  	
				WHERE    							
					em.college_id   = '" . $_SESSION["VedantnrCollegeId"] . "' ";

		if ($condition != "") {
			$qry .= $condition;
		}

		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}

		if (intval($limit) > 0 && intval($start) >= 0) {
			$qry .= " Limit $start , $limit";
		}
		//		echo $qry; exit;
		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			$this->employee_count = dbRows($out);
			return $out;
		}
		return $out;
	}

	function add()
	{
		global $SQLDateFormat;
		$Qry1 = "";
		$Qry1 .= "college_id='" . Escape($this->college_id) . "',";
		$Qry1 .= "employee_salaryno='" . Escape($this->employee_salaryno) . "',";
		$Qry1 .= "employee_no='" . Escape($this->employee_no) . "',";
		$Qry1 .= "employee_name='" . Escape($this->employee_name) . "',";
		$Qry1 .= "branch_id='" . Escape($this->branch_id) . "',";
		$Qry1 .= "employee_designation='" . Escape($this->employee_designation) . "',";
		$Qry1 .= "employee_category='" . Escape($this->employee_category) . "',";
		$Qry1 .= "employee_gender='" . Escape($this->employee_gender) . "',";
		$Qry1 .= "employee_ishandicap='" . Escape($this->employee_ishandicap) . "',";
		$Qry1 .= "employee_isteaching='" . Escape($this->employee_isteaching) . "',";
		$Qry1 .= "employee_birthdate=        STR_TO_DATE('" . Escape($this->employee_birthdate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_regularorfixpay='" . Escape($this->employee_regularorfixpay) . "',";
		$Qry1 .= "employee_panno='" . Escape($this->employee_panno) . "',";
		$Qry1 .= "employee_gpfacno='" . Escape($this->employee_gpfacno) . "',";
		$Qry1 .= "employee_bankacno='" . Escape($this->employee_bankacno) . "',";
		$Qry1 .= "employee_deptjoindate=	STR_TO_DATE('" . Escape($this->employee_deptjoindate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_schooljoindate=	STR_TO_DATE('" . Escape($this->employee_schooljoindate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_payscale='" . Escape($this->employee_payscale) . "',";
		$Qry1 .= "employee_basicsalary='" . Escape($this->employee_basicsalary) . "',";
		$Qry1 .= "employee_pension='" . Escape($this->employee_pension) . "',";
		$Qry1 .= "employee_incrdate=		STR_TO_DATE('" . Escape($this->employee_incrdate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_eduqualification='" . Escape($this->employee_eduqualification) . "',";
		$Qry1 .= "employee_edusub='" . Escape($this->employee_edusub) . "',";
		$Qry1 .= "employee_eduuni='" . Escape($this->employee_eduuni) . "',";
		$Qry1 .= "employee_eduyear='" . Escape($this->employee_eduyear) . "',";
		$Qry1 .= "employee_eduobtclass='" . Escape($this->employee_eduobtclass) . "',";
		$Qry1 .= "employee_profqualification='" . Escape($this->employee_profqualification) . "',";
		$Qry1 .= "employee_profsub='" . Escape($this->employee_profsub) . "',";
		$Qry1 .= "employee_profuni='" . Escape($this->employee_profuni) . "',";
		$Qry1 .= "employee_profyear='" . Escape($this->employee_profyear) . "',";
		$Qry1 .= "employee_profobtclass='" . Escape($this->employee_profobtclass) . "',";
		$Qry1 .= "employee_otherqualification='" . Escape($this->employee_otherqualification) . "',";
		$Qry1 .= "employee_othersub='" . Escape($this->employee_othersub) . "',";
		$Qry1 .= "employee_otheruni='" . Escape($this->employee_otheruni) . "',";
		$Qry1 .= "employee_otheryear='" . Escape($this->employee_otheryear) . "',";
		$Qry1 .= "employee_otherobtclass='" . Escape($this->employee_otherobtclass) . "',";
		$Qry1 .= "employee_retddate=		STR_TO_DATE('" . Escape($this->employee_retddate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_nominee='" . Escape($this->employee_nominee) . "',";
		$Qry1 .= "employee_active='" . Escape($this->employee_active) . "',";
		$Qry1 .= "employee_curaddress='" . replaceHtmlEditor(Escape($this->employee_curaddress)) . "',";
		$Qry1 .= "employee_contactnores='" . Escape($this->employee_contactnores) . "',";
		$Qry1 .= "employee_mobile='" . Escape($this->employee_mobile) . "',";
		$Qry1 .= "employee_permaddress='" . replaceHtmlEditor(Escape($this->employee_permaddress)) . "',";
		$Qry1 .= "employee_phone='" . Escape($this->employee_phone) . "',";
		$Qry1 .= "employee_emailid='" . Escape($this->employee_emailid) . "',";
		$Qry1 .= "employee_bloodgroup='" . Escape($this->employee_bloodgroup) . "',";
		$Qry1 .= "user_id='" . Escape($this->user_id) . "',";
		$Qry1 .= "employee_adharno='" . Escape($this->employee_adharno) . "',";


			$Qry1 .= "employee_credit_amount='"	         .Escape($this->employee_credit_amount)."',";
			$Qry1 .= "employee_loan='"	     .Escape($this->employee_loan)."',";	
			$Qry1 .= "loan_amount='"				     .Escape($this->loan_amount)."',";	
			$Qry1 .= "loan_month='"				     .Escape($this->loan_month)."',";			
			$Qry1 .= "loan_date=		STR_TO_DATE('".Escape($this->loan_date)."','$SQLDateFormat'),";


		$Qry1 .= "login_id='" . Escape($_SESSION['aUserId']) . "',";
		$Qry1 .= "createdon='" . Escape(date('Y-m-d h:i:s')) . "',";
		$Qry1 .= "blnBackup = '0',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "insert into cms_employeemaster set " . $Qry1 . " ";

			dbQuery($qry);
			$this->employee_id = dbInsertedId();
		}
		$this->employee_msg = "<strong>" . $this->bullet . " Employee inserted successfully.</strong>";
		$this->employee_redirectfile = "viewmenu.php";
	}

	function edit()
	{
		global $SQLDateFormat;
		$Qry1 = "";
		$Qry1 .= "college_id='" . Escape($this->college_id) . "',";
		$Qry1 .= "employee_salaryno='" . Escape($this->employee_salaryno) . "',";
		$Qry1 .= "employee_no='" . Escape($this->employee_no) . "',";
		$Qry1 .= "employee_name='" . Escape($this->employee_name) . "',";
		$Qry1 .= "branch_id='" . Escape($this->branch_id) . "',";
		$Qry1 .= "employee_designation='" . Escape($this->employee_designation) . "',";
		$Qry1 .= "employee_gender='" . Escape($this->employee_gender) . "',";
		$Qry1 .= "employee_category='" . Escape($this->employee_category) . "',";
		$Qry1 .= "employee_ishandicap='" . Escape($this->employee_ishandicap) . "',";
		$Qry1 .= "employee_isteaching='" . Escape($this->employee_isteaching) . "',";
		$Qry1 .= "employee_birthdate=        STR_TO_DATE('" . Escape($this->employee_birthdate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_regularorfixpay='" . Escape($this->employee_regularorfixpay) . "',";
		$Qry1 .= "employee_panno='" . Escape($this->employee_panno) . "',";
		$Qry1 .= "employee_gpfacno='" . Escape($this->employee_gpfacno) . "',";
		$Qry1 .= "employee_bankacno='" . Escape($this->employee_bankacno) . "',";
		$Qry1 .= "employee_deptjoindate=	STR_TO_DATE('" . Escape($this->employee_deptjoindate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_schooljoindate=	STR_TO_DATE('" . Escape($this->employee_schooljoindate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_payscale='" . Escape($this->employee_payscale) . "',";
		$Qry1 .= "employee_basicsalary='" . Escape($this->employee_basicsalary) . "',";
		$Qry1 .= "employee_pension='" . Escape($this->employee_pension) . "',";
		$Qry1 .= "employee_incrdate=		STR_TO_DATE('" . Escape($this->employee_incrdate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_eduqualification='" . Escape($this->employee_eduqualification) . "',";
		$Qry1 .= "employee_edusub='" . Escape($this->employee_edusub) . "',";
		$Qry1 .= "employee_eduuni='" . Escape($this->employee_eduuni) . "',";
		$Qry1 .= "employee_eduyear='" . Escape($this->employee_eduyear) . "',";
		$Qry1 .= "employee_eduobtclass='" . Escape($this->employee_eduobtclass) . "',";
		$Qry1 .= "employee_profqualification='" . Escape($this->employee_profqualification) . "',";
		$Qry1 .= "employee_profsub='" . Escape($this->employee_profsub) . "',";
		$Qry1 .= "employee_profuni='" . Escape($this->employee_profuni) . "',";
		$Qry1 .= "employee_profyear='" . Escape($this->employee_profyear) . "',";
		$Qry1 .= "employee_profobtclass='" . Escape($this->employee_profobtclass) . "',";
		$Qry1 .= "employee_otherqualification='" . Escape($this->employee_otherqualification) . "',";
		$Qry1 .= "employee_othersub='" . Escape($this->employee_othersub) . "',";
		$Qry1 .= "employee_otheruni='" . Escape($this->employee_otheruni) . "',";
		$Qry1 .= "employee_otheryear='" . Escape($this->employee_otheryear) . "',";
		$Qry1 .= "employee_otherobtclass='" . Escape($this->employee_otherobtclass) . "',";
		$Qry1 .= "employee_retddate=		STR_TO_DATE('" . Escape($this->employee_retddate) . "','$SQLDateFormat'),";
		$Qry1 .= "employee_nominee='" . Escape($this->employee_nominee) . "',";
		$Qry1 .= "employee_active='" . Escape($this->employee_active) . "',";
		$Qry1 .= "employee_curaddress='" . replaceHtmlEditor(Escape($this->employee_curaddress)) . "',";
		$Qry1 .= "employee_contactnores='" . Escape($this->employee_contactnores) . "',";
		$Qry1 .= "employee_mobile='" . Escape($this->employee_mobile) . "',";
		$Qry1 .= "employee_permaddress='" . replaceHtmlEditor(Escape($this->employee_permaddress)) . "',";
		$Qry1 .= "employee_phone='" . Escape($this->employee_phone) . "',";
		$Qry1 .= "employee_emailid='" . Escape($this->employee_emailid) . "',";
		$Qry1 .= "employee_bloodgroup='" . Escape($this->employee_bloodgroup) . "',";
		$Qry1 .= "employee_adharno='" . Escape($this->employee_adharno) . "',";

			$Qry1 .= "employee_credit_amount='"	         .Escape($this->employee_credit_amount)."',";
			$Qry1 .= "employee_loan='"	     .Escape($this->employee_loan)."',";	
			$Qry1 .= "loan_amount='"				     .Escape($this->loan_amount)."',";	
			$Qry1 .= "loan_month='"				     .Escape($this->loan_month)."',";	
			$Qry1 .= "loan_date=		STR_TO_DATE('".Escape($this->loan_date)."','$SQLDateFormat'),";



		$Qry1 .= "user_id='" . Escape($this->user_id) . "',";
		$Qry1 .= "login_id='" . Escape($_SESSION['aUserId']) . "',";
		$Qry1 .= "createdon='" . Escape(date('Y-m-d h:i:s')) . "',";
		$Qry1 .= "blnBackup = '0',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update cms_employeemaster set " . $Qry1 . " where employee_id=" . $this->employee_id . " and college_id = '" . $_SESSION['VedantnrCollegeId'] . "' ";
			//	echo  $qry; exit;

			dbQuery($qry);
		}
		$this->employee_msg = "<strong>" . $this->bullet . " Employee updated successfully.</strong>";
		$this->employee_redirectfile = "addedit-faculty.php.php";
	}
	function updateField()
	{
		global $SQLDateFormat;
		$Qry1 = "";

		$Qry1 .= "employee_shortname='" . Escape($this->employee_shortname) . "',";
		$Qry1 .= "employee_workingperiods='" . Escape($this->employee_workingperiods) . "',";
		//    $Qry1 .= "recordstatus='1',";
		//	  $Qry1 .= "modified_userid='".$_SESSION['SSA_UserID']."',";
		//	  $Qry1 .= "modified_datetime='". date('Y-m-d H:i:s')."',";
		//	  $Qry1 .= "modified_terminalid='".getIP() ."',";

		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update cms_employeemaster set " . $Qry1 . " where employee_id=" . $this->employee_id . " and college_id = '" . $_SESSION['VedantnrCollegeId'] . "' ";
			dbQuery($qry);
		}
	}
	function delete()
	{
		$qry = "delete from  cms_employeemaster where employee_id in (" . $this->employee_id . ") and college_id='" . $_SESSION["VedantnrCollegeId"] . "'";
		dbQuery($qry);
	}

	function updatePhoto()
	{
		$qry = "update cms_employeemaster set employee_photo = '" . $this->employee_photo . "'
             	where employee_id = " . $this->employee_id . " and college_id='" . $_SESSION["VedantnrCollegeId"] . "'";
		//echo $qry; exit;     	
		dbQuery($qry);
	}

	
	function updatefile1()
	{
		$qry = "update cms_employeemaster set employee_sign = '" . $this->employee_sign . "', blnBackup = '0'
             	where employee_id = " . $this->employee_id . " and college_id='" . $_SESSION["VedantnrCollegeId"] . "'";
		dbQuery($qry);
	}
	function getPayScale()
	{
		$qry = "SELECT * FROM cms_payscalemaster  ";
		$out = dbQuery($qry);
		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}

//check-duplication.php
	function getuser($UserName)
	{
		$SQL_user = "
				SELECT *
				FROM `cms_employeemaster`
				WHERE `user_id` ='".$UserName."'";
		$out = dbQuery($SQL_user);
		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}

	//get-subject.php
	function getsubject($condition)
	{
		$qry ="select employee_id from cms_employeemaster where user_id ='" . $_SESSION["VedantnrUserId"] . "'";

		if ($condition != "") {
			$qry .= $condition;
		}
		$out = dbQuery($qry);
		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}


	//data/qualification-combo.php
	function GetEmpeduqualification()
	{
		$qry = "SELECT DISTINCT employee_eduqualification 
						FROM cms_employeemaster 
						where employee_eduqualification!=''
						order by employee_eduqualification ASC ";
						//echo $qry;
		$out = dbQuery($qry);
		
		return $out;
	}

	function GetEmpedusub()
	{
		$qry = "SELECT DISTINCT employee_edusub 
						FROM cms_employeemaster 
						where employee_edusub!=''
						order by employee_edusub ASC ";
						//echo $qry;
		$out = dbQuery($qry);
		
		return $out;
	}

	function GetEmpprofqualification()
	{
		$qry ="SELECT DISTINCT employee_profqualification 
						FROM cms_employeemaster 
						where employee_profqualification!=''
						order by employee_profqualification ASC ";
						//echo $qry;
		$out = dbQuery($qry);
		
		return $out;
	}

	function GetEmpprofsub()
	{
		$qry = "SELECT DISTINCT employee_profsub 
		FROM cms_employeemaster 
		where employee_profsub!=''
		order by employee_profsub ASC ";
						//echo $qry;
		$out = dbQuery($qry);
		
		return $out;
	}

	function GetEmpotherqualification()
	{
		$qry ="SELECT DISTINCT employee_otherqualification 
						FROM cms_employeemaster 
						where employee_otherqualification!=''
						order by employee_otherqualification ASC ";
						//echo $qry;
		$out = dbQuery($qry);
		
		return $out;
	}

	function GetEmpothersub()
	{
		$qry = "SELECT DISTINCT employee_othersub 
						FROM cms_employeemaster 
						where employee_othersub!=''
						order by employee_othersub ASC ";
						//echo $qry;
		$out = dbQuery($qry);
		
		return $out;
	}

	//report-employee-feedback-result
	function getbranchemp($condition)
	{
		$qry = " SELECT branch_id FROM `cms_employeemaster` WHERE `user_id` ='" . $_SESSION["VedantnrUserId"] . "'";
						//echo $qry;
						if ($condition != "") {
							$qry .= $condition;
						}
		$out = dbQuery($qry);
		
		return $out;
	}

	//report-syllabus-covered-result.php
	function getusersyllabus($condition)
	{
		$qry = "select user_id from cms_employeemaster where 1=1 ";
						//echo $qry;
						if ($condition != "") {
							$qry .= $condition;
						}
		$out = dbQuery($qry);
		
		return $out;
	}

	//report-student-overall-result-timetable.php	
	function gettimetable($condition)
	{
		$qry ="SELECT sa.*,
(Select branch_name from cms_branchmaster where cms_branchmaster.branch_id = sa.branch_id)as branch_name,
(Select lectype_name from cms_lectype where cms_lectype.lectype_id = sa.lectype)as lectype_name,
(Select semester_name from cms_semestermaster where cms_semestermaster.semester_id = sa.semester_id)as semester_name,
(Select year_name from cms_yearmaster where cms_yearmaster.year_id = sa.year_id)as year_name,
(Select branchyear_name from cms_branchyear where cms_branchyear.branchyear_id = sa.branchyear_id)as branchyear_name,
(Select DISTINCT time_start_name from cms_timemaster where cms_timemaster.time_id = sa.time_id)as time_name,
(Select DISTINCT time_end_name from cms_timemaster where cms_timemaster.time_id = sa.time_id)as time_name1,
(Select subject_name from cms_subjectmaster where cms_subjectmaster.subject_id = sa.subject_id)as subject_name,
(Select employee_name from cms_employeemaster where cms_employeemaster.employee_id = sa.employee_id)as employee_name,
(Select room_name from cms_roommaster where cms_roommaster.room_id = sa.room_id)as room_name,
(Select room_no from cms_roommaster where cms_roommaster.room_id = sa.room_id)as room_name1,
(Select subject_code from cms_subjectmaster where cms_subjectmaster.subject_id = sa.subject_id)as subject_name1,
(Select lec_name from cms_lecmaster where cms_lecmaster.lec_id = sa.lec_id)as lec_id
 FROM work_allotment_subject as sa where 1=1 ";
						//echo $qry;
						if ($condition != "") {
							$qry .= $condition;
						}
		$out = dbQuery($qry);
		
		return $out;
	}
	//loginhome.php
	function getuseremp( $condition= "")
	{
		$this->employee_count = 0;
		$qry = "SELECT em.*,bm.branch_name FROM cms_employeemaster em , cms_branchmaster bm Where 1=1 and em.branch_id=bm.branch_id ";
		/*$qry = "SELECT em.*
					  FROM cms_employeemaster em			  
						WHERE em.college_id = '".$_SESSION["VedantnrCollegeId"]."' "; */
		if ($condition != "") {
			$qry .= $condition;
		}
		
		//	echo $qry;
		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}
}
?>