<?php

class TaxCategorySetup {

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

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


	public static function GetTaxCategorySetupById($id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_TAXCATEGORYSETUP." WHERE id ='$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
      
      //echo $query;

	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}

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

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

?>
