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


PHP RoundEx函数代码示例

本文整理汇总了PHP中RoundEx函数的典型用法代码示例。如果您正苦于以下问题:PHP RoundEx函数的具体用法?PHP RoundEx怎么用?PHP RoundEx使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: DoProcessOrderDelivery

 static function DoProcessOrderDelivery(&$arOrder, $arOptions, &$arErrors)
 {
     if ((!array_key_exists("TAX_LOCATION", $arOrder) || intval($arOrder["TAX_LOCATION"]) <= 0) && !$arOrder["USE_VAT"]) {
         return;
     }
     if (!array_key_exists("COUNT_DELIVERY_TAX", $arOptions)) {
         $arOptions["COUNT_DELIVERY_TAX"] = COption::GetOptionString("sale", "COUNT_DELIVERY_TAX", "N");
     }
     if (doubleval($arOrder["DELIVERY_PRICE"]) <= 0 || $arOptions["COUNT_DELIVERY_TAX"] != "Y") {
         return;
     }
     if (!$arOrder["USE_VAT"]) {
         if (!array_key_exists("TAX_EXEMPT", $arOrder)) {
             $arUserGroups = CUser::GetUserGroup($arOrder["USER_ID"]);
             $dbTaxExemptList = CSaleTax::GetExemptList(array("GROUP_ID" => $arUserGroups));
             while ($TaxExemptList = $dbTaxExemptList->Fetch()) {
                 if (!in_array(intval($TaxExemptList["TAX_ID"]), $arOrder["TAX_EXEMPT"])) {
                     $arOrder["TAX_EXEMPT"][] = intval($TaxExemptList["TAX_ID"]);
                 }
             }
         }
         if (!array_key_exists("TAX_LIST", $arOrder)) {
             $arOrder["TAX_LIST"] = array();
             $dbTaxRate = CSaleTaxRate::GetList(array("APPLY_ORDER" => "ASC"), array("LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "ACTIVE" => "Y", "LOCATION" => $arOrder["TAX_LOCATION"]));
             while ($arTaxRate = $dbTaxRate->GetNext()) {
                 if (!in_array(intval($arTaxRate["TAX_ID"]), $arOrder["TAX_EXEMPT"])) {
                     if ($arTaxRate["IS_PERCENT"] != "Y") {
                         $arTaxRate["VALUE"] = RoundEx(CCurrencyRates::ConvertCurrency($arTaxRate["VALUE"], $arTaxRate["CURRENCY"], $arOrder["CURRENCY"]), SALE_VALUE_PRECISION);
                         $arTaxRate["CURRENCY"] = $arOrder["CURRENCY"];
                     }
                     $arOrder["TAX_LIST"][] = $arTaxRate;
                 }
             }
         }
         if (count($arOrder["TAX_LIST"]) > 0) {
             CSaleOrderTax::CountTaxes($arOrder["DELIVERY_PRICE"], $arOrder["TAX_LIST"], $arOrder["CURRENCY"]);
             foreach ($arOrder["TAX_LIST"] as &$arTax) {
                 $arTax["VALUE_MONEY"] += roundEx($arTax["TAX_VAL"], SALE_VALUE_PRECISION);
             }
             unset($arTax);
             $arOrder["TAX_PRICE"] = 0;
             foreach ($arOrder["TAX_LIST"] as $arTax) {
                 if ($arTax["IS_IN_PRICE"] != "Y") {
                     $arOrder["TAX_PRICE"] += roundEx($arTax["VALUE_MONEY"], SALE_VALUE_PRECISION);
                 }
             }
         }
     } else {
         $deliveryVat = roundEx($arOrder["DELIVERY_PRICE"] * $arOrder["VAT_RATE"] / (1 + $arOrder["VAT_RATE"]), 2);
         $arOrder["VAT_SUM"] += $deliveryVat;
         $arOrder["VAT_DELIVERY"] += $deliveryVat;
         //if (!array_key_exists("TAX_LIST", $arOrder))
         //{
         $arOrder["TAX_LIST"][0] = array("NAME" => GetMessage("SOA_VAT"), "IS_PERCENT" => "Y", "VALUE" => $arOrder["VAT_RATE"] * 100, "VALUE_FORMATED" => "(" . $arOrder["VAT_RATE"] * 100 . "%, " . GetMessage("SOA_VAT_INCLUDED") . ")", "VALUE_MONEY" => $arOrder["VAT_SUM"], "VALUE_MONEY_FORMATED" => SaleFormatCurrency($arOrder["VAT_SUM"], $arOrder["CURRENCY"]), "APPLY_ORDER" => 100, "IS_IN_PRICE" => "Y", "CODE" => "VAT");
         //}
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:57,代码来源:tax.php

示例2: ReCountFromBase

	function ReCountFromBase(&$arFields, &$boolBase)
	{
		$arBaseGroup = CCatalogGroup::GetBaseGroup();
		if (!empty($arBaseGroup))
		{
			if ($arFields['CATALOG_GROUP_ID'] == $arBaseGroup['ID'])
			{
				$boolBase = true;
			}
			else
			{
				if (!empty($arFields['EXTRA_ID']) && intval($arFields['EXTRA_ID']) > 0)
				{
					$arExtra = CExtra::GetByID($arFields['EXTRA_ID']);
					if (!empty($arExtra))
					{
						$arFilter = array('PRODUCT_ID' => $arFields['PRODUCT_ID'],'CATALOG_GROUP_ID' => $arBaseGroup['ID']);
						if (isset($arFields['QUANTITY_FROM']))
							$arFilter['QUANTITY_FROM'] = $arFields['QUANTITY_FROM'];
						if (isset($arFields['QUANTITY_TO']))
							$arFilter['QUANTITY_TO'] = $arFields['QUANTITY_TO'];
						$rsBasePrices = CPrice::GetListEx(
							array("QUANTITY_FROM" => "ASC", "QUANTITY_TO" => "ASC"),
							$arFilter,
							false,
							array('nTopCount' => 1),
							array('PRICE','CURRENCY')
						);
						if ($arBasePrice = $rsBasePrices->Fetch())
						{
							$arFields['CURRENCY'] = $arBasePrice['CURRENCY'];
							$arFields['PRICE'] = RoundEx($arBasePrice["PRICE"] * (1 + DoubleVal($arExtra["PERCENTAGE"])/100), CATALOG_VALUE_PRECISION);
						}
						else
						{
							$arFields['EXTRA_ID'] = 0;
						}
					}
					else
					{
						$arFields['EXTRA_ID'] = 0;
					}
				}
			}
		}
	}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:46,代码来源:price.php

示例3: loadAvailableList

 /**
  * @return array
  */
 protected function loadAvailableList()
 {
     $order = $this->getOrder();
     $basket = $order->getBasket();
     if (!$basket) {
         return null;
     }
     if (!$order->isUsedVat()) {
         $taxExemptList = static::loadExemptList($order->getUserId());
         $taxRateRes = \CSaleTaxRate::GetList(array("APPLY_ORDER" => "ASC"), array("LID" => $order->getSiteId(), "PERSON_TYPE_ID" => $order->getPersonTypeId(), "ACTIVE" => "Y", "LOCATION" => $order->getTaxLocation()));
         while ($taxRate = $taxRateRes->GetNext()) {
             if (!in_array(intval($taxRate["TAX_ID"]), $taxExemptList)) {
                 if ($taxRate["IS_PERCENT"] != "Y") {
                     $taxRate["VALUE"] = RoundEx(\CCurrencyRates::convertCurrency($taxRate["VALUE"], $taxRate["CURRENCY"], $order->getCurrency()), SALE_VALUE_PRECISION);
                     $taxRate["CURRENCY"] = $order->getCurrency();
                 }
                 $this->availableList[] = $taxRate;
             }
         }
     } else {
         $this->availableList[] = array("NAME" => Loc::getMessage("SOA_VAT"), "IS_PERCENT" => "Y", "VALUE" => $order->getVatRate() * 100, "VALUE_FORMATED" => "(" . $order->getVatRate() * 100 . "%, " . GetMessage("SOA_VAT_INCLUDED") . ")", "VALUE_MONEY" => $order->getVatSum(), "VALUE_MONEY_FORMATED" => SaleFormatCurrency($order->getVatSum(), $order->getCurrency()), "APPLY_ORDER" => 100, "IS_IN_PRICE" => "Y", "CODE" => "VAT");
     }
     return $this->availableList;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:27,代码来源:tax.php

示例4: count

 $intBasePriceCount = count($arCatalogBasePrices);
 $dbCatGroups = CCatalogGroup::GetList(array(), array("!BASE" => "Y"));
 while ($arCatGroups = $dbCatGroups->Fetch()) {
     unset($arCatalogPrice_tmp);
     $arCatalogPrice_tmp = array();
     for ($i = 0; $i < $intBasePriceCount; $i++) {
         ${"CAT_PRICE_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]} = str_replace(",", ".", ${"CAT_PRICE_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]});
         $arCatalogPrice_tmp[$i] = array("ID" => IntVal(${"CAT_ID_" . $arCatGroups["ID"]}[$arCatalogBasePrices[$i]["IND"]]), "EXTRA_ID" => ${"CAT_EXTRA_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]} ? IntVal(${"CAT_EXTRA_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]}) : 0, "PRICE" => ${"CAT_PRICE_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]}, "CURRENCY" => Trim(${"CAT_CURRENCY_" . $arCatGroups["ID"] . "_" . $arCatalogBasePrices[$i]["IND"]}), "QUANTITY_FROM" => $arCatalogBasePrices[$i]["QUANTITY_FROM"], "QUANTITY_TO" => $arCatalogBasePrices[$i]["QUANTITY_TO"]);
         if (strlen($arCatalogPrice_tmp[$i]["CURRENCY"]) <= 0) {
             $arCatalogPrice_tmp[$i]["CURRENCY"] = $arCatalogBasePrices[$i]["CURRENCY"];
         }
         if ($arCatalogPrice_tmp[$i]["EXTRA_ID"] > 0) {
             if (0 < doubleval($arCatalogBasePrices[$i]["PRICE"])) {
                 $arCatalogPrice_tmp[$i]["CURRENCY"] = $arCatalogBasePrices[$i]["CURRENCY"];
                 $arCatalogExtra = CExtra::GetByID($arCatalogPrice_tmp[$i]["EXTRA_ID"]);
                 $arCatalogPrice_tmp[$i]["PRICE"] = RoundEx($arCatalogBasePrices[$i]["PRICE"] * (1 + DoubleVal($arCatalogExtra["PERCENTAGE"]) / 100), CATALOG_VALUE_PRECISION);
             } else {
                 $arCatalogPrice_tmp[$i]["EXTRA_ID"] = 0;
             }
         }
     }
     $arCatalogPrices[$arCatGroups["ID"]] = $arCatalogPrice_tmp;
 }
 $arUpdatedIDs = array();
 $availCanBuyZero = COption::GetOptionString("catalog", "default_can_buy_zero");
 $quantityTrace = $_POST['CAT_BASE_QUANTITY_TRACE'];
 if (!$quantityTrace || $quantityTrace == '') {
     $quantityTrace = 'D';
 }
 $useStore = $_POST['USE_STORE'];
 if (!$useStore || $useStore == '') {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:product_edit_action.php

示例5: catalog_1c_mutator_final

    $DB->Query("TRUNCATE TABLE b_catalog_cml_property_var");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_section");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_product");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_product_cat");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_product_prop");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_oflist");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_oflist_prop");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_offer");
    $DB->Query("TRUNCATE TABLE b_catalog_cml_tmp");
    if (function_exists("catalog_1c_mutator_final")) {
        catalog_1c_mutator_final($iBlockIDString);
    }
    __SetTimeMark("Clear temp tables", "STOP");
}
if (strlen($strImportErrorMessage) <= 0) {
    $totalExecutionTime = RoundEx(getmicrotime() - $startImportExecTime, 1);
    $totalExecutionTimeM = RoundEx($totalExecutionTime / 60, 1);
    $strImportOKMessage .= str_replace("#MIN#", $totalExecutionTimeM > 1 ? " (" . $totalExecutionTimeM . " " . GetMessage("CML_R_MIN") . ")" : "", str_replace("#TIME#", $totalExecutionTime, GetMessage("CML_R_TIME"))) . "<br>";
    $strImportOKMessage .= str_replace("#NUM#", $cmlLoadCnts["CATALOG"], GetMessage("CML_R_NCATA")) . "<br> ";
    $strImportOKMessage .= str_replace("#NUM#", $cmlLoadCnts["PROPERTY"], GetMessage("CML_R_NPROP")) . "<br> ";
    $strImportOKMessage .= str_replace("#NUM#", $cmlLoadCnts["SECTION"], GetMessage("CML_R_NGRP")) . "<br> ";
    $strImportOKMessage .= str_replace("#NUM#", $cmlLoadCnts["PRODUCT"], GetMessage("CML_R_NPRD")) . "<br> ";
    $strImportOKMessage .= str_replace("#NUM#", $cmlLoadCnts["OFFER"], GetMessage("CML_R_NOFF")) . "<br> ";
}
if ($bTmpUserCreated) {
    unset($USER);
    if (isset($USER_TMP)) {
        $USER = $USER_TMP;
        unset($USER_TMP);
    }
}
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:commerceml_g_run.php

示例6: Array

					}

					$totalOrderPrice = $arResult["ORDER_PRICE"] + $arResult["DELIVERY_PRICE"] + $arResult["TAX_PRICE"] - $arResult["DISCOUNT_PRICE"];
					CSaleOrder::Update($arResult["ORDER_ID"], Array("PRICE" => $totalOrderPrice));
				}

				if (empty($arResult["ERROR"]))
				{
					$countResultTax = count($arResult["arTaxList"]);
					for ($i = 0; $i < $countResultTax; $i++)
					{
						$arFields = array(
								"ORDER_ID" => $arResult["ORDER_ID"],
								"TAX_NAME" => $arResult["arTaxList"][$i]["NAME"],
								"IS_PERCENT" => $arResult["arTaxList"][$i]["IS_PERCENT"],
								"VALUE" => ($arResult["arTaxList"][$i]["IS_PERCENT"]=="Y") ? $arResult["arTaxList"][$i]["VALUE"] : RoundEx(CCurrencyRates::ConvertCurrency($arResult["arTaxList"][$i]["VALUE"], $arResult["arTaxList"][$i]["CURRENCY"], $arResult["BASE_LANG_CURRENCY"]), SALE_VALUE_PRECISION),
								"VALUE_MONEY" => $arResult["arTaxList"][$i]["VALUE_MONEY"],
								"APPLY_ORDER" => $arResult["arTaxList"][$i]["APPLY_ORDER"],
								"IS_IN_PRICE" => $arResult["arTaxList"][$i]["IS_IN_PRICE"],
								"CODE" => $arResult["arTaxList"][$i]["CODE"]
							);
						CSaleOrderTax::Add($arFields);
					}

					$arTmpUserPropsVal = Array();
					if(IntVal($arUserResult["PROFILE_ID"]) > 0)
					{
						$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(
								array("SORT" => "ASC"),
								array(
									"USER_PROPS_ID" => $arUserResult["PROFILE_ID"],
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:component.php

示例7: NextPayment


//.........这里部分代码省略.........
							"CURRENCY" => $baseSiteCurrency,
							"DISCOUNT_VALUE" => $discount,
							"USER_ID" => $arOrder["USER_ID"],
							"PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"],
							"DELIVERY_ID" => $deliveryID,
							"USER_DESCRIPTION" => $arOrder["USER_DESCRIPTION"],
							"TAX_VALUE" => (($bUseVat)? $taxVatPrice : $taxPrice),
							"STAT_GID" => $arOrder["STAT_GID"],
							"RECURRING_ID" => $arRecur["ID"]
						);

					$newOrderID = CSaleOrder::Add($arFields);

					$newOrderID = IntVal($newOrderID);
					if ($newOrderID <= 0)
						$bSuccess = False;
				}

				if ($bSuccess)
				{
					$arDiscounts = array();
					$arDiscounts[$basketID] = $discountProduct;
					CSaleBasket::OrderBasket($newOrderID, $currentFUser, $arOrder["LID"], $arDiscounts);
				}

				if ($bSuccess)
				{
					for ($it = 0, $intCount = count($arTaxList); $it < $intCount; $it++)
					{
						$arFields = array(
							"ORDER_ID" => $newOrderID,
							"TAX_NAME" => $arTaxList[$it]["TAX_NAME"],
							"IS_PERCENT" => $arTaxList[$it]["IS_PERCENT"],
							"VALUE" => ($arTaxList[$it]["IS_PERCENT"]=="Y") ? $arTaxList[$it]["VALUE"] : RoundEx(CCurrencyRates::ConvertCurrency($arTaxList[$it]["VALUE"], $arTaxList[$it]["CURRENCY"], $baseSiteCurrency), 2),
							"VALUE_MONEY" => $arTaxList[$it]["VALUE_MONEY"],
							"APPLY_ORDER" => $arTaxList[$it]["APPLY_ORDER"],
							"IS_IN_PRICE" => $arTaxList[$it]["IS_IN_PRICE"],
							"CODE" => $arTaxList[$it]["CODE"]
							);
						CSaleOrderTax::Add($arFields);
					}

					$dbOrderPropValues = CSaleOrderPropsValue::GetList(
							array(),
							array("ORDER_ID" => $arRecur["ORDER_ID"]),
							false,
							false,
							array("ORDER_PROPS_ID", "NAME", "CODE", "VALUE", "PROP_IS_PAYER", "PROP_IS_EMAIL")
						);
					while ($arOrderPropValues = $dbOrderPropValues->Fetch())
					{
						$arFields = array(
							"ORDER_ID" => $newOrderID,
							"ORDER_PROPS_ID" => $arOrderPropValues["ORDER_PROPS_ID"],
							"NAME" => $arOrderPropValues["NAME"],
							"CODE" => $arOrderPropValues["CODE"],
							"VALUE" => $arOrderPropValues["VALUE"]
							);
						CSaleOrderPropsValue::Add($arFields);

						if ($arOrderPropValues["PROP_IS_PAYER"] == "Y")
							$payerName = $arOrderPropValues["VALUE"];
						if ($arOrderPropValues["PROP_IS_EMAIL"] == "Y")
							$payerEMail = $arOrderPropValues["VALUE"];
					}
				}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:67,代码来源:recurring.php

示例8: Array

				$khjk = CPrice::Add($arFields);
		}
	}

	if (COption::GetOptionString("catalog", "deactivate_1c_no_price", "N")=="Y")
	{
		foreach ($arProductsTmpA as $keyA=>$valA)
		{
			foreach ($valA["arProducts"] as $keyB=>$valB)
			{
				$res = $el->Update(IntVal($valB), Array("ACTIVE" => "N"));
			}
		}
	}

	$strImportOKMessage .= str_replace("#TIME#", RoundEx(getmicrotime() - $startImportExecTime, 2), GetMessage("CICML_LOAD_TIME"))."<br>";
	$strImportOKMessage .= str_replace("#NUM#", ($STT_CATALOG_UPDATE + $STT_CATALOG_ADD), GetMessage("CICML_LOAD_CATALOG"))." ";
	$strImportOKMessage .= str_replace("#NUM_UPD#", $STT_CATALOG_UPDATE, str_replace("#NUM_NEW#", $STT_CATALOG_ADD, GetMessage("CICML_LOAD_NEW_UPD")))." ";

	if (IntVal($STT_CATALOG_ERROR) > 0)
		$strImportOKMessage .= str_replace("#NUM#", $STT_CATALOG_ERROR, GetMessage("CICML_LOAD_ERROR"));
	$strImportOKMessage .= "<br>";

	$strImportOKMessage .= str_replace("#NUM#", ($STT_GROUP_UPDATE + $STT_GROUP_ADD), GetMessage("CICML_LOAD_GROUP"))." ";
	$strImportOKMessage .= str_replace("#NUM_UPD#", $STT_GROUP_UPDATE, str_replace("#NUM_NEW#", $STT_GROUP_ADD, GetMessage("CICML_LOAD_GROUP_NEW_UPD")))." ";

	if (IntVal($STT_GROUP_ERROR) > 0)
		$strImportOKMessage .= str_replace("#NUM#", $STT_GROUP_ERROR, GetMessage("CICML_LOAD_GROUP_ERROR"));
	$strImportOKMessage .= "<br>";

	$strImportOKMessage .= str_replace("#NUM#", ($STT_PROP_UPDATE + $STT_PROP_ADD), GetMessage("CICML_LOAD_PROPS"))." ";
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:31,代码来源:commerceml_run.php


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