当前位置: 首页>>代码示例>>PHP>>正文


PHP CCurrencyRates::GetConvertFactor方法代码示例

本文整理汇总了PHP中CCurrencyRates::GetConvertFactor方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrencyRates::GetConvertFactor方法的具体用法?PHP CCurrencyRates::GetConvertFactor怎么用?PHP CCurrencyRates::GetConvertFactor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCurrencyRates的用法示例。


在下文中一共展示了CCurrencyRates::GetConvertFactor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetList


//.........这里部分代码省略.........
                 case "ADV_VISIBLE":
                 case "DIAGRAM_DEFAULT":
                     $arSqlSearch[] = $val == "Y" ? "E." . $key . "='Y'" : "E." . $key . "='N'";
                     break;
                 case "DESCRIPTION":
                 case "NAME":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("E." . $key, $val, $match);
                     break;
                 case "KEEP_DAYS1":
                     $arSqlSearch[] = "E.KEEP_DAYS>='" . intval($val) . "'";
                     break;
                 case "KEEP_DAYS2":
                     $arSqlSearch[] = "E.KEEP_DAYS<='" . intval($val) . "'";
                     break;
                 case "DYNAMIC_KEEP_DAYS1":
                     $arSqlSearch[] = "E.DYNAMIC_KEEP_DAYS>='" . intval($val) . "'";
                     break;
                 case "DYNAMIC_KEEP_DAYS2":
                     $arSqlSearch[] = "E.DYNAMIC_KEEP_DAYS<='" . intval($val) . "'";
                     break;
                 case "CURRENCY":
                     $CURRENCY = $val;
                     break;
             }
         }
     }
     $rate = 1;
     $base_currency = GetStatisticBaseCurrency();
     $view_currency = $base_currency;
     if (strlen($base_currency) > 0) {
         if (CModule::IncludeModule("currency")) {
             if ($CURRENCY != $base_currency && strlen($CURRENCY) > 0) {
                 $rate = CCurrencyRates::GetConvertFactor($base_currency, $CURRENCY);
                 $view_currency = $CURRENCY;
             }
         }
     }
     if ($by == "s_id" && $find_group == "") {
         $strSqlOrder = "ORDER BY E.ID";
     } elseif ($by == "s_date_last") {
         $strSqlOrder = "ORDER BY E_DATE_LAST";
     } elseif ($by == "s_date_enter") {
         $strSqlOrder = "ORDER BY DATE_ENTER";
     } elseif ($by == "s_today_counter") {
         $strSqlOrder = "ORDER BY TODAY_COUNTER";
     } elseif ($by == "s_yesterday_counter") {
         $strSqlOrder = "ORDER BY YESTERDAY_COUNTER";
     } elseif ($by == "s_b_yesterday_counter") {
         $strSqlOrder = "ORDER BY B_YESTERDAY_COUNTER";
     } elseif ($by == "s_total_counter") {
         $strSqlOrder = "ORDER BY TOTAL_COUNTER";
     } elseif ($by == "s_period_counter") {
         $strSqlOrder = "ORDER BY PERIOD_COUNTER";
     } elseif ($by == "s_name" && $find_group == "") {
         $strSqlOrder = "ORDER BY E.NAME";
     } elseif ($by == "s_event1" && $find_group == "") {
         $strSqlOrder = "ORDER BY E.EVENT1";
     } elseif ($by == "s_event1" && $find_group == "event1") {
         $strSqlOrder = "ORDER BY E.EVENT1";
     } elseif ($by == "s_event2" && $find_group == "") {
         $strSqlOrder = "ORDER BY E.EVENT2";
     } elseif ($by == "s_event2" && $find_group == "event2") {
         $strSqlOrder = "ORDER BY E.EVENT2";
     } elseif ($by == "s_event12" && $find_group == "") {
         $strSqlOrder = "ORDER BY E.EVENT1, E.EVENT2";
开发者ID:rasuldev,项目名称:torino,代码行数:67,代码来源:stateventtype.php

示例2: trim

$arParams['CART_PAGE'] = trim($arParams['CART_PAGE']);
$arParams['PAY_IMMED'] = isset($arParams['PAY_IMMED']) && $arParams['PAY_IMMED'] == 'Y';
$arResult = array();
$arResult['ACCOUNT'] = array();
$arResult['CURRENCIES'] = array();
$arResult['ERROR'] = '';
$arResult['LANG_CURRENCY'] = CSaleLang::GetLangCurrency(SITE_ID);
$arResult['REQUEST_AMOUNT'] = $_REQUEST['amount'] > 0 ? round(str_replace(',', '.', trim($_REQUEST['amount'])), 2) : '';
$arResult['REQUEST_ACCOUNT'] = isset($_REQUEST['account']) ? $_REQUEST['account'] : $arParams['DEFAULT_CURRENCY'];
$arResult['REQUEST_PAY_SYSTEM'] = isset($_REQUEST['pay_system']) ? $_REQUEST['pay_system'] : 0;
$i = 0;
$rsCurrency = CCurrency::GetList($by = 'name', $order = 'desc', LANGUAGE_ID);
while ($arCurrency = $rsCurrency->Fetch()) {
    $arCurrency['ID'] = ++$i;
    if ($arCurrency['CURRENCY'] != $arResult['LANG_CURRENCY']) {
        $arCurrency['FACTOR'] = round(CCurrencyRates::GetConvertFactor($arCurrency['CURRENCY'], $arResult['LANG_CURRENCY']), 2);
    } else {
        $arCurrency['FACTOR'] = 1;
    }
    $arResult['CURRENCIES'][$arCurrency['CURRENCY']] = $arCurrency;
    if (empty($arParams['ALLOWED_CURRENCY']) || in_array($arCurrency['CURRENCY'], $arParams['ALLOWED_CURRENCY'])) {
        $arResult['ACCOUNT'][$arCurrency['CURRENCY']] = array();
    }
}
if ($arParams['PAY_IMMED']) {
    if (isset($arParams['PERSON_TYPE']) && $arParams['PERSON_TYPE'] > 0) {
        $arResult['PAY_SYSTEMS'] = array();
        $dbPaySysAction = CSalePaySystemAction::GetList(array(), array('PS_ACTIVE' => 'Y', 'PERSON_TYPE_ID' => $arParams['PERSON_TYPE']), false, false, array('*'));
        while ($arPaySysAction = $dbPaySysAction->fetch()) {
            if (intval($arPaySysAction['LOGOTIP']) > 0) {
                $arPaySysAction['LOGOTIP'] = CFile::GetFileArray($arPaySysAction['LOGOTIP']);
开发者ID:Hawkart,项目名称:megatv,代码行数:31,代码来源:component.php

示例3: updateBaseRates

 protected static function updateBaseRates($currency = '', $updateCurrency = '')
 {
     global $DB;
     if ($currency === '') {
         $currency = (string) Currency\CurrencyManager::getBaseCurrency();
     }
     if ($currency === '') {
         return;
     }
     if ($updateCurrency != '') {
         $factor = 1;
         if ($updateCurrency != $currency) {
             $factor = CCurrencyRates::GetConvertFactor($updateCurrency, $currency);
         }
         $query = "update b_catalog_currency set CURRENT_BASE_RATE = " . (double) $factor . " where CURRENCY = '" . $updateCurrency . "'";
         $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
     } else {
         $query = "select CURRENCY from b_catalog_currency";
         $currencyIterator = $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
         while ($oneCurrency = $currencyIterator->Fetch()) {
             $factor = 1;
             if ($oneCurrency['CURRENCY'] != $currency) {
                 $factor = CCurrencyRates::GetConvertFactor($oneCurrency['CURRENCY'], $currency);
             }
             $query = "update b_catalog_currency set CURRENT_BASE_RATE = " . (double) $factor . " where CURRENCY = '" . $oneCurrency['CURRENCY'] . "'";
             $DB->Query($query, false, 'File: ' . __FILE__ . '<br>Line: ' . __LINE__);
         }
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:29,代码来源:currency.php

示例4: GetList


//.........这里部分代码省略.........
                     } else {
                         $arSqlSearch_h[] = "ATTENT<='" . doubleval($val) . "'";
                     }
                     break;
                     break;
                 case "VISITORS_PER_DAY1":
                     $arSqlSearch_h[] = "VISITORS_PER_DAY>='" . doubleval($val) . "'";
                     break;
                 case "VISITORS_PER_DAY2":
                     $arSqlSearch_h[] = "VISITORS_PER_DAY<='" . doubleval($val) . "'";
                     break;
                 case "DURATION1":
                     $arSqlSearch_h[] = "ADV_TIME>=" . doubleval($val) . "*86400";
                     break;
                 case "DURATION2":
                     $arSqlSearch_h[] = "ADV_TIME<=" . doubleval($val) . "*86400";
                     break;
                 case "CURRENCY":
                     $CURRENCY = $val;
                     break;
                 case "DESCRIPTION":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("A." . $key, $val, $match);
                     break;
             }
         }
     }
     $rate = 1;
     $base_currency = GetStatisticBaseCurrency();
     $view_currency = $base_currency;
     if (strlen($base_currency) > 0) {
         if (CModule::IncludeModule("currency")) {
             if ($CURRENCY != $base_currency && strlen($CURRENCY) > 0) {
                 $rate = CCurrencyRates::GetConvertFactor($base_currency, $CURRENCY);
                 $view_currency = $CURRENCY;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     foreach ($arSqlSearch_h as $sqlWhere) {
         $strSqlSearch_h .= " and (" . $sqlWhere . ") ";
     }
     $group = false;
     $find_group = strlen($find_group) <= 0 ? "NOT_REF" : $find_group;
     $arrFields_1 = array("C_TIME_FIRST", "C_TIME_LAST", "CURRENCY", "DATE_FIRST", "DATE_LAST", "ADV_TIME", "GUESTS", "NEW_GUESTS", "FAVORITES", "C_HOSTS", "SESSIONS", "HITS", "GUESTS_BACK", "FAVORITES_BACK", "HOSTS_BACK", "SESSIONS_BACK", "HITS_BACK", "ATTENT", "ATTENT_BACK", "NEW_VISITORS", "RETURNED_VISITORS", "VISITORS_PER_DAY", "COST", "REVENUE", "BENEFIT", "SESSION_COST", "VISITOR_COST", "ROI");
     if ($find_group == "referer1") {
         array_push($arrFields_1, "REFERER1");
     }
     if ($find_group == "referer2") {
         array_push($arrFields_1, "REFERER2");
     }
     $arrFields_2 = array("GUESTS_TODAY", "NEW_GUESTS_TODAY", "FAVORITES_TODAY", "C_HOSTS_TODAY", "SESSIONS_TODAY", "HITS_TODAY", "GUESTS_BACK_TODAY", "FAVORITES_BACK_TODAY", "HOSTS_BACK_TODAY", "SESSIONS_BACK_TODAY", "HITS_BACK_TODAY", "GUESTS_YESTERDAY", "NEW_GUESTS_YESTERDAY", "FAVORITES_YESTERDAY", "C_HOSTS_YESTERDAY", "SESSIONS_YESTERDAY", "HITS_YESTERDAY", "GUESTS_BACK_YESTERDAY", "FAVORITES_BACK_YESTERDAY", "HOSTS_BACK_YESTERDAY", "SESSIONS_BACK_YESTERDAY", "HITS_BACK_YESTERDAY", "GUESTS_BEF_YESTERDAY", "NEW_GUESTS_BEF_YESTERDAY", "FAVORITES_BEF_YESTERDAY", "C_HOSTS_BEF_YESTERDAY", "SESSIONS_BEF_YESTERDAY", "HITS_BEF_YESTERDAY", "GUESTS_BACK_BEF_YESTERDAY", "FAVORITES_BACK_BEF_YESTERDAY", "HOSTS_BACK_BEF_YESTERDAY", "SESSIONS_BACK_BEF_YESTERDAY", "HITS_BACK_BEF_YESTERDAY", "A.ID", "REFERER1", "REFERER2", "A.PRIORITY", "A.EVENTS_VIEW", "A.DESCRIPTION", "GUESTS_PERIOD", "C_HOSTS_PERIOD", "NEW_GUESTS_PERIOD", "FAVORITES_PERIOD", "SESSIONS_PERIOD", "HITS_PERIOD", "GUESTS_BACK_PERIOD", "HOSTS_BACK_PERIOD", "FAVORITES_BACK_PERIOD", "SESSIONS_BACK_PERIOD", "HITS_BACK_PERIOD");
     $arrFields = $arrFields_1;
     if ($find_group == "NOT_REF") {
         $arrFields = array_merge($arrFields, $arrFields_2);
     }
     if ($order != "asc") {
         $order = "desc";
     }
     $key = array_search(strtoupper($by), $arrFields);
     if ($key === NULL || $key === false) {
         $key = array_search("A." . strtoupper($by), $arrFields);
     }
     if ($key !== NULL && $key !== false) {
         $strSqlOrder = " ORDER BY " . $arrFields[$key];
     } elseif ($by == "s_dropdown") {
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:adv.php

示例5: trim

 if ($EVENTS_VIEW == "NOT_REF") {
     $EVENTS_VIEW = "";
 }
 $statDB->PrepareFields("b_stat_adv");
 $str_REFERER1 = trim($str_REFERER1);
 $str_REFERER2 = trim($str_REFERER2);
 $arFields = array("REFERER1" => strlen($str_REFERER1) <= 0 ? "null" : "'" . $str_REFERER1 . "'", "REFERER2" => strlen($str_REFERER1) <= 0 ? "null" : "'" . $str_REFERER2 . "'", "EVENTS_VIEW" => "'" . $str_EVENTS_VIEW . "'", "PRIORITY" => intval($str_PRIORITY), "DESCRIPTION" => "'" . $str_DESCRIPTION . "'");
 if (CheckFields()) {
     $rate_cost = 1;
     $rate_revenue = 1;
     if ($currency_module == "Y") {
         if ($CURRENCY_COST != $base_currency && strlen($CURRENCY_COST) > 0) {
             $rate_cost = CCurrencyRates::GetConvertFactor($CURRENCY_COST, $base_currency);
         }
         if ($CURRENCY_REVENUE != $base_currency && strlen($CURRENCY_REVENUE) > 0) {
             $rate_revenue = CCurrencyRates::GetConvertFactor($CURRENCY_REVENUE, $base_currency);
         }
     }
     $arFields["COST"] = round(doubleval($COST) * $rate_cost, 2);
     $arFields["REVENUE"] = round(doubleval($REVENUE) * $rate_revenue, 2);
     if ($ID > 0) {
         $statDB->Update("b_stat_adv", $arFields, "WHERE ID = " . $ID, $err_mess . __LINE__);
     } else {
         $ID = $statDB->Insert("b_stat_adv", $arFields, $err_mess . __LINE__);
     }
     if (strlen($strError) <= 0) {
         $statDB->Query("DELETE FROM b_stat_adv_searcher WHERE ADV_ID = " . $ID, false, $err_mess . __LINE__);
         if (is_array($arSEARCHERS)) {
             foreach ($arSEARCHERS as $searcher_id) {
                 $arFields = array("ADV_ID" => "'" . intval($ID) . "'", "SEARCHER_ID" => "'" . intval($searcher_id) . "'");
                 $statDB->Insert("b_stat_adv_searcher", $arFields, $err_mess . __LINE__);
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:adv_edit.php

示例6: RecountBaseCurrency

	public static function RecountBaseCurrency($new_base_currency)
	{
		$err_mess = "File: ".__FILE__."<br>Line: ";
		$DB = CDatabase::GetModuleConnection('statistic');
		$base_currency = GetStatisticBaseCurrency();
		if ($base_currency!="xxx" && strlen($base_currency)>0)
		{
			if (CModule::IncludeModule("currency"))
			{
				if (CCurrency::GetByID($base_currency))
				{
					$rate = CCurrencyRates::GetConvertFactor($base_currency, $new_base_currency);
					if ($rate!=1 && $rate>0)
					{
						$arUpdate = array(
							array("TABLE" => "b_stat_adv", "FIELDS" => array("COST", "REVENUE")),
							array("TABLE" => "b_stat_event", "FIELDS" => array("MONEY")),
							array("TABLE" => "b_stat_event_day", "FIELDS" => array("MONEY")),
							array("TABLE" => "b_stat_event_list", "FIELDS" => array("MONEY"))
							);
						set_time_limit(0);
						ignore_user_abort(true);
						$DB->StartTransaction();
						foreach ($arUpdate as $arr)
						{
							$arFields = $arr["FIELDS"];
							$strSql = "UPDATE ".$arr["TABLE"]." SET ";
							$i = 0;
							$str = "";
							foreach ($arFields as $field)
							{
								if ($i>0) $str .= ", ";
								$str .= $field." = round(".$field."*".$rate.",2)";
								$i++;
							}
							$DB->Query($strSql.$str, false, $err_mess.__LINE__);
						}
						$DB->Commit();
					}
				}
			}
		}
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:43,代码来源:statistic.php

示例7: CalculateAffiliate


//.........这里部分代码省略.........
         }
     }
     // Orders cicle
     $affiliateSum = 0;
     $affiliateCurrency = CSaleLang::GetLangCurrency($arAffiliate["SITE_ID"]);
     $dbOrders = \Bitrix\Sale\Internals\OrderTable::getList(array('filter' => array("=ALLOW_DELIVERY" => 'Y', ">=DATE_ALLOW_DELIVERY" => $dateFrom, "<DATE_ALLOW_DELIVERY" => $dateTo, "=AFFILIATE_ID" => $affiliateID, "=LID" => $arAffiliate["SITE_ID"], "=CANCELED" => 'N'), 'select' => array("ID", "LID", "PRICE_DELIVERY", "PRICE", "CURRENCY", "TAX_VALUE", "AFFILIATE_ID", "BASKET_QUANTITY" => 'BASKET.QUANTITY', "BASKET_PRODUCT_ID" => 'BASKET.PRODUCT_ID', "BASKET_MODULE" => 'BASKET.MODULE', "BASKET_PRICE" => 'BASKET.PRICE', "BASKET_CURRENCY" => 'BASKET.CURRENCY', "BASKET_DISCOUNT_PRICE" => 'BASKET.DISCOUNT_PRICE'), 'order' => array('ID' => 'ASC')));
     $fOrderId = "";
     while ($arOrder = $dbOrders->fetch()) {
         $arProductSections = array();
         if (!array_key_exists("SALE_PRODUCT_SECTION_CACHE", $GLOBALS)) {
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = array();
         }
         if (array_key_exists($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"], $GLOBALS["SALE_PRODUCT_SECTION_CACHE"])) {
             $arProductSections = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"][$arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"]];
             unset($GLOBALS["SALE_PRODUCT_SECTION_CACHE"][$arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"]]);
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] + array($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"] => $arProductSections);
         } else {
             if ($arOrder["BASKET_MODULE"] == "catalog") {
                 CModule::IncludeModule("catalog");
                 $arSku = CCatalogSku::GetProductInfo($arOrder["BASKET_PRODUCT_ID"]);
                 if ($arSku && count($arSku) > 0) {
                     $elementId = $arSku["ID"];
                 } else {
                     $elementId = $arOrder["BASKET_PRODUCT_ID"];
                 }
                 $arProductSections = CCatalogProduct::GetProductSections($elementId);
             } else {
                 $events = GetModuleEvents("sale", "OnAffiliateGetSections");
                 if ($arEvent = $events->Fetch()) {
                     $arProductSections = ExecuteModuleEventEx($arEvent, array($arOrder["BASKET_MODULE"], $arOrder["BASKET_PRODUCT_ID"]));
                 }
             }
             $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] = $GLOBALS["SALE_PRODUCT_SECTION_CACHE"] + array($arOrder["BASKET_MODULE"] . $arOrder["BASKET_PRODUCT_ID"] => $arProductSections);
             if (count($GLOBALS["SALE_PRODUCT_SECTION_CACHE"]) > 20) {
                 array_shift($GLOBALS["SALE_PRODUCT_SECTION_CACHE"]);
             }
         }
         $realRate = $arAffiliatePlan["BASE_RATE"];
         $realRateType = $arAffiliatePlan["BASE_RATE_TYPE"];
         $realRateCurrency = $arAffiliatePlan["BASE_RATE_CURRENCY"];
         $coountArProd = count($arProductSections);
         for ($i = 0; $i < $coountArProd; $i++) {
             if (array_key_exists($arOrder["BASKET_MODULE"] . $arProductSections[$i], $arPlanSections)) {
                 $realRate = $arPlanSections[$arOrder["BASKET_MODULE"] . $arProductSections[$i]]["RATE"];
                 $realRateType = $arPlanSections[$arOrder["BASKET_MODULE"] . $arProductSections[$i]]["RATE_TYPE"];
                 $realRateCurrency = $arPlanSections[$arOrder["BASKET_MODULE"] . $arProductSections[$i]]["RATE_CURRENCY"];
                 break;
             }
         }
         if ($realRateType == "P") {
             if ($arOrder["CURRENCY"] != $affiliateCurrency) {
                 if (!array_key_exists("SALE_CONVERT_CURRENCY_CACHE", $GLOBALS)) {
                     $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"] = array();
                 }
                 if (!array_key_exists($arOrder["CURRENCY"] . "-" . $affiliateCurrency, $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"])) {
                     $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"][$arOrder["CURRENCY"] . "-" . $affiliateCurrency] = CCurrencyRates::GetConvertFactor($arOrder["CURRENCY"], $affiliateCurrency);
                 }
                 if ($fOrderId != $arOrder["ID"]) {
                     $affiliateSum += \Bitrix\Sale\PriceMaths::roundPrecision(($arOrder["PRICE"] - $arOrder["PRICE_DELIVERY"]) * $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"][$arOrder["CURRENCY"] . "-" . $affiliateCurrency] * $realRate / 100);
                     $fOrderId = $arOrder["ID"];
                 }
             } else {
                 if ($fOrderId != $arOrder["ID"]) {
                     $affiliateSum += \Bitrix\Sale\PriceMaths::roundPrecision(($arOrder["PRICE"] - $arOrder["PRICE_DELIVERY"]) * $realRate / 100);
                     $fOrderId = $arOrder["ID"];
                 }
             }
         } else {
             if ($realRateCurrency != $affiliateCurrency) {
                 if (!array_key_exists("SALE_CONVERT_CURRENCY_CACHE", $GLOBALS)) {
                     $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"] = array();
                 }
                 if (!array_key_exists($realRateCurrency . "-" . $affiliateCurrency, $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"])) {
                     $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"][$realRateCurrency . "-" . $affiliateCurrency] = CCurrencyRates::GetConvertFactor($realRateCurrency, $affiliateCurrency);
                 }
                 $affiliateSum += roundEx($realRate * $GLOBALS["SALE_CONVERT_CURRENCY_CACHE"][$realRateCurrency . "-" . $affiliateCurrency], SALE_VALUE_PRECISION);
             } else {
                 $affiliateSum += roundEx($realRate, SALE_VALUE_PRECISION);
             }
         }
     }
     $arFields = array("=PENDING_SUM" => "PENDING_SUM + " . $affiliateSum, "LAST_CALCULATE" => $dateTo);
     $res = CSaleAffiliate::Update($affiliateID, $arFields);
     if (!$res) {
         return False;
     }
     if ($affiliateSum > 0) {
         $cnt = min(count($arAffiliateParents), count($GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"][$arAffiliate["SITE_ID"]]));
         for ($i = 0; $i < $cnt; $i++) {
             $affiliateSumTmp = roundEx($affiliateSum * $GLOBALS["SALE_AFFILIATE_TIER_TMP_CACHE"][$arAffiliate["SITE_ID"]][$i] / 100, SALE_VALUE_PRECISION);
             $arFields = array("=PENDING_SUM" => "PENDING_SUM + " . $affiliateSumTmp);
             CSaleAffiliate::Update($arAffiliateParents[$i], $arFields);
         }
     }
     $events = GetModuleEvents("sale", "OnAfterAffiliateCalculate");
     while ($arEvent = $events->Fetch()) {
         ExecuteModuleEventEx($arEvent, array($affiliateID));
     }
     return True;
 }
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:affiliate.php

示例8: ConvertCurrency

 /**
  * <p>Функция переводит сумму valSum из валюты curFrom в валюту curTo по курсу, установленному на дату valDate </p>
  *
  *
  *
  *
  * @param float $valSum  Сумма в валюте curFrom, которую нужно перевести в валюту curTo
  *
  *
  *
  * @param string $curFrom  Исходная валюта.
  *
  *
  *
  * @param string $curTo  Конечная валюта.
  *
  *
  *
  * @param string $valDate = "" Дата, по курсу на которую нужно осуществить перевод. Если дата
  * пуста, то перевод идет по текущему курсу. Необязательный
  * параметр.
  *
  *
  *
  * @return float <p>Сумма в новой валюте </p> <a name="examples"></a>
  *
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * // предполагаем, что валюты USD и EUR существуют в базе
  * $val = 11.95; // сумма в USD
  * $newval = CCurrencyRates::ConvertCurrency($val, "USD", "EUR");
  * echo $val." USD = ".$newval." EUR";
  * ?&gt;
  * 
  * 
  * &lt;?
  * // способ конвертации валюты для списка
  * if (CModule::IncludeModule('currency')) {
  *    $factor = CCurrencyRates::GetConvertFactor('UEE', 'RUB');
  * } else {
  *    $factor = 1;
  * }
  * 
  * foreach ($arResult['ITEMS'] as $i =&gt; &amp;$arItem) {
  *    $arItem['PROPERTY_PRICE_VALUE'] = number_format($arItem['PROPERTY_PRICE_VALUE'] * $factor, 0, '.', ' ');
  * }
  * ?&amp;gt
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/currency/developer/ccurrencyrates/ccurrencyrates__convertcurrency.930a5544.php
  * @author Bitrix
  */
 public static function ConvertCurrency($valSum, $curFrom, $curTo, $valDate = "")
 {
     return doubleval(doubleval($valSum) * CCurrencyRates::GetConvertFactor($curFrom, $curTo, $valDate));
 }
开发者ID:rasuldev,项目名称:torino,代码行数:60,代码来源:currency_rate.php

示例9: GetList


//.........这里部分代码省略.........
                 case "ADV_ID":
                 case "HIT_ID":
                 case "COUNTRY_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("E." . $key, $val, $match);
                     break;
                 case "ADV_BACK":
                     $arSqlSearch[] = $val == "Y" ? "E.ADV_BACK='Y'" : "E.ADV_BACK='N'";
                     break;
                 case "REFERER_URL":
                 case "URL":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("E." . $key, $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 case "COUNTRY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("C.NAME", $val, $match);
                     break;
                 case "SITE_ID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("E.SITE_ID", $val, $match);
                     break;
                 case "REFERER_SITE_ID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("E.REFERER_SITE_ID", $val, $match);
                     break;
                 case "CURRENCY":
                     $CURRENCY = $val;
                     break;
             }
         }
     }
     $rate = 1;
     $base_currency = GetStatisticBaseCurrency();
     $view_currency = $base_currency;
     if (strlen($base_currency) > 0) {
         if (CModule::IncludeModule("currency")) {
             if ($CURRENCY != $base_currency && strlen($CURRENCY) > 0) {
                 $rate = CCurrencyRates::GetConvertFactor($base_currency, $CURRENCY);
                 $view_currency = $CURRENCY;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     foreach ($arSqlSearch_h as $sqlWhere) {
         $strSqlSearch_h .= " and (" . $sqlWhere . ") ";
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY E.ID";
     } elseif ($by == "s_site_id") {
         $strSqlOrder = "ORDER BY E.SITE_ID";
     } elseif ($by == "s_event_id" || $by == "s_type_id") {
         $strSqlOrder = "ORDER BY E.EVENT_ID";
     } elseif ($by == "s_event3") {
         $strSqlOrder = "ORDER BY E.EVENT3";
     } elseif ($by == "s_date_enter") {
         $strSqlOrder = "ORDER BY E.DATE_ENTER";
     } elseif ($by == "s_adv_id") {
         $strSqlOrder = "ORDER BY E.ADV_ID";
     } elseif ($by == "s_adv_back") {
         $strSqlOrder = "ORDER BY E.ADV_BACK";
     } elseif ($by == "s_session_id") {
         $strSqlOrder = "ORDER BY E.SESSION_ID";
     } elseif ($by == "s_guest_id") {
         $strSqlOrder = "ORDER BY E.GUEST_ID";
     } elseif ($by == "s_hit_id") {
         $strSqlOrder = "ORDER BY E.HIT_ID";
     } elseif ($by == "s_url") {
         $strSqlOrder = "ORDER BY E.URL";
     } elseif ($by == "s_referer_url") {
         $strSqlOrder = "ORDER BY E.REFERER_URL";
     } elseif ($by == "s_redirect_url") {
         $strSqlOrder = "ORDER BY E.REDIRECT_URL";
     } elseif ($by == "s_country_id") {
         $strSqlOrder = "ORDER BY E.COUNTRY_ID";
     } elseif ($by == "s_money") {
         $strSqlOrder = "ORDER BY MONEY";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY E.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     if ($arFilter["GROUP"] == "total") {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tCOUNT(1)\t\t\t\t\t\t\tCOUNTER,\n\t\t\t\t\tround(sum(if(E.CHARGEBACK='Y',-E.MONEY,E.MONEY)*{$rate}),2)\tMONEY,\n\t\t\t\t\t'" . $DB->ForSql($view_currency) . "'\t\t\t\t\t\tCURRENCY\n\t\t\t\tFROM\n\t\t\t\t\tb_stat_event_list E\n\t\t\t\tINNER JOIN b_stat_event V ON (V.ID=E.EVENT_ID)\n\t\t\t\tLEFT JOIN b_stat_country C ON (C.ID=E.COUNTRY_ID)\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\tHAVING\n\t\t\t\t\t1=1\n\t\t\t\t\t{$strSqlSearch_h}\n\t\t\t\t";
     } else {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tE.ID, E.EVENT3, E.EVENT_ID, E.ADV_ID, E.ADV_BACK, E.COUNTRY_ID, E.SESSION_ID, E.GUEST_ID, E.HIT_ID, E.REFERER_URL, E.URL, E.REDIRECT_URL, E.CHARGEBACK, E.SITE_ID, E.REFERER_SITE_ID,\n\t\t\t\t\tround((E.MONEY*{$rate}),2)\t\t\t\t\t\t\t\t\t\tMONEY,\n\t\t\t\t\t'" . $DB->ForSql($view_currency) . "'\t\t\t\t\t\t\t\t\t\t\t\tCURRENCY,\n\t\t\t\t\t" . $DB->DateToCharFunction("E.DATE_ENTER") . "\t\t\t\t\t\tDATE_ENTER,\n\t\t\t\t\tV.ID\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTYPE_ID,\n\t\t\t\t\tV.DESCRIPTION, V.NAME, V.EVENT1, V.EVENT2,\n\t\t\t\t\tC.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCOUNTRY_NAME,\n\t\t\t\t\tif (length(V.NAME)>0, V.NAME,\n\t\t\t\t\t\tconcat(ifnull(V.EVENT1,''),' / ',ifnull(V.EVENT2,'')))\t\tEVENT\n\t\t\t\tFROM\n\t\t\t\t\tb_stat_event_list E\n\t\t\t\tINNER JOIN b_stat_event V ON (V.ID=E.EVENT_ID)\n\t\t\t\tLEFT JOIN b_stat_country C ON (C.ID=E.COUNTRY_ID)\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\tHAVING\n\t\t\t\t\t1=1\n\t\t\t\t\t{$strSqlSearch_h}\n\t\t\t\t{$strSqlOrder}\n\t\t\t\tLIMIT " . intval(COption::GetOptionString('statistic', 'RECORDS_LIMIT')) . "\n\t\t\t\t";
     }
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch) || strlen($strSqlSearch_h) > 0;
     return $res;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:statevent.php

示例10: AddCurrent


//.........这里部分代码省略.........
     }
     // lookup event type ID
     $EVENT_ID = CStatEvent::SetEventType($event1, $event2, $arEventType);
     // return if it's unknown
     if ($EVENT_ID <= 0) {
         return array("EVENT_ID" => 0, "TYPE_ID" => 0, "EID" => 0);
     }
     if ($site_id === false) {
         if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
             $sql_site = "null";
             $site_id = false;
         } elseif (defined("SITE_ID")) {
             $sql_site = "'" . $DB->ForSql(SITE_ID, 2) . "'";
             $site_id = SITE_ID;
         } else {
             $sql_site = "null";
             $site_id = false;
         }
     } else {
         if (strlen(trim($site_id)) > 0) {
             $sql_site = "'" . $DB->ForSql($site_id, 2) . "'";
         } else {
             $sql_site = "null";
             $site_id = false;
         }
     }
     $money = doubleval($money);
     // convert when currency specified
     if (strlen(trim($currency)) > 0) {
         $base_currency = GetStatisticBaseCurrency();
         if (strlen($base_currency) > 0) {
             if ($currency != $base_currency) {
                 if (CModule::IncludeModule("currency")) {
                     $rate = CCurrencyRates::GetConvertFactor($currency, $base_currency);
                     if ($rate > 0 && $rate != 1) {
                         $money = $money * $rate;
                     }
                 }
             }
         }
     }
     $money = round($money, 2);
     $chargeback = $chargeback == "Y" ? "Y" : "N";
     $goto = preg_replace("/#EVENT_GID#/i", CStatEvent::GetGID($site_id), $goto);
     $sql_KEEP_DAYS = intval($arEventType["KEEP_DAYS"]) > 0 ? intval($arEventType["KEEP_DAYS"]) : "null";
     $arr = false;
     $referer_url = strlen($_SERVER["HTTP_REFERER"]) <= 0 ? $_SESSION["SESS_HTTP_REFERER"] : $_SERVER["HTTP_REFERER"];
     if (strlen($referer_url) > 0) {
         if ($url = @parse_url($referer_url)) {
             $rs = CSite::GetList($v1 = "LENDIR", $v2 = "DESC", array("ACTIVE" => "Y", "DOMAIN" => "%" . $url["host"], "IN_DIR" => $url["path"]));
             $arr = $rs->Fetch();
         }
     }
     $sql_referer_site_id = is_array($arr) && strlen($arr["ID"]) > 0 ? "'" . $DB->ForSql($arr["ID"], 2) . "'" : "null";
     $HIT_ID = CKeepStatistics::GetCuurentHitID();
     $arFields = array("EVENT_ID" => "'" . $EVENT_ID . "'", "EVENT3" => "'" . $DB->ForSql($event3, 255) . "'", "MONEY" => $money, "DATE_ENTER" => $DB->GetNowFunction(), "REFERER_URL" => "'" . $DB->ForSql($referer_url, 2000) . "'", "URL" => "'" . $DB->ForSql(__GetFullRequestUri(), 2000) . "'", "REDIRECT_URL" => "'" . $DB->ForSql($goto, 2000) . "'", "SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]) > 0 ? intval($_SESSION["SESS_SESSION_ID"]) : "null", "GUEST_ID" => intval($_SESSION["SESS_GUEST_ID"]) > 0 ? intval($_SESSION["SESS_GUEST_ID"]) : "null", "ADV_ID" => $_SESSION["SESS_LAST_ADV_ID"] > 0 ? $_SESSION["SESS_LAST_ADV_ID"] : "null", "HIT_ID" => $HIT_ID > 0 ? $HIT_ID : "NULL", "COUNTRY_ID" => "'" . $DB->ForSql($_SESSION["SESS_COUNTRY_ID"], 2) . "'", "KEEP_DAYS" => $sql_KEEP_DAYS, "CHARGEBACK" => "'" . $chargeback . "'", "SITE_ID" => $sql_site, "REFERER_SITE_ID" => $sql_referer_site_id);
     if (intval($_SESSION["SESS_LAST_ADV_ID"]) > 0 && intval($_SESSION["SESS_ADV_ID"]) <= 0) {
         $arFields["ADV_BACK"] = "'Y'";
     }
     $eid = $DB->Insert("b_stat_event_list", $arFields, $err_mess . __LINE__);
     // in case of first occurence
     if (strlen($arEventType["DATE_ENTER"]) <= 0) {
         // set date of the first event
         $arFields = array("DATE_ENTER" => $DB->GetNowFunction());
         $DB->Update("b_stat_event", $arFields, "WHERE ID='" . $EVENT_ID . "'", $err_mess . __LINE__);
     }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:67,代码来源:statevent.php

示例11: LoadEventsBySteps

function LoadEventsBySteps($csvfile, $time_step, $next_line, &$step_processed, &$step_loaded, &$step_duplicate, $check_unique = "Y", $base_currency = "", &$next_pos)
{
    if ($fp = fopen($csvfile, "rb")) {
        if ($next_pos > 0) {
            fseek($fp, $next_pos);
        }
        $start = getmicrotime();
        $all_loaded = "";
        $next_line = intval($next_line);
        $read_lines = 0;
        $step_loaded = 0;
        $step_processed = 0;
        $step_duplicate = 0;
        while (!feof($fp)) {
            $arrCSV = fgetcsv($fp, 4096, ",");
            if (is_array($arrCSV) && count($arrCSV) > 0) {
                array_walk($arrCSV, "CleanUpResultCsv");
                $read_lines++;
                $step_processed++;
                $EVENT_ID = $arrCSV[0];
                $EVENT3 = $arrCSV[1];
                $DATE_ENTER = $arrCSV[2];
                $PARAMETER = $arrCSV[3];
                $MONEY = $arrCSV[4];
                $CURRENCY = $arrCSV[5];
                $CHARGEBACK = $arrCSV[6];
                $RES_MONEY = $MONEY;
                $EVENT_ID = intval($EVENT_ID);
                $CHARGEBACK = $CHARGEBACK == "Y" ? "Y" : "N";
                if ($EVENT_ID > 0) {
                    if (strlen($base_currency) <= 0) {
                        $base_currency = GetStatisticBaseCurrency();
                    }
                    if (strlen($base_currency) > 0) {
                        if ($CURRENCY != $base_currency && strlen(trim($CURRENCY)) > 0) {
                            if (CModule::IncludeModule("currency")) {
                                $stmp = MkDateTime(ConvertDateTime($DATE_ENTER, "D.M.Y H:I:S"), "d.m.Y H:i:s");
                                $valDate = date("Y-m-d", $stmp);
                                $rate = CCurrencyRates::GetConvertFactor($CURRENCY, $base_currency, $valDate);
                                if ($rate > 0) {
                                    $RES_MONEY = $MONEY * $rate;
                                }
                            }
                        }
                    }
                    $RES_MONEY = round($RES_MONEY, 2);
                    $add_event = "Y";
                    if ($check_unique == "Y") {
                        $arr = CStatEvent::DecodeGid($PARAMETER);
                        $arFilter = array("EVENT_ID" => $EVENT_ID, "EVENT3" => $EVENT3, "DATE" => $DATE_ENTER, "SESSION_ID" => $arr["SESSION_ID"], "GUEST_ID" => $arr["GUEST_ID"], "COUNTRY_ID" => $arr["COUNTRY_ID"], "ADV_ID" => $arr["ADV_ID"], "ADV_BACK" => $arr["ADV_BACK"], "SITE_ID" => $arr["SITE_ID"]);
                        $rsEvents = CStatEvent::GetListUniqueCheck($arFilter);
                        if ($arEvent = $rsEvents->Fetch()) {
                            $add_event = "N";
                            $step_duplicate++;
                        }
                    }
                    if ($add_event == "Y") {
                        CStatEvent::AddByID($EVENT_ID, $EVENT3, $DATE_ENTER, $PARAMETER, $RES_MONEY, "", $CHARGEBACK);
                        $step_loaded++;
                    }
                    $end = getmicrotime();
                    if (intval($time_step) > 0 && $end - $start > intval($time_step)) {
                        $all_loaded = "N";
                        break;
                    }
                }
            }
        }
        if ($all_loaded == "N") {
            $next_pos = ftell($fp);
        } else {
            $next_pos = 0;
        }
        @fclose($fp);
        if ($all_loaded != "N") {
            $all_loaded = "Y";
            @unlink($csvfile);
        }
        return $all_loaded;
    }
}
开发者ID:rasuldev,项目名称:torino,代码行数:81,代码来源:stat_tools.php


注:本文中的CCurrencyRates::GetConvertFactor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。