<?php

class EmployeeCategorySetup {

	/*************************************************
	/ This function add new EmployeeCategory Setup
	*************************************************/
	
	public static function AddEmployeeCategorySetup($data) {
		global $db;
				
		$id = $db->query_insert(TABLE_EMPLOYEECATEGORYSETUP, $data);
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			return $id;
		}else{
			return false;
		}
	
	} // AddEmployee

	/*************************************************
	/ This function update Employee
	*************************************************/
	
	public static function UpdateEmployeeCategorySetup($pid,$data) {
		global $db;
				
		$id = $db->query_update(TABLE_EMPLOYEECATEGORYSETUP,$data,"id='$pid'");
		
		if($db->affected_rows > 0){
			//$db->query_insert("vrs_logs", $data);
			
			return $id;
		}else{
			return $id;
		}
	
	} // UpdateEmployee


	public static function GetEmployeeCategorySetupById($id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_EMPLOYEECATEGORYSETUP." WHERE id ='$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//EmployeeSetup


	public static function CheckEmployeeCategory($name, $id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_EMPLOYEECATEGORYSETUP." WHERE name ='$name' && id <> '$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//EmployeeSetupSetup
	
	/**********************************************************
	/ This function will return EmployeeSetupSetup
	**********************************************************/
		
	public static function GetEmployeeCategorySetupList($filter="",$pageno="null",$pagesize="null") {
	
		global $db;
		$query = "SELECT *, ".TABLE_EMPLOYEECATEGORYSETUP.".name AS catname, ".TABLE_EMPLOYEECATEGORYSETUP.".id AS catid from ".TABLE_EMPLOYEECATEGORYSETUP." ". $filter;
		//print($query);exit;
		$rows = $db->fetch_all_array($query,$pageno,$pagesize);
	
			if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//EmployeeSetupSetup

	public static function GetNumRows() { global $db; return $db->GetNumRows(); }
	public static function GetNumberOfPages() { global $db; return $db->GetNumberOfPages(); }
		
	
}

?>
