コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 function convertCurrency($src_currency_id, $dst_currency_id, $amount)
 {
     return CurrencyFactory::convertCurrency($src_currency_id, $dst_currency_id, $amount);
 }