Exemplo n.º 1
0
 /**
  * @param \DDelivery\Order\DDeliveryOrder $order
  * @throws \Bitrix\Main\ArgumentException
  */
 public function onFinishChange($order)
 {
     global $APPLICATION;
     $point = $order->getPoint();
     if ($order->type == DDeliverySDK::TYPE_SELF) {
         $replaceData = array('%1' => $order->cityName, '%2' => $point['address'], '%3' => $point['delivery_company_name'], '%4' => $point['_id'], '%5' => $point['type'] == 1 ? 'Постомат' : 'ПВЗ');
         $replaceData = $APPLICATION->ConvertCharsetArray($replaceData, 'UTF-8', SITE_CHARSET);
         $comment = GetMessage('DDELIVERY_ABOUT_SELF', $replaceData);
     } else {
         if ($order->type == DDeliverySDK::TYPE_COURIER) {
             $replaceData = array('%1' => $order->getFullAddress(), '%2' => $point['delivery_company_name']);
             $replaceData = $APPLICATION->ConvertCharsetArray($replaceData, 'UTF-8', SITE_CHARSET);
             $comment = GetMessage('DDELIVERY_ABOUT_COURIER', $replaceData);
         } else {
             $comment = 'error';
         }
     }
     $orderId = $this->formData['bx_order_id'];
     $params = array('DD_ABOUT' => $comment, 'DD_LOCAL_ID' => $order->localId);
     $orderDeliveryTableData = OrderDeliveryTable::getList(array('filter' => array('ORDER_ID' => $orderId)))->fetch();
     if ($orderDeliveryTableData) {
         OrderDeliveryTable::update($orderDeliveryTableData['ID'], array('PARAMS' => serialize($params)));
     } else {
         OrderDeliveryTable::add(array('ORDER_ID' => $orderId, 'PARAMS' => serialize($params)));
     }
     $order = CSaleOrder::GetByID($orderId);
     $arDeliveryResult = CSaleDeliveryHandler::CalculateFull('ddelivery', 'ddelivery:all', $order, CSaleLang::GetLangCurrency(SITE_ID), SITE_ID);
     if ($arDeliveryResult['RESULT'] == 'OK') {
         CSaleOrder::Update($orderId, array('PRICE_DELIVERY' => $arDeliveryResult['VALUE']));
     }
 }
Exemplo n.º 2
0
 public static function DoLoadDelivery($location, $locationZip, $weight, $price, $currency, $siteId = null)
 {
     $location = intval($location);
     if ($location <= 0) {
         return null;
     }
     if ($siteId == null) {
         $siteId = SITE_ID;
     }
     $arResult = array();
     $arFilter = array("COMPABILITY" => array("WEIGHT" => $weight, "PRICE" => $price, "LOCATION_FROM" => COption::GetOptionString('sale', 'location', false, $siteId), "LOCATION_TO" => $location, "LOCATION_ZIP" => $locationZip), "SITE_ID" => $siteId);
     $dbDeliveryServices = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), $arFilter);
     while ($arDeliveryService = $dbDeliveryServices->GetNext()) {
         if (!is_array($arDeliveryService) || !is_array($arDeliveryService["PROFILES"])) {
             continue;
         }
         foreach ($arDeliveryService["PROFILES"] as $profileId => $arDeliveryProfile) {
             if ($arDeliveryProfile["ACTIVE"] != "Y") {
                 continue;
             }
             if (!array_key_exists($arDeliveryService["SID"], $arResult)) {
                 $arResult[$arDeliveryService["SID"]] = array("SID" => $arDeliveryService["SID"], "TITLE" => $arDeliveryService["NAME"], "DESCRIPTION" => $arDeliveryService["DESCRIPTION"], "PROFILES" => array());
             }
             $arResult[$arDeliveryService["SID"]]["PROFILES"][$profileId] = array("ID" => $arDeliveryService["SID"] . ":" . $profileId, "SID" => $profileId, "TITLE" => $arDeliveryProfile["TITLE"], "DESCRIPTION" => $arDeliveryProfile["DESCRIPTION"], "FIELD_NAME" => "DELIVERY_ID");
             $arDeliveryPriceTmp = CSaleDeliveryHandler::CalculateFull($arDeliveryService["SID"], $profileId, array("PRICE" => $price, "WEIGHT" => $weight, "LOCATION_FROM" => COption::GetOptionString('sale', 'location', false, $siteId), "LOCATION_TO" => $location, "LOCATION_ZIP" => $locationZip), $currency);
             if ($arDeliveryPriceTmp["RESULT"] != "ERROR") {
                 $arResult[$arDeliveryService["SID"]]["PROFILES"][$profileId]["DELIVERY_PRICE"] = roundEx($arDeliveryPriceTmp["VALUE"], SALE_VALUE_PRECISION);
                 $arResult[$arDeliveryService["SID"]]["PROFILES"][$profileId]["CURRENCY"] = $currency;
             }
         }
     }
     $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("LID" => $siteId, "+<=WEIGHT_FROM" => $weight, "+>=WEIGHT_TO" => $weight, "+<=ORDER_PRICE_FROM" => $price, "+>=ORDER_PRICE_TO" => $price, "ACTIVE" => "Y", "LOCATION" => $location));
     while ($arDelivery = $dbDelivery->GetNext()) {
         $arDeliveryDescription = CSaleDelivery::GetByID($arDelivery["ID"]);
         $arDelivery["DESCRIPTION"] = $arDeliveryDescription["DESCRIPTION"];
         $arDelivery["FIELD_NAME"] = "DELIVERY_ID";
         if (intval($arDelivery["PERIOD_FROM"]) > 0 || intval($arDelivery["PERIOD_TO"]) > 0) {
             $arDelivery["PERIOD_TEXT"] = GetMessage("SALE_DELIV_PERIOD");
             if (intval($arDelivery["PERIOD_FROM"]) > 0) {
                 $arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_FROM") . " " . intval($arDelivery["PERIOD_FROM"]);
             }
             if (intval($arDelivery["PERIOD_TO"]) > 0) {
                 $arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_TO") . " " . intval($arDelivery["PERIOD_TO"]);
             }
             if ($arDelivery["PERIOD_TYPE"] == "H") {
                 $arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_HOUR") . " ";
             } elseif ($arDelivery["PERIOD_TYPE"] == "M") {
                 $arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_MONTH") . " ";
             } else {
                 $arDelivery["PERIOD_TEXT"] .= " " . GetMessage("SOA_DAY") . " ";
             }
         }
         $arResult[] = $arDelivery;
     }
     return $arResult;
 }
Exemplo n.º 3
0
 function Compability($arOrder, $arConfig)
 {
     $result = array();
     $aviableBoxes = CSaleDeliveryHelper::getBoxesFromConfig('distant_inner', $arConfig);
     foreach ($aviableBoxes as $arBox) {
         if (CSaleDeliveryHandler::checkDimensions($arOrder["MAX_DIMENSIONS"], $arBox["DIMENSIONS"])) {
             $result = array('distant_inner');
             break;
         }
     }
     return $result;
 }
Exemplo n.º 4
0
 function Compability($arOrder, $arConfig)
 {
     if (floatval($arOrder["WEIGHT"]) <= self::$MAX_WEIGHT) {
         $profiles = array('ware', 'door');
     } else {
         $profiles = array();
     }
     $arRes = array();
     foreach ($profiles as $profile) {
         $aviableBoxes = CSaleDeliveryHelper::getBoxesFromConfig($profile, $arConfig);
         foreach ($aviableBoxes as $arBox) {
             if (CSaleDeliveryHandler::checkDimensions($arOrder["MAX_DIMENSIONS"], $arBox["DIMENSIONS"])) {
                 $arRes[] = $profile;
                 break;
             }
         }
     }
     return $arRes;
 }
Exemplo n.º 5
0
 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     if (is_set($arFields, "SITE_ID") && strlen($arFields["SITE_ID"]) > 0) {
         $arFields["LID"] = $arFields["SITE_ID"];
     }
     if ((is_set($arFields, "LID") || $ACTION == "ADD") && strlen($arFields["LID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_SITE"), "EMPTY_SITE_ID");
         return false;
     }
     if ((is_set($arFields, "PERSON_TYPE_ID") || $ACTION == "ADD") && IntVal($arFields["PERSON_TYPE_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_PERS_TYPE"), "EMPTY_PERSON_TYPE_ID");
         return false;
     }
     if ((is_set($arFields, "USER_ID") || $ACTION == "ADD") && IntVal($arFields["USER_ID"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_USER_ID"), "EMPTY_USER_ID");
         return false;
     }
     if (is_set($arFields, "PAYED") && $arFields["PAYED"] != "Y") {
         $arFields["PAYED"] = "N";
     }
     if (is_set($arFields, "CANCELED") && $arFields["CANCELED"] != "Y") {
         $arFields["CANCELED"] = "N";
     }
     if (is_set($arFields, "STATUS_ID") && strlen($arFields["STATUS_ID"]) <= 0) {
         $arFields["STATUS_ID"] = "N";
     }
     if (is_set($arFields, "ALLOW_DELIVERY") && $arFields["ALLOW_DELIVERY"] != "Y") {
         $arFields["ALLOW_DELIVERY"] = "N";
     }
     if (is_set($arFields, "PRICE") || $ACTION == "ADD") {
         $arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
         $arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
     }
     if (is_set($arFields, "PRICE_DELIVERY") || $ACTION == "ADD") {
         $arFields["PRICE_DELIVERY"] = str_replace(",", ".", $arFields["PRICE_DELIVERY"]);
         $arFields["PRICE_DELIVERY"] = DoubleVal($arFields["PRICE_DELIVERY"]);
     }
     if (is_set($arFields, "SUM_PAID") || $ACTION == "ADD") {
         $arFields["SUM_PAID"] = str_replace(",", ".", $arFields["SUM_PAID"]);
         $arFields["SUM_PAID"] = DoubleVal($arFields["SUM_PAID"]);
     }
     if (is_set($arFields, "DISCOUNT_VALUE") || $ACTION == "ADD") {
         $arFields["DISCOUNT_VALUE"] = str_replace(",", ".", $arFields["DISCOUNT_VALUE"]);
         $arFields["DISCOUNT_VALUE"] = DoubleVal($arFields["DISCOUNT_VALUE"]);
     }
     if (is_set($arFields, "TAX_VALUE") || $ACTION == "ADD") {
         $arFields["TAX_VALUE"] = str_replace(",", ".", $arFields["TAX_VALUE"]);
         $arFields["TAX_VALUE"] = DoubleVal($arFields["TAX_VALUE"]);
     }
     if (!is_set($arFields, "LOCKED_BY") && (!is_set($arFields, "UPDATED_1C") || is_set($arFields, "UPDATED_1C") && $arFields["UPDATED_1C"] != "Y")) {
         $arFields["UPDATED_1C"] = "N";
     }
     if ((is_set($arFields, "CURRENCY") || $ACTION == "ADD") && strlen($arFields["CURRENCY"]) <= 0) {
         $GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
         return false;
     }
     if (is_set($arFields, "CURRENCY")) {
         if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGO_WRONG_CURRENCY")), "ERROR_NO_CURRENCY");
             return false;
         }
     }
     if (is_set($arFields, "LID")) {
         $dbSite = CSite::GetByID($arFields["LID"]);
         if (!$dbSite->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGO_WRONG_SITE")), "ERROR_NO_SITE");
             return false;
         }
     }
     if (is_set($arFields, "USER_ID")) {
         $dbUser = CUser::GetByID($arFields["USER_ID"]);
         if (!$dbUser->Fetch()) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGO_WRONG_USER")), "ERROR_NO_USER_ID");
             return false;
         }
     }
     if (is_set($arFields, "PERSON_TYPE_ID")) {
         if (!($arPersonType = CSalePersonType::GetByID($arFields["PERSON_TYPE_ID"]))) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERSON_TYPE_ID"], GetMessage("SKGO_WRONG_PERSON_TYPE")), "ERROR_NO_PERSON_TYPE");
             return false;
         }
     }
     if (is_set($arFields, "PAY_SYSTEM_ID") && IntVal($arFields["PAY_SYSTEM_ID"]) > 0) {
         if (!($arPaySystem = CSalePaySystem::GetByID(IntVal($arFields["PAY_SYSTEM_ID"])))) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PAY_SYSTEM_ID"], GetMessage("SKGO_WRONG_PS")), "ERROR_NO_PAY_SYSTEM");
             return false;
         }
     }
     if (is_set($arFields, "DELIVERY_ID") && (strpos($arFields["DELIVERY_ID"], ":") !== false || IntVal($arFields["DELIVERY_ID"]) > 0)) {
         if (strpos($arFields["DELIVERY_ID"], ":") !== false) {
             $arId = explode(":", $arFields["DELIVERY_ID"]);
             $obDelivery = new CSaleDeliveryHandler();
             if ($arDelivery = $obDelivery->GetBySID($arId[0])) {
                 if ($arDelivery = $arDelivery->Fetch()) {
                     if (!is_set($arDelivery["PROFILES"], $arId[1])) {
                         $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
                         return false;
                     }
                 }
             } else {
                 $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
                 return false;
             }
         } else {
             if (!($arDelivery = CSaleDelivery::GetByID(IntVal($arFields["DELIVERY_ID"])))) {
                 $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
                 return false;
             }
         }
     }
     if (is_set($arFields, "STATUS_ID")) {
         if (!($arStatus = CSaleStatus::GetByID($arFields["STATUS_ID"]))) {
             $GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["STATUS_ID"], GetMessage("SKGO_WRONG_STATUS")), "ERROR_NO_STATUS_ID");
             return false;
         }
     }
     return True;
 }
Exemplo n.º 6
0
						"LOCATION_ZIP" => $locationZip,
						"ITEMS" => $arBasketItems
					);


					$depList = \Bitrix\Sale\Delivery\OrderDeliveryTable::getList(array(
						'filter'=>array('=ORDER_ID' => $ID),
					));

					if($dep = $depList->fetch())
					{
						$arDeliveryOrder["EXTRA_PARAMS"] = unserialize($dep["PARAMS"]);
					}

					$arPacks = CSaleDeliveryHelper::getBoxesFromConfig($profileId, $arDeliveryData["CONFIG"]["CONFIG"]);
					$arDeliveryResult = CSaleDeliveryHandler::CalculateFull($arDeliveryData["SID"], $profileId, $arDeliveryOrder, $arOrder["CURRENCY"], $LID);
					$delDiscountDiff = roundEx($arDeliveryResult["VALUE"] - $arOrder["PRICE_DELIVERY"], SALE_VALUE_PRECISION);

					$tabControl->BeginCustomField("ORDER_DELIVERY_ADDITIONAL_INFO", "");

					if (!empty($arPacks)):
						$arBox = array_shift(array_values($arPacks));
					?>
						<tr>
							<td width="40%"></td>
							<td width="60%">
								<a class="dashed-link" href="javascript:void(0);" onclick="fToggleDeliveryInfo();"><?php 
echo GetMessage("SOD_SHOW_DELIVERY_ADDITIONAL_INFO");
?>
</a></td>
							</td>
Exemplo n.º 7
0
 foreach ($arDeliveryServiceAll as $arDeliveryService) {
     foreach ($arDeliveryService["PROFILES"] as $profile_id => $arDeliveryProfile) {
         if ($arDeliveryProfile["ACTIVE"] == "Y" && (count($arP2D[$arUserResult["PAY_SYSTEM_ID"]]) <= 0 || in_array($arDeliveryService["SID"], $arP2D[$arUserResult["PAY_SYSTEM_ID"]]) || empty($arD2P[$arDeliveryService["SID"]]))) {
             $delivery_id = $arDeliveryService["SID"];
             $arProfile = array("SID" => $profile_id, "TITLE" => $arDeliveryProfile["TITLE"], "DESCRIPTION" => $arDeliveryProfile["DESCRIPTION"], "FIELD_NAME" => "DELIVERY_ID");
             if (strlen($arUserResult["DELIVERY_ID"]) > 0 && $arUserResult["DELIVERY_ID"] == $delivery_id . ":" . $profile_id) {
                 $arProfile["CHECKED"] = "Y";
                 $arUserResult["DELIVERY_ID"] = $delivery_id . ":" . $profile_id;
                 $bSelected = true;
                 $arOrderTmpDel = array("PRICE" => $arResult["ORDER_PRICE"], "WEIGHT" => $arResult["ORDER_WEIGHT"], "DIMENSIONS" => $arResult["ORDER_DIMENSIONS"], "LOCATION_FROM" => COption::GetOptionInt('sale', 'location'), "LOCATION_TO" => $arUserResult["DELIVERY_LOCATION"], "LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"], "ITEMS" => $arResult["BASKET_ITEMS"], "EXTRA_PARAMS" => $arResult["DELIVERY_EXTRA"]);
                 $arDeliveryPrice = CSaleDeliveryHandler::CalculateFull($delivery_id, $profile_id, $arOrderTmpDel, $arResult["BASE_LANG_CURRENCY"]);
             }
             if (empty($arResult["DELIVERY"][$delivery_id])) {
                 $arResult["DELIVERY"][$delivery_id] = array("SID" => $delivery_id, "SORT" => $arDeliveryService["SORT"], "TITLE" => $arDeliveryService["NAME"], "DESCRIPTION" => $arDeliveryService["DESCRIPTION"], "PROFILES" => array());
             }
             $arDeliveryExtraParams = CSaleDeliveryHandler::GetHandlerExtraParams($delivery_id, $profile_id, $arOrderTmpDel, SITE_ID);
             if (!empty($arDeliveryExtraParams)) {
                 $_SESSION["SALE_DELIVERY_EXTRA_PARAMS"][$delivery_id . ":" . $profile_id] = $arDeliveryExtraParams;
                 $arResult["DELIVERY"][$delivery_id]["ISNEEDEXTRAINFO"] = "Y";
             } else {
                 $arResult["DELIVERY"][$delivery_id]["ISNEEDEXTRAINFO"] = "N";
             }
             if ($arDeliveryPrice["RESULT"] == "ERROR") {
                 $arResult["ERROR"][] = $arDeliveryPrice["TEXT"];
             } else {
                 $arResult["DELIVERY_PRICE"] = roundEx($arDeliveryPrice["VALUE"], SALE_VALUE_PRECISION);
                 $arResult["PACKS_COUNT"] = $arDeliveryPrice["PACKS_COUNT"];
             }
             if (!empty($arUserResult["DELIVERY_ID"]) && strpos($arUserResult["DELIVERY_ID"], ":") !== false) {
                 if ($arUserResult["DELIVERY_ID"] == $delivery_id . ":" . $profile_id) {
                     $bFound = true;
Exemplo n.º 8
0
    function ShowStep()
    {
        $wizard =& $this->GetWizard();
        $shopLocalization = $wizard->GetVar("shopLocalization", true);
        $personType = $wizard->GetVar("personType");
        $arAutoDeliveries = array();
        if (CModule::IncludeModule("sale")) {
            $dbDelivery = CSaleDeliveryHandler::GetList();
            while ($arDelivery = $dbDelivery->Fetch()) {
                $arAutoDeliveries[$arDelivery["SID"]] = $arDelivery["ACTIVE"];
            }
        }
        $siteID = WizardServices::GetCurrentSiteID($wizard->GetVar("siteID"));
        $this->content .= '<div class="wizard-input-form">';
        $this->content .= '
		<div class="wizard-input-form-block">
			<div class="wizard-catalog-title">' . GetMessage("WIZ_PAY_SYSTEM_TITLE") . '</div>
			<div>
				<div class="wizard-input-form-field wizard-input-form-field-checkbox">
					<div class="wizard-catalog-form-item">
						' . $this->ShowCheckboxField('paysystem[cash]', 'Y', array("id" => "paysystemC")) . ' <label for="paysystemC">' . GetMessage("WIZ_PAY_SYSTEM_C") . '</label>
					</div>';
        if (LANGUAGE_ID == "ru") {
            if ($shopLocalization == "ua" && ($personType["fiz"] == "Y" || $personType["fiz_ua"] == "Y")) {
                $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[oshad]', 'Y', array("id" => "paysystemO")) . ' <label for="paysystemS">' . GetMessage("WIZ_PAY_SYSTEM_O") . '</label>
							</div>';
            }
            if ($shopLocalization == "ru") {
                if ($personType["fiz"] == "Y") {
                    $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[sber]', 'Y', array("id" => "paysystemS")) . ' <label for="paysystemS">' . GetMessage("WIZ_PAY_SYSTEM_S") . '</label>
								</div>';
                }
                if ($personType["fiz"] == "Y" || $personType["ur"] == "Y") {
                    $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[collect]', 'Y', array("id" => "paysystemCOL")) . ' <label for="paysystemCOL">' . GetMessage("WIZ_PAY_SYSTEM_COL") . '</label>
								</div>';
                }
            }
            if ($personType["ur"] == "Y") {
                $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[bill]', 'Y', array("id" => "paysystemB")) . ' <label for="paysystemB">';
                if ($shopLocalization == "ua") {
                    $this->content .= GetMessage("WIZ_PAY_SYSTEM_B_UA");
                } else {
                    $this->content .= GetMessage("WIZ_PAY_SYSTEM_B");
                }
                $this->content .= '</label>
							</div>';
            }
        } else {
            $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('paysystem[paypal]', 'Y', array("id" => "paysystemP")) . ' <label for="paysystemP">PayPal</label>
						</div>';
        }
        $this->content .= '</div>
			</div>
			<div class="wizard-catalog-form-item">' . GetMessage("WIZ_PAY_SYSTEM") . '</div>
		</div>';
        if (LANGUAGE_ID != "ru" || LANGUAGE_ID == "ru" && (COption::GetOptionString("youstore", "wizard_installed", "N", $siteID) != "Y" || $shopLocalization == "ru" && ($arAutoDeliveries["russianpost"] != "Y" || $arAutoDeliveries["rus_post"] != "Y" || $arAutoDeliveries["rus_post_first"] != "Y") || $shopLocalization == "ua" && $arAutoDeliveries["ua_post"] != "Y" || $shopLocalization == "kz" && $arAutoDeliveries["kaz_post"] != "Y")) {
            $this->content .= '
			<div class="wizard-input-form-block">
				<div class="wizard-catalog-title">' . GetMessage("WIZ_DELIVERY_TITLE") . '</div>
				<div>
					<div class="wizard-input-form-field wizard-input-form-field-checkbox">';
            if (COption::GetOptionString("youstore", "wizard_installed", "N", $siteID) != "Y") {
                $this->content .= '<div class="wizard-catalog-form-item">
								' . $this->ShowCheckboxField('delivery[courier]', 'Y', array("id" => "deliveryC")) . ' <label for="deliveryC">' . GetMessage("WIZ_DELIVERY_C") . '</label>
							</div>
							<div class="wizard-catalog-form-item">
								' . $this->ShowCheckboxField('delivery[self]', 'Y', array("id" => "deliveryS")) . ' <label for="deliveryS">' . GetMessage("WIZ_DELIVERY_S") . '</label>
							</div>';
            }
            if (LANGUAGE_ID == "ru") {
                if ($shopLocalization == "ru") {
                    if ($arAutoDeliveries["russianpost"] != "Y") {
                        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[russianpost]', 'Y', array("id" => "deliveryR")) . ' <label for="deliveryR">' . GetMessage("WIZ_DELIVERY_R") . '</label>
										</div>';
                    }
                    if ($arAutoDeliveries["rus_post"] != "Y") {
                        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[rus_post]', 'Y', array("id" => "deliveryR2")) . ' <label for="deliveryR2">' . GetMessage("WIZ_DELIVERY_R2") . '</label>
										</div>';
                    }
                    if ($arAutoDeliveries["rus_post_first"] != "Y") {
                        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[rus_post_first]', 'Y', array("id" => "deliveryRF")) . ' <label for="deliveryRF">' . GetMessage("WIZ_DELIVERY_RF") . '</label>
										</div>';
                    }
                } elseif ($shopLocalization == "ua") {
                    if ($arAutoDeliveries["ua_post"] != "Y") {
                        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[ua_post]', 'Y', array("id" => "deliveryU")) . ' <label for="deliveryU">' . GetMessage("WIZ_DELIVERY_UA") . '</label>
										</div>';
                    }
                } elseif ($shopLocalization == "kz") {
                    if ($arAutoDeliveries["kaz_post"] != "Y") {
                        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[kaz_post]', 'Y', array("id" => "deliveryK")) . ' <label for="deliveryK">' . GetMessage("WIZ_DELIVERY_KZ") . '</label>
										</div>';
                    }
                }
            } else {
                $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[dhl]', 'Y', array("id" => "deliveryD")) . ' <label for="deliveryD">DHL</label>
								</div>';
                $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowCheckboxField('delivery[ups]', 'Y', array("id" => "deliveryU")) . ' <label for="deliveryU">UPS</label>
								</div>';
            }
            $this->content .= '
					</div>
				</div>
				<div class="wizard-catalog-form-item">' . GetMessage("WIZ_DELIVERY") . '</div>
			</div>';
        }
        $this->content .= '
		<div>
			<div class="wizard-catalog-title">' . GetMessage("WIZ_LOCATION_TITLE") . '</div>
			<div>
				<div class="wizard-input-form-field wizard-input-form-field-checkbox">';
        if (in_array(LANGUAGE_ID, array("ru", "ua"))) {
            $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowRadioField("locations_csv", "loc_ussr.csv", array("id" => "loc_ussr", "checked" => "checked")) . " <label for=\"loc_ussr\">" . GetMessage('WSL_STEP2_GFILE_USSR') . "</label>\r\n\t\t\t\t</div>";
            $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowRadioField("locations_csv", "loc_ua.csv", array("id" => "loc_ua")) . " <label for=\"loc_ua\">" . GetMessage('WSL_STEP2_GFILE_UA') . "</label>\r\n\t\t\t\t</div>";
            $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowRadioField("locations_csv", "loc_kz.csv", array("id" => "loc_kz")) . " <label for=\"loc_kz\">" . GetMessage('WSL_STEP2_GFILE_KZ') . "</label>\r\n\t\t\t\t</div>";
        }
        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowRadioField("locations_csv", "loc_usa.csv", array("id" => "loc_usa")) . " <label for=\"loc_usa\">" . GetMessage('WSL_STEP2_GFILE_USA') . "</label>\r\n\t\t\t</div>";
        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowRadioField("locations_csv", "loc_cntr.csv", array("id" => "loc_cntr")) . " <label for=\"loc_cntr\">" . GetMessage('WSL_STEP2_GFILE_CNTR') . "</label>\r\n\t\t\t</div>";
        $this->content .= '<div class="wizard-catalog-form-item">' . $this->ShowRadioField("locations_csv", "", array("id" => "none")) . " <label for=\"none\">" . GetMessage('WSL_STEP2_GFILE_NONE') . "</label>\r\n\t\t\t</div>";
        $this->content .= '
				</div>
			</div>
		</div>';
        $this->content .= '<div class="wizard-catalog-form-item">' . GetMessage("WIZ_DELIVERY_HINT") . '</div>';
        $this->content .= '</div>';
    }
Exemplo n.º 9
0
        if (isset($order['summ']) === false || $order['summ'] <= 0) {
            $order['summ'] = $arFields['PRICE'] - $arFields['PRICE_DELIVERY'];
        }

        $wasCanaceled = $arFields['CANCELED'] == 'Y' ? true : false;

        if (isset($optionsDelivTypes[$order['delivery']['code']])) {
            $resultDeliveryTypeId = $optionsDelivTypes[$order['delivery']['code']];
        } else {
            $resultDeliveryTypeId = isset($order['delivery']['service']) && isset($order['delivery']['service']['code']) ?
                                        reset(explode(":", $arFields['DELIVERY_ID'], 1)) :
                                        $arFields['DELIVERY_ID'];
        }

        if(isset($order['delivery']['service']) && isset($order['delivery']['service']['code'])) {
            $deliveryHandler = reset(CSaleDeliveryHandler::GetBySID($resultDeliveryTypeId)->arResult);
            if (count($deliveryHandler) > 0 && array_key_exists($order['delivery']['service']['code'], $deliveryHandler['PROFILES'])) {
                $resultDeliveryTypeId = $resultDeliveryTypeId . ':' . $order['delivery']['service']['code'];
            }
        }

        // orderUpdate
        $arFields = ICrmOrderActions::clearArr(array(
            'PRICE_DELIVERY'   => $order['delivery']['cost'],
            'PRICE'            => $order['summ'] + (double) $order['delivery']['cost'],
            'DATE_MARKED'      => $order['markDatetime'],
            'USER_ID'          => $userId,
            'PAY_SYSTEM_ID'    => $optionsPayTypes[$order['paymentType']],
            'DELIVERY_ID'      => $resultDeliveryTypeId,
            'STATUS_ID'        => $optionsPayStatuses[$order['status']],
            'REASON_CANCELED'  => ICrmOrderActions::fromJSON($order['statusComment']),
Exemplo n.º 10
0
 public function getDeliveryOptions($locationId = null, $from = null)
 {
     if (empty($locationId)) {
         $locationId = $this->getLocationId();
     }
     if (empty($locationId)) {
         throw new \Exception('Для получения служб доставки нужно указать место доставки ' . __METHOD__);
     }
     $filter = array('COMPABILITY' => array('WEIGHT' => $this->getWeight(), 'PRICE' => $this->getTotal(), 'LOCATION_FROM' => !empty($from) ? $from : \COption::GetOptionString('sale', 'location', false, SITE_ID), 'LOCATION_TO' => $locationId, 'ITEMS' => $this->getItemsRaw()));
     $delivery = array();
     $res = \CSaleDeliveryHandler::GetList(array('SORT' => 'ASC'), $filter);
     while ($deliveryItem = $res->Fetch()) {
         if (!is_array($deliveryItem) || !is_array($deliveryItem['PROFILES'])) {
             continue;
         }
         foreach ($deliveryItem['PROFILES'] as $key => $profile) {
             $deliveryProfile = array('ID' => $deliveryItem['SID'] . ':' . $key, 'SID' => $deliveryItem['SID'], 'PROFILE' => $key, 'NAME' => $deliveryItem['NAME'], 'TITLE' => $profile['TITLE'], 'DESCRIPTION' => $deliveryItem['DESCRIPTION'], 'DESCRIPTION_INNER' => $deliveryItem['DESCRIPTION_INNER'], 'BASE_CURRENCY' => $deliveryItem['BASE_CURRENCY'], 'HANDLER' => $deliveryItem['HANDLER'], 'DELIVERY' => $deliveryItem);
             $delivery[] = $deliveryProfile;
         }
     }
     $res = \CSaleDelivery::GetList(array('SORT' => 'ASC', 'NAME' => 'ASC'), array('LID' => SITE_ID, '+<=WEIGHT_FROM' => $this->getWeight(), '+>=WEIGHT_TO' => $this->getWeight(), 'ACTIVE' => 'Y', 'LOCATION' => $locationId));
     while ($deliveryItem = $res->Fetch()) {
         $deliveryDescription = \CSaleDelivery::GetByID($deliveryItem['ID']);
         $deliveryItem['DESCRIPTION'] = htmlspecialcharsbx($deliveryDescription['DESCRIPTION']);
         $delivery[] = $deliveryItem;
     }
     foreach ($delivery as $k => $deliveryItem) {
         if ($deliveryItem['NAME'] == 'Самовывоз') {
             continue;
         }
         if (empty($deliveryItem['SID'])) {
             continue;
         }
         /**
          * TODO
          * dimensions
          */
         $arOrderTmpDel = array('PRICE' => $this->getTotal(), 'WEIGHT' => $this->getWeight() / 1000, 'DIMENSIONS' => array(10, 10, 10), 'LOCATION_FROM' => COption::GetOptionInt('sale', 'location'), 'LOCATION_TO' => $locationId, 'ITEMS' => $this->getItemsRaw());
         $price = \CSaleDeliveryHandler::CalculateFull($deliveryItem['SID'], $deliveryItem['PROFILE'], $arOrderTmpDel, 'RUB');
         $delivery[$k]['PRICE'] = $price['VALUE'];
     }
     return $delivery;
 }
Exemplo n.º 11
0
			if ($saleModulePermissions >= "W")
				$fieldValue .= "</a>";

			$fieldValue .= "] ".$LOCAL_PAY_SYSTEM_CACHE[$arOrder["PAY_SYSTEM_ID"]];
		}
	}
	$row->AddField("PAY_SYSTEM", $fieldValue);

	$fieldValue = "";
	if (in_array("DELIVERY", $arVisibleColumns))
	{
		if (strpos($arOrder["DELIVERY_ID"], ":") !== false)
		{
			if (!isset($obDelivery))
			{
				$obDelivery = new CSaleDeliveryHandler();
				$obDelivery->GetList(array("SITE_ID" => "ASC"), array("SITE_ID" => "ALL", "ACTIVE" => "ALL"));
			}

			$arId = explode(":", $arOrder["DELIVERY_ID"]);

			$rsDelivery = CSaleDeliveryHandler::GetBySID($arId[0]);
			$arDelivery = $rsDelivery->Fetch();

			$fieldValue .= "[";
			if ($saleModulePermissions >= "W")
				$fieldValue .= '<a href="/bitrix/admin/sale_delivery_handler_edit.php?SID='.$arId[0].'&lang='.LANGUAGE_ID.'">';
			$fieldValue .= $arOrder["DELIVERY_ID"];
			if ($saleModulePermissions >= "W")
				$fieldValue .= "</a>";
Exemplo n.º 12
0
	function CheckFields($ACTION, &$arFields, $ID = 0)
	{
		global $USER_FIELD_MANAGER, $DB;

		if (is_set($arFields, "SITE_ID") && strlen($arFields["SITE_ID"]) > 0)
			$arFields["LID"] = $arFields["SITE_ID"];

		if ((is_set($arFields, "LID") || $ACTION=="ADD") && strlen($arFields["LID"])<=0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_SITE"), "EMPTY_SITE_ID");
			return false;
		}
		if ((is_set($arFields, "PERSON_TYPE_ID") || $ACTION=="ADD") && IntVal($arFields["PERSON_TYPE_ID"])<=0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_PERS_TYPE"), "EMPTY_PERSON_TYPE_ID");
			return false;
		}
		if ((is_set($arFields, "USER_ID") || $ACTION=="ADD") && IntVal($arFields["USER_ID"])<=0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_USER_ID"), "EMPTY_USER_ID");
			return false;
		}

		if (is_set($arFields, "PAYED") && $arFields["PAYED"]!="Y")
			$arFields["PAYED"]="N";
		if (is_set($arFields, "CANCELED") && $arFields["CANCELED"]!="Y")
			$arFields["CANCELED"]="N";
		if (is_set($arFields, "STATUS_ID") && strlen($arFields["STATUS_ID"])<=0)
			$arFields["STATUS_ID"]="N";
		if (is_set($arFields, "ALLOW_DELIVERY") && $arFields["ALLOW_DELIVERY"]!="Y")
			$arFields["ALLOW_DELIVERY"]="N";
		if (is_set($arFields, "EXTERNAL_ORDER") && $arFields["EXTERNAL_ORDER"]!="Y")
			$arFields["EXTERNAL_ORDER"]="N";

		if (is_set($arFields, "PRICE") || $ACTION=="ADD")
		{
			$arFields["PRICE"] = str_replace(",", ".", $arFields["PRICE"]);
			$arFields["PRICE"] = DoubleVal($arFields["PRICE"]);
		}
		if (is_set($arFields, "PRICE_DELIVERY") || $ACTION=="ADD")
		{
			$arFields["PRICE_DELIVERY"] = str_replace(",", ".", $arFields["PRICE_DELIVERY"]);
			$arFields["PRICE_DELIVERY"] = DoubleVal($arFields["PRICE_DELIVERY"]);
		}
		if (is_set($arFields, "SUM_PAID") || $ACTION=="ADD")
		{
			$arFields["SUM_PAID"] = str_replace(",", ".", $arFields["SUM_PAID"]);
			$arFields["SUM_PAID"] = DoubleVal($arFields["SUM_PAID"]);
		}
		if (is_set($arFields, "DISCOUNT_VALUE") || $ACTION=="ADD")
		{
			$arFields["DISCOUNT_VALUE"] = str_replace(",", ".", $arFields["DISCOUNT_VALUE"]);
			$arFields["DISCOUNT_VALUE"] = DoubleVal($arFields["DISCOUNT_VALUE"]);
		}
		if (is_set($arFields, "TAX_VALUE") || $ACTION=="ADD")
		{
			$arFields["TAX_VALUE"] = str_replace(",", ".", $arFields["TAX_VALUE"]);
			$arFields["TAX_VALUE"] = DoubleVal($arFields["TAX_VALUE"]);
		}

		if(!is_set($arFields, "LOCKED_BY") && (!is_set($arFields, "UPDATED_1C") || (is_set($arFields, "UPDATED_1C") && $arFields["UPDATED_1C"] != "Y")))
		{
			$arFields["UPDATED_1C"] = "N";
			$arFields["~VERSION"] = "VERSION+0+1";
		}

		if ((is_set($arFields, "CURRENCY") || $ACTION=="ADD") && strlen($arFields["CURRENCY"])<=0)
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_CURRENCY"), "EMPTY_CURRENCY");
			return false;
		}

		if (is_set($arFields, "CURRENCY"))
		{
			if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"])))
			{
				$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGO_WRONG_CURRENCY")), "ERROR_NO_CURRENCY");
				return false;
			}
		}

		if (is_set($arFields, "LID"))
		{
			$dbSite = CSite::GetByID($arFields["LID"]);
			if (!$dbSite->Fetch())
			{
				$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["LID"], GetMessage("SKGO_WRONG_SITE")), "ERROR_NO_SITE");
				return false;
			}
		}

		if (is_set($arFields, "USER_ID"))
		{
			$dbUser = CUser::GetByID($arFields["USER_ID"]);
			if (!$dbUser->Fetch())
			{
				$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["USER_ID"], GetMessage("SKGO_WRONG_USER")), "ERROR_NO_USER_ID");
				return false;
			}
		}

		if (is_set($arFields, "PERSON_TYPE_ID"))
		{
			if (!($arPersonType = CSalePersonType::GetByID($arFields["PERSON_TYPE_ID"])))
			{
				$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PERSON_TYPE_ID"], GetMessage("SKGO_WRONG_PERSON_TYPE")), "ERROR_NO_PERSON_TYPE");
				return false;
			}
		}

		if (is_set($arFields, "PAY_SYSTEM_ID") && IntVal($arFields["PAY_SYSTEM_ID"]) > 0)
		{
			if (!($arPaySystem = CSalePaySystem::GetByID(IntVal($arFields["PAY_SYSTEM_ID"]))))
			{
				$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["PAY_SYSTEM_ID"], GetMessage("SKGO_WRONG_PS")), "ERROR_NO_PAY_SYSTEM");
				return false;
			}
		}

		if (is_set($arFields, "DELIVERY_ID") && (
				strpos($arFields["DELIVERY_ID"], ":") !== false
				||
				IntVal($arFields["DELIVERY_ID"]) > 0
			)
		)
		{
			if (strpos($arFields["DELIVERY_ID"], ":") !== false)
			{
				$arId = explode(":", $arFields["DELIVERY_ID"]);
				$obDelivery = new CSaleDeliveryHandler();
				if ($arDelivery = $obDelivery->GetBySID($arId[0]))
				{
					if ($arDelivery = $arDelivery->Fetch())
					{
						if (!is_set($arDelivery["PROFILES"], $arId[1]))
						{
							$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
							return false;
						}
					}
				}
				else
				{
					$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
					return false;
				}
			}
			else
			{
				if (!($arDelivery = CSaleDelivery::GetByID(IntVal($arFields["DELIVERY_ID"]))))
				{
					$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["DELIVERY_ID"], GetMessage("SKGO_WRONG_DELIVERY")), "ERROR_NO_DELIVERY");
					return false;
				}
			}
		}

		if (is_set($arFields, "STATUS_ID"))
		{
			if (!($arStatus = CSaleStatus::GetByID($arFields["STATUS_ID"])))
			{
				$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["STATUS_ID"], GetMessage("SKGO_WRONG_STATUS")), "ERROR_NO_STATUS_ID");
				return false;
			}
		}

		if (is_set($arFields, "ACCOUNT_NUMBER") && $ACTION=="UPDATE")
		{
			if (strlen($arFields["ACCOUNT_NUMBER"]) <= 0)
			{
				$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EMPTY_ACCOUNT_NUMBER"), "EMPTY_ACCOUNT_NUMBER");
				return false;
			}
			else
			{
				$dbres = $DB->Query("SELECT ID, ACCOUNT_NUMBER FROM b_sale_order WHERE ACCOUNT_NUMBER = '".$DB->ForSql($arFields["ACCOUNT_NUMBER"])."'", true);
				if ($arRes = $dbres->GetNext())
				{
					if (is_array($arRes) && $arRes["ID"] != $ID)
					{
						$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_EXISTING_ACCOUNT_NUMBER"), "EXISTING_ACCOUNT_NUMBER");
						return false;
					}
				}
			}
		}

		if($ACTION == "ADD")
			$arFields["VERSION"] = 1;

		if (!$USER_FIELD_MANAGER->CheckFields("ORDER", $ID, $arFields))
		{
			return false;
		}

		return True;
	}
Exemplo n.º 13
0
:
				</td>
				<td width="60%">
					<select multiple="multiple" size="5" name="DELIVERY_HANDLERS[]">
						<?php 
$arDeliveryId = array();
$arDeliverySid = array();
$dbRes = CSaleDelivery2PaySystem::GetList(array("PAYSYSTEM_ID" => $ID));
while ($arRes = $dbRes->Fetch()) {
    $deliveryId = $arRes["DELIVERY_ID"];
    if (isset($arRes["DELIVERY_PROFILE_ID"]) && strlen($arRes["DELIVERY_PROFILE_ID"]) > 0) {
        $deliveryId .= ":" . $arRes["DELIVERY_PROFILE_ID"];
    }
    $arDeliveryId[] = $deliveryId;
}
$rsDeliveryServicesList = CSaleDeliveryHandler::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array());
$arDeliveryServicesList = array();
while ($arDeliveryService = $rsDeliveryServicesList->Fetch()) {
    if (!is_array($arDeliveryService) || !is_array($arDeliveryService["PROFILES"])) {
        continue;
    }
    foreach ($arDeliveryService["PROFILES"] as $profile_id => $arDeliveryProfile) {
        $delivery_id = $arDeliveryService["SID"] . ":" . $profile_id;
        ?>
<option
											value="<?php 
        echo htmlspecialcharsbx($delivery_id);
        ?>
"
											<?php 
        if (is_array($arDeliveryId) && (in_array($delivery_id, $arDeliveryId) || in_array($arDeliveryService["SID"], $arDeliveryId) || empty($arDeliveryId))) {
Exemplo n.º 14
0
 public static function execHandlerAction($orderId, $actionId)
 {
     global $DB, $USER;
     $arResult = array();
     $arOrder = CSaleOrder::GetById($orderId);
     $handlerActions = CSaleDeliveryHandler::getActionsList($arOrder["DELIVERY_ID"]);
     if (!array_key_exists($actionId, $handlerActions)) {
         $arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_HAS_NO_ACTION"));
     }
     $dt = new \Bitrix\Main\Type\DateTime();
     $depList = \Bitrix\Sale\Internals\OrderDeliveryReqTable::getList(array('filter' => array('=ORDER_ID' => $orderId)));
     $dep = $depList->fetch();
     if ($dep && !is_null($dep["DATE_REQUEST"])) {
         $arResult = array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DHLP_HANDLER_REQUEST_ALREADY_SENT"));
     }
     if (empty($arResult)) {
         $arUserGroups = $USER->GetUserGroupArray();
         $arOrder["ITEMS"] = array();
         $dbItemsList = CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $orderId));
         while ($arItem = $dbItemsList->GetNext()) {
             $arItem["DIMENSIONS"] = unserialize($arItem["~DIMENSIONS"]);
             unset($arItem["~DIMENSIONS"]);
             $arOrder["ITEMS"][] = $arItem;
         }
         $arResult = CSaleDeliveryHandler::executeAction($arOrder["DELIVERY_ID"], $actionId, $arOrder);
         if ($actionId == "REQUEST_SELF" && isset($arResult["TRACKING_NUMBER"])) {
             $bUserCanEditOrder = CSaleOrder::CanUserUpdateOrder($orderId, $arUserGroups);
             if ($bUserCanEditOrder) {
                 if ($dep) {
                     \Bitrix\Sale\Internals\OrderDeliveryReqTable::update($dep["ID"], array("DATE_REQUEST" => $dt));
                 } else {
                     \Bitrix\Sale\Internals\OrderDeliveryReqTable::add(array("ORDER_ID" => $orderId, "DATE_REQUEST" => $dt));
                 }
                 $fields = array();
                 if (isset($arResult["TRACKING_NUMBER"])) {
                     $fields["TRACKING_NUMBER"] = $arResult["TRACKING_NUMBER"];
                 }
                 if (isset($arResult["DELIVERY_DOC_NUM"])) {
                     $fields["DELIVERY_DOC_NUM"] = $arResult["DELIVERY_DOC_NUM"];
                     $fields["DELIVERY_DOC_DATE"] = Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", $arOrder["LID"])));
                 }
                 CSaleOrder::Update($orderId, $fields);
             }
         }
         CSaleOrderChange::AddRecord($orderId, "ORDER_DELIVERY_REQUEST_SENT", $arResult);
     }
     return $arResult;
 }
Exemplo n.º 15
0
 public static function FormatOrderDeliverySystemChanged($arData)
 {
     $info = GetMessage("SOC_ORDER_DELIVERY_SYSTEM_CHANGED_INFO");
     foreach ($arData as $param => $value) {
         if ($param == "DELIVERY_ID") {
             if (strpos($value, ":") !== false) {
                 $arId = explode(":", $value);
                 $dbDelivery = CSaleDeliveryHandler::GetBySID($arId[0]);
                 $arDelivery = $dbDelivery->Fetch();
                 $value = "\"" . htmlspecialcharsEx($arDelivery["NAME"]) . "\"";
             } elseif (intval($value) > 0) {
                 $arDelivery = CSaleDelivery::GetByID($value);
                 $value = "\"" . $arDelivery["NAME"] . "\"";
             }
         }
         $info = str_replace("#" . $param . "#", $value, $info);
     }
     return array("NAME" => GetMessage("SOC_ORDER_DELIVERY_SYSTEM_CHANGED"), "INFO" => $info);
 }
Exemplo n.º 16
0
 public static function getActionsList()
 {
     $actions = CSaleDeliveryHandler::getActionsNames();
     return array("REQUEST_SELF" => $actions["REQUEST_SELF"]);
 }
Exemplo n.º 17
0
									$arResult["DELIVERY"][$k]["PROFILES"][$kk]["CHECKED"] = "Y";
									$arUserResult["DELIVERY_ID"] = $k.":".$kk;
									$bf = false;

									$arOrderTmpDel = array(
										"PRICE" => $arResult["ORDER_PRICE"],
										"WEIGHT" => $arResult["ORDER_WEIGHT"],
										"DIMENSIONS" => $arResult["ORDER_DIMENSIONS"],
										"LOCATION_FROM" => COption::GetOptionInt('sale', 'location'),
										"LOCATION_TO" => $arUserResult["DELIVERY_LOCATION"],
										"LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"],
										"ITEMS" => $arResult["BASKET_ITEMS"],
										"EXTRA_PARAMS" => $arResult["DELIVERY_EXTRA"]
									);

									$arDeliveryPrice = CSaleDeliveryHandler::CalculateFull($k, $kk, $arOrderTmpDel, $arResult["BASE_LANG_CURRENCY"]);

									if ($arDeliveryPrice["RESULT"] == "ERROR")
									{
										$arResult["ERROR"][] = $arDeliveryPrice["TEXT"];
									}
									else
									{
										$arResult["DELIVERY_PRICE"] = roundEx($arDeliveryPrice["VALUE"], SALE_VALUE_PRECISION);
										$arResult["PACKS_COUNT"] = $arDeliveryPrice["PACKS_COUNT"];
									}
									break;
								}
							}
						}
					}
Exemplo n.º 18
0
 function Compability($arOrder, $arConfig)
 {
     $profiles = array('land', 'avia');
     $bHevyWeightEnabled = self::isConfCheckedVal($arConfig, 'service_' . self::$TARIF_HEAVY_WEIGHT . '_enabled');
     $maxWeight = $bHevyWeightEnabled ? self::$MAX_WEIGHT_HEAVY : self::$MAX_WEIGHT;
     if (!empty($arOrder["ITEMS"]) && is_array($arOrder["ITEMS"])) {
         foreach ($arOrder["ITEMS"] as $arItem) {
             if (floatval($arItem["WEIGHT"]) > $maxWeight) {
                 $profiles = array();
                 break;
             }
         }
     }
     $arRes = array();
     foreach ($profiles as $profile) {
         $aviableBoxes = CSaleDeliveryHelper::getBoxesFromConfig($profile, $arConfig);
         foreach ($aviableBoxes as $arBox) {
             if (CSaleDeliveryHandler::checkDimensions($arOrder["MAX_DIMENSIONS"], $arBox["DIMENSIONS"])) {
                 $arRes[] = $profile;
                 break;
             }
         }
     }
     return $arRes;
 }
Exemplo n.º 19
0
 function ShowStep()
 {
     $wizard =& $this->GetWizard();
     $arResult = $wizard->GetVars(true);
     $dbSite = CSite::GetByID($arResult["siteID"]);
     $arSite = $dbSite->GetNext();
     CModule::IncludeModule("currency");
     $dbCurrency = CCurrency::GetList($b = "SORT", $o = "ASC", $arResult["siteID"]);
     while ($arCur = $dbCurrency->GetNext()) {
         $arCurrency[$arCur["CURRENCY"]] = $arCur["FULL_NAME"];
     }
     $dbUGroup = CGroup::GetList($b = "c_sort", $o = "ASC", array("ACTIVE" => "Y"));
     while ($arUGroup = $dbUGroup->GetNext()) {
         $arGroups[$arUGroup["ID"]] = $arUGroup["NAME"];
     }
     CModule::IncludeModule("sale");
     $dbPersonType = CSalePersonType::GetList(array("SORT" => "ASC"), array("ACTIVE" => "Y", "LID" => $arResult["siteID"]));
     while ($arPersonType = $dbPersonType->GetNext()) {
         $arPersons[$arPersonType["ID"]] = $arPersonType["NAME"];
     }
     $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"), array("ACTIVE" => "Y", "LID" => $arResult["siteID"]));
     while ($arPaySystem = $dbPaySystem->GetNext()) {
         $arPaySystems[$arPaySystem["ID"]] = $arPaySystem["NAME"];
     }
     $dbDelivery = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), array("SITE_ID" => $arResult["siteID"], "ACTIVE" => "Y"));
     while ($arDelivery = $dbDelivery->GetNext()) {
         $arDeliveries[$arDelivery["SID"] . "_new"] = $arDelivery["NAME"] . " " . GetMessage("WW_STEP8_1");
     }
     $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"], "ACTIVE" => "Y"));
     while ($arDelivery = $dbDelivery->GetNext()) {
         $arDeliveries[$arDelivery["ID"]] = $arDelivery["NAME"];
     }
     $this->content = GetMessage("WW_2") . "<br />";
     $this->content .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"/bitrix/wizards/bitrix/sale.install/styles.css\">";
     $this->content .= "<table class=\"data-table\">";
     $this->content .= "<tr><th>" . GetMessage("WW_STEP1_2") . "</th><td>[" . $arSite["ID"] . "] " . $arSite["NAME"] . "</td></tr>";
     $this->content .= "<tr><th>" . GetMessage("WW_STEP1_3") . "</th><td>" . $arResult["orderEmail"] . "</td></tr>";
     $this->content .= "<tr><th>" . GetMessage("WW_STEP1_5") . "</th><td>" . $arResult["currencyID"] . " (" . $arCurrency[$arResult["currencyID"]] . ")" . "</td></tr>";
     $this->content .= "<tr><th>" . GetMessage("WW_3") . "</th><td>";
     foreach ($arResult["groupID"] as $v) {
         $this->content .= $arGroups[$v] . "<br />";
     }
     $this->content .= "</td></tr>";
     $this->content .= "<tr><th>" . GetMessage("WW_4") . "</th><td>";
     foreach ($arResult["personType"] as $v) {
         $this->content .= $arPersons[$v] . "<br />";
     }
     $this->content .= "</td></tr>";
     $this->content .= "<tr><th>" . GetMessage("WW_5") . "</th><td>";
     $arPS = array();
     foreach ($arResult["paySystem"] as $v) {
         if (!empty($v)) {
             foreach ($v as $v1) {
                 if (!in_array($v1, $arPS)) {
                     $arPS[] = $v1;
                 }
             }
         }
     }
     foreach ($arPS as $v) {
         $this->content .= $arPaySystems[$v] . "<br />";
     }
     $this->content .= "</td></tr>";
     $this->content .= "<tr><th>" . GetMessage("WW_6") . "</th><td>";
     if (!empty($arResult["delivery"])) {
         foreach ($arResult["delivery"] as $v) {
             $this->content .= $arDeliveries[$v] . "<br />";
         }
     }
     $this->content .= "</td></tr>";
     $this->content .= "</table>";
 }
Exemplo n.º 20
0
			</tr>
<?php 
        $obDelivery = ob_get_contents();
        ob_end_clean();
        ob_start();
        ?>
				<td width="40%" align="right">
					<?php 
        echo GetMessage("SOE_DELIVERY_COM");
        ?>
:
				</td>
				<td width="60%">
<?php 
        $arFilter = array("SITE_ID" => $str_LID);
        $dbDeliveries = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), $arFilter);
        $arDeliveries = array();
        while ($arDelivery = $dbDeliveries->GetNext()) {
            $bUseDeliveryHandlers = true;
            $arDeliveries[$arDelivery["SID"]] = $arDelivery;
        }
        ?>
					<select name="DELIVERY_ID_handler" OnChange="recalcDelivery(this.value)">
						<option value="">(<?php 
        echo GetMessage("SOE_NO");
        ?>
)</option>
						<?php 
        foreach ($arDeliveries as $SID => $arDelivery) {
            foreach ($arDelivery["PROFILES"] as $profile_id => $arProfile) {
                $DELIVERY_ID = $SID . ":" . $profile_id;
Exemplo n.º 21
0
 function Calculate($STEP, $SID, $profile, $arOrder, $currency, $TMP = false, $SITE_ID = false)
 {
     global $APPLICATION;
     if (!defined('SALE_DH_INITIALIZED')) {
         CSaleDeliveryHandler::Initialize();
     }
     if (!$SITE_ID) {
         $SITE_ID = SITE_ID;
     }
     $rsDeliveryHandler = CSaleDeliveryHandler::GetBySID($SID, $SITE_ID);
     if (!($arHandler = $rsDeliveryHandler->Fetch())) {
         return array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DH_ERROR_HANDLER_NOT_INSTALLED"));
     }
     if (is_callable($arHandler["CALCULATOR"])) {
         $arConfig = $arHandler["CONFIG"]["CONFIG"];
         $arOrder["PRICE"] = CCurrencyRates::ConvertCurrency($arOrder["PRICE"], $currency, $arHandler["BASE_CURRENCY"]);
         if ($res = call_user_func($arHandler["CALCULATOR"], $profile, $arConfig, $arOrder, $STEP, $TMP)) {
             if (is_array($res)) {
                 $arReturn = $res;
             } elseif (is_numeric($res)) {
                 $arReturn = array("RESULT" => "OK", "VALUE" => doubleval($res));
             }
         } else {
             if ($ex = $APPLICATION->GetException()) {
                 return array("RESULT" => "ERROR", "TEXT" => $ex->GetString());
             } else {
                 return array("RESULT" => "OK", "VALUE" => 0);
             }
         }
         if (is_array($arReturn) && $arReturn["RESULT"] == "OK" && $currency != $arHandler["BASE_CURRENCY"] && CModule::IncludeModule('currency')) {
             $arReturn["VALUE"] = CCurrencyRates::ConvertCurrency($arReturn["VALUE"], $arHandler["BASE_CURRENCY"], $currency);
         }
         $arReturn["VALUE"] *= 1 + $arHandler["TAX_RATE"] / 100;
         $arReturn = CSaleDeliveryHandler::__executeCalculateEvents($SID, $profile, $arOrder, $arReturn);
         return $arReturn;
     } else {
         return array("RESULT" => "ERROR", "TEXT" => GetMessage("SALE_DH_ERROR_WRONG_HANDLER_FILE"));
     }
 }
Exemplo n.º 22
0
						if((empty($arUserResult["DELIVERY_ID"]) && $bFirst) ||
							(strlen($arUserResult["DELIVERY_ID"]) > 0 && $arUserResult["DELIVERY_ID"] == $delivery_id.":".$profile_id)
						)
						{
							$arProfile["CHECKED"] = "Y";
							$arUserResult["DELIVERY_ID"] = $delivery_id.":".$profile_id;

							$arOrderTmpDel = array(
								"PRICE" => $arResult["ORDER_PRICE"],
								"WEIGHT" => $arResult["ORDER_WEIGHT"],
								"LOCATION_FROM" => COption::GetOptionInt('sale', 'location'),
								"LOCATION_TO" => $arUserResult["DELIVERY_LOCATION"],
								"LOCATION_ZIP" => $arUserResult["DELIVERY_LOCATION_ZIP"],
							);

							$arDeliveryPrice = CSaleDeliveryHandler::CalculateFull($delivery_id, $profile_id, $arOrderTmpDel, $arResult["BASE_LANG_CURRENCY"]);

							if ($arDeliveryPrice["RESULT"] == "ERROR")
								$arResult["ERROR"][] = $arDeliveryPrice["TEXT"];
							else
								$arResult["DELIVERY_PRICE"] = roundEx($arDeliveryPrice["VALUE"], SALE_VALUE_PRECISION);
						}

						if (empty($arResult["DELIVERY"][$delivery_id]))
						{
							$arResult["DELIVERY"][$delivery_id] = array(
								"SID" => $delivery_id,
								"TITLE" => $arDeliveryService["NAME"],
								"DESCRIPTION" => $arDeliveryService["DESCRIPTION"],
								"PROFILES" => array(),
							);
Exemplo n.º 23
0
 public static function getDeliveriesInfo($arDeliveryIds)
 {
     if (!is_array($arDeliveryIds)) {
         return false;
     }
     static $arDeliveries = array();
     $arTmpSD = array();
     foreach ($arDeliveryIds as $deliveryId) {
         if (!$deliveryId || is_null($deliveryId)) {
             continue;
         }
         if (!isset($arDeliveries[$deliveryId])) {
             if (strpos($deliveryId, ":") !== false) {
                 $arId = explode(":", $deliveryId);
                 $dbDelivery = CSaleDeliveryHandler::GetList(array(), array("SID" => $arId[0]));
                 if ($arDelivery = $dbDelivery->Fetch()) {
                     $arDeliveries[$deliveryId] = htmlspecialcharsEx($arDelivery["NAME"]);
                     if (strlen($arId[1]) > 0 && isset($arDelivery["PROFILES"][$arId[1]]["TITLE"])) {
                         $arDeliveries[$deliveryId] .= " / " . htmlspecialcharsEx($arDelivery["PROFILES"][$arId[1]]["TITLE"]);
                     }
                 }
             } else {
                 $arTmpSD[] = $deliveryId;
             }
         }
     }
     if (is_array($arTmpSD)) {
         $dbDelivery = CSaleDelivery::GetList(array(), array("ID" => $arTmpSD), false, false, array("ID", "NAME"));
         while ($arDelivery = $dbDelivery->Fetch()) {
             $arDeliveries[$arDelivery["ID"]] = htmlspecialcharsbx($arDelivery["NAME"]);
         }
     }
     return $arDeliveries;
 }
Exemplo n.º 24
0
	function ExportOrders2Xml($arFilter = Array(), $nTopCount = 0, $currency = "", $crmMode = false, $time_limit = 0, $version = false, $arOptions = Array())
	{
		global $DB;
		$count = false;
		if(IntVal($nTopCount) > 0)
			$count = Array("nTopCount" => $nTopCount);
		$bNewVersion = (strlen($version) > 0);
		$bExportFromCrm = (isset($arOptions["EXPORT_FROM_CRM"]) && $arOptions["EXPORT_FROM_CRM"] === "Y");

		if(IntVal($time_limit) > 0)
		{
			//This is an optimization. We assume than no step can take more than one year.
			if($time_limit > 0)
				$end_time = time() + $time_limit;
			else
				$end_time = time() + 365*24*3600; // One year

			//$version
			$lastOrderPrefix = "LAST_ORDER_ID";
			if($crmMode)
			{
				$lastOrderPrefix = md5(serialize($arFilter));
				if(!empty($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && IntVal($nTopCount) > 0)
					$count["nTopCount"] = $count["nTopCount"]+count($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]);
			}
			else
			{
				if(IntVal($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) > 0)
				{
					$arFilter["<ID"] = $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix];
				}
			}
		}

		$arResultStat = array(
			"ORDERS" => 0,
			"CONTACTS" => 0,
			"COMPANIES" => 0,
		);

		$accountNumberPrefix = COption::GetOptionString("sale", "1C_SALE_ACCOUNT_NUMBER_SHOP_PREFIX", "");

		$dbPaySystem = CSalePaySystem::GetList(Array("ID" => "ASC"), Array("ACTIVE" => "Y"), false, false, Array("ID", "NAME", "ACTIVE"));
		while($arPaySystem = $dbPaySystem -> Fetch())
			$paySystems[$arPaySystem["ID"]] = $arPaySystem["NAME"];

		$dbDelivery = CSaleDelivery::GetList(Array("ID" => "ASC"), Array("ACTIVE" => "Y"), false, false, Array("ID", "NAME", "ACTIVE"));
		while($arDelivery = $dbDelivery -> Fetch())
			$delivery[$arDelivery["ID"]] = $arDelivery["NAME"];

		$rsDeliveryHandlers = CSaleDeliveryHandler::GetAdminList(array("SID" => "ASC"));
		while ($arHandler = $rsDeliveryHandlers->Fetch())
		{
			if(is_array($arHandler["PROFILES"]))
			{
				foreach($arHandler["PROFILES"] as $k => $v)
				{
					$delivery[$arHandler["SID"].":".$k] = $v["TITLE"]." (".$arHandler["NAME"].")";
				}
			}
		}

		$arStore = array();
		$arMeasures = array();
		if(CModule::IncludeModule("catalog"))
		{
			$dbList = CCatalogStore::GetList(
				array("SORT" => "DESC", "ID" => "ASC"),
				array("ACTIVE" => "Y", "ISSUING_CENTER" => "Y"),
				false,
				false,
				array("ID", "SORT", "TITLE", "ADDRESS", "DESCRIPTION", "PHONE", "EMAIL", "XML_ID")
			);
			while ($arStoreTmp = $dbList->Fetch())
			{
				if(strlen($arStoreTmp["XML_ID"]) <= 0)
					$arStoreTmp["XML_ID"] = $arStoreTmp["ID"];
				$arStore[$arStoreTmp["ID"]] = $arStoreTmp;
			}

			$dbList = CCatalogMeasure::getList(array(), array(), false, false, array("CODE", "MEASURE_TITLE"));
			while($arList = $dbList->Fetch())
			{
				$arMeasures[$arList["CODE"]] = $arList["MEASURE_TITLE"];
			}
		}
		if(empty($arMeasures))
			$arMeasures[796] = GetMessage("SALE_EXPORT_SHTUKA");

		$dbExport = CSaleExport::GetList();
		while($arExport = $dbExport->Fetch())
		{
			$arAgent[$arExport["PERSON_TYPE_ID"]] = unserialize($arExport["VARS"]);
		}

		$dateFormat = CSite::GetDateFormat("FULL");

		if ($crmMode)
		{
			echo "<"."?xml version=\"1.0\" encoding=\"UTF-8\"?".">\n";

			$arCharSets = array();
			$dbSitesList = CSite::GetList(($b=""), ($o=""));
			while ($arSite = $dbSitesList->Fetch())
				$arCharSets[$arSite["ID"]] = $arSite["CHARSET"];
		}
		else
			echo "<"."?xml version=\"1.0\" encoding=\"windows-1251\"?".">\n";
		?>
		<<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
 <?php 
echo GetMessage("SALE_EXPORT_SHEM_VERSION");
?>
="<?php 
echo $bNewVersion ? "2.08" : "2.05";
?>
" <?php 
echo GetMessage("SALE_EXPORT_SHEM_DATE_CREATE");
?>
="<?php 
echo date("Y-m-d");
?>
T<?php 
echo date("G:i:s");
?>
" <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
?>
=yyyy-MM-dd; <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
?>
=DT" <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DATETIME");
?>
="<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
?>
=<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_TIME");
?>
; <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
?>
=T" <?php 
echo GetMessage("SALE_EXPORT_DEL_DT");
?>
="T" <?php 
echo GetMessage("SALE_EXPORT_FORM_SUMM");
?>
="<?php 
echo GetMessage("SALE_EXPORT_FORM_CC");
?>
=18; <?php 
echo GetMessage("SALE_EXPORT_FORM_CDC");
?>
=2; <?php 
echo GetMessage("SALE_EXPORT_FORM_CRD");
?>
=." <?php 
echo GetMessage("SALE_EXPORT_FORM_QUANT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_FORM_CC");
?>
=18; <?php 
echo GetMessage("SALE_EXPORT_FORM_CDC");
?>
=2; <?php 
echo GetMessage("SALE_EXPORT_FORM_CRD");
?>
=.">
		<?
		$arOrder = array("ID" => "DESC");
		if ($crmMode)
			$arOrder = array("DATE_UPDATE" => "ASC");

		$arSelect = array(
			"ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "EMP_PAYED_ID", "CANCELED", "DATE_CANCELED",
			"EMP_CANCELED_ID", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "EMP_STATUS_ID",
			"PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "EMP_ALLOW_DELIVERY_ID", "PRICE", "CURRENCY", "DISCOUNT_VALUE",
			"SUM_PAID", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION",
			"ADDITIONAL_INFO", "PS_STATUS", "PS_STATUS_CODE", "PS_STATUS_DESCRIPTION", "PS_STATUS_MESSAGE", "PS_SUM", "PS_CURRENCY", "PS_RESPONSE_DATE",
			"COMMENTS", "TAX_VALUE", "STAT_GID", "RECURRING_ID", "ACCOUNT_NUMBER", "SUM_PAID", "DELIVERY_DOC_DATE", "DELIVERY_DOC_NUM", "TRACKING_NUMBER", "STORE_ID",
			"ID_1C", "VERSION",
		);

		$bCrmModuleIncluded = false;
		if ($bExportFromCrm)
		{
			$arSelect[] = "UF_COMPANY_ID";
			$arSelect[] = "UF_CONTACT_ID";
			if (IsModuleInstalled("crm") && CModule::IncludeModule("crm"))
				$bCrmModuleIncluded = true;
		}

		$dbOrderList = CSaleOrder::GetList($arOrder, $arFilter, false, $count, $arSelect);

		while($arOrder = $dbOrderList->Fetch())
		{
			if ($crmMode)
			{			
				if($bNewVersion && is_array($_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && in_array($arOrder["ID"], $_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix]) && empty($arFilter["ID"]))
					continue;
				ob_start();
			}

			$arResultStat["ORDERS"]++;

			$agentParams = $arAgent[$arOrder["PERSON_TYPE_ID"]];
			$arProp = Array();
			$arProp["ORDER"] = $arOrder;

			if (IntVal($arOrder["USER_ID"]) > 0)
			{
				$dbUser = CUser::GetByID($arOrder["USER_ID"]);
				if ($arUser = $dbUser->Fetch())
					$arProp["USER"] = $arUser;
			}
			if ($bExportFromCrm)
			{
				$arProp["CRM"] = array();
				$companyID = isset($arOrder["UF_COMPANY_ID"]) ? intval($arOrder["UF_COMPANY_ID"]) : 0;
				$contactID = isset($arOrder["UF_CONTACT_ID"]) ? intval($arOrder["UF_CONTACT_ID"]) : 0;
				if ($companyID > 0)
				{
					$arProp["CRM"]["CLIENT_ID"] = "CRMCO".$companyID;
				}
				else
				{
					$arProp["CRM"]["CLIENT_ID"] = "CRMC".$contactID;
				}

				$clientInfo = array(
					"LOGIN" => "",
					"NAME" => "",
					"LAST_NAME" => "",
					"SECOND_NAME" => ""
				);

				if ($bCrmModuleIncluded)
				{
					if ($companyID > 0)
					{
						$arCompanyFilter = array('=ID' => $companyID);
						$dbCompany = CCrmCompany::GetListEx(
							array(), $arCompanyFilter, false, array("nTopCount" => 1),
							array("TITLE")
						);
						$arCompany = $dbCompany->Fetch();
						unset($dbCompany, $arCompanyFilter);
						if (is_array($arCompany))
						{
							if (isset($arCompany["TITLE"]))
								$clientInfo["NAME"] = $arCompany["TITLE"];
						}
						unset($arCompany);
					}
					else if ($contactID > 0)
					{
						$arContactFilter = array('=ID' => $contactID);
						$dbContact = CCrmContact::GetListEx(
							array(), $arContactFilter, false, array("nTopCount" => 1),
							array("NAME", "LAST_NAME", "SECOND_NAME")
						);
						$arContact = $dbContact->Fetch();
						unset($dbContact, $arContactFilter);
						if (is_array($arContact))
						{
							if (isset($arContact["NAME"]))
								$clientInfo["NAME"] = $arContact["NAME"];
							if (isset($arContact["LAST_NAME"]))
								$clientInfo["LAST_NAME"] = $arContact["LAST_NAME"];
							if (isset($arContact["SECOND_NAME"]))
								$clientInfo["SECOND_NAME"] = $arContact["SECOND_NAME"];
						}
						unset($arContact);
					}
				}

				$arProp["CRM"]["CLIENT"] = $clientInfo;
				unset($clientInfo);
			}
			if(IntVal($arOrder["PAY_SYSTEM_ID"]) > 0)
				$arProp["ORDER"]["PAY_SYSTEM_NAME"] = $paySystems[$arOrder["PAY_SYSTEM_ID"]];
			if(strlen($arOrder["DELIVERY_ID"]) > 0)
				$arProp["ORDER"]["DELIVERY_NAME"] = $delivery[$arOrder["DELIVERY_ID"]];

			$dbOrderPropVals = CSaleOrderPropsValue::GetList(
					array(),
					array("ORDER_ID" => $arOrder["ID"]),
					false,
					false,
					array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE")
				);
			while ($arOrderPropVals = $dbOrderPropVals->Fetch())
			{
				if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX")
				{
					if ($arOrderPropVals["VALUE"] == "Y")
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
					else
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA")
				{
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO")
				{
					$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT")
				{
					$curVal = explode(",", $arOrderPropVals["VALUE"]);
					foreach($curVal as $vm)
					{
						$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $vm);
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .=  ", ".$arVal["NAME"];
					}
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = substr($arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]], 2);
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION")
				{
					$arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] =  ($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["REGION_NAME"])<=0) ? "" : " - ").$arVal["REGION_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_CITY"] = $arVal["CITY_NAME"];
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_COUNTRY"] = $arVal["COUNTRY_NAME"];
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_REGION"] = $arVal["REGION_NAME"];
				}
				else
				{
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				}
			}

			foreach($agentParams as $k => $v)
			{
				if(strpos($k, "REKV_") !== false)
				{
					if(!is_array($v))
					{
						$agent["REKV"][$k] = $v;
					}
					else
					{
						if(strlen($v["TYPE"])<=0)
							$agent["REKV"][$k] = $v["VALUE"];
						else
							$agent["REKV"][$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
					}
				}
				else
				{
					if(!is_array($v))
					{
						$agent[$k] = $v;
					}
					else
					{
						if(strlen($v["TYPE"])<=0)
							$agent[$k] = $v["VALUE"];
						else
							$agent[$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
					}
				}
			}
			?>
			<<?php 
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo $arOrder["ID"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_NUMBER");
?>
><?php 
echo $accountNumberPrefix . $arOrder["ACCOUNT_NUMBER"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_NUMBER");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_DATE");
?>
><?php 
echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "YYYY-MM-DD");
?>
</<?php 
echo GetMessage("SALE_EXPORT_DATE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM_ORDER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SELLER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_CURRENCY");
?>
><?php 
echo htmlspecialcharsbx(strlen($currency) > 0 ? substr($currency, 0, 3) : substr($arOrder["CURRENCY"], 0, 3));
?>
</<?php 
echo GetMessage("SALE_EXPORT_CURRENCY");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
				<?
				if($bNewVersion)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_VERSION");
?>
><?php 
echo IntVal($arOrder["VERSION"]) > 0 ? $arOrder["VERSION"] : 0;
?>
</<?php 
echo GetMessage("SALE_EXPORT_VERSION");
?>
>
					<?
					if(strlen($arOrder["ID_1C"]) > 0)
					{
						?><<?php 
echo GetMessage("SALE_EXPORT_ID_1C");
?>
><?php 
echo htmlspecialcharsbx($arOrder["ID_1C"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID_1C");
?>
><?
					}
				}
				if ($crmMode)
				{
					?><DateUpdate><?php 
echo $DB->FormatDate($arOrder["DATE_UPDATE"], $dateFormat, "YYYY-MM-DD HH:MI:SS");
?>
</DateUpdate><?
				}

				$deliveryAdr = CSaleExport::ExportContragents(
					$arOrder, $arProp, $agent, $arResultStat, $bNewVersion,
					$bExportFromCrm ? array("EXPORT_FROM_CRM" => "Y") : array()
				);
				?>
				<<?php 
echo GetMessage("SALE_EXPORT_TIME");
?>
><?php 
echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "HH:MI:SS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TIME");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_COMMENTS");
?>
><?php 
echo htmlspecialcharsbx($arOrder["COMMENTS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_COMMENTS");
?>
>
				<?
				$dbOrderTax = CSaleOrderTax::GetList(
					array(),
					array("ORDER_ID" => $arOrder["ID"]),
					false,
					false,
					array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE")
				);
				$i=-1;
				$orderTax = 0;
				while ($arOrderTax = $dbOrderTax->Fetch())
				{
					$arOrderTax["VALUE_MONEY"] = roundEx($arOrderTax["VALUE_MONEY"], 2);
					$orderTax += $arOrderTax["VALUE_MONEY"];
					$i++;
					if($i == 0)
						echo "<".GetMessage("SALE_EXPORT_TAXES").">";
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arOrderTax["TAX_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
><?php 
echo $arOrderTax["IS_IN_PRICE"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrderTax["VALUE_MONEY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
					<?
				}
				if($i != -1)
					echo "</".GetMessage("SALE_EXPORT_TAXES").">";
				?>
				<?if(DoubleVal($arOrder["DISCOUNT_VALUE"]) > 0)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_DISCOUNT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["DISCOUNT_VALUE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>false</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
					<?
				}

				$storeBasket = "";
				if(IntVal($arOrder["STORE_ID"]) > 0 && !empty($arStore[$arOrder["STORE_ID"]]))
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_STORIES");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_STORY");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo $arStore[$arOrder["STORE_ID"]]["XML_ID"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["TITLE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["ADDRESS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_STREET");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["ADDRESS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_CONTACTS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo $bNewVersion ? GetMessage("SALE_EXPORT_WORK_PHONE_NEW") : GetMessage("SALE_EXPORT_WORK_PHONE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["PHONE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_CONTACTS");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_STORY");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_STORIES");
?>
>
					<?
					/*
					$storeBasket = "				
						<".GetMessage("SALE_EXPORT_STORIES").">
							<".GetMessage("SALE_EXPORT_STORY").">
								<".GetMessage("SALE_EXPORT_ID").">".$arStore[$arOrder["STORE_ID"]]["XML_ID"]."</".GetMessage("SALE_EXPORT_ID").">
								<".GetMessage("SALE_EXPORT_ITEM_NAME").">".htmlspecialcharsbx($arStore[$arOrder["STORE_ID"]]["TITLE"])."</".GetMessage("SALE_EXPORT_ITEM_NAME").">
							</".GetMessage("SALE_EXPORT_STORY").">
						</".GetMessage("SALE_EXPORT_STORIES").">
						";
					*/
				}
				?>
				<<?php 
echo GetMessage("SALE_EXPORT_ITEMS");
?>
>
				<?
				$dbBasket = CSaleBasket::GetList(
						array("NAME" => "ASC"),
						array("ORDER_ID" => $arOrder["ID"]),
						false,
						false,
						array("ID", "NOTES", "PRODUCT_XML_ID", "CATALOG_XML_ID", "NAME", "PRICE", "QUANTITY", "DISCOUNT_PRICE", "VAT_RATE", "MEASURE_CODE")
					);
				$basketSum = 0;
				$priceType = "";
				$bVat = false;
				$vatRate = 0;
				$vatSum = 0;
				while ($arBasket = $dbBasket->Fetch())
				{
					if(strlen($priceType) <= 0)
						$priceType = $arBasket["NOTES"];
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo htmlspecialcharsbx($arBasket["PRODUCT_XML_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_CATALOG_ID");
?>
><?php 
echo htmlspecialcharsbx($arBasket["CATALOG_XML_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_CATALOG_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arBasket["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<?
						if($bNewVersion)
						{
							if(IntVal($arBasket["MEASURE_CODE"]) <= 0)
								$arBasket["MEASURE_CODE"] = 796;
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
><?php 
echo $arBasket["MEASURE_CODE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
><?php 
echo htmlspecialcharsbx($arMeasures[$arBasket["MEASURE_CODE"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>
							<?
						}
						else
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
 <?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
="796" <?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_SHTUKA");
?>
" <?php 
echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
?>
="<?php 
echo GetMessage("SALE_EXPORT_RCE");
?>
"><?php 
echo GetMessage("SALE_EXPORT_SHT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
>
							<?
						}
						if(DoubleVal($arBasket["DISCOUNT_PRICE"]) > 0)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM_DISCOUNT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arBasket["DISCOUNT_PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
							<?
						}
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
><?php 
echo $arBasket["PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
><?php 
echo $arBasket["QUANTITY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arBasket["PRICE"] * $arBasket["QUANTITY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<?
							$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "ID" => "ASC"), Array("BASKET_ID" => $arBasket["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")), false, false, array("NAME", "VALUE", "CODE"));
							while($arProp = $dbProp->Fetch())
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arProp["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arProp["VALUE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<?
							}
							?>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
						<?if(DoubleVal($arBasket["VAT_RATE"]) > 0)
						{
							$bVat = true;
							$vatRate = DoubleVal($arBasket["VAT_RATE"]);
							$basketVatSum = (($arBasket["PRICE"] / ($arBasket["VAT_RATE"]+1)) * $arBasket["VAT_RATE"]);
							$vatSum += roundEx($basketVatSum * $arBasket["QUANTITY"], 2);
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
><?php 
echo $arBasket["VAT_RATE"] * 100;
?>
</<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo roundEx($basketVatSum, 2);
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
							<?
						}
						?>
						<?php 
echo $storeBasket;
?>
					</<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
					<?
					$basketSum += $arBasket["PRICE"]*$arBasket["QUANTITY"];
				}

				if(IntVal($arOrder["PRICE_DELIVERY"]) > 0)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>ORDER_DELIVERY</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<?
						if($bNewVersion)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
>796</<?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
><?php 
echo htmlspecialcharsbx($arMeasures[796]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_UNIT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_KOEF");
?>
>
						<?
						}
						else
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
 <?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
="796" <?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_SHTUKA");
?>
" <?php 
echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
?>
="<?php 
echo GetMessage("SALE_EXPORT_RCE");
?>
"><?php 
echo GetMessage("SALE_EXPORT_SHT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
>
						<?
						}
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
><?php 
echo $arOrder["PRICE_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["PRICE_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
						<?if($bVat)
						{
							$deliveryTax = roundEx((($arOrder["PRICE_DELIVERY"] / ($vatRate+1)) * $vatRate), 2);
							if($orderTax > $vatSum && $orderTax == roundEx($vatSum + $deliveryTax, 2))
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
><?php 
echo $vatRate * 100;
?>
</<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $deliveryTax;
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
								<?
							}
						}
						?>
					</<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
					<?
				}
				?>
				</<?php 
echo GetMessage("SALE_EXPORT_ITEMS");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
					<?if(strlen($arOrder["DATE_PAYED"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_PAID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_PAYED"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["PAY_VOUCHER_NUM"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_NUMBER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["PAY_VOUCHER_NUM"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(IntVal($arOrder["PAY_SYSTEM_ID"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_SYSTEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($paySystems[$arOrder["PAY_SYSTEM_ID"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_SYSTEM_ID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["PAY_SYSTEM_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DATE_ALLOW_DELIVERY"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_ALLOW_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_ALLOW_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DELIVERY_ID"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DELIVERY_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($delivery[$arOrder["DELIVERY_ID"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_PAID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["PAYED"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ALLOW_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["ALLOW_DELIVERY"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_CANCELED");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["CANCELED"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_FINAL_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["STATUS_ID"] == "F" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?$arStatus = CSaleStatus::GetLangByID($arOrder["STATUS_ID"]); echo htmlspecialcharsbx("[".$arOrder["STATUS_ID"]."] ".$arStatus["NAME"]);?></<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_STATUS_ID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["STATUS_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<?if(strlen($arOrder["DATE_CANCELED"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_CANCEL");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_CANCELED"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_CANCEL_REASON");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["REASON_CANCELED"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DATE_STATUS"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_STATUS"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["USER_DESCRIPTION"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_USER_DESCRIPTION");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["USER_DESCRIPTION"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					$dbSite = CSite::GetByID($arOrder["LID"]);
					$arSite = $dbSite->Fetch();
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_SITE_NAME");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>[<?php 
echo $arOrder["LID"];
?>
] <?php 
echo htmlspecialcharsbx($arSite["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<?
					if(!empty($agent["REKV"]))
					{
						foreach($agent["REKV"] as $k => $v)
						{
							if(strlen($agentParams[$k]["NAME"]) > 0 && strlen($v) > 0)
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($agentParams[$k]["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($v);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<?
							}
						}
					}

					if(strlen($deliveryAdr) > 0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DELIVERY_ADDRESS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($deliveryAdr);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>

						<?
					}
					?>
				</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
			</<?php 
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
			<?
			if ($crmMode)
			{
				$c = ob_get_clean();
				$c = CharsetConverter::ConvertCharset($c, $arCharSets[$arOrder["LID"]], "utf-8");
				echo $c;
				$_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix][] = $arOrder["ID"];
			}
			else
			{
				$_SESSION["BX_CML2_EXPORT"][$lastOrderPrefix] = $arOrder["ID"];
			}

			if(IntVal($time_limit) > 0 && time() > $end_time)
			{
				break;
			}
		}
		?>
		</<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
>
		<?
		return $arResultStat;
	}
Exemplo n.º 25
0
        $arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "ups", "NAME" => "UPS", "SORT" => 300, "DESCRIPTION" => GetMessage("SALE_WIZARD_UPS"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_ups.php", "SETTINGS" => "/bitrix/modules/sale/delivery/ups/ru_csv_zones.csv;/bitrix/modules/sale/delivery/ups/ru_csv_export.csv", "PROFILES" => "", "TAX_RATE" => 0);
        if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif")) {
            $arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif");
        }
        if ($delivery["ups"] != "Y") {
            $arFields["ACTIVE"] = "N";
        }
        CSaleDeliveryHandler::Set("ups", $arFields);
        $arFields = array("LID" => "", "ACTIVE" => "Y", "HID" => "dhlusa", "NAME" => "DHL (USA)", "SORT" => 300, "DESCRIPTION" => GetMessage("SALE_WIZARD_UPS"), "HANDLERS" => "/bitrix/modules/sale/delivery/delivery_dhl_usa.php ", "SETTINGS" => "", "PROFILES" => "", "TAX_RATE" => 0);
        if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif")) {
            $arFields["LOGOTIP"] = CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/delivery/" . $arFields["HID"] . "_logo.gif");
        }
        if ($delivery["dhl"] != "Y") {
            $arFields["ACTIVE"] = "N";
        }
        CSaleDeliveryHandler::Set("dhlusa", $arFields);
    }
}
if (CModule::IncludeModule('subscribe')) {
    $templates_dir = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/subscribe/templates";
    $template = $templates_dir . "/store_news_" . WIZARD_SITE_ID;
    //Copy template from module if where was no template
    if (!file_exists($template)) {
        CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/subscribe/install/php_interface/subscribe/templates/news", $template, false, true);
        $fname = $template . "/template.php";
        if (file_exists($fname) && is_file($fname) && ($fh = fopen($fname, "rb"))) {
            $php_source = fread($fh, filesize($fname));
            $php_source = preg_replace("#([\"'])(SITE_ID)(\\1)(\\s*=>\\s*)([\"'])(.*?)(\\5)#", "\\1\\2\\3\\4\\5" . WIZARD_SITE_ID . "\\7", $php_source);
            $php_source = str_replace("Windows-1251", $arSite["CHARSET"], $php_source);
            $php_source = str_replace("Hello!", GetMessage("SUBSCR_1"), $php_source);
            $php_source = str_replace("<P>Best Regards!</P>", "", $php_source);
Exemplo n.º 26
0
 /**
  * @return \Bitrix\Sale\Result|bool
  * @throws Exception
  * @throws \Bitrix\Main\SystemException
  */
 public static function convertToNew($renameTable = false)
 {
     $result = new \Bitrix\Sale\Result();
     $con = \Bitrix\Main\Application::getConnection();
     if (!$con->isTableExists("b_sale_delivery_handler")) {
         return true;
     }
     $sqlHelper = $con->getSqlHelper();
     $deliveryRes = $con->query('SELECT * FROM b_sale_delivery_handler WHERE CONVERTED != \'Y\'');
     $tablesToUpdate = array('b_sale_order', 'b_sale_order_history');
     \CSaleDeliveryHandler::Initialize();
     $handlers = \CSaleDeliveryHandler::__getRegisteredHandlers();
     while ($delivery = $deliveryRes->fetch()) {
         if (strlen($delivery["PROFILES"]) > 0) {
             $delivery["PROFILES"] = unserialize($delivery["PROFILES"]);
         } else {
             $delivery["PROFILES"] = $handlers[$delivery["HID"]]["PROFILES"];
             foreach ($delivery["PROFILES"] as $id => $params) {
                 $delivery["PROFILES"][$id]["ACTIVE"] = $delivery["ACTIVE"];
             }
         }
         // Something strange it probably not used
         if ($delivery["PROFILES"] == false || !is_array($delivery["PROFILES"]) || empty($delivery["PROFILES"])) {
             $result->addError(new \Bitrix\Main\Entity\EntityError("Can't receive info about profiles. Delivery HID: \"" . $delivery["HID"] . "\""));
             continue;
         }
         unset($delivery["ID"]);
         $delivery["CONFIG"] = array();
         if (strlen($delivery["SETTINGS"]) > 0) {
             if (isset($handlers[$delivery["HID"]]["DBGETSETTINGS"]) && is_callable($handlers[$delivery["HID"]]["DBGETSETTINGS"])) {
                 $delivery["CONFIG"] = call_user_func($handlers[$delivery["HID"]]["DBGETSETTINGS"], $delivery["SETTINGS"]);
             } else {
                 $delivery["CONFIG"] = $delivery["SETTINGS"];
             }
         } elseif (is_callable($handlers[$delivery["HID"]]["GETCONFIG"])) {
             $config = call_user_func($handlers[$delivery["HID"]]["GETCONFIG"], strlen($delivery["LID"]) > 0 ? $delivery["LID"] : false);
             foreach ($config["CONFIG"] as $key => $arConfig) {
                 if (!empty($arConfig["DEFAULT"])) {
                     $delivery["CONFIG"][$key] = $arConfig["DEFAULT"];
                 }
             }
         }
         $delivery["SID"] = $handlers[$delivery["HID"]]["SID"];
         $id = \CSaleDeliveryHandler::Set($delivery["HID"], $delivery, strlen($delivery["LID"]) > 0 ? $delivery["LID"] : false);
         if (intval($id) <= 0) {
             $result->addError(new \Bitrix\Main\Entity\EntityError("Can't convert delivery handler with hid: " . $delivery["HID"] . (strlen($delivery["LID"]) > 0 ? " for site: " . $delivery["LID"] : "")));
             continue;
         }
         $con->queryExecute('UPDATE b_sale_delivery_handler SET CONVERTED="Y" WHERE HID="' . $sqlHelper->forSql($delivery["HID"]) . '"');
         $ids = array($id);
         foreach ($delivery["PROFILES"] as $profileName => $profileData) {
             $fullSid = $delivery["HID"] . ":" . $profileName;
             $profileId = \Bitrix\Sale\Delivery\Services\Table::getIdByCode($fullSid);
             $ids[] = $profileId;
             if (intval($profileId) > 0) {
                 foreach ($tablesToUpdate as $table) {
                     $con->queryExecute("UPDATE " . $table . " SET DELIVERY_ID=" . $sqlHelper->forSql($profileId) . " WHERE DELIVERY_ID = '" . $sqlHelper->forSql($fullSid) . "'");
                 }
                 $con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID=" . $sqlHelper->forSql($profileId) . ", DELIVERY_PROFILE_ID='' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($delivery["HID"]) . "' AND DELIVERY_PROFILE_ID='" . $profileName . "'");
             } else {
                 $result->addError(new \Bitrix\Main\Entity\EntityError("Cant determine id for profile code: " . $fullSid));
             }
         }
         $con->queryExecute("UPDATE b_sale_delivery2paysystem SET DELIVERY_ID=" . $sqlHelper->forSql($id) . ", DELIVERY_PROFILE_ID='' WHERE DELIVERY_ID = '" . $sqlHelper->forSql($delivery["HID"]) . "' AND (DELIVERY_PROFILE_ID='' OR DELIVERY_PROFILE_ID IS NULL)");
         $d2pRes = \Bitrix\Sale\Internals\DeliveryPaySystemTable::getList(array('filter' => array('DELIVERY_ID' => $ids), 'select' => array("DELIVERY_ID"), 'group' => array("DELIVERY_ID")));
         while ($d2p = $d2pRes->fetch()) {
             $res = \Bitrix\Sale\Delivery\Restrictions\Table::add(array("DELIVERY_ID" => $d2p["DELIVERY_ID"], "CLASS_NAME" => '\\Bitrix\\Sale\\Delivery\\Restrictions\\ByPaySystem', "SORT" => 100));
             if (!$res->isSuccess()) {
                 $result->addErrors($res->getErrors());
             }
         }
     }
     if ($renameTable && $result->isSuccess()) {
         $con->queryExecute("ALTER TABLE b_sale_delivery_handler RENAME b_sale_delivery_handler_old");
     }
     return $result;
 }
Exemplo n.º 27
0
 /**
  * Function returns reference data as shared cache between this component and sale.personal.order.list.
  *
  * @throws Exception
  * @return void
  */
 protected function obtainDataReferences()
 {
     if ($this->startCache(array('spo-shared'))) {
         try {
             $cachedData = array();
             /////////////////////
             /////////////////////
             // Person type
             $dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
             while ($arPType = $dbPType->Fetch()) {
                 $cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
             }
             // Save statuses for Filter form
             $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
             while ($arStatus = $dbStatus->Fetch()) {
                 $cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
             }
             $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
             while ($arPaySystem = $dbPaySystem->Fetch()) {
                 $cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
             }
             $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"));
             while ($arDelivery = $dbDelivery->Fetch()) {
                 $cachedData['DELIVERY'][$arDelivery["ID"]] = $arDelivery;
             }
             $dbDelivery = CSaleDeliveryHandler::GetList(array(), array(array("SITE_ID" => SITE_ID)));
             while ($arDeliveryHandler = $dbDelivery->Fetch()) {
                 $cachedData['DELIVERY_HANDLERS'][$arDeliveryHandler["SID"]] = $arDeliveryHandler;
             }
             /////////////////////
             /////////////////////
         } catch (Exception $e) {
             $this->abortCache();
             throw $e;
         }
         $this->endCache($cachedData);
     } else {
         $cachedData = $this->getCacheData();
     }
     $this->dbResult = array_merge($this->dbResult, $this->adaptCachedReferences($cachedData));
 }
Exemplo n.º 28
0
	public static function ExportOrders2Xml($arFilter = Array(), $nTopCount = 0, $currency = "", $crmMode = false)
	{
		global $DB;
		$count = false;
		if(IntVal($nTopCount)>0)
			$count = Array("nTopCount" => $nTopCount);

		$arResultStat = array(
			"ORDERS" => 0,
			"CONTACTS" => 0,
			"COMPANIES" => 0,
		);

		$accountNumberPrefix = COption::GetOptionString("sale", "1C_SALE_ACCOUNT_NUMBER_SHOP_PREFIX", "");

		$arOrder = array("ID" => "DESC");
		if ($crmMode)
			$arOrder = array("DATE_UPDATE" => "ASC");

		$dbOrderList = CSaleOrder::GetList(
				$arOrder,
				$arFilter,
				false,
				$count,
				array(
					"ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "EMP_PAYED_ID", "CANCELED", "DATE_CANCELED",
					"EMP_CANCELED_ID", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "EMP_STATUS_ID",
					"PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "EMP_ALLOW_DELIVERY_ID", "PRICE", "CURRENCY", "DISCOUNT_VALUE",
					"SUM_PAID", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION",
					"ADDITIONAL_INFO", "PS_STATUS", "PS_STATUS_CODE", "PS_STATUS_DESCRIPTION", "PS_STATUS_MESSAGE", "PS_SUM", "PS_CURRENCY", "PS_RESPONSE_DATE",
					"COMMENTS", "TAX_VALUE", "STAT_GID", "RECURRING_ID", "ACCOUNT_NUMBER"
				)
			);

		$dbPaySystem = CSalePaySystem::GetList(Array("ID" => "ASC"), Array("ACTIVE" => "Y"), false, false, Array("ID", "NAME", "ACTIVE"));
		while($arPaySystem = $dbPaySystem -> Fetch())
			$paySystems[$arPaySystem["ID"]] = $arPaySystem["NAME"];

		$dbDelivery = CSaleDelivery::GetList(Array("ID" => "ASC"), Array("ACTIVE" => "Y"), false, false, Array("ID", "NAME", "ACTIVE"));
		while($arDelivery = $dbDelivery -> Fetch())
			$delivery[$arDelivery["ID"]] = $arDelivery["NAME"];

		$rsDeliveryHandlers = CSaleDeliveryHandler::GetAdminList(array("SID" => "ASC"));
		while ($arHandler = $rsDeliveryHandlers->Fetch())
		{
			if(is_array($arHandler["PROFILES"]))
			{
				foreach($arHandler["PROFILES"] as $k => $v)
				{
					$delivery[$arHandler["SID"].":".$k] = $v["TITLE"]." (".$arHandler["NAME"].")";
				}
			}
		}

		$dbExport = CSaleExport::GetList();
		while($arExport = $dbExport->Fetch())
		{
			$arAgent[$arExport["PERSON_TYPE_ID"]] = unserialize($arExport["VARS"]);
		}

		$dateFormat = CSite::GetDateFormat("FULL");

		if ($crmMode)
		{
			echo "<"."?xml version=\"1.0\" encoding=\"UTF-8\"?".">\n";

			$arCharSets = array();
			$dbSitesList = CSite::GetList(($b=""), ($o=""));
			while ($arSite = $dbSitesList->Fetch())
				$arCharSets[$arSite["ID"]] = $arSite["CHARSET"];
		}
		else
			echo "<"."?xml version=\"1.0\" encoding=\"windows-1251\"?".">\n";
		?>
		<<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
 <?php 
echo GetMessage("SALE_EXPORT_SHEM_VERSION");
?>
="2.05" <?php 
echo GetMessage("SALE_EXPORT_SHEM_DATE_CREATE");
?>
="<?php 
echo date("Y-m-d");
?>
T<?php 
echo date("G:i:s");
?>
" <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
?>
=yyyy-MM-dd; <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
?>
=DT" <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DATETIME");
?>
="<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DF");
?>
=<?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_TIME");
?>
; <?php 
echo GetMessage("SALE_EXPORT_DATE_FORMAT_DLF");
?>
=T" <?php 
echo GetMessage("SALE_EXPORT_DEL_DT");
?>
="T" <?php 
echo GetMessage("SALE_EXPORT_FORM_SUMM");
?>
="<?php 
echo GetMessage("SALE_EXPORT_FORM_CC");
?>
=18; <?php 
echo GetMessage("SALE_EXPORT_FORM_CDC");
?>
=2; <?php 
echo GetMessage("SALE_EXPORT_FORM_CRD");
?>
=." <?php 
echo GetMessage("SALE_EXPORT_FORM_QUANT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_FORM_CC");
?>
=18; <?php 
echo GetMessage("SALE_EXPORT_FORM_CDC");
?>
=2; <?php 
echo GetMessage("SALE_EXPORT_FORM_CRD");
?>
=.">
		<?

		while($arOrder = $dbOrderList->Fetch())
		{
			if ($crmMode)
				ob_start();

			$arResultStat["ORDERS"]++;

			$agentParams = $arAgent[$arOrder["PERSON_TYPE_ID"]];
			$arProp = Array();

			$arProp["ORDER"] = $arOrder;
			if (IntVal($arOrder["USER_ID"]) > 0)
			{
				$dbUser = CUser::GetByID($arOrder["USER_ID"]);
				if ($arUser = $dbUser->Fetch())
					$arProp["USER"] = $arUser;
			}

			$dbOrderPropVals = CSaleOrderPropsValue::GetList(
					array(),
					array("ORDER_ID" => $arOrder["ID"]),
					false,
					false,
					array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE")
				);
			while ($arOrderPropVals = $dbOrderPropVals->Fetch())
			{
				//$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				if ($arOrderPropVals["PROP_TYPE"] == "CHECKBOX")
				{
					if ($arOrderPropVals["VALUE"] == "Y")
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "true";
					else
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = "false";
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "TEXT" || $arOrderPropVals["PROP_TYPE"] == "TEXTAREA")
				{
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "SELECT" || $arOrderPropVals["PROP_TYPE"] == "RADIO")
				{
					$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["VALUE"]);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arVal["NAME"];
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "MULTISELECT")
				{
					$curVal = explode(",", $arOrderPropVals["VALUE"]);
					for ($i = 0; $i < count($curVal); $i++)
					{
						$arVal = CSaleOrderPropsVariant::GetByValue($arOrderPropVals["ORDER_PROPS_ID"], $curVal[$i]);
						if ($i > 0)
							$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .=  ", ";
						$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] .=  $arVal["NAME"];
					}
				}
				elseif ($arOrderPropVals["PROP_TYPE"] == "LOCATION")
				{
					$arVal = CSaleLocation::GetByID($arOrderPropVals["VALUE"], LANGUAGE_ID);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] =  ($arVal["COUNTRY_NAME"].((strlen($arVal["COUNTRY_NAME"])<=0 || strlen($arVal["CITY_NAME"])<=0) ? "" : " - ").$arVal["CITY_NAME"]);
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_CITY"] = $arVal["CITY_NAME"];
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]."_COUNTRY"] = $arVal["COUNTRY_NAME"];
				}
				else
				{
					$arProp["PROPERTY"][$arOrderPropVals["ORDER_PROPS_ID"]] = $arOrderPropVals["VALUE"];
				}
			}

			foreach($agentParams as $k => $v)
			{
				if(strpos($k, "REKV_") !== false)
				{
					if(!is_array($v))
					{
						$agent["REKV"][$k] = $v;
					}
					else
					{
						if(strlen($v["TYPE"])<=0)
						{
							$agent["REKV"][$k] = $v["VALUE"];
						}
						else
						{
							$agent["REKV"][$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
						}
					}
				}
				else
				{
					if(!is_array($v))
					{
						$agent[$k] = $v;
					}
					else
					{
						if(strlen($v["TYPE"])<=0)
						{
							$agent[$k] = $v["VALUE"];
						}
						else
						{
							$agent[$k] = $arProp[$v["TYPE"]][$v["VALUE"]];
						}
					}
				}
			}
			?>
			<<?php 
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo $arOrder["ID"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_NUMBER");
?>
><?php 
echo $accountNumberPrefix . $arOrder["ACCOUNT_NUMBER"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_NUMBER");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_DATE");
?>
><?php 
echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "YYYY-MM-DD");
?>
</<?php 
echo GetMessage("SALE_EXPORT_DATE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM_ORDER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_HOZ_OPERATION");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SELLER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_CURRENCY");
?>
><?php 
echo htmlspecialcharsbx(strlen($currency) > 0 ? substr($currency, 0, 3) : substr($arOrder["CURRENCY"], 0, 3));
?>
</<?php 
echo GetMessage("SALE_EXPORT_CURRENCY");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_CURRENCY_RATE");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
				<?
				if ($crmMode)
				{
					?><DateUpdate><?php 
echo $DB->FormatDate($arOrder["DATE_UPDATE"], $dateFormat, "YYYY-MM-DD HH:MI:SS");
?>
</DateUpdate><?
				}
				?>
				<<?php 
echo GetMessage("SALE_EXPORT_CONTRAGENTS");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_CONTRAGENT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo htmlspecialcharsbx($arOrder["USER_ID"] . "#" . $arProp["USER"]["LOGIN"] . "#" . $arProp["USER"]["LAST_NAME"] . " " . $arProp["USER"]["NAME"] . " " . $arProp["USER"]["SECOND_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["AGENT_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<?
						$address = "<".GetMessage("SALE_EXPORT_PRESENTATION").">".htmlspecialcharsbx($agent["ADDRESS_FULL"])."</".GetMessage("SALE_EXPORT_PRESENTATION").">";
						if(strlen($agent["INDEX"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_POST_CODE")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["INDEX"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["COUNTRY"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_COUNTRY")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["COUNTRY"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["REGION"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_REGION")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["REGION"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["STATE"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_STATE")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["STATE"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["TOWN"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_SMALL_CITY")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["TOWN"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["CITY"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_CITY")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["CITY"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["STREET"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_STREET")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["STREET"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["HOUSE"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_HOUSE")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["HOUSE"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["BUILDING"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_BUILDING")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["BUILDING"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}
						if(strlen($agent["FLAT"])>0)
						{
							$address .= "<".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">
										<".GetMessage("SALE_EXPORT_TYPE").">".GetMessage("SALE_EXPORT_FLAT")."</".GetMessage("SALE_EXPORT_TYPE").">
										<".GetMessage("SALE_EXPORT_VALUE").">".htmlspecialcharsbx($agent["FLAT"])."</".GetMessage("SALE_EXPORT_VALUE").">
									</".GetMessage("SALE_EXPORT_ADDRESS_FIELD").">";
						}

						if($agent["IS_FIZ"]=="Y")
						{
							$arResultStat["CONTACTS"]++;
							?>
								<<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["FULL_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_FULL_NAME");
?>
>
								<?
								if(strlen($agent["SURNAME"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_SURNAME");
?>
><?php 
echo htmlspecialcharsbx($agent["SURNAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_SURNAME");
?>
><?
								}
								if(strlen($agent["NAME"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_NAME");
?>
><?
								}
								if(strlen($agent["SECOND_NAME"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_MIDDLE_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["SECOND_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_MIDDLE_NAME");
?>
><?
								}
								if(strlen($agent["BIRTHDAY"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_BIRTHDAY");
?>
><?php 
echo htmlspecialcharsbx($agent["BIRTHDAY"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_BIRTHDAY");
?>
><?
								}
								if(strlen($agent["MALE"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_SEX");
?>
><?php 
echo htmlspecialcharsbx($agent["MALE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_SEX");
?>
><?
								}
								if(strlen($agent["INN"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_INN");
?>
><?php 
echo htmlspecialcharsbx($agent["INN"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_INN");
?>
><?
								}
								if(strlen($agent["KPP"])>0)
								{
									?><<?php 
echo GetMessage("SALE_EXPORT_KPP");
?>
><?php 
echo htmlspecialcharsbx($agent["KPP"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_KPP");
?>
><?
								}
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_REGISTRATION_ADDRESS");
?>
>
									<?php 
echo $address;
?>
								</<?php 
echo GetMessage("SALE_EXPORT_REGISTRATION_ADDRESS");
?>
>
							<?
						}
						else
						{
							$arResultStat["COMPANIES"]++;
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_OFICIAL_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["FULL_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_OFICIAL_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_UR_ADDRESS");
?>
>
								<?php 
echo $address;
?>
							</<?php 
echo GetMessage("SALE_EXPORT_UR_ADDRESS");
?>
>
							<?
							if(strlen($agent["INN"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_INN");
?>
><?php 
echo htmlspecialcharsbx($agent["INN"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_INN");
?>
><?
							}
							if(strlen($agent["KPP"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_KPP");
?>
><?php 
echo htmlspecialcharsbx($agent["KPP"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_KPP");
?>
><?
							}
							if(strlen($agent["EGRPO"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_EGRPO");
?>
><?php 
echo htmlspecialcharsbx($agent["EGRPO"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_EGRPO");
?>
><?
							}
							if(strlen($agent["OKVED"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_OKVED");
?>
><?php 
echo htmlspecialcharsbx($agent["OKVED"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_OKVED");
?>
><?
							}
							if(strlen($agent["OKDP"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_OKDP");
?>
><?php 
echo htmlspecialcharsbx($agent["OKDP"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_OKDP");
?>
><?
							}
							if(strlen($agent["OKOPF"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_OKOPF");
?>
><?php 
echo htmlspecialcharsbx($agent["OKOPF"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_OKOPF");
?>
><?
							}
							if(strlen($agent["OKFC"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_OKFC");
?>
><?php 
echo htmlspecialcharsbx($agent["OKFC"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_OKFC");
?>
><?
							}
							if(strlen($agent["OKPO"])>0)
							{
								?><<?php 
echo GetMessage("SALE_EXPORT_OKPO");
?>
><?php 
echo htmlspecialcharsbx($agent["OKPO"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_OKPO");
?>
><?
							}
							if(strlen($agent["ACCOUNT_NUMBER"])>0)
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_MONEY_ACCOUNTS");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_MONEY_ACCOUNT");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ACCOUNT_NUMBER");
?>
><?php 
echo htmlspecialcharsbx($agent["ACCOUNT_NUMBER"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ACCOUNT_NUMBER");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_BANK");
?>
>
											<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["B_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
											<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
												<<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
><?php 
echo htmlspecialcharsbx($agent["B_ADDRESS_FULL"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
>
												<?
												if(strlen($agent["B_INDEX"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_POST_CODE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_INDEX"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_COUNTRY"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_COUNTRY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_COUNTRY"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_REGION"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_REGION");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_REGION"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_STATE"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_STATE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_STATE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_TOWN"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SMALL_CITY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_TOWN"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_CITY"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_CITY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_CITY"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_STREET"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_STREET");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_STREET"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_HOUSE"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_HOUSE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_HOUSE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_BUILDING"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_BUILDING");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_BUILDING"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												if(strlen($agent["B_FLAT"])>0)
												{
													?><<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_FLAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
													<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["B_FLAT"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
												</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
><?
												}
												?>
											</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
											<?
											if(strlen($agent["B_BIK"])>0)
											{
												?><<?php 
echo GetMessage("SALE_EXPORT_BIC");
?>
><?php 
echo htmlspecialcharsbx($agent["B_BIK"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_BIC");
?>
><?
											}
											?>
										</<?php 
echo GetMessage("SALE_EXPORT_BANK");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_MONEY_ACCOUNT");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_MONEY_ACCOUNTS");
?>
>
								<?
							}
						}
						if(strlen($agent["F_ADDRESS_FULL"])>0)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
><?php 
echo htmlspecialcharsbx($agent["F_ADDRESS_FULL"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRESENTATION");
?>
>
								<?
								if(strlen($agent["F_INDEX"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_POST_CODE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_INDEX"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_COUNTRY"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_COUNTRY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_COUNTRY"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_REGION"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_REGION");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_REGION"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_STATE"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_STATE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_STATE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_TOWN"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SMALL_CITY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_TOWN"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_CITY"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_CITY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_CITY"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_STREET"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_STREET");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_STREET"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_HOUSE"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_HOUSE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_HOUSE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_BUILDING"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_BUILDING");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_BUILDING"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								if(strlen($agent["F_FLAT"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_FLAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["F_FLAT"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS_FIELD");
?>
>
									<?
								}
								?>
							</<?php 
echo GetMessage("SALE_EXPORT_ADDRESS");
?>
>
							<?
						}
						if(strlen($agent["PHONE"])>0 || strlen($agent["EMAIL"])>0)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_CONTACTS");
?>
>
								<?
								if(strlen($agent["PHONE"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_WORK_PHONE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["PHONE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
									<?
								}
								if(strlen($agent["EMAIL"])>0)
								{
									?>
									<<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
><?php 
echo GetMessage("SALE_EXPORT_MAIL");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TYPE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($agent["EMAIL"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_CONTACT");
?>
>
									<?
								}
								?>
							</<?php 
echo GetMessage("SALE_EXPORT_CONTACTS");
?>
>
							<?
						}
						if(strlen($agent["CONTACT_PERSON"])>0)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_REPRESENTATIVES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_REPRESENTATIVE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_CONTRAGENT");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_RELATION");
?>
><?php 
echo GetMessage("SALE_EXPORT_CONTACT_PERSON");
?>
</<?php 
echo GetMessage("SALE_EXPORT_RELATION");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo md5($agent["CONTACT_PERSON"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($agent["CONTACT_PERSON"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_CONTRAGENT");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_REPRESENTATIVE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_REPRESENTATIVES");
?>
>
							<?
						}?>
						<<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
><?php 
echo GetMessage("SALE_EXPORT_BUYER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ROLE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_CONTRAGENT");
?>
>
				</<?php 
echo GetMessage("SALE_EXPORT_CONTRAGENTS");
?>
>

				<<?php 
echo GetMessage("SALE_EXPORT_TIME");
?>
><?php 
echo $DB->FormatDate($arOrder["DATE_INSERT_FORMAT"], $dateFormat, "HH:MI:SS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_TIME");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_COMMENTS");
?>
><?php 
echo htmlspecialcharsbx($arOrder["COMMENTS"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_COMMENTS");
?>
>
				<?
				$dbOrderTax = CSaleOrderTax::GetList(
					array(),
					array("ORDER_ID" => $arOrder["ID"]),
					false,
					false,
					array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE")
				);
				$i=-1;
				$orderTax = 0;
				while ($arOrderTax = $dbOrderTax->Fetch())
				{
					$arOrderTax["VALUE_MONEY"] = roundEx($arOrderTax["VALUE_MONEY"], 2);
					$orderTax += $arOrderTax["VALUE_MONEY"];
					$i++;
					if($i == 0)
						echo "<".GetMessage("SALE_EXPORT_TAXES").">";
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arOrderTax["TAX_NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
><?php 
echo $arOrderTax["IS_IN_PRICE"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrderTax["VALUE_MONEY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
					<?
				}
				if($i != -1)
					echo "</".GetMessage("SALE_EXPORT_TAXES").">";
				?>
				<?if(IntVal($arOrder["DISCOUNT_VALUE"])>0)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_DISCOUNT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["DISCOUNT_VALUE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>false</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
					<?
				}
				?>
				<<?php 
echo GetMessage("SALE_EXPORT_ITEMS");
?>
>
				<?
				$dbBasket = CSaleBasket::GetList(
						array("NAME" => "ASC"),
						array("ORDER_ID" => $arOrder["ID"])
					);
				$basketSum = 0;
				$priceType = "";
				$bVat = false;
				$vatRate = 0;
				$vatSum = 0;
				while ($arBasket = $dbBasket->Fetch())
				{
					if(strlen($priceType) <= 0)
						$priceType = $arBasket["NOTES"];
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
><?php 
echo htmlspecialcharsbx($arBasket["PRODUCT_XML_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_CATALOG_ID");
?>
><?php 
echo htmlspecialcharsbx($arBasket["CATALOG_XML_ID"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_CATALOG_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arBasket["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
 <?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
="796" <?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_SHTUKA");
?>
" <?php 
echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
?>
="<?php 
echo GetMessage("SALE_EXPORT_RCE");
?>
"><?php 
echo GetMessage("SALE_EXPORT_SHT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
>
						<?
						if(IntVal($arBasket["DISCOUNT_PRICE"])>0)
						{
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM_DISCOUNT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arBasket["DISCOUNT_PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNT");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_DISCOUNTS");
?>
>
							<?
						}
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
><?php 
echo $arBasket["PRICE"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
><?php 
echo $arBasket["QUANTITY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arBasket["PRICE"] * $arBasket["QUANTITY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<?
							$dbProp = CSaleBasket::GetPropsList(Array("SORT" => "ASC", "ID" => "ASC"), Array("BASKET_ID" => $arBasket["ID"], "!CODE" => array("CATALOG.XML_ID", "PRODUCT.XML_ID")));
							while($arProp = $dbProp->Fetch())
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($arProp["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arProp["VALUE"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<?
							}
							?>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
						<?if(DoubleVal($arBasket["VAT_RATE"]) > 0)
						{
							$bVat = true;
							$vatRate = DoubleVal($arBasket["VAT_RATE"]);
							$basketVatSum = (($arBasket["PRICE"] / ($arBasket["VAT_RATE"]+1)) * $arBasket["VAT_RATE"]);
							$vatSum += roundEx($basketVatSum * $arBasket["QUANTITY"], 2);
							?>
							<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
><?php 
echo $arBasket["VAT_RATE"] * 100;
?>
</<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo roundEx($basketVatSum, 2);
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
							<?
						}
						?>
					</<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
					<?
					$basketSum += $arBasket["PRICE"]*$arBasket["QUANTITY"];
				}

				if(IntVal($arOrder["PRICE_DELIVERY"]) > 0)
				{
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>ORDER_DELIVERY</<?php 
echo GetMessage("SALE_EXPORT_ID");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
 <?php 
echo GetMessage("SALE_EXPORT_CODE");
?>
="796" <?php 
echo GetMessage("SALE_EXPORT_FULL_NAME_UNIT");
?>
="<?php 
echo GetMessage("SALE_EXPORT_SHTUKA");
?>
" <?php 
echo GetMessage("SALE_EXPORT_INTERNATIONAL_ABR");
?>
="<?php 
echo GetMessage("SALE_EXPORT_RCE");
?>
"><?php 
echo GetMessage("SALE_EXPORT_SHT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_BASE_UNIT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
><?php 
echo $arOrder["PRICE_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_PRICE_PER_ITEM");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>1</<?php 
echo GetMessage("SALE_EXPORT_QUANTITY");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $arOrder["PRICE_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_TYPE_OF_NOMENKLATURA");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo GetMessage("SALE_EXPORT_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
							</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
						<?if($bVat)
						{
							$deliveryTax = roundEx((($arOrder["PRICE_DELIVERY"] / ($vatRate+1)) * $vatRate), 2);
							if($orderTax > $vatSum && $orderTax == roundEx($vatSum + $deliveryTax, 2))
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
><?php 
echo $vatRate * 100;
?>
</<?php 
echo GetMessage("SALE_EXPORT_RATE");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAX_RATES");
?>
>
								<<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_VAT");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>true</<?php 
echo GetMessage("SALE_EXPORT_IN_PRICE");
?>
>
										<<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
><?php 
echo $deliveryTax;
?>
</<?php 
echo GetMessage("SALE_EXPORT_AMOUNT");
?>
>
									</<?php 
echo GetMessage("SALE_EXPORT_TAX");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_TAXES");
?>
>
								<?
							}
						}
						?>
					</<?php 
echo GetMessage("SALE_EXPORT_ITEM");
?>
>
					<?
				}
				?>
				</<?php 
echo GetMessage("SALE_EXPORT_ITEMS");
?>
>
				<<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
					<?if(strlen($arOrder["DATE_PAYED"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_PAID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_PAYED"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["PAY_VOUCHER_NUM"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_NUMBER");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["PAY_VOUCHER_NUM"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(IntVal($arOrder["PAY_SYSTEM_ID"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_PAY_SYSTEM");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($paySystems[$arOrder["PAY_SYSTEM_ID"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DATE_ALLOW_DELIVERY"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_ALLOW_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_ALLOW_DELIVERY"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DELIVERY_ID"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DELIVERY_SERVICE");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($delivery[$arOrder["DELIVERY_ID"]]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_PAID");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["PAYED"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ALLOW_DELIVERY");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["ALLOW_DELIVERY"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_CANCELED");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["CANCELED"] == "Y" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_FINAL_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["STATUS_ID"] == "F" ? "true" : "false";
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_ORDER_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?$arStatus = CSaleStatus::GetLangByID($arOrder["STATUS_ID"]); echo htmlspecialcharsbx("[".$arOrder["STATUS_ID"]."] ".$arStatus["NAME"]);?></<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>

					<?if(strlen($arOrder["DATE_CANCELED"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_CANCEL");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_CANCELED"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_CANCEL_REASON");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["REASON_CANCELED"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["DATE_STATUS"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_DATE_STATUS");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo $arOrder["DATE_STATUS"];
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					if(strlen($arOrder["USER_DESCRIPTION"])>0)
					{
						?>
						<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_USER_DESCRIPTION");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
							<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($arOrder["USER_DESCRIPTION"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
						</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<?
					}
					$dbSite = CSite::GetByID($arOrder["LID"]);
					$arSite = $dbSite->Fetch();
					?>
					<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo GetMessage("SALE_EXPORT_SITE_NAME");
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
						<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>[<?php 
echo $arOrder["LID"];
?>
] <?php 
echo htmlspecialcharsbx($arSite["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
					</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
					<?
					if(!empty($agent["REKV"]))
					{
						foreach($agent["REKV"] as $k => $v)
						{
							if(strlen($agentParams[$k]["NAME"]) > 0 && strlen($v) > 0)
							{
								?>
								<<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
><?php 
echo htmlspecialcharsbx($agentParams[$k]["NAME"]);
?>
</<?php 
echo GetMessage("SALE_EXPORT_ITEM_NAME");
?>
>
									<<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
><?php 
echo htmlspecialcharsbx($v);
?>
</<?php 
echo GetMessage("SALE_EXPORT_VALUE");
?>
>
								</<?php 
echo GetMessage("SALE_EXPORT_PROPERTY_VALUE");
?>
>
								<?
							}
						}
					}
					?>
				</<?php 
echo GetMessage("SALE_EXPORT_PROPERTIES_VALUES");
?>
>
			</<?php 
echo GetMessage("SALE_EXPORT_DOCUMENT");
?>
>
			<?
			if ($crmMode)
			{
				$c = ob_get_clean();
				$c = CharsetConverter::ConvertCharset($c, $arCharSets[$arOrder["LID"]], "utf-8");
				echo $c;
			}
		}
		?>
		</<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
>
		<?
		return $arResultStat;
	}
Exemplo n.º 29
0
	/**
	 * @param bool|string $strControlID
	 * @return array|bool
	 */
	public static function GetControls($strControlID = false)
	{
		$arSalePersonTypes = array();
		$arFilter = array();
		if (static::$boolInit)
		{
			if (isset(static::$arInitParams['SITE_ID']))
				$arFilter['LID'] = static::$arInitParams['SITE_ID'];
		}
		$rsPersonTypes = CSalePersonType::GetList(array(), $arFilter, false, false, array('ID', 'NAME', 'LIDS'));
		while ($arPersonType = $rsPersonTypes->Fetch())
		{
			$arPersonType['ID'] = intval($arPersonType['ID']);
			$arSalePersonTypes[$arPersonType['ID']] = $arPersonType['NAME'].'('.implode(' ', $arPersonType['LIDS']).')';
		}

		$arSalePaySystemList = array();
		$arFilter = array();
		$rsPaySystems = CSalePaySystem::GetList(array(), $arFilter, false, false, array('ID', 'NAME'));
		while ($arPaySystem = $rsPaySystems->Fetch())
		{
			$arSalePaySystemList[$arPaySystem['ID']] = $arPaySystem['NAME'];
		}

		$arSaleDeliveryList = array();
		$arFilter = array();
		if (static::$boolInit)
		{
			if (isset(static::$arInitParams['SITE_ID']))
				$arFilter['LID'] = static::$arInitParams['SITE_ID'];
		}

		$rsDeliverySystems = CSaleDelivery::GetList(array(), $arFilter, false, false, array('ID', 'LID', 'NAME'));
		while ($arDelivery = $rsDeliverySystems->Fetch())
		{
			$arSaleDeliveryList[$arDelivery['ID']] = $arDelivery['NAME'].' ('.$arDelivery['LID'].')';
		}

		$arFilter = array();
		if (static::$boolInit)
		{
			if (isset(static::$arInitParams['SITE_ID']))
				$arFilter['SITE'] = static::$arInitParams['SITE_ID'];
		}

		$rsDeliveryHandlers = CSaleDeliveryHandler::GetList(array(),$arFilter);
		while ($arDeliveryHandler = $rsDeliveryHandlers->Fetch())
		{
			$boolSep = true;
			if (!empty($arDeliveryHandler['PROFILES']) && is_array($arDeliveryHandler['PROFILES']))
			{
				foreach ($arDeliveryHandler['PROFILES'] as $key => $arProfile)
				{
					$arSaleDeliveryList[$arDeliveryHandler['SID'].':'.$key] = $arDeliveryHandler['NAME'];
				}
			}
		}

		$arLabels = array(
			BT_COND_LOGIC_EQ => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_EQ_LABEL'),
			BT_COND_LOGIC_NOT_EQ => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_NOT_EQ_LABEL'),
			BT_COND_LOGIC_GR => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_GR_LABEL'),
			BT_COND_LOGIC_LS => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_LS_LABEL'),
			BT_COND_LOGIC_EGR => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_EGR_LABEL'),
			BT_COND_LOGIC_ELS => Loc::getMessage('BT_SALE_AMOUNT_LOGIC_ELS_LABEL')
		);
		$arLabelsWeight = array(
			BT_COND_LOGIC_EQ => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_EQ_LABEL'),
			BT_COND_LOGIC_NOT_EQ => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_NOT_EQ_LABEL'),
			BT_COND_LOGIC_GR => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_GR_LABEL'),
			BT_COND_LOGIC_LS => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_LS_LABEL'),
			BT_COND_LOGIC_EGR => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_EGR_LABEL'),
			BT_COND_LOGIC_ELS => Loc::getMessage('BT_SALE_WEIGHT_LOGIC_ELS_LABEL')
		);

		$arControlList = array(
			'CondSaleOrderSumm' => array(
				'ID' => 'CondSaleOrderSumm',
				'FIELD' => 'ORDER_PRICE',
				'FIELD_TYPE' => 'double',
				'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_ORDER_SUMM_LABEL_EXT'),
				'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_ORDER_SUMM_PREFIX_EXT'),
				'LOGIC' => static::GetLogicEx(array_keys($arLabels), $arLabels),
				'JS_VALUE' => array(
					'type' => 'input'
				)
			),
			'CondSalePersonType' => array(
				'ID' => 'CondSalePersonType',
				'FIELD' => 'PERSON_TYPE_ID',
				'FIELD_TYPE' => 'int',
				'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PERSON_TYPE_LABEL'),
				'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PERSON_TYPE_PREFIX'),
				'LOGIC' => static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)),
				'JS_VALUE' => array(
					'type' => 'select',
					'multiple' => 'Y',
					'values' => $arSalePersonTypes,
					'show_value' => 'Y'
				),
				'PHP_VALUE' => array(
					'VALIDATE' => 'list'
				)
			),
			'CondSalePaySystem' => array(
				'ID' => 'CondSalePaySystem',
				'FIELD' => 'PAY_SYSTEM_ID',
				'FIELD_TYPE' => 'int',
				'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PAY_SYSTEM_LABEL'),
				'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_PAY_SYSTEM_PREFIX'),
				'LOGIC' => static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)),
				'JS_VALUE' => array(
					'type' => 'select',
					'multiple' => 'Y',
					'values' => $arSalePaySystemList,
					'show_value' => 'Y'
				),
				'PHP_VALUE' => array(
					'VALIDATE' => 'list'
				)
			),
			'CondSaleDelivery' => array(
				'ID' => 'CondSaleDelivery',
				'FIELD' => 'DELIVERY_ID',
				'FIELD_TYPE' => 'string',
				'FIELD_LENGTH' => 50,
				'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_DELIVERY_LABEL'),
				'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_CMP_SALE_DELIVERY_PREFIX'),
				'LOGIC' => static::GetLogic(array(BT_COND_LOGIC_EQ, BT_COND_LOGIC_NOT_EQ)),
				'JS_VALUE' => array(
					'type' => 'select',
					'multiple' => 'Y',
					'values' => $arSaleDeliveryList,
					'show_value' => 'Y'
				),
				'PHP_VALUE' => array(
					'VALIDATE' => 'list'
				)
			),
			'CondSaleOrderWeight' => array(
				'ID' => 'CondSaleOrderWeight',
				'FIELD' => 'ORDER_WEIGHT',
				'FIELD_TYPE' => 'double',
				'LABEL' => Loc::getMessage('BT_MOD_SALE_COND_SALE_ORDER_WEIGHT_LABEL'),
				'PREFIX' => Loc::getMessage('BT_MOD_SALE_COND_SALE_ORDER_WEIGHT_PREFIX'),
				'LOGIC' => static::GetLogicEx(array_keys($arLabelsWeight), $arLabelsWeight),
				'JS_VALUE' => array(
					'type' => 'input'
				)
			)
		);
		foreach ($arControlList as &$control)
		{
			$control['EXECUTE_MODULE'] = 'sale';
			$control['MODULE_ID'] = 'sale';
			$control['MODULE_ENTITY'] = 'sale';
			$control['ENTITY'] = 'ORDER';
			$control['MULTIPLE'] = 'N';
			$control['GROUP'] = 'N';
		}
		unset($control);

		if ($strControlID === false)
		{
			return $arControlList;
		}
		elseif (isset($arControlList[$strControlID]))
		{
			return $arControlList[$strControlID];
		}
		else
		{
			return false;
		}
	}
Exemplo n.º 30
0
            if ($result["RESULT"] == "OK" && CModule::IncludeModule('currency')) {
                $result["VALUE_FORMATTED"] = CurrencyFormat($result["VALUE"], $arParams["CURRENCY"]);
            } elseif ($result["RESULT"] == "NEXT_STEP" && strlen($result["TEMP"]) > 0) {
                $result["TEMP"] = CUtil::JSEscape($result["TEMP"]);
            }
            $arResult["RESULT"] = $result;
        }
    } else {
        $dbHandler = CSaleDeliveryHandler::GetBySID($arParams["DELIVERY"]);
        if ($arHandler = $dbHandler->Fetch()) {
            foreach ($arHandler["PROFILES"] as $profile_id => $arProfile) {
                if ($profile_id != $arParams["PROFILE"]) {
                    unset($arHandler["PROFILES"][$profile_id]);
                }
            }
            $result = CSaleDeliveryHandler::Calculate($arParams["STEP"], $arParams["DELIVERY"], $arParams["PROFILE"], array("PRICE" => $arParams["ORDER_PRICE"], "WEIGHT" => $arParams["ORDER_WEIGHT"], "LOCATION_FROM" => $arParams["LOCATION_FROM"], "LOCATION_TO" => $arParams["LOCATION_TO"], "LOCATION_ZIP" => $arParams['LOCATION_ZIP'], "ITEMS" => $arParams["ITEMS"], "EXTRA_PARAMS" => $arParams["EXTRA_PARAMS"]), $arParams["CURRENCY"], $arParams["~TEMP"]);
            if (is_array($result)) {
                if ($result["RESULT"] == "OK" && CModule::IncludeModule('currency')) {
                    $result["VALUE_FORMATTED"] = CurrencyFormat($result["VALUE"], $arParams["CURRENCY"]);
                } elseif ($result["RESULT"] == "NEXT_STEP" && strlen($result["TEMP"]) > 0) {
                    $result["TEMP"] = CUtil::JSEscape($result["TEMP"]);
                }
                $arResult["RESULT"] = $result;
            }
        } else {
            ShowError(GetMessage("SALE_DELIVERY_HANDLER_NOT_INSTALL"));
            return;
        }
    }
} else {
    $arParams["STEP"] = 0;