function OnBasketAddHandler($ID, $arFields)
{
    global $USER;
    \Bitrix\Main\Loader::includeModule('catalog');
    \Bitrix\Main\Loader::includeModule('sale');
    if ($USER->IsAuthorized()) {
        $arFilter = array("USER_ID" => $USER->GetID());
        $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
        $arrCount = [];
        while ($ar_sales = $db_sales->Fetch()) {
            $arrCount[] = $ar_sales;
        }
        if (is_array($arrCount) == false) {
            $res = CCatalogDiscount::SetCoupon('SL-CDUEA-HI8MMPY');
            //3%
        } else {
            if (count($arrCount) >= 1) {
                $resClean = CCatalogDiscount::ClearCoupon('SL-CDUEA-HI8MMPY');
                $res5 = CCatalogDiscount::SetCoupon('SL-0JG2C-XIHBEYZ');
                //5%
            } else {
            }
        }
    } else {
        $res = CCatalogDiscountCoupon::SetCoupon('SL-CDUEA-HI8MMPY');
        //3%
    }
}
 public static function chStatusOld($id, $status)
 {
     try {
         self::$o_erip = new \Dm\Erip();
         self::$opt_status = \Bitrix\Main\Config\Option::get(self::$module_id, "order_status_code_erip");
         self::$opt_payment = \Bitrix\Main\Config\Option::get(self::$module_id, "payment_system_id");
         self::$values = CSaleOrder::GetList(array(), array("ID" => $id), false, false, array("ID", "PAY_SYSTEM_ID", "PRICE", "CURRENCY", "STATUS_ID"))->Fetch();
         if (self::$values["PAY_SYSTEM_ID"] == self::$opt_payment && $status != self::$values["STATUS_ID"] && $status == self::$opt_status) {
             static::setTehnicalInfo();
             static::setUserInfo();
             static::setMoneyInfo();
             $r = self::$o_erip->submit();
             self::$o_response = json_decode($r);
             if (isset(self::$o_response->errors)) {
                 throw new \Exception(self::$o_response->message);
             }
             if (CSaleOrder::Update($id, array("COMMENTS" => "status: " . self::$o_response->transaction->status . "\n" . "transaction_id: " . self::$o_response->transaction->transaction_id . "\n" . "order_id: " . self::$o_response->transaction->order_id . "\n" . "account_number: " . self::$o_response->transaction->erip->account_number . "\n"))) {
                 static::sendMail();
             }
             return true;
         }
     } catch (Exception $e) {
         $GLOBALS["APPLICATION"]->ThrowException($e->getMessage());
         return false;
     }
 }
示例#3
0
 function OnBeforeUserDeleteHandler($user_id)
 {
     \CModule::IncludeModule("iblock");
     \CModule::IncludeModule("sale");
     //Привязки к соц. сетям
     $arrFilter = array("IBLOCK_ID" => USER_SOCIAL_IB, "PROPERTY_USER_ID" => $user_id);
     $arSelect = array("ID");
     $rsRes = \CIBlockElement::GetList($arOrder, $arrFilter, false, false, $arSelect);
     while ($arItem = $rsRes->GetNext()) {
         \CIBlockElement::Delete($arItem["ID"]);
     }
     //Удаляем записи
     $result = \Hawkart\Megatv\RecordTable::getList(array('filter' => array("UF_USER_ID" => $user_id), 'select' => array("ID")));
     while ($arRecord = $result->fetch()) {
         \CRecordEx::delete($arRecord["ID"]);
     }
     //Удаляем счет
     if ($arAccount = \CSaleUserAccount::GetByUserID($user_id, "RUR")) {
         \CSaleUserAccount::Delete($arAccount["ID"]);
     }
     //Удаляем заказы
     $arFilter = array("USER_ID" => $user_id);
     $db_sales = \CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
     while ($ar_sales = $db_sales->Fetch()) {
         \CSaleOrder::Delete($ar_sales["ID"]);
     }
     //Удаляем подписки
     $result = \Hawkart\Megatv\SubscribeTable::getList(array('filter' => array("=UF_USER_ID" => $user_id), 'select' => array("ID")));
     if ($arSub = $result->fetch()) {
         \Hawkart\Megatv\SubscribeTable::delete($arSub["ID"]);
     }
 }
示例#4
0
	private static function CountOrderSumm($USER_ID)
	{
		if(!CModule::IncludeModule("sale"))
			return false;
			
		$rs = CSaleOrder::GetList(
			array(),
			array(
				"USER_ID" => $USER_ID,
				"STATUS_ID" => "F"
			),
			false,
			false,
			array()
		);
		
		$iSumm = 0;
		while($ar = $rs -> Fetch())
		{
			if($ar["CURRENCY"] !== "RUB") continue;
			$iSumm += ($ar["PRICE"] - $ar["PRICE_DELIVERY"]);
		}
				
		return $iSumm;
	}
示例#5
0
 protected static function isDeliveryInOrders($deliveryId)
 {
     $dbOrders = \CSaleOrder::GetList(array(), array("DELIVERY_ID" => $deliveryId), false, false, array("ID"));
     if ($dbOrders->Fetch()) {
         $result = true;
     } else {
         $result = false;
     }
     return $result;
 }
 public static function onGenerateInitialData(Date $from, Date $to)
 {
     $data = array();
     // 1. Payments
     $result = \CSaleOrder::GetList(array(), array('PAYED' => 'Y', 'CANCELED' => 'N', '>=DATE_PAYED' => $from, '<=DATE_PAYED' => $to), false, false, array('LID', 'DATE_PAYED', 'PRICE', 'CURRENCY'));
     while ($row = $result->Fetch()) {
         $day = new DateTime($row['DATE_PAYED']);
         $sum = Config::convertToBaseCurrency($row['PRICE'], $row['CURRENCY']);
         if ($counters =& $data[$row['LID']][$day->format('Y-m-d')]) {
             $counters['sale_payment_add_day'] += 1;
             $counters['sale_payment_sum_add'] += $sum;
         } else {
             $counters = array('sale_payment_add_day' => 1, 'sale_payment_sum_add' => $sum);
         }
     }
     // 2. Orders
     $result = \CSaleOrder::GetList(array(), array('CANCELED' => 'N', '>=DATE_INSERT' => $from, '<=DATE_INSERT' => $to), false, false, array('LID', 'DATE_INSERT', 'PRICE', 'CURRENCY'));
     while ($row = $result->Fetch()) {
         $day = new DateTime($row['DATE_INSERT']);
         $sum = Config::convertToBaseCurrency($row['PRICE'], $row['CURRENCY']);
         if ($counters =& $data[$row['LID']][$day->format('Y-m-d')]) {
             $counters['sale_order_add_day'] += 1;
             $counters['sale_order_sum_add'] += $sum;
         } else {
             $counters = array('sale_order_add_day' => 1, 'sale_order_sum_add' => $sum);
         }
     }
     // 3. Cart
     $result = \CSaleBasket::GetList(array(), array('>=DATE_INSERT' => $from, '<=DATE_INSERT' => $to), false, false, array('LID', 'DATE_INSERT', 'PRICE', 'CURRENCY', 'QUANTITY'));
     while ($row = $result->Fetch()) {
         $day = new DateTime($row['DATE_INSERT']);
         $sum = Config::convertToBaseCurrency($row['PRICE'] * $row['QUANTITY'], $row['CURRENCY']);
         if ($counters =& $data[$row['LID']][$day->format('Y-m-d')]) {
             $counters['sale_cart_add_day'] += 1;
             $counters['sale_cart_sum_add'] += $sum;
         } else {
             $counters = array('sale_cart_add_day' => 1, 'sale_cart_sum_add' => $sum);
         }
     }
     // Result
     unset($counters);
     $result = array();
     foreach ($data as $siteId => $dayCounters) {
         $result[] = array('ATTRIBUTES' => array('conversion_site' => $siteId), 'DAY_COUNTERS' => $dayCounters);
     }
     return $result;
 }
示例#7
0
 public static function OnSalePayOrder($ID, $val)
 {
     $ID = intval($ID);
     if ($ID > 0 && $val == 'Y') {
         $arOrder = array();
         $dbBasketItems = CSaleBasket::GetList(array(), array('ORDER_ID' => $ID), false, false, array('ID', 'MODULE', 'CATALOG_XML_ID', 'QUANTITY'));
         while ($arItems = $dbBasketItems->Fetch()) {
             if ($arItems['MODULE'] == 'asd.money' && !empty($arItems['CATALOG_XML_ID']) && strpos($arItems['CATALOG_XML_ID'], '@') !== false) {
                 if (empty($arOrder)) {
                     $rsOrders = CSaleOrder::GetList(array(), array('ID' => $ID), false, false, array('ID', 'USER_ID'));
                     $arOrder = $rsOrders->Fetch();
                     if (empty($arOrder)) {
                         return;
                     }
                 }
                 list($amount, $curr) = explode('@', $arItems['CATALOG_XML_ID']);
                 CSaleUserAccount::UpdateAccount($arOrder['USER_ID'], doubleval($amount) * doubleval($arItems['QUANTITY']), $curr, GetMessage('ASD_MODULE_TRANSACT_PREPAID'), $ID);
             }
         }
     }
 }
示例#8
0
?>
<div class="row"> 
  <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 col-lg-push-8 col-md-push-8"> 
    <div class="heading"> 
      <h4>Мой кабинет</h4>
     </div>
   <?php 
$APPLICATION->IncludeComponent("bitrix:menu", "vertical_left_menu", array("ROOT_MENU_TYPE" => "left", "MAX_LEVEL" => "1", "CHILD_MENU_TYPE" => "left", "USE_EXT" => "N", "DELAY" => "N", "ALLOW_MULTI_SELECT" => "N", "MENU_CACHE_TYPE" => "N", "MENU_CACHE_TIME" => "3600", "MENU_CACHE_USE_GROUPS" => "Y", "MENU_CACHE_GET_VARS" => array()));
?>
 </div>
 
  <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 col-lg-pull-4 col-md-pull-4"> <?php 
if ($USER->IsAuthorized() && CModule::IncludeModule("sale")) {
    $arOrders = array();
    $arFilter = array("USER_ID" => $USER->GetID(), "STATUS_ID" => "F");
    $rsSales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
    while ($arSales = $rsSales->Fetch()) {
        $arOrders[] = $arSales["ID"];
    }
    $dbBasketItems = CSaleBasket::GetList(array("NAME" => "ASC", "ID" => "ASC"), array("ORDER_ID" => $arOrders), false, false, array("PRODUCT_ID"));
    while ($arItems = $dbBasketItems->Fetch()) {
        $arBasketItems[] = $arItems["PRODUCT_ID"];
    }
    $arFilter = array("IBLOCK_ID" => 31, "ACTIVE" => "Y", "PROPERTY_Linked_Goods" => $arBasketItems);
}
?>
 <?php 
if (!empty($arBasketItems) && !empty($arOrders) && $USER->IsAuthorized() || $USER->isAdmin()) {
    ?>
 
    <h3>Релизы </h3>
示例#9
0
	/**
	 * <p>Функция удаляет тип плательщика с кодом ID. Так же удаляются все связанные данные. Если есть заказы, привязанные к этому типу плательщика, то тип плательщика не может быть удален. </p>
	 *
	 *
	 *
	 *
	 * @param int $ID  Код типа плательщика.
	 *
	 *
	 *
	 * @return bool <p>Возвращается <i>true</i> в случае успешного удаления и <i>false</i> - в
	 * противном случае.</p><br><br>
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/sale/classes/csalepersontype/csalepersontype__delete.c2566ed3.php
	 * @author Bitrix
	 */
	public static function Delete($ID)
	{
		global $DB;
		$ID = IntVal($ID);

		$db_orders = CSaleOrder::GetList(
				array("DATE_UPDATE" => "DESC"),
				array("PERSON_TYPE_ID" => $ID),
				false,
				array("nTopCount" => 1),
				array("ID")
			);
		if ($db_orders->Fetch())
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGP_ERROR_PERSON_HAS_ORDER").$ID, "ERROR_PERSON_HAS_ORDER");
			return False;
		}

		$db_events = GetModuleEvents("sale", "OnBeforePersonTypeDelete");
		while ($arEvent = $db_events->Fetch())
			if (ExecuteModuleEventEx($arEvent, Array($ID))===false)
				return false;

		$events = GetModuleEvents("sale", "OnPersonTypeDelete");
		while ($arEvent = $events->Fetch())
			ExecuteModuleEventEx($arEvent, Array($ID));

		$DB->Query("DELETE FROM b_sale_pay_system_action WHERE PERSON_TYPE_ID = ".$ID."", true);

		$db_orderProps = CSaleOrderProps::GetList(
				array("PROPS_GROUP_ID" => "ASC"),
				array("PERSON_TYPE_ID" => $ID)
			);
		while ($arOrderProps = $db_orderProps->Fetch())
		{
			$DB->Query("DELETE FROM b_sale_order_props_variant WHERE ORDER_PROPS_ID = ".$arOrderProps["ID"]."", true);
			$DB->Query("DELETE FROM b_sale_order_props_value WHERE ORDER_PROPS_ID = ".$arOrderProps["ID"]."", true);
			$DB->Query("DELETE FROM b_sale_user_props_value WHERE ORDER_PROPS_ID = ".$arOrderProps["ID"]."", true);
		}
		$DB->Query("DELETE FROM b_sale_order_props WHERE PERSON_TYPE_ID = ".$ID."", true);

		$db_orderUserProps = CSaleOrderUserProps::GetList(
				array("NAME" => "ASC"),
				array("PERSON_TYPE_ID" => $ID)
			);
		while ($arOrderUserProps = $db_orderUserProps->Fetch())
		{
			$DB->Query("DELETE FROM b_sale_user_props_value WHERE USER_PROPS_ID = ".$arOrderUserProps["ID"]."", true);
		}
		$DB->Query("DELETE FROM b_sale_user_props WHERE PERSON_TYPE_ID = ".$ID."", true);
		$DB->Query("DELETE FROM b_sale_order_props_group WHERE PERSON_TYPE_ID = ".$ID."", true);
		$DB->Query("DELETE FROM b_sale_person_type_site WHERE PERSON_TYPE_ID=".$ID, true);

		unset($GLOBALS["SALE_PERSON_TYPE_LIST_CACHE"]);
		return $DB->Query("DELETE FROM b_sale_person_type WHERE ID = ".$ID."", true);
	}
示例#10
0
 function __SaleOrderCount($arFilter, $strCurrency = '')
 {
     $mxResult = false;
     if (is_array($arFilter) && !empty($arFilter)) {
         $dblPrice = 0;
         $strCurrency = strval($strCurrency);
         $mxLastOrderDate = '';
         $intMaxTimestamp = 0;
         $intTimeStamp = 0;
         $rsSaleOrders = CSaleOrder::GetList(array(), $arFilter, false, false, array('ID', 'PRICE', 'CURRENCY', 'DATE_INSERT'));
         while ($arSaleOrder = $rsSaleOrders->Fetch()) {
             $intTimeStamp = MakeTimeStamp($arSaleOrder['DATE_INSERT']);
             if ($intMaxTimestamp < $intTimeStamp) {
                 $intMaxTimestamp = $intTimeStamp;
                 $mxLastOrderDate = $arSaleOrder['DATE_INSERT'];
             }
             if (empty($strCurrency)) {
                 $dblPrice += $arSaleOrder['PRICE'];
                 $strCurrency = $arSaleOrder['CURRENCY'];
             } else {
                 if ($strCurrency != $arSaleOrder['CURRENCY']) {
                     $dblPrice += $arSaleOrder['PRICE'];
                 } else {
                     $dblPrice += $arSaleOrder['PRICE'];
                 }
             }
         }
         $mxResult = array('PRICE' => $dblPrice, 'CURRENCY' => $strCurrency, 'LAST_ORDER_DATE' => $mxLastOrderDate, 'TIMESTAMP' => $intMaxTimestamp);
     }
     return $mxResult;
 }
示例#11
0
        $arResult["ITEMS"]["AnDelCanBuy"] = $arOrderForDiscount['BASKET_ITEMS'];
    }
    //end if array basket
    if (empty($arBasketItems)) {
        $arResult["ERROR_MESSAGE"] = GetMessage("SALE_EMPTY_BASKET");
    }
    if (!isset($_POST["BasketOrder"])) {
        $errorMessage = "";
    }
    $errorMessage .= $productLimit;
    $arResult["ERROR_MESSAGE"] = $errorMessage;
} else {
    $arResult["ORDER_BASKET"]["CONFIRM_ORDER"] = "Y";
    $arResult["ORDER_BASKET"]["ORDER_ID"] = intval($ORDER_ID);
    $arResult["ORDER_ID"] = intval($ORDER_ID);
    $dbOrder = CSaleOrder::GetList(array("DATE_UPDATE" => "DESC"), array("LID" => SITE_ID, "USER_ID" => $currentUserId, "ID" => $arResult["ORDER_BASKET"]["ORDER_ID"]));
    if ($arOrder = $dbOrder->GetNext()) {
        if (intval($arOrder["PAY_SYSTEM_ID"]) > 0) {
            $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"]), false, false, array("NAME", "ACTION_FILE", "NEW_WINDOW", "PARAMS", "ENCODING"));
            if ($arPaySysAction = $dbPaySysAction->Fetch()) {
                $arPaySysAction["NAME"] = htmlspecialcharsEx($arPaySysAction["NAME"]);
                if (strlen($arPaySysAction["ACTION_FILE"]) > 0) {
                    if ($arPaySysAction["NEW_WINDOW"] != "Y") {
                        CSalePaySystemAction::InitParamArrays($arOrder, $arOrder["ID"], $arPaySysAction["PARAMS"]);
                        $pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysAction["ACTION_FILE"];
                        $pathToAction = str_replace("\\", "/", $pathToAction);
                        while (substr($pathToAction, strlen($pathToAction) - 1, 1) == "/") {
                            $pathToAction = substr($pathToAction, 0, strlen($pathToAction) - 1);
                        }
                        if (file_exists($pathToAction)) {
                            if (is_dir($pathToAction) && file_exists($pathToAction . "/payment.php")) {
示例#12
0
function fGetBuyerType($PERSON_TYPE_ID, $LID, $USER_ID = '', $ORDER_ID = 0, $formVarsSubmit = false)
{
	global $locationZipID, $locationID, $DELIVERY_LOCATION, $DELIVERY_LOCATION_ZIP;
	$resultHtml = "<script>locationZipID = 0;locationID = 0;</script><table width=\"100%\" id=\"order_type_props\" class=\"edit-table\">";

	//select person type
	$arPersonTypeList = array();
	$personTypeSelect = "<select name='buyer_type_id' id='buyer_type_id' OnChange='fBuyerChangeType(this);' >";
	$dbPersonType = CSalePersonType::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("ACTIVE" => "Y"));
	while ($arPersonType = $dbPersonType->GetNext())
	{
		if (!in_array($LID, $arPersonType["LIDS"]))
			continue;

		if (!isset($PERSON_TYPE_ID) OR $PERSON_TYPE_ID == "")
			$PERSON_TYPE_ID = $arPersonType["ID"];

		$class = "";
		if (intval($arPersonType["ID"]) == intval($PERSON_TYPE_ID))
			$class = " selected";

		$personTypeSelect .= "<option value=\"".$arPersonType["ID"]."\" ".$class.">".$arPersonType["NAME"]." [".$arPersonType["ID"]."]</option>";
	}
	$personTypeSelect .= "</select>";

	$userComment = "";
	$userDisplay = "none";
	if (intval($ORDER_ID) > 0)
	{
		$dbOrder = CSaleOrder::GetList(
			array(),
			array("ID" => $ORDER_ID, "ACTIVE" => "Y"),
			false,
			false,
			array()
		);
		$arOrder = $dbOrder->Fetch();
		$userComment = $arOrder["USER_DESCRIPTION"];
		$userDisplay = "table-row";
	}

	if ($formVarsSubmit && $_REQUEST["btnTypeBuyer"] == "btnBuyerNew")
		$userDisplay = "none";
	elseif ($formVarsSubmit && $_REQUEST["btnTypeBuyer"] == "btnBuyerExist")
		$userDisplay = "table-row";

	$resultHtml .= "<tr id=\"btnBuyerExistField\" style=\"display:".$userDisplay."\">
			<td class=\"adm-detail-content-cell-l\" width=\"40%\">".GetMessage("NEWO_BUYER").":</td>
			<td class=\"adm-detail-content-cell-r\" width=\"60%\"><div id=\"user_name\">".fGetUserName($USER_ID)."</div></td></tr>";

	$resultHtml .= "<tr class=\"adm-detail-required-field\">
		<td class=\"adm-detail-content-cell-l\" width=\"40%\">".GetMessage("SOE_PERSON_TYPE").":</td>
		<td class=\"adm-detail-content-cell-r\" width=\"60%\">".$personTypeSelect."</td>
	</tr>";

	$bShowTrProfile = "none";
	if ($formVarsSubmit && $_POST["btnTypeBuyer"] == "btnBuyerExist")
		$bShowTrProfile = "table-row";

	$resultHtml .= "<tr id=\"buyer_profile_display\" style=\"display:".$bShowTrProfile."\" class=\"adm-detail-required-field\">
		<td class=\"adm-detail-content-cell-l\">".GetMessage("NEWO_BUYER_PROFILE").":</td>
		<td class=\"adm-detail-content-cell-r\">
			<div id=\"buyer_profile_select\">";

			if ($formVarsSubmit && $_POST["btnTypeBuyer"] == "btnBuyerExist")
			{
				$resultHtml .= fUserProfile(intval($_POST["user_id"]), intval($_POST["buyer_type_id"]), $default = '');
			}

	$resultHtml .= "</div></td>
	</tr>";

	if ($ORDER_ID <= 0)
	{
		$arCountProps = fGetCountProfileProps($PERSON_TYPE_ID);
		$resultHtml .= "<tr id=\"btnBuyerNewField\">";
		if (count($arCountProps) < 3)
		{
			$resultHtml .= "<td colspan=2>
					<table width=\"100%\" class=\"edit-table\" >";
					if (intval($arCountProps["IS_EMAIL"]) <= 0)
						$resultHtml .= "<tr class=\"adm-detail-required-field\">
							<td class=\"adm-detail-content-cell-l\" width=\"40%\">".GetMessage("NEWO_BUYER_REG_MAIL")."</td>
							<td class=\"adm-detail-content-cell-r\"><input type=\"text\" name=\"NEW_BUYER_EMAIL\" size=\"30\" value=\"".htmlspecialcharsbx(trim($_REQUEST["NEW_BUYER_EMAIL"]))."\" tabindex=\"1\" /></td>
						</tr>";
					if (intval($arCountProps["IS_PAYER"]) <= 0)
						$resultHtml .= "<tr class=\"adm-detail-required-field\">
							<td class=\"adm-detail-content-cell-l\">".GetMessage("NEWO_BUYER_REG_LASTNAME")."</td>
							<td class=\"adm-detail-content-cell-r\"><input type=\"text\" name=\"NEW_BUYER_LAST_NAME\" size=\"30\" value=\"".htmlspecialcharsbx(trim($_REQUEST["NEW_BUYER_LAST_NAME"]))."\" tabindex=\"3\" /></td>
						</tr>
						<tr class=\"adm-detail-required-field\">
							<td class=\"adm-detail-content-cell-l\">".GetMessage("NEWO_BUYER_REG_NAME")."</td>
							<td class=\"adm-detail-content-cell-r\"><input type=\"text\" name=\"NEW_BUYER_NAME\" size=\"30\" value=\"".htmlspecialcharsbx(trim($_REQUEST["NEW_BUYER_NAME"]))."\" tabindex=\"2\" /></td>
						</tr>";
					$resultHtml .= "</table>
				</td>";
		}
		$resultHtml .= "</tr>";
	}

	$arPropertiesList = array();
	$dbProperties = CSaleOrderProps::GetList(
		array("GROUP_SORT" => "ASC", "PROPS_GROUP_ID" => "ASC", "SORT" => "ASC", "NAME" => "ASC"),
		array("PERSON_TYPE_ID" => $PERSON_TYPE_ID, "ACTIVE" => "Y", "RELATED" => false),
		false,
		false,
		array("*")
	);
	while($property = $dbProperties->Fetch())
	{
		$arPropertiesList[$property['ID']] = $property;
	}

	// getting values
	$arPropValues = array();
	if ($formVarsSubmit) // from request
	{
		$locationIndexForm = "";
		foreach ($_POST as $key => $value)
		{
			if (substr($key, 0, strlen("CITY_ORDER_PROP_")) == "CITY_ORDER_PROP_")
			{
				$arPropValues[intval(substr($key, strlen("CITY_ORDER_PROP_")))] = htmlspecialcharsbx($value);
				$locationIndexForm = intval(substr($key, strlen("CITY_ORDER_PROP_")));
			}
			if (substr($key, 0, strlen("ORDER_PROP_")) == "ORDER_PROP_")
			{
				if ($locationIndexForm != intval(substr($key, strlen("ORDER_PROP_"))) && !is_array($value))
					$arPropValues[intval(substr($key, strlen("ORDER_PROP_")))] = htmlspecialcharsbx($value);
			}
		}
		$userComment = $_POST["USER_DESCRIPTION"];
	}
	elseif ($ORDER_ID == "" AND $USER_ID != "") // from profile
	{
		//profile
		$userProfile = array();
		$userProfile = CSaleOrderUserProps::DoLoadProfiles($USER_ID, $PERSON_TYPE_ID);
		$arPropValues = $userProfile[$PERSON_TYPE_ID]["VALUES"];
	}
	elseif ($ORDER_ID != "") // from order properties
	{
		$dbPropValuesList = CSaleOrderPropsValue::GetList(
			array(),
			array("ORDER_ID" => $ORDER_ID, "ACTIVE" => "Y"),
			false,
			false,
			array("ID", "ORDER_PROPS_ID", "NAME", "VALUE", "CODE")
		);
		while ($arPropValuesList = $dbPropValuesList->Fetch())
		{
			// from db
			if(CSaleLocation::isLocationProMigrated() && $arPropertiesList[$arPropValuesList['ORDER_PROPS_ID']]['TYPE'] == 'LOCATION')
				$arPropValuesList["VALUE"] = CSaleLocation::getLocationIDbyCODE($arPropValuesList["VALUE"]);

			$arPropValues[intval($arPropValuesList["ORDER_PROPS_ID"])] = htmlspecialcharsbx($arPropValuesList["VALUE"]);
		}
	}

	$location2townFldMap = array();
	$arDisableFieldForLocation = array();
	//select field (town) for disable
	$dbProperties = CSaleOrderProps::GetList(
		array(),
		array("PERSON_TYPE_ID" => $PERSON_TYPE_ID, "ACTIVE" => "Y", ">INPUT_FIELD_LOCATION" => 0),
		false,
		false,
		array("INPUT_FIELD_LOCATION")
	);
	while ($arProperties = $dbProperties->Fetch())
	{
		$arDisableFieldForLocation[$arProperties["INPUT_FIELD_LOCATION"]] = $arProperties["INPUT_FIELD_LOCATION"];
	}

	//show town if location is another
	$arEnableTownProps = array();
	$dbOrderProps = CSaleOrderPropsValue::GetOrderProps($ORDER_ID);
	while ($arOrderProps = $dbOrderProps->Fetch())
	{
		if($arOrderProps["TYPE"] == "LOCATION" && $arOrderProps["ACTIVE"] == "Y" && $arOrderProps["IS_LOCATION"] == "Y")
		{
			if (in_array($arOrderProps["INPUT_FIELD_LOCATION"], $arDisableFieldForLocation))
			{
				if(CSaleLocation::isLocationProMigrated())
				{
					if(CSaleLocation::checkLocationIsAboveCity($arPropValues[$arOrderProps["ORDER_PROPS_ID"]]))
						unset($arDisableFieldForLocation[$arOrderProps["INPUT_FIELD_LOCATION"]]);
				}
				else
				{
					$arLocation = CSaleLocation::GetByID($arPropValues[$arOrderProps["ORDER_PROPS_ID"]]);
					if (intval($arLocation["CITY_ID"]) <= 0)
						unset($arDisableFieldForLocation[$arOrderProps["INPUT_FIELD_LOCATION"]]);
				}
			}

			$location2townFldMap[$arOrderProps['ORDER_PROPS_ID']] = $arOrderProps['INPUT_FIELD_LOCATION'];
		}
	}

	$propertyGroupID = -1;

	foreach($arPropertiesList as $arProperties)
	{
		if (intval($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID)
		{
			$resultHtml .= "<tr><td colspan=\"2\" style=\"text-align:center;font-weight:bold;font-size:14px;color:rgb(75, 98, 103);\" >".htmlspecialcharsEx($arProperties["GROUP_NAME"])."\n</td>\n</tr>";
			$propertyGroupID = intval($arProperties["PROPS_GROUP_ID"]);
		}

		if (intval($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID)
			$propertyGroupID = intval($arProperties["PROPS_GROUP_ID"]);

		$adit = "";
		$requiredField = "";
		if ($arProperties["REQUIED"] == "Y" || $arProperties["IS_PROFILE_NAME"] == "Y" || $arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y" || $arProperties["IS_PAYER"] == "Y" || $arProperties["IS_ZIP"] == "Y")
		{
			$adit = " class=\"adm-detail-required-field\"";
			$requiredField = " class=\"adm-detail-content-cell-l\"";
		}

		$isTownProperty = in_array($arProperties["ID"], $location2townFldMap) || $arProperties['CODE'] == 'CITY';

		//delete town from location
		if (in_array($arProperties["ID"], $arDisableFieldForLocation))
			$resultHtml .= "<tr style=\"display:none;\" id=\"town_location_".$arProperties["ID"]."\"".$adit.">\n";
		else
			$resultHtml .= "<tr id=\"town_location_".$arProperties["ID"]."\"".$adit.($isTownProperty ? " class=\"-bx-order-property-city\"" : '').">\n";

		if(($arProperties["TYPE"] == "MULTISELECT" || $arProperties["TYPE"] == "TEXTAREA" || $arProperties["TYPE"] == "FILE") || ($ORDER_ID <= 0 && $arProperties["IS_PROFILE_NAME"] == "Y") )
			$resultHtml .= "<td valign=\"top\" class=\"adm-detail-content-cell-l\" width=\"40%\">\n";
		else
			$resultHtml .= "<td align=\"right\" width=\"40%\" ".$requiredField.">\n";

		$resultHtml .= $arProperties["NAME"].":</td>";

		$curVal = $arPropValues[intval($arProperties["ID"])];

		if($arProperties["IS_EMAIL"] == "Y" || $arProperties["IS_PAYER"] == "Y")
		{
			if(strlen($arProperties["DEFAULT_VALUE"]) <= 0 && intval($USER_ID) > 0)
			{
				$rsUser = CUser::GetByID($USER_ID);
				if ($arUser = $rsUser->Fetch())
				{
					if($arProperties["IS_EMAIL"] == "Y")
						$arProperties["DEFAULT_VALUE"] = $arUser["EMAIL"];
					else
					{
						if (strlen($arUser["LAST_NAME"]) > 0)
							$arProperties["DEFAULT_VALUE"] .= $arUser["LAST_NAME"];
						if (strlen($arUser["NAME"]) > 0)
							$arProperties["DEFAULT_VALUE"] .= " ".$arUser["NAME"];
						if (strlen($arUser["SECOND_NAME"]) > 0 AND strlen($arUser["NAME"]) > 0)
							$arProperties["DEFAULT_VALUE"] .= " ".$arUser["SECOND_NAME"];
					}
				}
			}
		}

		$resultHtml .= "<td class=\"adm-detail-content-cell-r\" width=\"60%\">";

		if ($arProperties["TYPE"] == "CHECKBOX")
		{
			$resultHtml .= '<input type="checkbox" class="inputcheckbox" ';
			$resultHtml .= 'name="ORDER_PROP_'.$arProperties["ID"].'" value="Y"';
			$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" ';
			if ($curVal=="Y" || !isset($curVal) && $arProperties["DEFAULT_VALUE"]=="Y")
				$resultHtml .= " checked";
			$resultHtml .= '>';
		}
		elseif ($arProperties["TYPE"] == "TEXT")
		{
			$change = "";
			if ($arProperties["IS_ZIP"] == "Y")
			{
				$DELIVERY_LOCATION_ZIP = $curVal;
				$resultHtml .= '<script> locationZipID = \''.$arProperties["ID"].'\';</script>';
				$locationZipID = ((isset($curVal)) ? htmlspecialcharsEx($curVal) : htmlspecialcharsex($arProperties["DEFAULT_VALUE"]));
			}

			if ($arProperties["IS_PAYER"] == "Y" && intval($USER_ID) <= 0)
			{
				$resultHtml .= '<div id="BREAK_NAME"';
				if ($ORDER_ID > 0 || ($formVarsSubmit && $_REQUEST["btnTypeBuyer"] == "btnBuyerExist"))
					$resultHtml .= ' style="display:none"';
				$resultHtml .= '>';

				$BREAK_LAST_NAME_TMP = GetMessage('NEWO_BREAK_LAST_NAME');
				if (isset($_REQUEST["BREAK_LAST_NAME"]) && strlen($_REQUEST["BREAK_LAST_NAME"]) > 0)
					$BREAK_LAST_NAME_TMP = htmlspecialcharsbx(trim($_REQUEST["BREAK_LAST_NAME"]));

				$NEWO_BREAK_NAME_TMP = GetMessage('NEWO_BREAK_NAME');
				if (isset($_REQUEST["BREAK_NAME"]) && strlen($_REQUEST["BREAK_NAME"]) > 0)
					$NEWO_BREAK_NAME_TMP = htmlspecialcharsbx(trim($_REQUEST["BREAK_NAME"]));

				$BREAK_SECOND_NAME_TMP = GetMessage('NEWO_BREAK_SECOND_NAME');
				if (isset($_REQUEST["BREAK_SECOND_NAME"]) && strlen($_REQUEST["BREAK_SECOND_NAME"]) > 0)
					$BREAK_SECOND_NAME_TMP = htmlspecialcharsbx(trim($_REQUEST["BREAK_SECOND_NAME"]));

				$resultHtml .= "<div class=\"fio newo_break_active\"><input onblur=\"if (this.value==''){this.value='".CUtil::JSEscape(GetMessage('NEWO_BREAK_LAST_NAME'))."';BX.addClass(this.parentNode,'newo_break_active');}\" onfocus=\"if (this.value=='".CUtil::JSEscape(GetMessage('NEWO_BREAK_LAST_NAME'))."') {this.value='';BX.removeClass(this.parentNode,'newo_break_active');}\" type=\"text\" name=\"BREAK_LAST_NAME\" id=\"BREAK_LAST_NAME\" size=\"30\" value=\"".$BREAK_LAST_NAME_TMP."\" /></div>";
				$resultHtml .= "<div class=\"fio newo_break_active\"><input onblur=\"if (this.value==''){this.value='".CUtil::JSEscape(GetMessage('NEWO_BREAK_NAME'))."';BX.addClass(this.parentNode,'newo_break_active');}\" onfocus=\"if (this.value=='".CUtil::JSEscape(GetMessage('NEWO_BREAK_NAME'))."') {this.value='';BX.removeClass(this.parentNode,'newo_break_active');}\" type=\"text\" name=\"BREAK_NAME\" id=\"BREAK_NAME_BUYER\" size=\"30\" value=\"".$NEWO_BREAK_NAME_TMP."\" /></div>";
				$resultHtml .= "<div class=\"fio newo_break_active\"><input onblur=\"if (this.value==''){this.value='".CUtil::JSEscape(GetMessage('NEWO_BREAK_SECOND_NAME'))."';BX.addClass(this.parentNode,'newo_break_active');}\" onfocus=\"if (this.value=='".CUtil::JSEscape(GetMessage('NEWO_BREAK_SECOND_NAME'))."') {this.value='';BX.removeClass(this.parentNode,'newo_break_active');}\" type=\"text\" name=\"BREAK_SECOND_NAME\" id=\"BREAK_SECOND_NAME\" size=\"30\" value=\"".$BREAK_SECOND_NAME_TMP."\" /></div>";
				$resultHtml .= '</div>';

				$resultHtml .= '<div id="NO_BREAK_NAME"';
				if ($ORDER_ID <= 0)
					$tmpNone = ' style="display:none"';
				if ($formVarsSubmit && $_REQUEST["btnTypeBuyer"] == "btnBuyerExist")
					$tmpNone = ' style="display:block"';
				$resultHtml .= $tmpNone.'>';
			}

			$resultHtml .= '<input type="text" maxlength="250" ';
			$resultHtml .= 'size="30" ';
			$resultHtml .= 'value="'.((isset($curVal)) ? $curVal : $arProperties["DEFAULT_VALUE"]).'" ';
			$resultHtml .= 'name="ORDER_PROP_'.$arProperties["ID"].'" ';
			$resultHtml .= ($arProperties["IS_ZIP"] == "Y" ? 'class="-bx-property-is-zip" ' : '');
			$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" '.$change.'>';

			if ($arProperties["IS_PAYER"] == "Y" && intval($USER_ID) <= 0)
				$resultHtml .= '</div>';
		}
		elseif ($arProperties["TYPE"] == "SELECT")
		{
			$size = (intval($arProperties["SIZE1"]) > 0) ? intval($arProperties["SIZE1"]) : 5;

			$resultHtml .= '<select name="ORDER_PROP_'.$arProperties["ID"].'" ';
			$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" ';
			$resultHtml .= 'size='.$size.' ';
			$resultHtml .= 'class="typeselect">';
			$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
			while ($arVariants = $dbVariants->Fetch())
			{
				$resultHtml .= '<option value="'.htmlspecialcharsex($arVariants["VALUE"]).'"';
				if ($arVariants["VALUE"] == $curVal || !isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])
					$resultHtml .= " selected";
				$resultHtml .= '>'.htmlspecialcharsEx($arVariants["NAME"]).'</option>';
			}
			$resultHtml .= '</select>';
		}
		elseif ($arProperties["TYPE"] == "MULTISELECT")
		{
			$size = (intval($arProperties["SIZE1"]) > 0) ? intval($arProperties["SIZE1"]) : 5;

			$resultHtml .= '<select multiple name="ORDER_PROP_'.$arProperties["ID"].'[]" ';
			$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" ';
			$resultHtml .= 'size='.$size.' ';
			$resultHtml .= 'class="typeselect" type="multyselect">';

			if (!is_array($curVal))
			{
				if (strlen($curVal) > 0 OR $ORDER_ID != "")
					$curVal = explode(",", $curVal);
				else
					$curVal = explode(",", $arProperties["DEFAULT_VALUE"]);

				$arCurVal = array();
				$countCurVal = count($curVal);
				for ($i = 0; $i < $countCurVal; $i++)
					$arCurVal[$i] = Trim($curVal[$i]);
			}
			else
				$arCurVal = $curVal;

			$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
			while ($arVariants = $dbVariants->Fetch())
			{
				$resultHtml .= '<option value="'.htmlspecialcharsex($arVariants["VALUE"]).'"';
				if (in_array($arVariants["VALUE"], $arCurVal))
					$resultHtml .= " selected";
				$resultHtml .= '>'.htmlspecialcharsEx($arVariants["NAME"]).'</option>';
			}
			$resultHtml .= '</select>';
		}
		elseif ($arProperties["TYPE"] == "TEXTAREA")
		{
			$resultHtml .= '<textarea ';
			$resultHtml .= 'rows="4" ';
			$resultHtml .= 'cols="40" ';
			$resultHtml .= 'name="ORDER_PROP_'.$arProperties["ID"].'" ';
			$resultHtml .= 'id="ORDER_PROP_'.$arProperties["ID"].'" type="textarea">';
			$resultHtml .= ((isset($curVal)) ? $curVal : $arProperties["DEFAULT_VALUE"]);
			$resultHtml .= '</textarea>';
		}
		elseif ($arProperties["TYPE"] == "LOCATION")
		{
			$countryID = "";
			$cityID = "";
			$cityList = "";
			$DELIVERY_LOCATION = $arPropValues[intval($arProperties["ID"])];

			$locationID = $curVal;

			$tmpLocation = '';
			ob_start();
			?>

			<?if($arProperties['IS_LOCATION'] == 'Y'):?>

				<?
				$funcId = 'changeLocationCity_'.$arProperties['ID'];
				?>

				<script>
					window['<?php 
echo $funcId;
?>
'] = function(node, info){
						fChangeLocationCity(node, info, <?php 
echo intval($location2townFldMap[$arProperties['ID']]);
?>
)
					}
					window.orderNewLocationPropId = <?php 
echo intval($arProperties['ID']);
?>
;
				</script>

			<?endif?>

			<?
			CSaleLocation::proxySaleAjaxLocationsComponent(
				array(
					"SITE_ID" => $LID,
					"AJAX_CALL" => "N",
					"COUNTRY_INPUT_NAME" => "ORDER_PROP_".$arProperties["ID"],
					"REGION_INPUT_NAME" => "REGION_ORDER_PROP_".$arProperties["ID"],
					"CITY_INPUT_NAME" => "CITY_ORDER_PROP_".$arProperties["ID"],
					"CITY_OUT_LOCATION" => "Y",
					"ALLOW_EMPTY_CITY" => "Y",
					"LOCATION_VALUE" => $curVal,
					"COUNTRY" => "",
					"ONCITYCHANGE" => "fChangeLocationCity();",
					"PUBLIC" => "N",
				),
				array(
					"JS_CALLBACK" => $arProperties['IS_LOCATION'] == 'Y' ? $funcId : false,
					"ID" => $curVal,
					"CODE" => '',
					"SHOW_DEFAULT_LOCATIONS" => 'Y',
					"JS_CONTROL_GLOBAL_ID" => intval($arProperties["ID"])
				),
				'',
				false,
				'location-selector-wrapper'
			);

			$tmpLocation = ob_get_contents();
			ob_end_clean();

			$resultHtml .= '<script>var locationID = \''.$arProperties["ID"].'\';</script>';
			$resultHtml .= $tmpLocation;
		}
		elseif ($arProperties["TYPE"] == "RADIO")
		{
			$dbVariants = CSaleOrderPropsVariant::GetList(
				array("SORT" => "ASC"),
				array("ORDER_PROPS_ID" => $arProperties["ID"]),
				false,
				false,
				array("*")
			);
			$resultHtml .= '<div id="ORDER_PROP_'.$arProperties["ID"].'" type="radio">';// type="radio"
			while ($arVariants = $dbVariants->Fetch())
			{
				$resultHtml .= '<input type="radio" class="inputradio" ';
				$resultHtml .= 'name="ORDER_PROP_'.$arProperties["ID"].'" ';
				$resultHtml .= 'value="'.htmlspecialcharsex($arVariants["VALUE"]).'"';
				if ($arVariants["VALUE"] == $curVal || !isset($curVal) && $arVariants["VALUE"] == $arProperties["DEFAULT_VALUE"])
					$resultHtml .= " checked";
				$resultHtml .= '>'.htmlspecialcharsEx($arVariants["NAME"]).'<br>';
			}
			$resultHtml .= '</div>';
		}
		elseif ($arProperties["TYPE"] == "FILE")
		{
			$arValues = array();
			$arTmpValues = array();
			if (isset($arPropValues[$arProperties["ID"]]))
			{
				$arTmpValues = explode(", ", $arPropValues[$arProperties["ID"]]);
				foreach ($arTmpValues as $key => $value)
					$arValues[$value] = $value;
			}

			$resultHtml .= fShowFilePropertyField("ORDER_PROP_".$arProperties["ID"], $arProperties, $arValues, $arProperties["SIZE1"], $formVarsSubmit);
		}

		if (strlen($arProperties["DESCRIPTION"]) > 0)
		{
			$resultHtml .= "<br><small>".htmlspecialcharsEx($arProperties["DESCRIPTION"])."</small>";
		}
		$resultHtml .= "\n</td>\n</tr>";

	}//end while

	$resultHtml .= "<tr>\n<td valign=\"top\" class=\"adm-detail-content-cell-l\">".GetMessage("SOE_BUYER_COMMENT").":
			</td>
			<td class=\"adm-detail-content-cell-r\">
				<textarea name=\"USER_DESCRIPTION\" rows=\"4\" cols=\"40\">".htmlspecialcharsbx($userComment)."</textarea>
			</td>
		</tr>";

	$resultHtml .= "</table>";
	return $resultHtml;
}
示例#13
0
$strLockUserInfo = '';
$strLockUserInfoExt = '';
$strLockTime = '';
$strNameFormat = CSite::GetNameFormat(true);

$dbOrder = CSaleOrder::GetList(
	array("ID" => "DESC"),
	array("ID" => $ID),
	false,
	false,
	array(
		"ID", "LID", "PERSON_TYPE_ID",
		"PAYED", "DATE_PAYED", "EMP_PAYED_ID", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE",
		"CANCELED", "DATE_CANCELED", "EMP_CANCELED_ID", "REASON_CANCELED",
		"STATUS_ID", "DATE_STATUS", "EMP_STATUS_ID", "PRICE_DELIVERY",
		"ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "EMP_ALLOW_DELIVERY_ID",
		"DEDUCTED", "DATE_DEDUCTED", "EMP_DEDUCTED_ID", "REASON_UNDO_DEDUCTED",
		"MARKED", "DATE_MARKED", "EMP_MARKED_ID", "REASON_MARKED",
		"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", "AFFILIATE_ID", "LOCK_STATUS",
		"USER_LOGIN", "USER_NAME", "USER_LAST_NAME", "USER_EMAIL", "DELIVERY_DOC_NUM",
		"DELIVERY_DOC_DATE", "STORE_ID", "ACCOUNT_NUMBER", "TRACKING_NUMBER",
	)
);
if (!($arOrder = $dbOrder->Fetch()))
	LocalRedirect("sale_order.php?lang=".LANGUAGE_ID.GetFilterParams("filter_", false));

$boolLocked = CSaleOrder::IsLocked($ID, $intLockUserID, $strLockTime);
if ($boolLocked)
示例#14
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;
	}
示例#15
0
 public static function AgentCountDayOrders()
 {
     global $DB;
     if (Bitrix\Main\Loader::includeModule("sale")) {
         //count orders
         $arFilter = array("STATUS_ID" => array("F", "P"), "PAYED" => "Y");
         $dateFromTs = MakeTimeStamp(date("d", time() - 3600 * 24 * 2) . "." . date("m", time() - 3600 * 24 * 2) . "." . date("Y", time() - 3600 * 24 * 2) . " 23:59:59", "DD.MM.YYYY HH:MI:SS");
         $dateToTs = MakeTimeStamp(date("d") . "." . date("m") . "." . date("Y") . " 00:00:00", "DD.MM.YYYY HH:MI:SS");
         $arFilter[">DATE_STATUS"] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), $dateFromTs);
         $arFilter["<DATE_STATUS"] = date($DB->DateFormatToPHP(CSite::GetDateFormat("FULL", SITE_ID)), $dateToTs);
         $dbOrders = CSaleOrder::GetList(array(), $arFilter);
         $numOrders = $dbOrders->SelectedRowsCount();
         $newNumOrders = array("newDay" => $numOrders);
         $curNumOrders = Bitrix\Main\Config\Option::get("storeassist", "num_orders", "");
         if ($curNumOrders) {
             $curNumOrders = unserialize($curNumOrders);
         }
         $newNumOrders["prevDay"] = isset($curNumOrders["newDay"]) ? $curNumOrders["newDay"] : 0;
         Bitrix\Main\Config\Option::set("storeassist", "num_orders", serialize($newNumOrders), "");
         //count progress
         $progress = Bitrix\Main\Config\Option::get("storeassist", "progress_percent", 0);
         $newProgress = 0;
         if ($newNumOrders["newDay"] >= $newNumOrders["prevDay"] && $newNumOrders["newDay"] > 0) {
             $newProgress = ++$progress > 10 ? 10 : $progress;
         } else {
             $newProgress = --$progress > 0 ? $progress : 0;
         }
         Bitrix\Main\Config\Option::set("storeassist", "progress_percent", $newProgress, "");
     }
     return "CStoreAssist::AgentCountDayOrders();";
 }
示例#16
0
	function Delete($ID)
	{
		global $DB;
		$ID = IntVal($ID);

		$db_orders = CSaleOrder::GetList(
				array("DATE_UPDATE" => "DESC"),
				array("DELIVERY_ID" => $ID)
			);
		if ($db_orders->Fetch())
		{
			$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGPS_ORDERS_TO_DELIVERY"), "SKGPS_ORDERS_TO_DELIVERY");
			return False;
		}

		$DB->Query("DELETE FROM b_sale_delivery2location WHERE DELIVERY_ID = ".$ID."", true);
		$DB->Query("DELETE FROM b_sale_delivery2paysystem WHERE DELIVERY_ID = ".$ID."", true);
		return $DB->Query("DELETE FROM b_sale_delivery WHERE ID = ".$ID."", true);
	}
示例#17
0
    $arCountY = $vars["arCountY"];
    $arPayedY = $vars["arPayedY"];
    $arCancelY = $vars["arCancelY"];
    $arDelivY = $vars["arDelivY"];
    $arStatusY = $vars["arStatusY"];
    $arPriceY = $vars["arPriceY"];
    $MaxX = $vars["MaxX"];
    $MinX = $vars["MinX"];
    $MaxY = $vars["MaxY"];
    $MinY = $vars["MinY"];
    $arrayX = $vars["arrayX"];
    $arrayY = $vars["arrayY"];
    $arResult = $vars["arResult"];
} else {
    $arSelectedFields = array("ID", "PAYED", "DATE_PAYED", "CANCELED", "DATE_CANCELED", "STATUS_ID", "DATE_STATUS", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "TAX_VALUE", "LID");
    $dbOrder = CSaleOrder::GetList(array(), $arFilter, false, false, $arSelectedFields);
    while ($arOrder = $dbOrder->Fetch()) {
        $arOrder["DATE_INSERT"] = ConvertDateTime($arOrder["DATE_INSERT"], FORMAT_DATE);
        $tstm = MakeTimeStamp($arOrder["DATE_INSERT"], FORMAT_DATE);
        if ($arFind["filter_by"] == "day") {
            $key = ConvertDateTime($arOrder["DATE_INSERT"], FORMAT_DATE);
            if ($tstm < $MinX || $MinX <= 0) {
                $MinX = $tstm;
            }
        } elseif ($arFind["filter_by"] == "week") {
            $d = date("w", $tstm);
            if ($d < 1) {
                $d = 6;
            } elseif ($d > 1) {
                $d = $d - 1;
            } else {
示例#18
0
 /**
  * get orders for the last 6 months for export
  *
  * @return bool|\CDBResult
  */
 public static function getLatestOrders()
 {
     $libOrder = new \CSaleOrder();
     $orders = $libOrder->GetList(array(), array('DATE_INSERT_FROM' => date('Y-m-d', strtotime('-6 months')), 'STATUS' => 'F'));
     return $orders;
 }
示例#19
0
文件: reminder.php 项目: pivvas/ratio
    $arFilterBasket = array("ORDER_ID" => false, "FUSER_ID" => $arBasket["FUSER_ID"], "LID" => $arBasket["LID"], "DELAY" => 'Y');
    $arBasketItems = array();
    $dbB = CSaleBasket::GetList(array("ID" => "ASC"), $arFilterBasket, false, false, array("ID", "PRODUCT_ID", "NAME", "QUANTITY", "PRICE", "CURRENCY", "DETAIL_PAGE_URL", "LID", "CAN_BUY", "SUBSCRIBE", "DELAY", 'ORDER_ID'));
    // Создадим массив с отложенными товарами, распределенными по пользователям
    while ($arB = $dbB->Fetch()) {
        $arItemsByUser[$arBasket['USER_ID']][] = $arB;
    }
}
// Получим e-mail'ы покупателей
$rsUsers = CUser::GetList($by = "ID", $order = "desc", ['ID' => implode('|', $arUserID)]);
while ($arUser = $rsUsers->Fetch()) {
    $arUsers[$arUser['ID']] = ['ID' => $arUser['ID'], 'EMAIL' => $arUser['EMAIL'], 'NAME' => $arUser['NAME'], 'LAST_NAME' => $arUser['LAST_NAME']];
}
// Получим список товаров пользователей, находящихся в заказах
foreach ($arUsers as $arUser) {
    $db_sales = CSaleOrder::GetList(false, ["USER_ID" => $arUser['ID'], ">=DATE_INSERT" => $filterDate]);
    while ($ar_sales = $db_sales->Fetch()) {
        $arFilterBasket = array("ORDER_ID" => $ar_sales['ID']);
        $arBasketItems = array();
        $dbB = CSaleBasket::GetList(array("ID" => "ASC"), $arFilterBasket, false, false, array("ID", "PRODUCT_ID", "NAME", "QUANTITY", "PRICE", "CURRENCY", "DETAIL_PAGE_URL", "LID", "CAN_BUY", "SUBSCRIBE", "DELAY", 'ORDER_ID'));
        // Создадим массив с товарами, которые находятся в заказах, распределенными по пользователям
        while ($arB = $dbB->Fetch()) {
            $arOrderedItemsByUser[$arUser['ID']][$arB['PRODUCT_ID']] = $arB['PRODUCT_ID'];
        }
    }
}
// Отфильтруем из отложенных товаров те, которые были отправленны в заказ. Для этого создадим новый массив
foreach ($arItemsByUser as $userID => $userItems) {
    foreach ($userItems as $itemIndex => $arItem) {
        if (!in_array($arItem['PRODUCT_ID'], $arOrderedItemsByUser[$userID])) {
            $arItemsByUserFinal[$userID][] = $arItem;
示例#20
0
			if($arLocation = $dbLocation->Fetch())
			{
				$location = $arLocation["ID"];
			}
		}
		if(empty($arGeneralInfo["properies"][$personType]))
		{
			$dbProp = CSaleOrderProps::GetList(array(), Array("PERSON_TYPE_ID" => $personType));
			while($arProp = $dbProp->Fetch())
				$arGeneralInfo["properies"][$personType][$arProp["CODE"]] = $arProp;
		}

		if(WIZARD_INSTALL_DEMO_DATA)
		{

			$db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), array("LID" => WIZARD_SITE_ID), false, false, array("ID"));
			while ($ar_sales = $db_sales->Fetch())
			{
				CSaleOrder::Delete($ar_sales["ID"]);
			}
		}

		$arData = Array(
				"SITE_ID" => WIZARD_SITE_ID,
				"PERSON_TYPE_ID" => $personType,
				"CURRENCY" => $defCurrency,
				"USER_ID" => 1,
				"PAY_SYSTEM_ID" => $paySystem,
				//"PRICE_DELIVERY" => "0",
				//"DELIVERY_ID" => "",
				"PROPS" => Array(),
示例#21
0
    }
}
$sum = 0;
$sumHtml = "";
$alertIntervalText = "";
$uptimeRate = 1;
if ($bAlert) {
    if ($uptime !== "") {
        $uptime = explode("/", $uptime);
        if ($uptime[0] > 0 && $uptime[1] > 0) {
            $uptimeRate = $uptime[0] / $uptime[1];
        }
    }
    if ($uptimeRate < 1 && $saleIncluded) {
        $base = CCurrency::GetBaseCurrency();
        $r = CSaleOrder::GetList(array(), array(">=DATE_INSERT" => ConvertTimeStamp(time() - $monitoring->getInterval() * 24 * 3400, "SHORT")), array("LID", "CURRENCY", "SUM" => "PRICE"));
        while ($a = $r->fetch()) {
            $sum += CCurrencyRates::ConvertCurrency($a["PRICE"], $a["CURRENCY"], $base);
        }
        $sum *= 1 - $uptimeRate;
        if ($sum <= 0.0) {
            $sumHtml = number_format((1 - $uptimeRate) * 100, 2, '.', ' ') . "%";
            $alertIntervalText = $intervalLang["uptime"][$monitoring->getInterval()];
        } else {
            $sumHtml = CurrencyFormat($sum, $base);
            $alertIntervalText = $intervalLang["sale"][$monitoring->getInterval()];
        }
    } elseif ($testCount === 1 && HasMessage("GD_BITRIXCLOUD_MONITOR_" . strtoupper($testAlert->getName()))) {
        $uptimeRate = 1;
        $resultText = FormatDate("ddiff", time(), $testAlert->getResult());
        $sumHtml = GetMessage("GD_BITRIXCLOUD_MONITOR_" . strtoupper($testAlert->getName()), array("#DOMAIN#" => $converter->Decode($testDomain), "#DAYS#" => $resultText));
示例#22
0
 protected function deleteOStatus()
 {
     $code_status = \Bitrix\Main\Config\Option::get($this->MODULE_ID, "order_status_code_erip");
     $order = CSaleOrder::GetList(array(), array("STATUS_ID" => $code_status))->Fetch();
     if ($order["ID"] > 0) {
         throw new Exception(Loc::getMessage("DEVTM_ERIP_DELETE_STATUS_ERROR"));
     }
     $o_s = new CSaleStatus();
     if (!$o_s->Delete($code_status)) {
         throw new Exception(Loc::getMessage("DEVTM_ERIP_DELETE_STATUS2_ERROR"));
     }
     return true;
 }
示例#23
0
define("PROP_COUNT_LIMIT", 21);

$arFilter = array(
	"LID" => LANG,
	"ID" => "N"
);

$str_PRICE = 0;
$str_DISCOUNT_VALUE = 0;

if (isset($ID) && $ID > 0)
{
	$dbOrder = CSaleOrder::GetList(
		array("ID" => "DESC"),
		array("ID" => $ID),
		false,
		false,
		array()
	);

	if ($arOrderOldTmp = $dbOrder->ExtractFields("str_"))
		$arFilter["ID"] = $arOrderOldTmp["STATUS_ID"];
}

$arStatusList = false;
$arGroupByTmpSt = false;

$arUserGroups = $USER->GetUserGroupArray();
$intUserID = intval($USER->GetID());

$saleModulePermissions = $APPLICATION->GetGroupRight("sale");
示例#24
0
if (strlen($arParams["PATH_TO_LIST"]) <= 0) {
    $arParams["PATH_TO_LIST"] = htmlspecialcharsbx($APPLICATION->GetCurPage());
}
$arParams["PATH_TO_DETAIL"] = Trim($arParams["PATH_TO_DETAIL"]);
if (strlen($arParams["PATH_TO_DETAIL"]) <= 0) {
    $arParams["PATH_TO_DETAIL"] = htmlspecialcharsbx($APPLICATION->GetCurPage() . "?" . "ID=#ID#");
}
if ($arParams["SET_TITLE"] == 'Y') {
    $APPLICATION->SetTitle(str_replace("#ID#", $ID, GetMessage("SPOC_TITLE")));
}
if ($ID > 0 && $_REQUEST["CANCEL"] == "Y" && $_SERVER["REQUEST_METHOD"] == "POST" && strlen($_REQUEST["action"]) > 0 && check_bitrix_sessid()) {
    $dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID" => $ID, "USER_ID" => IntVal($USER->GetID())), false, false, array("ID"));
    if ($arOrder = $dbOrder->Fetch()) {
        CSaleOrder::CancelOrder($arOrder["ID"], "Y", $_REQUEST["REASON_CANCELED"]);
        LocalRedirect($arParams["PATH_TO_LIST"]);
    }
}
if ($ID <= 0 && $arParams["PATH_TO_LIST"] != htmlspecialcharsbx($APPLICATION->GetCurPage())) {
    LocalRedirect($arParams["PATH_TO_LIST"]);
}
$dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID" => $ID, "USER_ID" => IntVal($USER->GetID())), false, false, array("ID", "CANCELED", "STATUS_ID", "PAYED"));
if ($arOrder = $dbOrder->GetNext()) {
    if ($arOrder["CANCELED"] != "Y" && $arOrder["STATUS_ID"] != "F" && $arOrder["PAYED"] != "Y") {
        $arResult = array("ID" => $ID, "URL_TO_DETAIL" => CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_DETAIL"], array("ID" => $arOrder["ID"])), "URL_TO_LIST" => $arParams["PATH_TO_LIST"]);
    } else {
        $arResult["ERROR_MESSAGE"] = GetMessage("SPOC_CANCEL_ORDER");
    }
} else {
    $arResult["ERROR_MESSAGE"] = str_replace("#ID#", $ID, GetMessage("SPOC_NO_ORDER"));
}
$this->IncludeComponentTemplate();
示例#25
0
 /**
  * Perform reading main data from database, no cache is used for it
  * @throws Main\SystemException
  * @return void
  */
 protected function obtainDataOrder()
 {
     global $USER;
     $sort = array("ID" => "ASC");
     $filter = array("USER_ID" => $USER->GetID(), "ACCOUNT_NUMBER" => $this->requestData["ID"]);
     $arOrder = false;
     if ($this->options['USE_ACCOUNT_NUMBER']) {
         $dbOrder = CSaleOrder::GetList($sort, $filter, false, false);
         if ($arOrder = $dbOrder->Fetch()) {
             $this->requestData["ID"] = $arOrder["ID"];
         }
     }
     if (!$arOrder) {
         $filter = array("USER_ID" => $USER->GetID(), "ID" => $this->requestData["ID"]);
         $dbOrder = CSaleOrder::GetList($sort, $filter);
         $arOrder = $dbOrder->GetNext();
     }
     if (empty($arOrder)) {
         throw new Main\SystemException(str_replace("#ID#", $this->requestData["ID"], Localization\Loc::getMessage("SPOD_NO_ORDER")), self::E_ORDER_NOT_FOUND);
     }
     $this->dbResult = $arOrder;
 }
示例#26
0
         $arUserResult["CONFIRM_ORDER"] = "N";
     }
     $arResult["USER_VALS"] = $arUserResult;
 } else {
     $arOrder = false;
     $arResult["USER_VALS"]["CONFIRM_ORDER"] = "Y";
     $ID = urldecode(urldecode($_REQUEST["ORDER_ID"]));
     if ($bUseAccountNumber) {
         $dbOrder = CSaleOrder::GetList(array("DATE_UPDATE" => "DESC"), array("LID" => SITE_ID, "ACCOUNT_NUMBER" => $ID));
         if ($arOrder = $dbOrder->GetNext()) {
             $arResult["ORDER_ID"] = $arOrder["ID"];
             $arResult["ACCOUNT_NUMBER"] = $arOrder["ACCOUNT_NUMBER"];
         }
     }
     if (!$arOrder) {
         $dbOrder = CSaleOrder::GetList(array("DATE_UPDATE" => "DESC"), array("LID" => SITE_ID, "ID" => $ID));
         if ($arOrder = $dbOrder->GetNext()) {
             $arResult["ORDER_ID"] = $ID;
             $arResult["ACCOUNT_NUMBER"] = $arOrder["ACCOUNT_NUMBER"];
         }
     }
     if ($arOrder) {
         foreach (GetModuleEvents("sale", "OnSaleComponentOrderOneStepFinal", true) as $arEvent) {
             ExecuteModuleEventEx($arEvent, array($arResult["ORDER_ID"], &$arOrder, &$arParams));
         }
     }
     if ($arOrder && $arOrder["USER_ID"] == IntVal($USER->GetID())) {
         if (IntVal($arOrder["PAY_SYSTEM_ID"]) > 0 && ($arOrder["PAYED"] != "Y" || DoubleVal($arOrder["SUM_PAID"]) <= 0)) {
             $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"]), false, false, array("NAME", "ACTION_FILE", "NEW_WINDOW", "PARAMS", "ENCODING", "LOGOTIP"));
             if ($arPaySysAction = $dbPaySysAction->Fetch()) {
                 $arPaySysAction["NAME"] = htmlspecialcharsEx($arPaySysAction["NAME"]);
示例#27
0
                    $arOrderStats[$key]["PRICE_" . $status_code] = $arOrder["PRICE"];
                }
            }
        }
    }
    if ($obCache->StartDataCache()) {
        $arCacheData = array();
        foreach ($arStatus1 as $status_code => $arStatus) {
            $arCacheData[$status_code] = array("COUNT" => $arOrderStats[$key][$status_code], "SUM" => $arOrderStats[$key]["PRICE_" . $status_code]);
        }
        $obCache->EndDataCache($arCacheData);
    }
}
$arFilter = array_merge($arFilterLID, $arFilterPerms);
$arSelectedFields = array("ID", "PAYED", "DATE_PAYED", "CANCELED", "DATE_CANCELED", "STATUS_ID", "DATE_STATUS", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "LID", "USER_ID", "USER_NAME", "USER_LAST_NAME");
$dbOrder = CSaleOrder::GetList(array("DATE_UPDATE" => "DESC"), $arFilter, false, array("nTopCount" => $arGadgetParams["ITEMS_COUNT"]), $arSelectedFields);
while ($arOrder = $dbOrder->Fetch()) {
    $arOrders[] = $arOrder;
}
$today = ConvertTimeStamp(time());
$yesterday = ConvertTimeStamp(AddToTimeStamp(array("DD" => -2, "MM" => 0, "YYYY" => 0, "HH" => 0, "MI" => 0, "SS" => 0), time()));
$before_yesterday = ConvertTimeStamp(AddToTimeStamp(array("DD" => -1, "MM" => 0, "YYYY" => 0, "HH" => 0, "MI" => 0, "SS" => 0), time()));
$d = date("w");
if ($d < 1) {
    $d = 6;
} elseif ($d > 1) {
    $d = $d - 1;
} else {
    $d = 0;
}
$this_week = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-" . $d), time()));
示例#28
0
 function getOrderInfoDetail($orderId)
 {
     if (!$orderId) {
         return false;
     }
     if (!$GLOBALS["USER"]->IsAuthorized()) {
         return false;
     }
     $arFilter["ID"] = $orderId;
     $saleModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("sale");
     if ($saleModulePermissions == "D") {
         $arFilter["USER_ID"] = IntVal($GLOBALS["USER"]->GetID());
     } elseif ($saleModulePermissions != "W") {
         $arFilter["STATUS_PERMS_GROUP_ID"] = $GLOBALS["USER"]->GetUserGroupArray();
         $arFilter[">=STATUS_PERMS_PERM_VIEW"] = "Y";
     }
     $arOrder = array();
     $dbOrder = CSaleOrder::GetList(array(), $arFilter);
     $arOrder = $dbOrder->GetNext();
     if (!$arOrder) {
         return false;
     }
     $arOrder["STATUS"] = CSaleStatus::GetLangByID($arOrder["STATUS_ID"]);
     $arOrder["STATUS_NAME"] = $arOrder["STATUS"]["NAME"];
     $arOrder["PRICE_IN_ALL_NUM"] = floatval($arOrder["~PRICE"] + floatval($arOrder["~PRICE_DELIVERY"]));
     $arOrder["PRICE_IN_ALL"] = SaleFormatCurrency($arOrder["PRICE_IN_ALL_NUM"], $arOrder["CURRENCY"]);
     $arOrder["PRICE_STR"] = SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"]);
     $arOrder["PERSON_TYPE"] = CSalePersonType::GetByID($arOrder["PERSON_TYPE_ID"]);
     $arOrder["PERSON_TYPE_NAME"] = htmlspecialcharsbx($arOrder["PERSON_TYPE"]["NAME"]);
     $arOrder = self::getOrderProps($arOrder);
     $arOrder["DELIVERY_NAME"] = self::getDeliveriesInfo(array($arOrder["DELIVERY_ID"]));
     $arOrder["DELIVERY_NAME"] = $arOrder["DELIVERY_NAME"][$arOrder["DELIVERY_ID"]];
     $arPaySys = CSalePaySystem::GetByID($arOrder["PAY_SYSTEM_ID"], $arOrder["PERSON_TYPE_ID"]);
     $arOrder["PAY_SYSTEM_NAME"] = $arPaySys["NAME"];
     $dbUserAccount = CSaleUserAccount::GetList(array(), array("USER_ID" => $arOrder["USER_ID"], "CURRENCY" => $arOrder["CURRENCY"], "LOCKED" => "N"));
     $arUserAccount = $dbUserAccount->GetNext();
     $arOrder["CURRENT_BUDGET"] = $arUserAccount["CURRENT_BUDGET"] ? $arUserAccount["CURRENT_BUDGET"] : 0;
     $arOrder["CURRENT_BUDGET_STRING"] = SaleFormatCurrency($arOrder["CURRENT_BUDGET"], $arOrder["CURRENCY"]);
     return $arOrder;
 }
示例#29
0
			return inputList[i];
		}
	}
	return false;
}
</script>
<?
	$this->IncludeComponentTemplate();
} catch (Exception $e) {
	if (CModule::IncludeModule('getparcel.gpwidget')) { CGPWidget::LogException($e); }
}

// в случае, если форма заказа пошаговая, делаем дополнительную обработку нового заказа для получения ORDER_GP_ID
if($_REQUEST["order"]){
    $arFilter = Array(
       "ACCOUNT_NUMBER" =>$_REQUEST["order"]
    );
    $db_sales = CSaleOrder::GetList(array(), $arFilter);
    while ($ar_sales = $db_sales->Fetch())
    {
        $ID = $ar_sales["ID"];
    }
    
    $MODULE_ID = "getparcel.gpwidget";
    CModule::IncludeModule($MODULE_ID);
    $options["ID"] = $ID;
    $options["URL"] = str_replace("#ID#", $ID, COption::GetOptionString(CGPWidgetEventHandler::$MODULE_ID, 'gp_script_url') . $arConfig["CONFIG"]["PATCH_URL"]);
    $options["ACTION"] = "ORDER";
    
    CGPWidgetEventHandler::formAndSendDataToGP("POST", $options, $fields);
}
示例#30
0
文件: class.php 项目: ASDAFF/gpbitrix
function testBronClass(){
    if(
        (CModule::IncludeModule("iblock"))
        &&
        (CModule::IncludeModule("catalog"))
        &&
        (CModule::IncludeModule("sale"))
    )
        $_SESSION['bron']="бронь начал работать";
    $arFilter = Array(
        "CANCELED"=>"N",
        "STATUS_ID"=>"B"
    );


    $order_id=array();
    $db_sales = CSaleOrder::GetList(array("DATE_INSERT" => "ASC"), $arFilter);
    while ($ar_sales = $db_sales->Fetch())
    {

        $order_id[]=$ar_sales['ID'];
    }
    $id_products=array();
    if($order_id){
        $dbBasketItems = CSaleBasket::GetList(
            array(
                "NAME" => "ASC",
                "ID" => "ASC"
            ),
            array(
                "LID" => SITE_ID,
                "ORDER_ID" => $order_id
            ),
            false,
            false,
            array("PRODUCT_ID","ORDER_ID")
        );

        while ($arItems = $dbBasketItems->Fetch())
        {
            $id_products[$arItems['ORDER_ID']]=$arItems['PRODUCT_ID'];

        }
    }
    if($id_products){
        $date_comparing = date('d.m.Y',time() + 48 * 60 * 60);
        //echo $date_comparing;
        $stmp_comparing = MakeTimeStamp($date_comparing, "DD.MM.YYYY HH:MI:SS");
        $arSelect = Array("ID", "IBLOCK_ID", "NAME", "PROPERTY_DEPARTURE");//IBLOCK_ID и ID обязательно должны быть указаны, см. описание arSelectFields выше
        $arFilter = Array("ID"=>$id_products);
        $res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
        while($ob = $res->GetNext()){
            $stmp_tickets = MakeTimeStamp($ob['PROPERTY_DEPARTURE_VALUE'], "DD.MM.YYYY HH:MI:SS");
            if($stmp_comparing>=$stmp_tickets){
                foreach($id_products as $key_id_order=>$item_id_product){
                    if($item_id_product==$ob['ID']){
                        CSaleOrder::CancelOrder($key_id_order, "Y", "Время брони истекло");
                    }
                }

            }
        }
    }
    return testBronClass();
}