<?php
require_once (PATH_TABLES . "activity/CurrencyTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class CurrencyClass extends MasterBase {
	function __construct($db) {
		$this->db = $db ;
		$this->tbl = CurrencyTable::C_TABLE ;
		$this->fldid = CurrencyTable::C_ID ;
		$this->flddesc = CurrencyTable::C_DESC ;
		$this->fldorg = CurrencyTable::C_ORG_ID ;
	}
	function __destruct() {
	}
	
	function getAllRecord(){
		$sql = "SELECT * FROM " . CurrencyTable::C_TABLE . " ";
		
		$rows = $this->db->getTable($sql);
		
		if(is_null($rows) || count($rows) == 0){
			return null;
		} else {			
			return $rows;
		}
	}
	
	function getRecordByRef($ref){
		$sql = "SELECT * FROM " . CurrencyTable::C_TABLE . " WHERE " . CurrencyTable::C_REF . " = '" . $ref . "'";
		
		$rows = $this->db->getTable($sql);
		if(is_null($rows) || count($rows) == 0){
			return null;
		} else {
			return $rows[0];
		}
	}
}
?>