<?php

class ExpenseTaxCategorySetup {

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

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


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


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

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

?>
