function getBaseCurrencyHourlyRate($rate) { if ($rate == '') { return FALSE; } if (!is_object($this->getUserObject())) { return FALSE; } $clf = TTnew('CurrencyListFactory'); $clf->getByCompanyIdAndBase($this->getUserObject()->getCompany(), TRUE); if ($clf->getRecordCount() > 0) { $base_currency_obj = $clf->getCurrent(); //If current currency is the base currency, just return the rate. if ($base_currency_obj->getId() == $this->getUserObject()->getCurrency()) { return $rate; } else { //Debug::text(' Base Currency Rate: '. $base_currency_obj->getConversionRate() .' Hourly Rate: '. $rate , __FILE__, __LINE__, __METHOD__,10); return CurrencyFactory::convertCurrency($this->getUserObject()->getCurrency(), $base_currency_obj->getId(), $rate); } } return FALSE; }
function convertToUserCurrency($amount) { $user_currency_id = $this->getUserCurrency(); $country_currency_id = $this->getCountryPrimaryCurrencyID(); if ($user_currency_id !== FALSE and $country_currency_id !== FALSE) { $retval = CurrencyFactory::convertCurrency($this->getCountryPrimaryCurrencyID(), $this->getUserCurrency(), $amount); } else { $retval = $amount; } return $retval; }
function convertCurrency($src_currency_id, $dst_currency_id, $amount) { return CurrencyFactory::convertCurrency($src_currency_id, $dst_currency_id, $amount); }