<?php

class Refund {

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

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


	public static function GetRefundSetupById($id) {
	
		global $db;
		$query = "SELECT * from ".TABLE_REFUND." WHERE id ='$id'";
		//print($query);exit;
		$rows = $db->query_first($query);
	
                if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Refund
	
	/**********************************************************
	/ This function will return Refund
	**********************************************************/
		
	public static function GetRefundList($filter="",$pageno="null",$pagesize="null") {
	
		global $db;
		$query = "SELECT * from ".TABLE_REFUND." ". $filter;
		//print($query);exit;
		$rows = $db->fetch_all_array($query,$pageno,$pagesize);
	
			if($db->affected_rows > 0){
			
                        return $rows;
                }else{
			
                        return false;
                }
	}//Refund

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

?>
