예제 #1
0
 public static function GetExchangeRate($currencyID)
 {
     if (!CModule::IncludeModule('currency')) {
         return 1;
     }
     $rates = new CCurrencyRates();
     if (!($rs = $rates->_get_last_rates(date('Y-m-d'), $currencyID))) {
         return 1.0;
     }
     $exchRate = doubleval($rs['RATE']);
     $cnt = intval($rs['RATE_CNT']);
     if ($exchRate <= 0) {
         $exchRate = doubleval($rs["AMOUNT"]);
         $cnt = intval($rs['AMOUNT_CNT']);
     }
     return $cnt != 1 ? $exchRate / $cnt : $exchRate;
 }