<?php

class StatementBankSetup {

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

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


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


	public static function CheckBankAccount($account_number, $id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_STATEMENT_BANKSETUP." WHERE bank_account_number ='$account_number' && id <> '$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Bank
	
	/**********************************************************
	/ This function will return BankSetup
	**********************************************************/
		
	public static function GetBankSetupList($filter="",$pageno="null",$pagesize="null") {
	
		global $db;
		$query = "SELECT * from ".TABLE_STATEMENT_BANKSETUP." ". $filter;
		//print($query);exit;
		$rows = $db->fetch_all_array($query,$pageno,$pagesize);
	
			if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//BankSetup

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

?>
