Ejemplo n.º 1
1
 function OnPostForm()
 {
     $wizard =& $this->GetWizard();
     if ($wizard->IsNextButtonClick()) {
         $arResult = $wizard->GetVars(true);
         COption::SetOptionString("sale", "order_email", $arResult["orderEmail"]);
         COption::SetOptionString("sale", "delete_after", $arResult["saveBasket"]);
         COption::SetOptionString("sale", "default_currency", $arResult["currencyID"]);
         $arFields["LID"] = $arResult["siteID"];
         $arFields["CURRENCY"] = $arResult["currencyID"];
         CSaleLang::Update($arResult["siteID"], array("LID" => $arResult["siteID"], "CURRENCY" => $arResult["currencyID"]));
         CSaleGroupAccessToSite::DeleteBySite($arResult["siteID"]);
         foreach ($arResult["groupID"] as $v) {
             CSaleGroupAccessToSite::Add(array("SITE_ID" => $arResult["siteID"], "GROUP_ID" => $v));
         }
         if (!empty($arResult["1C_GROUP_PERMISSIONS"])) {
             COption::SetOptionString("catalog", "1C_GROUP_PERMISSIONS", implode(",", $arResult["1C_GROUP_PERMISSIONS"]));
         }
         COption::SetOptionString("catalog", "1C_ELEMENT_ACTION", $arResult["1C_ELEMENT_ACTION"]);
         COption::SetOptionString("catalog", "1C_SECTION_ACTION", $arResult["1C_SECTION_ACTION"]);
         COption::SetOptionString("catalog", "1C_INTERVAL", $arResult["1C_INTERVAL"]);
         COption::SetOptionString("catalog", "1C_FILE_SIZE_LIMIT", $arResult["1C_FILE_SIZE_LIMIT"]);
         COption::SetOptionString("catalog", "1C_SITE_LIST", $arResult["siteID"]);
         if (!empty($arResult["1C_GROUP_PERMISSIONS"])) {
             COption::SetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", implode(",", $arResult["1C_GROUP_PERMISSIONS"]));
         }
         COption::SetOptionString("sale", "1C_EXPORT_PAYED_ORDERS", $arResult["1C_EXPORT_PAYED_ORDERS"]);
         COption::SetOptionString("sale", "1C_EXPORT_ALLOW_DELIVERY_ORDERS", $arResult["1C_EXPORT_ALLOW_DELIVERY_ORDERS"]);
         COption::SetOptionString("sale", "1C_EXPORT_FINAL_ORDERS", $arResult["1C_EXPORT_FINAL_ORDERS"]);
         COption::SetOptionString("sale", "1C_FINAL_STATUS_ON_DELIVERY", $arResult["1C_FINAL_STATUS_ON_DELIVERY"]);
         COption::SetOptionString("sale", "1C_SALE_SITE_LIST", $arResult["siteID"]);
         foreach ($arResult["groupID"] as $v) {
             $perm = $GLOBALS["APPLICATION"]->GetGroupRight("sale", $v);
             if ($perm != "W") {
                 $GLOBALS["APPLICATION"]->SetGroupRight("sale", $v, "U");
             }
         }
         $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"]), false, false, array("ID", "LID", "SORT"));
         while ($arStatus = $dbStatus->Fetch()) {
             $arPerms = array();
             foreach ($arResult["groupID"] as $v) {
                 $arPerms[] = array("GROUP_ID" => $v, "PERM_VIEW" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELETE"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_UPDATE"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_PAYMENT"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELIVERY"] == "Y" || $arResult["perm"][$arStatus["ID"]][$v]["PERM_CANCEL"] == "Y" ? "Y" : $arResult["perm"][$arStatus["ID"]][$v]["PERM_VIEW"], "PERM_CANCEL" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_CANCEL"], "PERM_MARK" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_MARK"], "PERM_DEDUCTION" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DEDUCTION"], "PERM_DELIVERY" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELIVERY"], "PERM_PAYMENT" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_PAYMENT"], "PERM_STATUS" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_STATUS"], "PERM_STATUS_FROM" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_STATUS_FROM"], "PERM_UPDATE" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_UPDATE"], "PERM_DELETE" => $arResult["perm"][$arStatus["ID"]][$v]["PERM_DELETE"]);
             }
             CSaleStatus::Update($arStatus["ID"], array("PERMS" => $arPerms, "SORT" => $arStatus["SORT"]));
         }
         $paySystemID = array();
         $paySystem = array();
         foreach ($arResult["paySystem"] as $pType => $pSystem) {
             if (!empty($pSystem)) {
                 foreach ($pSystem as $v) {
                     $paySystem[$v][] = $pType;
                     if (!in_array($v, $paySystemID)) {
                         $paySystemID[] = $v;
                     }
                 }
             }
         }
         $dbPaySys = CSalePaySystem::GetList(array(), array("ACTIVE" => "Y"), false, false, array("ID", "ACTIVE"));
         while ($arPaySys = $dbPaySys->Fetch()) {
             if (!in_array($arPaySys["ID"], $paySystemID)) {
                 CSalePaySystem::Update($arPaySys["ID"], array("ACTIVE" => "N"));
             }
         }
         foreach ($paySystem as $pID => $value) {
             $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
             while ($arPaySysAction = $dbPaySysAction->Fetch()) {
                 if (!in_array($arPaySysAction["PERSON_TYPE_ID"], $value)) {
                     CSalePaySystemAction::Delete($arPaySysAction["ID"]);
                 }
             }
         }
         function LocalGetPSActionParams($fileName)
         {
             $arPSCorrespondence = array();
             if (file_exists($fileName) && is_file($fileName)) {
                 include $fileName;
             }
             return $arPSCorrespondence;
         }
         foreach ($paySystem as $pID => $value) {
             foreach ($value as $personID) {
                 $arFields = array();
                 $arPaySysAction = "";
                 $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID, "PERSON_TYPE_ID" => $personID));
                 if ($arPaySysAction = $dbPaySysAction->Fetch()) {
                     $pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysAction["ACTION_FILE"];
                 } else {
                     $dbPaySysAction = CSalePaySystemAction::GetList(array(), array("PAY_SYSTEM_ID" => $pID));
                     if ($arPaySysActionTmp = $dbPaySysAction->Fetch()) {
                         $pathToAction = $_SERVER["DOCUMENT_ROOT"] . $arPaySysActionTmp["ACTION_FILE"];
                     }
                 }
                 if (strlen($pathToAction) > 0) {
                     $arPSCorrespondence = LocalGetPSActionParams($pathToAction . "/.description.php");
                     $arParams = array();
                     foreach ($arPSCorrespondence as $k => $v) {
                         $typeTmp = $arResult[$pID . "_" . $k . "_" . $personID];
                         $valueTmp = $arResult["VALUE1_" . $pID . "_" . $k . "_" . $personID];
                         if (strlen($valueTmp) <= 0) {
                             $valueTmp = $arResult["VALUE2_" . $pID . "_" . $k . "_" . $personID];
                         }
                         $arParams[$k] = array("TYPE" => $typeTmp, "VALUE" => $valueTmp);
                     }
                     $arFields = array("NEW_WINDOW" => $arResult["paySystemPopup"][$pID][$personID], "PARAMS" => CSalePaySystemAction::SerializeParams($arParams));
                     if (IntVal($arPaySysAction["ID"]) > 0) {
                         CSalePaySystemAction::Update($arPaySysAction["ID"], $arFields);
                     } else {
                         $arFields["PAY_SYSTEM_ID"] = $pID;
                         $arFields["PERSON_TYPE_ID"] = $personID;
                         $arFields["NAME"] = $arPaySysActionTmp["NAME"];
                         $arFields["ACTION_FILE"] = $arPaySysActionTmp["ACTION_FILE"];
                         $arFields["HAVE_PREPAY"] = "N";
                         $arFields["HAVE_RESULT"] = "N";
                         $arFields["HAVE_ACTION"] = "N";
                         $arFields["HAVE_PAYMENT"] = "N";
                         $arFields["HAVE_RESULT_RECEIVE"] = "N";
                         if (file_exists($pathToAction)) {
                             if (is_dir($pathToAction)) {
                                 if (file_exists($pathToAction . "/pre_payment.php")) {
                                     $arFields["HAVE_PREPAY"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/result.php")) {
                                     $arFields["HAVE_RESULT"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/action.php")) {
                                     $arFields["HAVE_ACTION"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/payment.php")) {
                                     $arFields["HAVE_PAYMENT"] = "Y";
                                 }
                                 if (file_exists($pathToAction . "/result_rec.php")) {
                                     $arFields["HAVE_RESULT_RECEIVE"] = "Y";
                                 }
                             } else {
                                 $arFields["HAVE_PAYMENT"] = "Y";
                             }
                         }
                         CSalePaySystemAction::Add($arFields);
                     }
                 }
             }
         }
         COption::SetOptionInt("sale", "location", $arResult["location"], false, $arResult["siteID"]);
         if (empty($arResult["delivery"])) {
             $arResult["delivery"] = array();
         }
         $dbDelivery = CSaleDeliveryHandler::GetList(array("SORT" => "ASC"), array("SITE_ID" => $arResult["siteID"], "ACTIVE" => "Y"));
         while ($arDelivery = $dbDelivery->Fetch()) {
             if (!in_array($arDelivery["SID"] . "_new", $arResult["delivery"])) {
                 CSaleDeliveryHandler::Set($arDelivery["SID"], array("ACTIVE" => "N"));
             }
         }
         $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"), array("LID" => $arResult["siteID"], "ACTIVE" => "Y"));
         while ($arDelivery = $dbDelivery->Fetch()) {
             if (!in_array($arDelivery["ID"], $arResult["delivery"])) {
                 CSaleDelivery::Update($arDelivery["ID"], array("ACTIVE" => "N"));
             }
         }
         if (strlen($arResult["login"]) > 0) {
             $arFields = array("LOGIN" => $arResult["login"], "PASSWORD" => $arResult["password"], "CONFIRM_PASSWORD" => $arResult["password_rep"], "EMAIL" => $arResult["email"]);
             $user = new CUser();
             $ID = $user->Add($arFields);
             if (IntVal($ID) > 0) {
                 $sGroups = COption::GetOptionString("main", "new_user_registration_def_group", "");
                 CUser::SetUserGroup($ID, array_merge(explode(",", $sGroups), $arResult["1C_GROUP_PERMISSIONS"]));
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @param $params
  * @override
  * @return array
  */
 public function onPrepareComponentParams($params)
 {
     $params = parent::onPrepareComponentParams($params);
     if (!isset($params["CACHE_TIME"])) {
         $params["CACHE_TIME"] = 86400;
     }
     $params["DETAIL_URL"] = trim($params["DETAIL_URL"]);
     if (isset($params["BY"]) && is_array($params["BY"])) {
         if (count($params["BY"])) {
             $params["BY"] = array_values($params["BY"]);
             $params["BY"] = $params["BY"][0];
         } else {
             $params["BY"] = "AMOUNT";
         }
     }
     if (!isset($params["BY"]) || !strlen(trim($params["BY"]))) {
         $params["BY"] = "AMOUNT";
     }
     if (isset($params["PERIOD"])) {
         if (is_array($params["PERIOD"])) {
             if (count($params["PERIOD"])) {
                 $params["PERIOD"] = array_values($params["PERIOD"]);
                 $params["PERIOD"] = $params["PERIOD"][0];
             } else {
                 $params["PERIOD"] = 0;
             }
         } else {
             $params["PERIOD"] = (int) $params["PERIOD"];
             if ($params["PERIOD"] < 0) {
                 $params["PERIOD"] = 0;
             }
         }
     } else {
         $params["PERIOD"] = 0;
     }
     if (!isset($params['FILTER']) || empty($params['FILTER']) || !is_array($params['FILTER'])) {
         $params['FILTER'] = array();
     }
     if (Loader::includeModule("sale")) {
         $statuses = array("CANCELED", "ALLOW_DELIVERY", "PAYED", "DEDUCTED");
         $saleStatusIterator = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => $this->getLanguageId()), false, false, array("ID"));
         while ($row = $saleStatusIterator->Fetch()) {
             $statuses[] = $row['ID'];
         }
         foreach ($params['FILTER'] as $key => $status) {
             if (!in_array($status, $statuses)) {
                 unset($params['FILTER'][$key]);
             }
         }
     }
     return $params;
 }
Ejemplo n.º 3
0
	function ExportOrders2Xml($arFilter = Array(), $nTopCount = 0, $currency = "", $crmMode = false, $time_limit = 0, $version = false, $arOptions = Array())
	{
		global $DB;
		$count = false;
		if(IntVal($nTopCount) > 0)
			$count = Array("nTopCount" => $nTopCount);
		$bNewVersion = (strlen($version) > 0);
		$bExportFromCrm = (isset($arOptions["EXPORT_FROM_CRM"]) && $arOptions["EXPORT_FROM_CRM"] === "Y");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

			$arResultStat["ORDERS"]++;

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

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

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

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

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

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

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

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

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

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

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

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

			if(IntVal($time_limit) > 0 && time() > $end_time)
			{
				break;
			}
		}
		?>
		</<?php 
echo GetMessage("SALE_EXPORT_COM_INFORMATION");
?>
>
		<?
		return $arResultStat;
	}
Ejemplo n.º 4
0
        ?>
			</font>
		</td>
	</tr>
	//-->
	<tr>
		<td align="right" width="40%" class="tablebody">
			<font class="tablefieldtext"><?php 
        echo GetMessage("STPOD_ORDER_STATUS");
        ?>
</font>
		</td>
		<td align="left" width="60%" class="tablebody">
			<font class="tablebodytext">
			<?php 
        $arCurrentStatus = CSaleStatus::GetByID($arOrder["STATUS_ID"]);
        echo $arCurrentStatus["NAME"] . GetMessage("STPOD_ORDER_FROM") . $arOrder["DATE_STATUS"] . ")";
        ?>
			</font>
		</td>
	</tr>
	<tr>
		<td align="right" width="40%" class="tablebody">
			<font class="tablefieldtext"><?php 
        echo GetMessage("P_ORDER_PRICE");
        ?>
:</font>
		</td>
		<td align="left" width="60%" class="tablebody">
			<font class="tablebodytext"><?php 
        echo "<b>" . SaleFormatCurrency($arOrder["PRICE"], $arOrder["CURRENCY"]) . "</b>";
Ejemplo n.º 5
0
 private static function makeMessage($eventId, $arParams)
 {
     global $DB;
     $strResult = GetMessage('SMOB_PUSH_MES_' . $eventId, array("#ACCOUNT_NUMBER#" => $arParams["ORDER"]["ACCOUNT_NUMBER"], "#DATE_INSERT#" => FormatDate($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), strtotime($arParams["ORDER"]["DATE_INSERT"])), "#PRICE#" => $arParams["ORDER"]["PRICE"], "#CURRENCY#" => $arParams["ORDER"]["CURRENCY"]));
     if ($eventId == "ORDER_STATUS_CHANGED") {
         $arFilter = array("LID" => LANGUAGE_ID, "ID" => $arParams["ORDER"]["STATUS_ID"]);
         $dbStatusListTmp = CSaleStatus::GetList(array("SORT" => "ASC"), $arFilter, false, false, array("NAME"));
         if ($arStatus = $dbStatusListTmp->GetNext()) {
             $strResult = str_replace("#STATUS_NAME#", $arStatus["NAME"], $strResult);
         }
     }
     return $strResult;
 }
Ejemplo n.º 6
0
 /**
  * Function returns reference data as shared cache between this component and sale.personal.order.list.
  *
  * @throws Exception
  * @return void
  */
 protected function obtainDataReferences()
 {
     if ($this->startCache(array('spo-shared'))) {
         try {
             $cachedData = array();
             /////////////////////
             /////////////////////
             // Person type
             $dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
             while ($arPType = $dbPType->Fetch()) {
                 $cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
             }
             // Save statuses for Filter form
             $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
             while ($arStatus = $dbStatus->Fetch()) {
                 $cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
             }
             $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
             while ($arPaySystem = $dbPaySystem->Fetch()) {
                 $cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
             }
             $dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"));
             while ($arDelivery = $dbDelivery->Fetch()) {
                 $cachedData['DELIVERY'][$arDelivery["ID"]] = $arDelivery;
             }
             $dbDelivery = CSaleDeliveryHandler::GetList(array(), array(array("SITE_ID" => SITE_ID)));
             while ($arDeliveryHandler = $dbDelivery->Fetch()) {
                 $cachedData['DELIVERY_HANDLERS'][$arDeliveryHandler["SID"]] = $arDeliveryHandler;
             }
             /////////////////////
             /////////////////////
         } catch (Exception $e) {
             $this->abortCache();
             throw $e;
         }
         $this->endCache($cachedData);
     } else {
         $cachedData = $this->getCacheData();
     }
     $this->dbResult = array_merge($this->dbResult, $this->adaptCachedReferences($cachedData));
 }
Ejemplo n.º 7
0
 public static function CheckFields($ACTION, &$arFields, $statusId = '')
 {
     if ((is_set($arFields, "SORT") || $ACTION == "ADD") && IntVal($arFields["SORT"]) <= 0) {
         $arFields["SORT"] = 100;
     }
     if ((is_set($arFields, "ID") || $ACTION == "ADD") && strlen($arFields["ID"]) <= 0) {
         return false;
     }
     if (is_set($arFields, "ID") && strlen($statusId) > 0 && $statusId != $arFields["ID"]) {
         return false;
     }
     if (is_set($arFields, "ID") && !preg_match("#[A-Za-z]#i", $arFields["ID"]) || strlen($statusId) > 0 && !preg_match("#[A-Za-z]#i", $statusId)) {
         $GLOBALS["APPLICATION"]->ThrowException(Loc::getMessage("SKGS_ID_NOT_SYMBOL"), "ERROR_ID_NOT_SYMBOL");
         return false;
     }
     $result = new Result();
     if (!self::$statusFields) {
         self::$statusFields = StatusTable::getEntity()->getScalarFields();
         self::$langFields = StatusLangTable::getEntity()->getScalarFields();
         self::$taskFields = StatusGroupTaskTable::getEntity()->getScalarFields();
     }
     switch ($ACTION) {
         case 'ADD':
             $statusId = $arFields['ID'];
             StatusTable::checkFields($result, null, array_intersect_key($arFields, self::$statusFields));
             break;
         case 'UPDATE':
             StatusTable::checkFields($result, $statusId, array_intersect_key(array_diff_key($arFields, array('ID' => 1)), self::$statusFields));
             break;
         default:
             throw new SystemException('Invalid action: ' . $ACTION, 0, __FILE__, __LINE__);
     }
     if (isset($arFields['LANG']) && is_array($arFields['LANG']) && !empty($arFields['LANG'])) {
         $availableLanguages = array_map('current', LanguageTable::getList(array('select' => array('LID'), 'filter' => array('=ACTIVE' => 'Y')))->fetchAll());
         foreach ($arFields['LANG'] as $data) {
             if ($data['NAME'] && in_array($data['LID'], $availableLanguages)) {
                 StatusLangTable::checkFields($result, null, array('STATUS_ID' => $statusId) + array_intersect_key($data, self::$langFields));
             } else {
                 return false;
             }
         }
     }
     return $result->isSuccess();
 }
Ejemplo n.º 8
0
						$arFilter,
						$arGroupByTmp,
						false,
						array("ID", "NAME", "SORT")
					);
					while($arStatusListTmp = $dbStatusListTmp->GetNext())
					{
						?><option value="<?echo $arStatusListTmp["ID"] ?>"<?if ($arStatusListTmp["ID"]==$str_STATUS_ID) echo " selected"?>><?echo $arStatusListTmp["NAME"] ?> [<?echo $arStatusListTmp["ID"] ?>]</option><?
					}
					?>
				</select>
				<?
			}
			else
			{
				$arStatusLand = CSaleStatus::GetLangByID($str_STATUS_ID, LANGUAGE_ID);
				echo htmlspecialcharsEx("[".$str_STATUS_ID."] ".$arStatusLand["NAME"]);
			}
			?>
			<input type="hidden" name="user_id" id="user_id" value="<?php 
echo $str_USER_ID;
?>
" onChange="fUserGetProfile(this);" >
		</td>
	</tr>
<?
$tabControl->EndCustomField("ORDER_STATUS");

if ($ID > 0)
{
	$arSitesShop = array();
Ejemplo n.º 9
0
 function StatusOrder($ID, $val)
 {
     global $DB, $USER;
     $ID = IntVal($ID);
     $val = trim($val);
     foreach (GetModuleEvents("sale", "OnSaleBeforeStatusOrder", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID, $val)) === false) {
             return false;
         }
     }
     $arFields = array("STATUS_ID" => $val, "=DATE_STATUS" => $DB->GetNowFunction(), "EMP_STATUS_ID" => IntVal($USER->GetID()) > 0 ? IntVal($USER->GetID()) : false);
     $res = CSaleOrder::Update($ID, $arFields);
     unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
     foreach (GetModuleEvents("sale", "OnSaleStatusOrder", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID, $val));
     }
     CTimeZone::Disable();
     $arOrder = CSaleOrder::GetByID($ID);
     CTimeZone::Enable();
     $userEmail = "";
     $dbOrderProp = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $ID, "PROP_IS_EMAIL" => "Y"));
     if ($arOrderProp = $dbOrderProp->Fetch()) {
         $userEmail = $arOrderProp["VALUE"];
     }
     if (strlen($userEmail) <= 0) {
         $dbUser = CUser::GetByID($arOrder["USER_ID"]);
         if ($arUser = $dbUser->Fetch()) {
             $userEmail = $arUser["EMAIL"];
         }
     }
     $dbSite = CSite::GetByID($arOrder["LID"]);
     $arSite = $dbSite->Fetch();
     $arStatus = CSaleStatus::GetByID($arOrder["STATUS_ID"], $arSite["LANGUAGE_ID"]);
     $arFields = array("ORDER_ID" => $ID, "ORDER_DATE" => $arOrder["DATE_INSERT_FORMAT"], "ORDER_STATUS" => $arStatus["NAME"], "EMAIL" => $userEmail, "ORDER_DESCRIPTION" => $arStatus["DESCRIPTION"], "TEXT" => "", "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER["SERVER_NAME"]));
     foreach (GetModuleEvents("sale", "OnSaleStatusEMail", true) as $arEvent) {
         $arFields["TEXT"] = ExecuteModuleEventEx($arEvent, array($ID, $arStatus["ID"]));
     }
     $eventName = "SALE_STATUS_CHANGED_" . $arOrder["STATUS_ID"];
     $bSend = true;
     foreach (GetModuleEvents("sale", "OnOrderStatusSendEmail", true) as $arEvent) {
         if (ExecuteModuleEventEx($arEvent, array($ID, &$eventName, &$arFields, $arOrder["STATUS_ID"])) === false) {
             $bSend = false;
         }
     }
     if ($bSend) {
         $eventMessage = new CEventMessage();
         $dbEventMessage = $eventMessage->GetList($b = "", $o = "", array("EVENT_NAME" => $eventName, "SITE_ID" => $arOrder["LID"]));
         if (!($arEventMessage = $dbEventMessage->Fetch())) {
             $eventName = "SALE_STATUS_CHANGED";
         }
         $event = new CEvent();
         $event->Send($eventName, $arOrder["LID"], $arFields, "N");
     }
     return $res;
 }
Ejemplo n.º 10
0
$width = intval($_GET["width"]);
$max_width = COption::GetOptionInt("sale", "GRAPH_WEIGHT", 600);
if ($width <= 0 || $width > $max_width) {
    $width = $max_width;
}
$height = intval($_GET["height"]);
$max_height = COption::GetOptionInt("sale", "GRAPH_HEIGHT", 600);
if ($height <= 0 || $height > $max_height) {
    $height = $max_height;
}
if ($mode != "money") {
    $mode = "count";
}
$arColor = array("08738C", "C6B59C", "0000FF", "FF0000", "FFFF00", "F7C684", "8CD694", "9CADCE", "B584BD", "C684BD", "FF94C6", "BDE794", "F7949C", "7BCE6B", "FF6342", "E2F86B", "A5DE63", "42BD6B", "52BDA5", "F79473", "5AC6DE", "94D6C6", "9C52AD", "BD52AD", "9C94C6", "FF63AD", "FF6384", "FE881D", "FF9C21", "FFAD7B", "EFFF29", "7BCE6B", "42BD6B", "52C6AD", "6B8CBD", "3963AD", "F7298C", "A51800", "9CA510", "528C21", "689EB9", "217B29", "6B8CC6", "D6496C", "C6A56B", "00B0A4", "AD844A", "9710B4", "946331", "AD3908", "734210", "008400", "3EC19A", "28D7D7", "6B63AD", "A4C13E", "7BCE31", "A5DE94", "94D6E7", "9C8C73", "FF8C4A", "A7588B", "03CF45", "F7B54A", "808040", "947BBD", "840084", "737373", "C48322", "809254", "1E8259", "63C6DE", "46128D", "8080C0");
$arStatus = array();
$dbStatusList = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID), false, false, array("ID", "NAME", "SORT"));
while ($arStatusList = $dbStatusList->GetNext()) {
    $arStatus[$arStatusList["ID"]] = $arStatusList["NAME"];
}
$arCurrency = array();
$dbCur = CCurrency::GetList($b = "sort", $order1 = "asc", LANGUAGE_ID);
while ($arCur = $dbCur->GetNext()) {
    $arCurrency[$arCur["CURRENCY"]] = $arCur["FULL_NAME"];
}
$dbSite = CSite::GetList($by = "sort", $order = "desc", array("ACTIVE" => "Y"));
while ($arSites = $dbSite->GetNext()) {
    $arSite[$arSites["LID"]] = $arSites["NAME"];
}
$arFind = array("find_canceled" => $find_canceled, "find_allow_delivery" => $find_allow_delivery, "find_payed" => $find_payed, "find_all" => $find_all, "filter_by" => $filter_by, "mode" => $mode);
foreach ($arCurrency as $k1 => $v1) {
    if (${"find_all_" . $k1} == "Y") {
Ejemplo n.º 11
0
									<div id="editStatusDIV">
										<select name="STATUS_ID" id="STATUS_ID" <? echo (!$boolLocked ? 'onchange="BX(\'change_status\').value=\'Y\';"': ''); ?>>
											<?
											if ($arStatusList)
											{
												$arFilter = array("LID" => LANG);
												$arGroupByTmp = false;
												if ($saleModulePermissions < "W")
												{
													$arFilter["GROUP_ID"] = $arUserGroups;
													$arFilter["PERM_STATUS"] = "Y";
												}
												$dbStatusListTmp = CSaleStatus::GetList(
														array("SORT" => "ASC"),
														$arFilter,
														$arGroupByTmp,
														false,
														array("ID", "NAME", "SORT")
													);
												while($arStatusListTmp = $dbStatusListTmp->GetNext())
												{
													$select = "";
													if ($arStatusListTmp["ID"]==$arOrder["STATUS_ID"])
														$select = " selected";

													$statusOrder .= '<option value="'.$arStatusListTmp["ID"].'" '.$select.'>'.$arStatusListTmp["NAME"].'</option>';
												}
											}

											echo $statusOrder;
										?>
Ejemplo n.º 12
0
    echo "[" . $str_LID . "] ";
    $db_lang = CLang::GetByID($str_LID);
    if ($arLang = $db_lang->GetNext()) {
        echo $arLang["NAME"];
    }
    ?>
			</td>
		</tr>
		<tr>
			<td><?php 
    echo GetMessage("P_ORDER_STATUS");
    ?>
:</td>
			<td>
				<?php 
    $ar_status = CSaleStatus::GetByID($str_STATUS_ID);
    ?>
				[<?php 
    echo $ar_status["ID"];
    ?>
] <?php 
    echo htmlspecialcharsbx($ar_status["NAME"]);
    ?>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
    echo GetMessage("P_ORDER_CANCELED");
    ?>
 / <?php 
Ejemplo n.º 13
0
                @set_time_limit(0);
                $DB->StartTransaction();
                if (!CSaleStatus::Delete($ID)) {
                    $DB->Rollback();
                    if ($ex = $APPLICATION->GetException()) {
                        $lAdmin->AddGroupError($ex->GetString(), $ID);
                    } else {
                        $lAdmin->AddGroupError(GetMessage("ERROR_DEL_STATUS"), $ID);
                    }
                }
                $DB->Commit();
                break;
        }
    }
}
$dbResultList = CSaleStatus::GetList(array($by => $order), $arFilter, false, false, array("ID", "SORT", "LID", "NAME", "DESCRIPTION", $by));
$dbResultList = new CAdminResult($dbResultList, $sTableID);
$dbResultList->NavStart();
$lAdmin->NavText($dbResultList->GetNavPrint(GetMessage("STATUS_NAV")));
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => GetMessage("STATUS_ID"), "sort" => "ID", "default" => true), array("id" => "SORT", "content" => GetMessage("STATUS_SORT"), "sort" => "SORT", "default" => true), array("id" => "NAME", "content" => GetMessage("SALE_NAME"), "sort" => "", "default" => true)));
$arVisibleColumns = $lAdmin->GetVisibleHeaderColumns();
while ($arCCard = $dbResultList->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arCCard);
    $row->AddField("ID", "<a href=\"/bitrix/admin/sale_status_edit.php?ID=" . $f_ID . "&lang=" . LANG . GetFilterParams("filter_") . "\" title=\"" . GetMessage("SALE_EDIT_DESCR") . "\">" . $f_ID . "</a>");
    $row->AddField("SORT", $f_SORT);
    $row->AddField("NAME", $f_NAME . "<br><small>" . $f_DESCRIPTION . "</small><br>");
    $arActions = array();
    $arActions[] = array("ICON" => "edit", "TEXT" => GetMessage("SALE_EDIT_DESCR"), "ACTION" => $lAdmin->ActionRedirect("sale_status_edit.php?ID=" . $f_ID . "&lang=" . LANG . GetFilterParams("filter_") . ""), "DEFAULT" => true);
    if ($saleModulePermissions >= "W" && $f_ID != "N" && $f_ID != "F") {
        $arActions[] = array("SEPARATOR" => true);
        $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage("SALE_DELETE_DESCR"), "ACTION" => "if(confirm('" . GetMessage('STATUS_DEL_CONF') . "')) " . $lAdmin->ActionDoGroup($f_ID, "delete"));
Ejemplo n.º 14
0
 protected function mapYandexStatusToOrder($order, $yandexStatus, $cancelReason = "")
 {
     global $APPLICATION;
     if (!is_array($order) || !isset($order["ID"]) || strlen($yandexStatus) <= 0) {
         return false;
     }
     $settings = $this->getSettingsBySiteId($order["LID"]);
     if (!isset($settings["STATUS_IN"][$yandexStatus]) || strlen($settings["STATUS_IN"][$yandexStatus]) <= 0) {
         return false;
     }
     $result = false;
     $bitrixStatus = $settings["STATUS_IN"][$yandexStatus];
     switch ($bitrixStatus) {
         /* flags */
         case "CANCELED":
             $errorMessageTmp = "";
             $result = CSaleOrder::CancelOrder($order["ID"], "Y", $cancelReason);
             if (!$result) {
                 if ($ex = $APPLICATION->GetException()) {
                     if ($ex->GetID() != "ALREADY_FLAG") {
                         $errorMessageTmp .= $ex->GetString();
                     }
                 } else {
                     $errorMessageTmp .= GetMessage("ERROR_CANCEL_ORDER") . ". ";
                 }
             }
             if ($errorMessageTmp != "") {
                 $this->log(self::LOG_LEVEL_ERROR, "YMARKET_INCOMING_ORDER_STATUS", $order["XML_ID"], $errorMessageTmp);
             } else {
                 $this->log(self::LOG_LEVEL_INFO, "YMARKET_INCOMING_ORDER_STATUS", $order["XML_ID"], GetMessage("SALE_YMH_INCOMING_ORDER_STATUS_CANCELED") . ": " . $order["ID"]);
             }
             break;
         case "ALLOW_DELIVERY":
             $result = CSaleOrder::DeliverOrder($order["ID"], "Y");
             break;
         case "PAYED":
             $result = CSaleOrder::PayOrder($order["ID"], "Y");
             break;
         case "DEDUCTED":
             $result = CSaleOrder::DeductOrder($order["ID"], "Y");
             break;
             /* statuses */
         /* statuses */
         default:
             if (CSaleStatus::GetByID($bitrixStatus)) {
                 $result = CSaleOrder::StatusOrder($order["ID"], $bitrixStatus);
             }
             break;
     }
     $this->log($result ? self::LOG_LEVEL_INFO : self::LOG_LEVEL_ERROR, "YMARKET_ORDER_STATUS_CHANGE", $order["ID"], ($result ? GetMessage("SALE_YMH_LOG_TYPE_ORDER_STATUS_CHANGE_OK") : GetMessage("SALE_YMH_LOG_TYPE_ORDER_STATUS_CHANGE_ERROR")) . " (" . $bitrixStatus . ")");
     return $result;
 }
Ejemplo n.º 15
0
	public static function getStatusesNames($arStatusIds)
	{
		$arStatusNames = array();

		$dbStat = CSaleStatus::GetList(
										array(),
										array("ID" =>$arStatusIds, "LID" => LANGUAGE_ID),
										false,
										false,
										array("ID", "NAME")
		);

		while($arStat = $dbStat->Fetch())
			$arStatusNames[$arStat["ID"]] = htmlspecialcharsbx($arStat["NAME"]);

		return $arStatusNames;
	}
Ejemplo n.º 16
0
				if($arStatus["ID"] == "P")
					$bStatusP = true;
			}
			if(!$bStatusP)
			{
				$arFields = Array("ID" => "P", "SORT" => 150);
				foreach($arLanguages as $langID)
				{
					WizardServices::IncludeServiceLang("step1.php", $langID);
					$arFields["LANG"][] = Array("LID" => $langID, "NAME" => GetMessage("WIZ_SALE_STATUS_P"), "DESCRIPTION" => GetMessage("WIZ_SALE_STATUS_DESCRIPTION_P"));
				}

				$ID = CSaleStatus::Add($arFields);
				if ($ID !== '')
				{
					CSaleStatus::CreateMailTemplate($ID);
				}
			}
		}

		if(CModule::IncludeModule("currency"))
		{
			$dbCur = CCurrency::GetList($by="currency", $o = "asc");
			while($arCur = $dbCur->Fetch())
			{
				if($lang == "ru")
					CCurrencyLang::Update($arCur["CURRENCY"], $lang, array("DECIMALS" => 2, "HIDE_ZERO" => "Y"));
				elseif($arCur["CURRENCY"] == "EUR")
					CCurrencyLang::Update($arCur["CURRENCY"], $lang, array("DECIMALS" => 2, "FORMAT_STRING" => "&euro;#"));
			}
		}
Ejemplo n.º 17
0
 /**
  * @param Main\Event $event
  *
  * @return Main\EventResult
  * @throws Main\ObjectNotFoundException
  */
 public static function onSaleOrderStatusChangeSendEmail(Main\Event $event)
 {
     $parameters = $event->getParameters();
     /** @var Sale\Order $basketItem */
     $order = $parameters['ENTITY'];
     $value = $parameters['VALUE'];
     $oldValue = $parameters['OLD_VALUE'];
     if (!$order instanceof Sale\Order) {
         return new Main\EventResult(Main\EventResult::ERROR, new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_EVENT_COMPATIBILITY_ORDER_STATUS_CHANGE_WRONG_ORDER'), 'SALE_EVENT_COMPATIBILITY_ORDER_STATUS_CHANGE_WRONG_ORDER'), 'sale');
     }
     $orderFields = array();
     /** @var Sale\Result $resultOrderFields */
     $resultOrderFields = OrderCompatibility::getOrderFields($order);
     if ($resultOrderFields->isSuccess()) {
         if ($orderFieldsResultData = $resultOrderFields->getData()) {
             if (!empty($orderFieldsResultData['ORDER_FIELDS']) && is_array($orderFieldsResultData['ORDER_FIELDS'])) {
                 $orderFields = $orderFieldsResultData['ORDER_FIELDS'];
             }
         }
     }
     \CSaleMobileOrderPush::send(static::EVENT_COMPATIBILITY_MOBILE_PUSH_ORDER_STATUS_CHANGE, array("ORDER" => $orderFields));
     $propertyCollection = $order->getPropertyCollection();
     $userEmail = "";
     /** @var Sale\PropertyValue $userEmailProperty */
     if ($userEmailProperty = $propertyCollection->getUserEmail()) {
         $userEmail = $userEmailProperty->getValue();
     }
     if (strval(trim($userEmail)) == '') {
         $userRes = \CUser::GetByID($order->getUserId());
         if ($userData = $userRes->fetch()) {
             $userEmail = $userData["EMAIL"];
         }
     }
     static $cacheSiteData = array();
     if (!isset($cacheSiteData[$order->getSiteId()])) {
         $siteRes = \CSite::GetByID($order->getSiteId());
         $siteData = $siteRes->Fetch();
     } else {
         $siteData = $cacheSiteData[$order->getSiteId()];
     }
     if (($statusData = \CSaleStatus::GetByID($order->getField("STATUS_ID"), $siteData['LANGUAGE_ID'])) && $statusData['NOTIFY'] == "Y") {
         $fields = array("ORDER_ID" => $order->getField("ACCOUNT_NUMBER"), "ORDER_DATE" => $order->getField("DATE_INSERT")->toString(), "ORDER_STATUS" => $statusData["NAME"], "EMAIL" => $userEmail, "ORDER_DESCRIPTION" => $statusData["DESCRIPTION"], "TEXT" => "", "SALE_EMAIL" => Main\Config\Option::get("sale", "order_email", "order@" . $_SERVER["SERVER_NAME"]));
         foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ORDER_STATUS_EMAIL, true) as $oldEvent) {
             $fields["TEXT"] = ExecuteModuleEventEx($oldEvent, array($order->getId(), $statusData["ID"]));
         }
         $eventName = "SALE_STATUS_CHANGED_" . $order->getField("STATUS_ID");
         $isSend = true;
         foreach (GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ORDER_STATUS_SEND_EMAIL, true) as $oldEvent) {
             if (ExecuteModuleEventEx($oldEvent, array($order->getId(), &$eventName, &$fields, $order->getField("STATUS_ID"))) === false) {
                 $isSend = false;
             }
         }
         if ($isSend) {
             $b = '';
             $o = '';
             $eventMessage = new \CEventMessage();
             $eventMessageRes = $eventMessage->GetList($b, $o, array("EVENT_NAME" => $eventName, "SITE_ID" => $order->getSiteId(), 'ACTIVE' => 'Y'));
             if (!($eventMessageData = $eventMessageRes->Fetch())) {
                 $eventName = "SALE_STATUS_CHANGED";
             }
             unset($o, $b);
             $event = new \CEvent();
             $event->Send($eventName, $order->getSiteId(), $fields, "N");
         }
     }
     return new Main\EventResult(Main\EventResult::SUCCESS, null, 'sale');
 }
Ejemplo n.º 18
0
 public static function FormatOrderStatusChanged($arData)
 {
     $info = GetMessage("SOC_ORDER_STATUS_CHANGED_INFO");
     foreach ($arData as $param => $value) {
         if ($param == "STATUS_ID") {
             $res = CSaleStatus::GetByID($value);
             $value = "\"" . $res["NAME"] . "\"";
         }
         $info = str_replace("#" . $param . "#", $value, $info);
     }
     return array("NAME" => GetMessage("SOC_ORDER_STATUS_CHANGED"), "INFO" => $info);
 }
Ejemplo n.º 19
0
    	$getxml = new ProductsXML();
    	$xml = $getxml->getXML();
    	header('Content-type: text/xml');
    	echo $xml;*/
    $arResult = array("ERROR" => "Не верный запрос");
    // обновление статусов заказа
    if ($_REQUEST["update"]) {
        if ($_REQUEST["orders"] && CModule::IncludeModule("catalog") && CModule::IncludeModule("sale")) {
            $arResult = "";
            $arOrders = $_REQUEST["orders"];
            foreach ($arOrders as $key => $order) {
                if (!CSaleOrder::StatusOrder($order["ID"], $order["STATUS"])) {
                    $result = true;
                } else {
                    $result = false;
                }
                $arResult[] = array("ID" => $order["ID"], "RESULT" => $result);
            }
        }
        // все типы статусов
    } elseif ($_REQUEST["getstatus"] && CModule::IncludeModule("catalog") && CModule::IncludeModule("sale")) {
        $arResult = "";
        $arStatus = array();
        $rsStatus = CSaleStatus::GetList(array("ID" => "ASC"), array("LID" => "ru"));
        while ($arStatus_tmp = $rsStatus->Fetch()) {
            $arResult[] = array("ID" => $arStatus_tmp["ID"], "NAME" => $arStatus_tmp["NAME"], "DESCRIPTION" => $arStatus_tmp["DESCRIPTION"]);
        }
    }
    echo json_encode($arResult);
    exit;
}
Ejemplo n.º 20
0
         $emess = new CEventMessage();
         $message = str_replace(array("#TITLE#", "#SUB_TITLE#", "#TEXT#", "#FOOTER_BR#", "#FOOTER_SHOP#"), array(GetMessage($eventName . "_HTML_TITLE"), GetMessage($eventName . "_HTML_SUB_TITLE"), str_replace("\n", "<br />\n", GetMessage($eventName . "_HTML_TEXT")), GetMessage("SMAIL_FOOTER_BR"), GetMessage("SMAIL_FOOTER_SHOP")), $template);
         $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => $eventName, "LID" => $arSites, "EMAIL_FROM" => "#SALE_EMAIL#", "EMAIL_TO" => "#EMAIL#", "BCC" => "#BCC#", "SUBJECT" => GetMessage($eventName . "_SUBJECT"), "MESSAGE" => $message, "BODY_TYPE" => "html"));
     }
     $emess = new CEventMessage();
     $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "SALE_NEW_ORDER_RECURRING", "LID" => $arSites, "EMAIL_FROM" => "#SALE_EMAIL#", "EMAIL_TO" => "#EMAIL#", "BCC" => "#BCC#", "SUBJECT" => GetMessage("SALE_NEW_ORDER_RECURRING_SUBJECT"), "MESSAGE" => GetMessage("SALE_NEW_ORDER_RECURRING_MESSAGE"), "BODY_TYPE" => "text"));
     $emess = new CEventMessage();
     $emess->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "SALE_RECURRING_CANCEL", "LID" => $arSites, "EMAIL_FROM" => "#SALE_EMAIL#", "EMAIL_TO" => "#EMAIL#", "BCC" => "#BCC#", "SUBJECT" => GetMessage("SALE_RECURRING_CANCEL_SUBJECT"), "MESSAGE" => GetMessage("SALE_RECURRING_CANCEL_MESSAGE"), "BODY_TYPE" => "text"));
 }
 $dbStatus = CSaleStatus::GetList(array($by => $order), array(), false, false, array("ID"));
 while ($arStatus = $dbStatus->Fetch()) {
     $ID = $arStatus["ID"];
     $eventType = new CEventType();
     $eventMessage = new CEventMessage();
     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/general/status.php", $lid);
     $arStatusLang = CSaleStatus::GetLangByID($ID, $lid);
     $template = str_replace("#SITE_CHARSET#", $lang["CHARSET"], $templateGeneral);
     $dbEventType = $eventType->GetList(array("EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "LID" => $lid));
     if (!($arEventType = $dbEventType->Fetch())) {
         $str = "";
         $str .= "#ORDER_ID# - " . GetMessage("SKGS_ORDER_ID") . "\n";
         $str .= "#ORDER_DATE# - " . GetMessage("SKGS_ORDER_DATE") . "\n";
         $str .= "#ORDER_STATUS# - " . GetMessage("SKGS_ORDER_STATUS") . "\n";
         $str .= "#EMAIL# - " . GetMessage("SKGS_ORDER_EMAIL") . "\n";
         $str .= "#ORDER_DESCRIPTION# - " . GetMessage("SKGS_STATUS_DESCR") . "\n";
         $str .= "#TEXT# - " . GetMessage("SKGS_STATUS_TEXT") . "\n";
         $str .= "#SALE_EMAIL# - " . GetMessage("SKGS_SALE_EMAIL") . "\n";
         $eventTypeID = $eventType->Add(array("LID" => $lid, "EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "NAME" => GetMessage("SKGS_CHANGING_STATUS_TO") . " \"" . $arStatusLang["NAME"] . "\"", "DESCRIPTION" => $str));
     }
     if (count($arSites) > 0) {
         $dbEventMessage = $eventMessage->GetList($b = "", $o = "", array("EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "SITE_ID" => $arSites));
Ejemplo n.º 21
0
 /**
  * Function returns reference data as shared cache between this component and sale.personal.order.list.
  *
  * @throws Exception
  * @return void
  */
 protected function obtainDataReferences()
 {
     if ($this->startCache(array('spo-shared'))) {
         try {
             $cachedData = array();
             /////////////////////
             /////////////////////
             // Person type
             $dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
             while ($arPType = $dbPType->Fetch()) {
                 $cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
             }
             // Save statuses for Filter form
             $dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
             while ($arStatus = $dbStatus->Fetch()) {
                 $cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
             }
             $dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
             while ($arPaySystem = $dbPaySystem->Fetch()) {
                 $arPaySystem['NAME'] = htmlspecialcharsbx($arPaySystem['NAME']);
                 $cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
             }
             $cachedData['DELIVERY'] = array();
             $shipmentIds = array();
             foreach ($this->dbResult['SHIPMENT'] as $shipment) {
                 $shipmentIds[] = $shipment['DELIVERY_ID'];
             }
             $dbDelivery = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME', 'PARENT_NAME' => 'PARENT.NAME', 'PARENT_CLASS_NAME' => 'PARENT.CLASS_NAME'), 'filter' => array('ID' => $shipmentIds)));
             $deliveryService = array();
             while ($delivery = $dbDelivery->fetch()) {
                 $deliveryService[$delivery['ID']] = $delivery;
             }
             foreach ($deliveryService as $delivery) {
                 $cachedData['DELIVERY'][$delivery["ID"]] = array();
                 if ($delivery['PARENT_NAME']) {
                     $cachedData['DELIVERY'][$delivery["ID"]]['NAME'] = htmlspecialcharsbx($delivery['PARENT_NAME'] . ':' . $delivery['NAME']);
                 } else {
                     $cachedData['DELIVERY'][$delivery["ID"]]['NAME'] = htmlspecialcharsbx($delivery['NAME']);
                 }
             }
             /////////////////////
             /////////////////////
         } catch (Exception $e) {
             $this->abortCache();
             throw $e;
         }
         $this->endCache($cachedData);
     } else {
         $cachedData = $this->getCacheData();
     }
     $this->dbResult = array_merge($this->dbResult, $this->adaptCachedReferences($cachedData));
 }
Ejemplo n.º 22
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;
	}
Ejemplo n.º 23
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("sale")) {
    return;
}
$arUGroupsEx = array();
$dbUGroups = CGroup::GetList($by = "c_sort", $order = "asc");
while ($arUGroups = $dbUGroups->Fetch()) {
    $arUGroupsEx[$arUGroups["ID"]] = $arUGroups["NAME"];
}
$rsSite = CSite::GetList($by = "sort", $order = "asc", $arFilter = array("ACTIVE" => "Y"));
$arSites = array("" => GetMessage("CP_BCI1_ALL_SITES"));
while ($arSite = $rsSite->GetNext()) {
    $arSites[$arSite["LID"]] = $arSite["NAME"];
}
$arStatuses = array("" => GetMessage("CP_BCI1_NO"));
$dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
while ($arStatus = $dbStatus->GetNext()) {
    $arStatuses[$arStatus["ID"]] = "[" . $arStatus["ID"] . "] " . $arStatus["NAME"];
}
$arComponentParameters = array("PARAMETERS" => array("SITE_LIST" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_SITE_LIST"), "TYPE" => "LIST", "MULTIPLE" => "N", "VALUES" => $arSites), "IMPORT_NEW_ORDERS" => array("PARENT" => "BASE", "NAME" => GetMessage("SALE_1C_IMPORT_NEW_ORDERS"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "1C_SITE_NEW_ORDERS" => array("PARENT" => "BASE", "NAME" => GetMessage("SALE_1C_SITE_NEW_ORDERS"), "TYPE" => "LIST", "MULTIPLE" => "N", "VALUES" => $arSites), "EXPORT_PAYED_ORDERS" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_EXPORT_PAYED_ORDERS"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "EXPORT_ALLOW_DELIVERY_ORDERS" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_EXPORT_ALLOW_DELIVERY_ORDERS"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "CHANGE_STATUS_FROM_1C" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_CHANGE_STATUS_FROM_1C"), "TYPE" => "CHECKBOX", "DEFAULT" => "N"), "EXPORT_FINAL_ORDERS" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_EXPORT_FINAL_ORDERS"), "TYPE" => "LIST", "DEFAULT" => "", "VALUES" => $arStatuses), "REPLACE_CURRENCY" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_REPLACE_CURRENCY"), "TYPE" => "TEXT", "DEFAULT" => GetMessage("CP_BCI1_REPLACE_CURRENCY_VALUE")), "GROUP_PERMISSIONS" => array("PARENT" => "BASE", "NAME" => GetMessage("CP_BCI1_GROUP_PERMISSIONS"), "TYPE" => "LIST", "VALUES" => $arUGroupsEx, "DEFAULT" => array(1), "MULTIPLE" => "Y"), "USE_ZIP" => array("PARENT" => "ADDITIONAL", "NAME" => GetMessage("CP_BCI1_USE_ZIP"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "INTERVAL" => array("PARENT" => "ADDITIONAL", "NAME" => GetMessage("SALE_1C_INTERVAL"), "TYPE" => "TEXT", "DEFAULT" => 30), "FILE_SIZE_LIMIT" => array("PARENT" => "ADDITIONAL", "NAME" => GetMessage("SALE_1C_FILE_SIZE_LIMIT"), "TYPE" => "TEXT", "DEFAULT" => 200 * 1024)));
Ejemplo n.º 24
0
			}
			$arFields["ID"] = $arStatus["ID"];
			CSaleStatus::Update($arStatus["ID"], $arFields);
			if($arStatus["ID"] == "P")
				$bStatusP = true;
		}
		if(!$bStatusP)
		{
			$arFields = Array("ID" => "P", "SORT" => 150);
			foreach($arLanguages as $langID)
			{
				WizardServices::IncludeServiceLang("step1.php", $langID);
				$arFields["LANG"][] = Array("LID" => $langID, "NAME" => GetMessage("WIZ_SALE_STATUS_P"), "DESCRIPTION" => GetMessage("WIZ_SALE_STATUS_DESCRIPTION_P"));
			}

			CSaleStatus::Add($arFields);
		}

		if(CModule::IncludeModule("currency"))
		{
			$dbCur = CCurrency::GetList($by="currency", $o = "asc");
			while($arCur = $dbCur->Fetch())
			{
				if($lang == "ru")
					CCurrencyLang::Update($arCur["CURRENCY"], $lang, Array("DECIMALS" => 0));
				elseif($arCur["CURRENCY"] == "EUR")
					CCurrencyLang::Update($arCur["CURRENCY"], $lang, Array("DECIMALS" => 2, "FORMAT_STRING" => "&euro;#"));
			}
		}
		WizardServices::IncludeServiceLang("step1.php", $lang);
		CModule::IncludeModule("catalog");
Ejemplo n.º 25
0
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arYesNo = array("Y" => GetMessage("SPO_DESC_YES"), "N" => GetMessage("SPO_DESC_NO"));
$arComponentParameters = array("PARAMETERS" => array("SEF_MODE" => array("list" => array("NAME" => GetMessage("SPO_LIST_DESC"), "DEFAULT" => "index.php", "VARIABLES" => array()), "detail" => array("NAME" => GetMessage("SPO_DETAIL_DESC"), "DEFAULT" => "order_detail.php?ID=#ID#", "VARIABLES" => array("ID")), "cancel" => array("NAME" => GetMessage("SPO_CANCEL_DESC"), "DEFAULT" => "order_cancel.php?ID=#ID#", "VARIABLES" => array("ID"))), "ORDERS_PER_PAGE" => array("NAME" => GetMessage("SPO_ORDERS_PER_PAGE"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "20", "PARENT" => "ADDITIONAL_SETTINGS"), "PATH_TO_PAYMENT" => array("NAME" => GetMessage("SPO_PATH_TO_PAYMENT"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "payment.php", "PARENT" => "ADDITIONAL_SETTINGS"), "PATH_TO_BASKET" => array("NAME" => GetMessage("SPO_PATH_TO_BASKET"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "basket.php", "COLS" => 25, "PARENT" => "ADDITIONAL_SETTINGS"), "SET_TITLE" => array(), "SAVE_IN_SESSION" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("SPO_SAVE_IN_SESSION"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "NAV_TEMPLATE" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("SPOL_NAV_TEMPLATE"), "TYPE" => "STRING", "DEFAULT" => ""), "CACHE_TIME" => array("DEFAULT" => 3600), "CACHE_GROUPS" => array("PARENT" => "CACHE_SETTINGS", "NAME" => GetMessage("SPO_CACHE_GROUPS"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y")));
if (CModule::IncludeModule("iblock")) {
    $arComponentParameters["PARAMETERS"]["ACTIVE_DATE_FORMAT"] = CIBlockParameters::GetDateFormat(GetMessage("SPO_ACTIVE_DATE_FORMAT"), "VISUAL");
    $arComponentParameters["PARAMETERS"]["CUSTOM_SELECT_PROPS"] = array("NAME" => GetMessage("SPO_PARAM_CUSTOM_SELECT_PROPS"), "TYPE" => "STRING", "MULTIPLE" => "Y", "VALUES" => array(), "PARENT" => "ADDITIONAL_SETTINGS");
}
if (CModule::IncludeModule("sale")) {
    $dbPerson = CSalePersonType::GetList(array("SORT" => "ASC", "NAME" => "ASC"));
    while ($arPerson = $dbPerson->GetNext()) {
        $arPers2Prop = array("" => GetMessage("SPO_SHOW_ALL"));
        $bProp = false;
        $dbProp = CSaleOrderProps::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("PERSON_TYPE_ID" => $arPerson["ID"]));
        while ($arProp = $dbProp->GetNext()) {
            $arPers2Prop[$arProp["ID"]] = $arProp["NAME"];
            $bProp = true;
        }
        if ($bProp) {
            $arComponentParameters["PARAMETERS"]["PROP_" . $arPerson["ID"]] = array("NAME" => GetMessage("SPO_PROPS_NOT_SHOW") . " \"" . $arPerson["NAME"] . "\" (" . $arPerson["LID"] . ")", "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arPers2Prop, "DEFAULT" => "", "COLS" => 25, "ADDITIONAL_VALUES" => "N", "PARENT" => "BASE");
        }
    }
    // "historic" statuses
    $dbStat = CSaleStatus::GetList(array('sort' => 'asc'), array('LID' => LANGUAGE_ID), false, false, array('ID', 'NAME'));
    $statList = array();
    while ($item = $dbStat->Fetch()) {
        $statList[$item['ID']] = $item['NAME'];
    }
    $arComponentParameters['PARAMETERS']['HISTORIC_STATUSES'] = array("NAME" => GetMessage("SPO_HISTORIC_STATUSES"), "TYPE" => "LIST", "VALUES" => $statList, "MULTIPLE" => "Y", "DEFAULT" => "F", "PARENT" => "ADDITIONAL_SETTINGS");
}
Ejemplo n.º 26
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;
 }
Ejemplo n.º 27
0
 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_sale_basket", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     ModuleManager::registerModule('sale');
     $eventManager = \Bitrix\Main\EventManager::getInstance();
     $eventManager->registerEventHandlerCompatible('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout');
     RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin");
     RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout");
     RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php");
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale");
     RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount");
     RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu");
     RegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer");
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr", 300);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr", 1100);
     //pulling for mobile orders
     RegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete", 100);
     RegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd", 100);
     RegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate", 100);
     // sale product2product
     RegisterModuleDependences("sale", "OnBasketOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleOrderAdd", 100);
     RegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler", 100);
     RegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler", 100);
     CAgent::AddAgent("\\Bitrix\\Sale\\Product2ProductTable::deleteOldProducts(10);", "sale", "N", 10 * 24 * 3600, "", "Y");
     COption::SetOptionString("sale", "viewed_capability", "N");
     COption::SetOptionString("sale", "viewed_count", 10);
     COption::SetOptionString("sale", "viewed_time", 5);
     COption::SetOptionString("sale", "p2p_status_list", serialize(array("N", "P", "F", "F_CANCELED", "F_DELIVERY", "F_PAY", "F_OUT")));
     CAgent::AddAgent("CSaleRecurring::AgentCheckRecurring();", "sale", "N", 7200, "", "Y");
     CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y");
     CAgent::AddAgent("CSaleViewedProduct::ClearViewed();", "sale", "N", 86400, "", "Y");
     CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", 259200, "", "Y");
     COption::SetOptionString("sale", "product_reserve_clear_period", "3");
     if (CModule::IncludeModule("sale")) {
         $dbStatusList = CSaleStatus::GetList(array(), array(), false, false, array());
         if (!($arStatusList = $dbStatusList->Fetch())) {
             $arLandDataN = array();
             $arLandDataF = array();
             $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ACTIVE' => 'Y')));
             while ($language = $languageIterator->fetch()) {
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/status.php", $language['ID']);
                 $arLandDataN[] = array("LID" => $language['ID'], "NAME" => GetMessage("SIM_ACCEPTED"), "DESCRIPTION" => GetMessage("SIM_ACCEPTED_DESCR"));
                 $arLandDataF[] = array("LID" => $language['ID'], "NAME" => GetMessage("SIM_FINISHED"), "DESCRIPTION" => GetMessage("SIM_FINISHED_DESCR"));
             }
             unset($language, $languageIterator);
             CSaleStatus::Add(array("ID" => "N", "SORT" => 100, "LANG" => $arLandDataN));
             CSaleStatus::Add(array("ID" => "F", "SORT" => 200, "LANG" => $arLandDataF));
         }
         // enabling location pro
         COption::SetOptionString("sale", "sale_locationpro_migrated", "Y");
         COption::SetOptionString("sale", "sale_locationpro_enabled", "Y");
         if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
             // this will create at least base types if we are at Bitrix24
             include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/sale/lib/location/migration/migrate.php";
             \Bitrix\Sale\Location\Migration\CUpdaterLocationPro::createBaseTypes();
         }
         CSaleYMHandler::install();
     }
     return true;
 }
Ejemplo n.º 28
0
echo GetMessage("SSEN_PERM_STATUS_FROM");
?>
</td>
				<td><?php 
echo GetMessage("SSEN_PERM_EDIT");
?>
</td>
				<td><?php 
echo GetMessage("SSEN_PERM_DELETE");
?>
</td>
			</tr>

			<?php 
$arPermsMatrix = array();
$dbPermsMatrix = CSaleStatus::GetPermissionsList(array(), array("STATUS_ID" => $ID), false, false, array());
while ($arPM = $dbPermsMatrix->Fetch()) {
    $arPermsMatrix[$arPM["GROUP_ID"]] = array("PERM_VIEW" => $arPM["PERM_VIEW"], "PERM_CANCEL" => $arPM["PERM_CANCEL"], "PERM_DELIVERY" => $arPM["PERM_DELIVERY"], "PERM_PAYMENT" => $arPM["PERM_PAYMENT"], "PERM_STATUS" => $arPM["PERM_STATUS"], "PERM_STATUS_FROM" => $arPM["PERM_STATUS_FROM"], "PERM_UPDATE" => $arPM["PERM_UPDATE"], "PERM_DELETE" => $arPM["PERM_DELETE"]);
}
$arSaleManagerGroups = array();
$dbSaleManagerGroups = $APPLICATION->GetGroupRightList(array("MODULE_ID" => "sale", "G_ACCESS" => "U"));
while ($arSaleManagerGroup = $dbSaleManagerGroups->Fetch()) {
    $arSaleManagerGroups[] = IntVal($arSaleManagerGroup["GROUP_ID"]);
}
$dbGroups = CGroup::GetList($b = "c_sort", $o = "asc", array("ANONYMOUS" => "N"));
while ($arGroup = $dbGroups->Fetch()) {
    $arGroup["ID"] = IntVal($arGroup["ID"]);
    if ($arGroup["ID"] == 1 || $arGroup["ID"] == 2 || !in_array($arGroup["ID"], $arSaleManagerGroups)) {
        continue;
    }
    $str_PM_VIEW = "N";
Ejemplo n.º 29
0
 public static function CreateMailTemplate($ID)
 {
     $ID = trim($ID);
     if ('' == $ID) {
         return false;
     }
     if (!($arStatus = CSaleStatus::GetByID($ID, LANGUAGE_ID))) {
         return false;
     }
     $eventType = new CEventType();
     $eventMessage = new CEventMessage();
     $eventType->Delete("SALE_STATUS_CHANGED_" . $ID);
     $b = 'sort';
     $o = 'asc';
     $dbSiteList = CSite::GetList($b, $o);
     while ($arSiteList = $dbSiteList->Fetch()) {
         IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/general/status.php", $arSiteList["LANGUAGE_ID"]);
         $arStatusLang = CSaleStatus::GetLangByID($ID, $arSiteList["LANGUAGE_ID"]);
         $dbEventType = $eventType->GetList(array("EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "LID" => $arSiteList["LANGUAGE_ID"]));
         if (!($arEventType = $dbEventType->Fetch())) {
             $str = "";
             $str .= "#ORDER_ID# - " . GetMessage("SKGS_ORDER_ID") . "\n";
             $str .= "#ORDER_DATE# - " . GetMessage("SKGS_ORDER_DATE") . "\n";
             $str .= "#ORDER_STATUS# - " . GetMessage("SKGS_ORDER_STATUS") . "\n";
             $str .= "#EMAIL# - " . GetMessage("SKGS_ORDER_EMAIL") . "\n";
             $str .= "#ORDER_DESCRIPTION# - " . GetMessage("SKGS_STATUS_DESCR") . "\n";
             $str .= "#TEXT# - " . GetMessage("SKGS_STATUS_TEXT") . "\n";
             $str .= "#SALE_EMAIL# - " . GetMessage("SKGS_SALE_EMAIL") . "\n";
             $eventTypeID = $eventType->Add(array("LID" => $arSiteList["LANGUAGE_ID"], "EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "NAME" => GetMessage("SKGS_CHANGING_STATUS_TO") . " \"" . $arStatusLang["NAME"] . "\"", "DESCRIPTION" => $str));
         }
         $dbEventMessage = $eventMessage->GetList($b = "", $o = "", array("EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "SITE_ID" => $arSiteList["LID"]));
         if (!($arEventMessage = $dbEventMessage->Fetch())) {
             $subject = GetMessage("SKGS_STATUS_MAIL_SUBJ");
             $message = GetMessage("SKGS_STATUS_MAIL_BODY1");
             $message .= "------------------------------------------\n\n";
             $message .= GetMessage("SKGS_STATUS_MAIL_BODY2");
             $message .= GetMessage("SKGS_STATUS_MAIL_BODY3");
             $message .= "#ORDER_STATUS#\n";
             $message .= "#ORDER_DESCRIPTION#\n";
             $message .= "#TEXT#\n\n";
             $message .= "#SITE_NAME#\n";
             $arFields = array("ACTIVE" => "Y", "EVENT_NAME" => "SALE_STATUS_CHANGED_" . $ID, "LID" => $arSiteList["LID"], "EMAIL_FROM" => "#SALE_EMAIL#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => $subject, "MESSAGE" => $message, "BODY_TYPE" => "text");
             $eventMessageID = $eventMessage->Add($arFields);
         }
     }
     return true;
 }
Ejemplo n.º 30
0
            } else {
                $errors = $result->getErrorMessages();
            }
        }
    }
    // add translations and group tasks, redirect
    if (!$errors) {
        foreach ($translations as $data) {
            StatusLangTable::add($data);
        }
        foreach ($groupTasks as $data) {
            StatusGroupTaskTable::add($data);
        }
        if ($result->isSuccess()) {
            if ($isNew) {
                CSaleStatus::CreateMailTemplate($statusId);
            }
        }
        if ($_POST['save']) {
            LocalRedirect('sale_status.php?lang=' . LANGUAGE_ID . GetFilterParams('filter_', false));
        } else {
            LocalRedirect("sale_status_edit.php?ID=" . $statusId . "&lang=" . LANGUAGE_ID . GetFilterParams("filter_", false));
        }
    }
} else {
    if ($statusId) {
        if ($row = StatusTable::getList(array('select' => array('*'), 'filter' => array('=ID' => $statusId), 'limit' => 1))->fetch()) {
            $status = $row;
            $result = StatusLangTable::getList(array('select' => array('*'), 'filter' => array('=STATUS_ID' => $statusId)));
            while ($row = $result->fetch()) {
                $translations[$row['LID']] = $row;