get source base currency
@param int $source
@return int base currency id fcrn_id
355814
public function getSourceBaseCurrency($source) {

        if ($this->_source === FALSE) {
            $this->_loadSources();
        }

        return $this->_source[$source]['fcsr_base_fcrn_id'];
    }
420504
public function getRate($currency = 'EUR')
    {
        $currency = mb_strtoupper($currency);
        if (array_key_exists($currency, $this->rates)) {
            return $this->rates[$currency];
        }
        throw new \InvalidArgumentException('Kurz pro měnu '.$currency.' neexistuje.');
    }
102978
public static function getISO4217CurrencyCode($currency) {
    return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["code"] : null;
  }
640722
public function getMainFromSource(int $sourceId): int
    {
        if (!array_key_exists($sourceId, $this->sourceMap)) {
            throw new \RuntimeException('Not mapped');
        }
        return $this->sourceMap[$sourceId];
    }
469906
public function getSysCcmpBaseCurrency($date){
        if(!preg_match('#\A\d\d\d\d#',$date,$match)){
            throw new CHttpException(400, 'invalid date in getSysCcmpBaseCurrency(): ' . $date);
        }
        $year = (int)$match[0];
        foreach($this->_base_currencies as $bc){
            if($bc['fcbc_year_from'] <= $year 
                    && (empty($bc['fcbc_year_to']) || $bc['fcbc_year_to'] >= $year) ){
                return $bc['fcbc_fcrn_id'];
            }
        }
        
        throw new CHttpException(400, 'Please define for ' . $date . ' base currency! SysCcmpId = ' . Yii::app()->sysCompany->getActiveCompany());
    }
1008462
public static function getISO4217CurrencyFromCode($code) {
    foreach (Connect2PayCurrencyHelper::$currencies as $currency => $data) {
      if ($data["code"] == $code) {
        return $currency;
      }
    }

    return null;
  }
866095
public static function getStoreAmountOfCurrency($amount, $currencyCode) {
        $currencyCode   = strtoupper($currencyCode);
        $amount         = (int) $amount;

        if( in_array($currencyCode, self::FULL_VALUE_CURRENCIES, true) ) {
            return (float) $amount;
        }

        if( in_array($currencyCode, self::DIV_1000_VALUE_CURRENCIES, true) ) {
            return (float) ($amount / self::DIV_1000);
        }

        return (float) ($amount / self::DIV_100);
    }
148532
public function currency($which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $adapter = $this->getAdapter($this->connectionType($which_connection));
        return $adapter->currency();
    }
546449
public function getCurrencyRate($id, $date, $source = FALSE) {
        
        
        $this->sError = FALSE;

        if(empty($date)){
            $this->sError = "Date can not be empty.";            
            return FALSE;
        }        
        
        /**
         * validate input param
         */
        if (!$this->isValidCurrencyId($id)) {
            return FALSE;
        }
        
        //same currency no convert
//        $base_fcrn_id = $this->getSysCcmpBaseCurrency($date);
//        if($id == $base_fcrn_id){
//            return 1;
//        }
        
        if ($source) {
            if (!$this->isValidSourceId($source)) {
                return FALSE;
            }
        } else {
            $source = $this->getSysCcmpCurrencySource($date);
        }

        $base = $this->getSourceBaseCurrency($source);
        if($id == $base){
            return 1;
        }
        
        $sSql = "SELECT IF(DATEDIFF('" . $date . "',CURDATE())>1, 1, 0) in_future ";
        $result = Yii::app()->db->createCommand($sSql)->queryScalar();
        if ($result == 1) {
            $this->sError = "Can not get currency rate, Date(" . $date . ") is in future.";
            return FALSE;
        }


        $rate = $this->_getRateFromDb($source, $base, $id, $date);

        /**
         * load rates
         */
        if ($rate) {
            return $rate;
        }
         /**
         * @todo add convert type to fcsr_courrency_source as definition 
         * and implement it in $this->convertFromTo
         */
        switch ($source) {
            case self::SOURCE_BANK_LV:
                $aRate = $this->_getRateFromBankLv($date);
                if (!$aRate) {
                    return FALSE;
                }
                break;
            case self::SOURCE_BANK_LT:
                $aRate = $this->_getRateFromBankLt($date);
                if (!$aRate) {
                    return FALSE;
                }
                break;
            case self::SOURCE_BANK_RU:
                $aRate = $this->_getRateFromBankRu($date);
                if (!$aRate) {
                    return FALSE;
                }
                break;
            case self::SOURCE_BANK_LT_ACC_EUR:
                $aRate = $this->_getRateFromBankLtAccEur($date);
                if (!$aRate) {
                    return FALSE;
                }
                break;
            default:
                $this->sError = "Undefined currency source: " .$source;
                return false;
                break;
         }

        $this->_saveRate($aRate, $date, $source);

        return $this->_getRateFromDb($source, $base, $id, $date);
    }
358324
public function getCurrencySign($currency = false)
    {
        $locale = \Locale::getDefault();

        $format = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
        $pattern = $format->formatCurrency('123', $currency);

        preg_match('/^([^\s\xc2\xa0]*)[\s\xc2\xa0]*123(?:[,.]0+)?[\s\xc2\xa0]*([^\s\xc2\xa0]*)$/u', $pattern, $matches);

        if (!empty($matches[1])) {
            $currency_sign = $matches[1];
        } elseif (!empty($matches[2])) {
            $currency_sign = $matches[2];
        } else {
            $currency_sign = '¤';
        }

        return $currency_sign;
    }
1041896
public static function getCurrencyCode()
    {
        if (!isset(self::$currencyCode)) {
            $localeconv = localeconv();
            self::$currencyCode = ($localeconv['currency_symbol'] != '')
                ? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];

            if (self::$currencyCode == '') {
                // Default to $
                self::$currencyCode = '$';
            }
        }
        return self::$currencyCode;
    }
484294
def get_amount_in_base_currency(self, currency: str, amount: Decimal) -> Decimal:
        
        assert isinstance(amount, Decimal)

        # If this is already the base currency, do nothing.
        if currency == self.get_default_currency().mnemonic:
            return amount

        agg = self.get_currency_aggregate_by_symbol(currency)
        if not agg:
            raise ValueError(f"Currency not found: {currency}!")

        # TODO use pricedb for the price.
        rate_to_base = agg.get_latest_price()
        if not rate_to_base:
            raise ValueError(f"Latest price not found for {currency}!")
        assert isinstance(rate_to_base.value, Decimal)

        result = amount * rate_to_base.value
        return result
1142925
public static function getCurrencyName($currency) {
    return (array_key_exists($currency, Connect2PayCurrencyHelper::$currencies)) ? Connect2PayCurrencyHelper::$currencies[$currency]["currency"] : null;
  }
227196
public function getBasePriceForCurrency($currency = 'EUR')
    {
        $prices = $this->entity->getPrices();
        if ($prices) {
            foreach ($prices as $price) {
                if ($price->getCurrency()->getCode() == $currency && $price->getMinimumQuantity() == 0) {
                    return new ProductPrice($price, $this->locale);
                }
            }
        }

        return null;
    }
1186209
public function get_file_source_info($source) {
        $ref = json_decode(base64_decode($source));
        $filename  = clean_param($ref->filename, PARAM_FILE);
        return 'EQUELLA: ' . $filename;
    }
473252
private function getCustomerBalanceBase(\Magento\Quote\Model\Quote $quote)
    {
        $result = 0;
        $customerId = $quote->getCustomerId();
        $storeId = $quote->getStoreId();
        if ($customerId) {
            $account = $this->daoAccount->getCustomerAccByAssetCode($customerId, Cfg::CODE_TYPE_ASSET_WALLET);
            if ($account) {
                $result = $account->getBalance();
                /* convert balance from WALLET currency to STORE currency */
                $result = $this->hlpWalletCur->walletToStore($result, $storeId);
                $result = $this->hlpFormat->toNumber($result);
            }
        }
        return $result;
    }
377612
public function getBasePriceForCurrency(ProductInterface $product, $currency = null)
    {
        $currency = $currency ?: $this->defaultCurrency;
        if ($prices = $product->getPrices()) {
            foreach ($prices as $price) {
                if ($price->getCurrency()->getCode() == $currency && $price->getMinimumQuantity() == 0) {
                    return $price;
                }
            }
        }

        return null;
    }