本文整理汇总了PHP中CSaleOrderTax::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderTax::GetList方法的具体用法?PHP CSaleOrderTax::GetList怎么用?PHP CSaleOrderTax::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrderTax
的用法示例。
在下文中一共展示了CSaleOrderTax::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
function Add($arFields)
{
global $DB;
if (!CSaleOrderTax::CheckFields("ADD", $arFields)) {
return false;
}
$dbResult = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $arFields['ORDER_ID'], "TAX_NAME" => $arFields['TAX_NAME'], "CODE" => $arFields['CODE']), false, false, array("ID"));
if ($dbResult->Fetch()) {
return false;
}
$arInsert = $DB->PrepareInsert("b_sale_order_tax", $arFields);
$strSql = "INSERT INTO b_sale_order_tax(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
return $ID;
}
示例2: obtainTaxes
/**
* Return order tax list
*
* @param array &$cached Cached data.
* @return void
*/
protected function obtainTaxes(&$cached)
{
$cached['TAX'] = array();
if (!empty($this->dbResult['ID'])) {
$taxIterator = CSaleOrderTax::GetList(array('APPLY_ORDER' => 'ASC'), array('ORDER_ID' => $this->dbResult['ID']));
while ($tax = $taxIterator->Fetch()) {
$cached['TAX'][] = $tax;
}
unset($tax, $taxIterator);
}
$cached['TAX_LIST'] = $cached['TAX'];
}
示例3: number_format
}
?>
<tr>
<td align="right" colspan="4">
Сумма:
</td>
<td align="right" nowrap>
<?php
echo number_format($total_sum, 2, ',', ' ');
?>
</td>
</tr>
<?php
$db_tax_list = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $ORDER_ID));
while ($ar_tax_list = $db_tax_list->Fetch()) {
?>
<tr>
<td align="right" colspan="4">
<?php
if ($ar_tax_list["IS_IN_PRICE"] == "Y") {
echo "В том числе ";
}
echo htmlspecialcharsbx($ar_tax_list["TAX_NAME"]);
if ($ar_tax_list["IS_PERCENT"] == "Y") {
echo " (" . $ar_tax_list["VALUE"] . "%)";
}
?>
:
</td>
示例4: loadList
/**
* @return array
*/
protected function loadList()
{
$resultList = array();
$order = $this->getOrder();
if ($order->getId() <= 0) {
return null;
}
$dbTaxList = \CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $order->getId()));
while ($taxList = $dbTaxList->Fetch()) {
$taxList['NAME'] = $taxList['TAX_NAME'];
$resultList[] = $taxList;
}
return !empty($resultList) ? $resultList : null;
}
示例5: DoSaveOrderTax
static function DoSaveOrderTax($orderId, $taxList, &$arErrors)
{
$duplicateList = array();
$idList = array();
$res = CSaleOrderTax::GetList(array('ID' => 'ASC'), array("ORDER_ID" => $orderId), false, false, array("ID", "TAX_NAME", "CODE"));
while ($data = $res->Fetch()) {
$hash = $data["TAX_NAME"] . "|" . $data["CODE"];
if (!array_key_exists($hash, $idList)) {
$idList[$data["TAX_NAME"] . "|" . $data["CODE"]] = $data["ID"];
} else {
$duplicateList[$hash] = $data['ID'];
}
}
if (is_array($taxList)) {
foreach ($taxList as $itemData) {
$fields = array("ORDER_ID" => $orderId, "TAX_NAME" => $itemData["NAME"], "IS_PERCENT" => $itemData["IS_PERCENT"], "VALUE" => $itemData["VALUE"], "VALUE_MONEY" => $itemData["VALUE_MONEY"], "APPLY_ORDER" => $itemData["APPLY_ORDER"], "IS_IN_PRICE" => $itemData["IS_IN_PRICE"], "CODE" => $itemData["CODE"]);
$hash = $itemData["NAME"] . "|" . $itemData["CODE"];
if (array_key_exists($hash, $idList)) {
CSaleOrderTax::Update($idList[$hash], $fields);
unset($idList[$hash]);
} elseif (!array_key_exists($hash, $duplicateList)) {
CSaleOrderTax::Add($fields);
}
}
}
foreach ($idList as $code => $id) {
CSaleOrderTax::Delete($id);
}
if (!empty($duplicateList)) {
foreach ($duplicateList as $hash => $id) {
CSaleOrderTax::Delete($id);
}
}
}
示例6: nodeHandler
function nodeHandler(CDataXML $value)
{
$value = $value->GetArray();
$value = $value[GetMessage("CC_BSC1_DOCUMENT")];
if ($value["#"][GetMessage("CC_BSC1_OPERATION")][0]["#"] == GetMessage("CC_BSC1_ORDER")) {
$orderId = IntVal($value["#"][GetMessage("CC_BSC1_NUMBER")][0]["#"]);
$arOrder = array();
$arItem = array();
$arOrder["AMOUNT"] = $value["#"][GetMessage("CC_BSC1_SUMM")][0]["#"];
$arOrder["AMOUNT"] = str_replace($SumFormat, ".", $arOrder["AMOUNT"]);
$arOrder["COMMENT"] = $value["#"][GetMessage("CC_BSC1_COMMENT")][0]["#"];
foreach ($value["#"][GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")] as $val) {
$arOrder["TRAITS"][$val["#"][GetMessage("CC_BSC1_NAME")][0]["#"]] = $val["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
}
$taxValue = 0;
$taxValueTmp = 0;
$taxName = "";
if (is_array($value["#"][GetMessage("CC_BSC1_ITEMS")][0]["#"][GetMessage("CC_BSC1_ITEM")])) {
foreach ($value["#"][GetMessage("CC_BSC1_ITEMS")][0]["#"][GetMessage("CC_BSC1_ITEM")] as $val) {
$val = $val["#"];
$productID = $val[GetMessage("CC_BSC1_ID")][0]["#"];
$bGood = false;
$discountPrice = "";
$priceAll = str_replace($SumFormat, ".", $val[GetMessage("CC_BSC1_SUMM")][0]["#"]);
$priceone = str_replace($SumFormat, ".", $val[GetMessage("CC_BSC1_PRICE_PER_UNIT")][0]["#"]);
$quantity = str_replace($QuantityFormat, ".", $val[GetMessage("CC_BSC1_QUANTITY")][0]["#"]);
$price = $priceAll / $quantity;
if ($priceone != $price) {
$discountPrice = $priceone - $price;
}
//DISCOUNTS!
$arItem[$productID] = array("NAME" => $val[GetMessage("CC_BSC1_NAME")][0]["#"], "PRICE" => $price, "QUANTITY" => $quantity, "DISCOUNT_PRICE" => $discountPrice);
if (is_array($val[GetMessage("CC_BSC1_PROPS_ITEMS")][0]["#"][GetMessage("CC_BSC1_PROP_ITEM")])) {
foreach ($val[GetMessage("CC_BSC1_PROPS_ITEMS")][0]["#"][GetMessage("CC_BSC1_PROP_ITEM")] as $val1) {
$arItem[$productID]["ATTRIBUTES"][$val1["#"][GetMessage("CC_BSC1_NAME")][0]["#"]] = $val1["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
}
}
if (is_array($val[GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")])) {
foreach ($val[GetMessage("CC_BSC1_REK_VALUES")][0]["#"][GetMessage("CC_BSC1_REK_VALUE")] as $val1) {
if ($val1["#"][GetMessage("CC_BSC1_NAME")][0]["#"] == GetMessage("CC_BSC1_ITEM_TYPE")) {
$arItem[$productID]["TYPE"] = $val1["#"][GetMessage("CC_BSC1_VALUE")][0]["#"];
}
}
}
if (strlen($value["#"][GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_NAME")][0]["#"]) > 0) {
$taxValueTmp = $val[GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_TAX_VALUE")][0]["#"];
$arItem[$productID]["VAT_RATE"] = $taxValueTmp / 100;
if (IntVal($taxValueTmp) > IntVal($taxValue)) {
$taxName = $val[GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_NAME")][0]["#"];
$taxValue = $taxValueTmp;
}
}
}
}
if (IntVal($taxValue) > 0) {
$price = str_replace($SumFormat, ".", $value["#"][GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_SUMM")][0]["#"]);
$arOrder["TAX"] = array("NAME" => $taxName, "VALUE" => $taxValue, "IS_IN_PRICE" => $value["#"][GetMessage("CC_BSC1_TAXES")][0]["#"][GetMessage("CC_BSC1_TAX")][0]["#"][GetMessage("CC_BSC1_IN_PRICE")][0]["#"] == "true" ? "Y" : "N", "VALUE_MONEY" => $price);
}
$arOrder["items"] = $arItem;
$v = $arOrder;
if ($orderInfo = CSaleOrder::GetByID($orderId)) {
if ($orderInfo["PAYED"] != "Y" && $orderInfo["ALLOW_DELIVERY"] != "Y" && $orderInfo["STATUS_ID"] != "F") {
$dbOrderTax = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $orderId), false, false, array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE"));
$bTaxFound = false;
if ($arOrderTax = $dbOrderTax->Fetch()) {
$bTaxFound = true;
if (IntVal($arOrderTax["VALUE_MONEY"]) != IntVal($v["TAX"]["VALUE_MONEY"]) || IntVal($arOrderTax["VALUE"]) != IntVal($v["TAX"]["VALUE"]) || $arOrderTax["IS_IN_PRICE"] != $v["TAX"]["IS_IN_PRICE"]) {
if (IntVal($v["TAX"]["VALUE"]) > 0) {
$arFields = array("TAX_NAME" => $v["TAX"]["NAME"], "ORDER_ID" => $orderId, "VALUE" => $v["TAX"]["VALUE"], "IS_PERCENT" => "Y", "IS_IN_PRICE" => $v["TAX"]["IS_IN_PRICE"], "VALUE_MONEY" => $v["TAX"]["VALUE_MONEY"], "CODE" => "VAT1C", "APPLY_ORDER" => "100");
CSaleOrderTax::Update($arOrderTax["ID"], $arFields);
CSaleOrder::Update($orderId, array("TAX_VALUE" => $v["TAX"]["VALUE_MONEY"]));
} else {
CSaleOrderTax::Delete($arOrderTax["ID"]);
CSaleOrder::Update($orderId, array("TAX_VALUE" => 0));
}
}
}
if (!$bTaxFound) {
if (IntVal($v["TAX"]["VALUE"]) > 0) {
$arFields = array("TAX_NAME" => $v["TAX"]["NAME"], "ORDER_ID" => $orderId, "VALUE" => $v["TAX"]["VALUE"], "IS_PERCENT" => "Y", "IS_IN_PRICE" => $v["TAX"]["IS_IN_PRICE"], "VALUE_MONEY" => $v["TAX"]["VALUE_MONEY"]);
CSaleOrderTax::Add($arFields);
CSaleOrder::Update($orderId, array("TAX_VALUE" => $v["TAX"]["VALUE_MONEY"]));
}
}
$dbBasket = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $orderId));
$basketSum = 0;
while ($arBasket = $dbBasket->Fetch()) {
$arFields = array();
if (!empty($v["items"][$arBasket["PRODUCT_XML_ID"]])) {
if ($arBasket["QUANTITY"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["QUANTITY"]) {
$arFields["QUANTITY"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["QUANTITY"];
}
if ($arBasket["PRICE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["PRICE"]) {
$arFields["PRICE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["PRICE"];
}
if ($arBasket["VAT_RATE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["VAT_RATE"]) {
$arFields["VAT_RATE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["VAT_RATE"];
}
if ($arBasket["DISCOUNT_PRICE"] != $v["items"][$arBasket["PRODUCT_XML_ID"]]["DISCOUNT_PRICE"]) {
$arFields["DISCOUNT_PRICE"] = $v["items"][$arBasket["PRODUCT_XML_ID"]]["DISCOUNT_PRICE"];
//.........这里部分代码省略.........
示例7: ExportOrders2Xml
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");
//.........这里部分代码省略.........
示例8: nodeHandler
function nodeHandler(CDataXML $value)
{
$value = $value->GetArray();
if(!empty($value[GetMessage("CC_BSC1_DOCUMENT")]))
{
$value = $value[GetMessage("CC_BSC1_DOCUMENT")];
$arOrder = $this->collectOrderInfo($value);
if(!empty($arOrder))
{
if(strlen($arOrder["ID"]) <= 0 && strlen($arOrder["ID_1C"]) > 0)//try to search order from 1C
{
$dbOrder = CSaleOrder::GetList(array("ID" => "DESC"), array("ID_1C" => $arOrder["ID_1C"]), false, false, array("ID", "ID_1C"));
if($orderInfo = $dbOrder->Fetch())
{
$arOrder["ID"] = $orderInfo["ID"];
}
}
if(strlen($arOrder["ID"]) > 0) // exists site order
{
$dbOrder = CSaleOrder::GetList(array(), array("ACCOUNT_NUMBER" => $arOrder["ID"]), false, false, array("ID", "LID", "PERSON_TYPE_ID", "PAYED", "DATE_PAYED", "CANCELED", "DATE_CANCELED", "REASON_CANCELED", "STATUS_ID", "DATE_STATUS", "PAY_VOUCHER_NUM", "PAY_VOUCHER_DATE", "PRICE_DELIVERY", "ALLOW_DELIVERY", "DATE_ALLOW_DELIVERY", "PRICE", "CURRENCY", "DISCOUNT_VALUE", "USER_ID", "PAY_SYSTEM_ID", "DELIVERY_ID", "DATE_INSERT", "DATE_INSERT_FORMAT", "DATE_UPDATE", "USER_DESCRIPTION", "ADDITIONAL_INFO", "COMMENTS", "TAX_VALUE", "DELIVERY_DOC_NUM", "DELIVERY_DOC_DATE", "STORE_ID", "ACCOUNT_NUMBER", "VERSION", "VERSION_1C", "ID_1C"));
if($orderInfo = $dbOrder->Fetch())
{
if($arOrder["VERSION_1C"] != $orderInfo["VERSION_1C"] || (strlen($orderInfo["VERSION_1C"]) <= 0 || strlen($arOrder["VERSION_1C"]) <= 0)) // skip update if the same version
{
$arOrderFields = array();
$orderId = $orderInfo["ID"];
CSaleOrderChange::AddRecord($orderId, "ORDER_1C_IMPORT");
if($arOrder["ID_1C"] != $orderInfo["ID_1C"])
$arOrderFields["ID_1C"] = $arOrder["ID_1C"];
$arOrderFields["VERSION_1C"] = $arOrder["VERSION_1C"];
if($orderInfo["PAYED"] != "Y" && $orderInfo["ALLOW_DELIVERY"] != "Y" && $orderInfo["STATUS_ID"] != "F")
{
$dbOrderTax = CSaleOrderTax::GetList(
array(),
array("ORDER_ID" => $orderId),
false,
false,
array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE")
);
$bTaxFound = false;
if($arOrderTax = $dbOrderTax->Fetch())
{
$bTaxFound = true;
if(IntVal($arOrderTax["VALUE_MONEY"]) != IntVal($arOrder["TAX"]["VALUE_MONEY"]) || IntVal($arOrderTax["VALUE"]) != IntVal($arOrder["TAX"]["VALUE"]) || ($arOrderTax["IS_IN_PRICE"] != $arOrder["TAX"]["IS_IN_PRICE"]))
{
if(IntVal($arOrder["TAX"]["VALUE"])>0)
{
$arFields = Array(
"TAX_NAME" => $arOrder["TAX"]["NAME"],
"ORDER_ID" => $orderId,
"VALUE" => $arOrder["TAX"]["VALUE"],
"IS_PERCENT" => "Y",
"IS_IN_PRICE" => $arOrder["TAX"]["IS_IN_PRICE"],
"VALUE_MONEY" => $arOrder["TAX"]["VALUE_MONEY"],
"CODE" => "VAT1C",
"APPLY_ORDER" => "100"
);
CSaleOrderTax::Update($arOrderTax["ID"], $arFields);
$arOrderFields["TAX_VALUE"] = $arOrder["TAX"]["VALUE_MONEY"];
}
else
{
CSaleOrderTax::Delete($arOrderTax["ID"]);
$arOrderFields["TAX_VALUE"] = 0;
}
}
}
if(!$bTaxFound)
{
if(IntVal($arOrder["TAX"]["VALUE"])>0)
{
$arFields = Array(
"TAX_NAME" => $arOrder["TAX"]["NAME"],
"ORDER_ID" => $orderId,
"VALUE" => $arOrder["TAX"]["VALUE"],
"IS_PERCENT" => "Y",
"IS_IN_PRICE" => $arOrder["TAX"]["IS_IN_PRICE"],
"VALUE_MONEY" => $arOrder["TAX"]["VALUE_MONEY"]
);
CSaleOrderTax::Add($arFields);
$arOrderFields["TAX_VALUE"] = $arOrder["TAX"]["VALUE_MONEY"];
}
}
$arShoppingCart = array();
$bNeedUpdate = false;
$dbBasket = CSaleBasket::GetList(
array("NAME" => "ASC"),
array("ORDER_ID" => $orderId),
false,
false,
array(
"ID",
"QUANTITY",
"CANCEL_CALLBACK_FUNC",
//.........这里部分代码省略.........
示例9: ExportOrders2Xml
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";
//.........这里部分代码省略.........
示例10: GetMessage
echo GetMessage("SOE_TAX_SORT");
?>
</td>
<td>
<?php
echo GetMessage("SOE_TAX_CODE");
?>
</td>
<td>
<?php
echo GetMessage("SOE_TAX_IN_PRICE");
?>
</td>
</tr>
<?php
$dbTaxList = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"), array("ORDER_ID" => $ID), false, false, array("*"));
$ind = -1;
while ($arTaxList = $dbTaxList->Fetch()) {
$ind++;
$str_TAX_NAME = htmlspecialcharsbx($arTaxList["TAX_NAME"]);
$str_TAX_VALUE = htmlspecialcharsbx($arTaxList["VALUE"]);
$str_TAX_VALUE_MONEY = htmlspecialcharsbx($arTaxList["VALUE_MONEY"]);
$str_TAX_APPLY_ORDER = htmlspecialcharsbx($arTaxList["APPLY_ORDER"]);
$str_TAX_CODE = htmlspecialcharsbx($arTaxList["CODE"]);
$str_TAX_IS_IN_PRICE = htmlspecialcharsbx($arTaxList["IS_IN_PRICE"]);
if ($bVarsFromForm) {
$str_TAX_NAME = htmlspecialcharsbx(${"TAX_NAME_" . $ind});
$str_TAX_VALUE = htmlspecialcharsbx(${"TAX_VALUE_" . $ind});
$str_TAX_VALUE_MONEY = htmlspecialcharsbx(${"TAX_VALUE_MONEY_" . $ind});
$str_TAX_APPLY_ORDER = htmlspecialcharsbx(${"TAX_APPLY_ORDER_" . $ind});
$str_TAX_CODE = htmlspecialcharsbx(${"TAX_CODE_" . $ind});
示例11: obtainDataReferences
/**
* Read some data from database, using cache. Under some info we mean status list, delivery system list and so on.
* This will be a shared cache between sale.personal.order.list and sale.personal.order.detail, so beware of collisions.
* @throws Main\SystemException
* @return void
*/
protected function obtainDataReferences()
{
if ($this->startCache(array('spo-shared'))) {
try {
$cachedData = array();
/////////////////////
/////////////////////
// Person type
$cachedData['PERSON_TYPE'] = array();
$dbPType = CSalePersonType::GetList(array("SORT" => "ASC"));
while ($arPType = $dbPType->Fetch()) {
$cachedData['PERSON_TYPE'][$arPType["ID"]] = $arPType;
}
// Tax list
$cachedData['TAX'] = array();
$dbTaxList = CSaleOrderTax::GetList(array("APPLY_ORDER" => "ASC"));
while ($arTaxList = $dbTaxList->Fetch()) {
$cachedData['TAX'] = $arTaxList;
}
// Save statuses for Filter form
$cachedData['STATUS'] = array();
$dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID));
while ($arStatus = $dbStatus->Fetch()) {
$cachedData['STATUS'][$arStatus["ID"]] = $arStatus;
}
$cachedData['PAYSYS'] = array();
$dbPaySystem = CSalePaySystem::GetList(array("SORT" => "ASC"));
while ($arPaySystem = $dbPaySystem->Fetch()) {
$cachedData['PAYSYS'][$arPaySystem["ID"]] = $arPaySystem;
}
$cachedData['DELIVERY'] = array();
$dbDelivery = CSaleDelivery::GetList(array("SORT" => "ASC"));
while ($arDelivery = $dbDelivery->Fetch()) {
$cachedData['DELIVERY'][$arDelivery["ID"]] = $arDelivery;
}
$cachedData['DELIVERY_HANDLERS'] = array();
$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, $cachedData);
}
示例12: DoSaveOrderTax
static function DoSaveOrderTax($orderId, $arTaxList, &$arErrors)
{
$arIDs = array();
$dbResult = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $orderId), false, false, array("ID", "TAX_NAME", "CODE"));
while ($arResult = $dbResult->Fetch()) {
$arIDs[$arResult["TAX_NAME"] . "|" . $arResult["CODE"]] = $arResult["ID"];
}
if (is_array($arTaxList)) {
foreach ($arTaxList as $arItem) {
$arFields = array("ORDER_ID" => $orderId, "TAX_NAME" => $arItem["NAME"], "IS_PERCENT" => $arItem["IS_PERCENT"], "VALUE" => $arItem["VALUE"], "VALUE_MONEY" => $arItem["VALUE_MONEY"], "APPLY_ORDER" => $arItem["APPLY_ORDER"], "IS_IN_PRICE" => $arItem["IS_IN_PRICE"], "CODE" => $arItem["CODE"]);
if (array_key_exists($arItem["NAME"] . "|" . $arItem["CODE"], $arIDs)) {
CSaleOrderTax::Update($arIDs[$arItem["NAME"] . "|" . $arItem["CODE"]], $arFields);
unset($arIDs[$arItem["NAME"] . "|" . $arItem["CODE"]]);
} else {
CSaleOrderTax::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
CSaleOrderTax::Delete($id);
}
}
示例13: getOrderTax
function getOrderTax($orderId)
{
$arResult = array();
if ($orderId > 0) {
$dbOrderTax = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $orderId), false, false, array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE"));
$i = -1;
$orderTax = 0;
while ($arOrderTax = $dbOrderTax->Fetch()) {
$arResult[] = $arOrderTax;
}
}
return $arResult;
}
示例14: die
if (!isset($arFilter) || !is_array($arFilter)) {
die("Wrong use 1");
}
$dbOrderList = CSaleOrder::GetList(array($by => $order), $arFilter, false, false, 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"));
ob_start();
echo "<" . "?xml version=\"1.0\" encoding=\"" . LANG_CHARSET . "\"?" . ">\n";
echo "<BizTalk xmlns=\"urn:schemas-biztalk-org:biztalk/biztalk-0.81.xml\"><Route><From locationID=\"\" locationType=\"\" process=\"\" path=\"\" handle=\"\"/><To locationID=\"\" locationType=\"\" process=\"\" path=\"\" handle=\"\"/></Route><Body>\n";
echo "\t<" . GetMessage("CommerceInfo") . " xmlns=\"urn:CommerceML\">\n";
$arContra = array();
while ($dbOrderList->NavNext(true, "f_")) {
echo "\t\t<" . GetMessage("Document") . " " . GetMessage("Operation") . "=\"Order\" " . GetMessage("NumberDoc") . "=\"" . $f_ID . "\" ";
echo "" . GetMessage("DateDoc") . "=\"" . CDatabase::FormatDate($f_DATE_INSERT, CLang::GetDateFormat("FULL", LANG), "Y-M-D") . "\" " . GetMessage("TimeDoc") . "=\"" . CDatabase::FormatDate($f_DATE_INSERT, CLang::GetDateFormat("FULL", LANG), "HH:MI:SS") . "\" " . GetMessage("PaymentDate") . "=\"\" ";
echo "" . GetMessage("Sum") . "=\"" . $f_PRICE . "\" " . GetMessage("Comment") . "=\"\" " . GetMessage("Currency") . "=\"" . $f_CURRENCY . "\">\n";
echo "\t\t\t<" . GetMessage("CompanyInDocument") . " " . GetMessage("Role") . "=\"Saler\" " . GetMessage("Company") . "=\"" . $SALER_COMPANY_XML_ID . "\"/>\n";
echo "\t\t\t<" . GetMessage("CompanyInDocument") . " " . GetMessage("Role") . "=\"Buyer\" " . GetMessage("Company") . "=\"BC" . $f_USER_ID . "\"/>\n";
$dbOrderTax = CSaleOrderTax::GetList(array(), array("ORDER_ID" => $f_ID), false, false, array("ID", "TAX_NAME", "VALUE", "VALUE_MONEY", "CODE", "IS_IN_PRICE"));
while ($arOrderTax = $dbOrderTax->Fetch()) {
echo "\t\t\t<" . GetMessage("TaxSum") . " " . GetMessage("Tax") . "=\"" . htmlspecialcharsbx($arOrderTax["TAX_NAME"]) . "\" " . GetMessage("TaxRate") . "=\"" . htmlspecialcharsbx($arOrderTax["VALUE"]) . "\" " . GetMessage("Sum") . "=\"" . htmlspecialcharsbx($arOrderTax["VALUE_MONEY"]) . "\" " . GetMessage("IncludedInSum") . "=\"" . ($arOrderTax["IS_IN_PRICE"] == "Y" ? 1 : 0) . "\"/>\n";
}
$dbBasket = CSaleBasket::GetList(array("NAME" => "ASC"), array("ORDER_ID" => $f_ID));
while ($arBasket = $dbBasket->Fetch()) {
$CATALOG_XML_ID = $arBasket["CATALOG_XML_ID"];
$PRODUCT_XML_ID = $arBasket["PRODUCT_XML_ID"];
if (strlen($PRODUCT_XML_ID) <= 0 && strlen($CATALOG_XML_ID) <= 0) {
$dbBasketProps = CSaleBasket::GetPropsList(array("CODE" => "ASC"), array("BASKET_ID" => $arBasket["ID"]));
while ($arBasketProps = $dbBasketProps->Fetch()) {
if ($arBasketProps["CODE"] == "CATALOG.XML_ID") {
$CATALOG_XML_ID = $arBasketProps["VALUE"];
} elseif ($arBasketProps["CODE"] == "PRODUCT.XML_ID") {
$PRODUCT_XML_ID = $arBasketProps["VALUE"];
if (substr($PRODUCT_XML_ID, 0, 2) == "ID") {
示例15: DoSaveOrderTax
static function DoSaveOrderTax($orderId, $taxList, &$arErrors)
{
$duplicateList = array();
$idList = array();
$res = CSaleOrderTax::GetList(array('ID' => 'ASC'), array("ORDER_ID" => $orderId), false, false, array("ID", "TAX_NAME", "CODE"));
while ($data = $res->Fetch()) {
$hash = $data["TAX_NAME"] . "|" . $data["CODE"];
if (!array_key_exists($hash, $idList)) {
$idList[$data["TAX_NAME"] . "|" . $data["CODE"]] = $data["ID"];
} else {
$duplicateList[$hash] = $data['ID'];
}
}
$isChanged = false;
if (is_array($taxList)) {
foreach ($taxList as $itemData) {
$fields = array("ORDER_ID" => $orderId, "TAX_NAME" => $itemData["NAME"], "IS_PERCENT" => $itemData["IS_PERCENT"], "VALUE" => $itemData["VALUE"], "VALUE_MONEY" => $itemData["VALUE_MONEY"], "APPLY_ORDER" => $itemData["APPLY_ORDER"], "IS_IN_PRICE" => $itemData["IS_IN_PRICE"], "CODE" => $itemData["CODE"]);
$hash = $itemData["NAME"] . "|" . $itemData["CODE"];
$isNew = false;
if (array_key_exists($hash, $idList)) {
$taxId = CSaleOrderTax::Update($idList[$hash], $fields);
unset($idList[$hash]);
} elseif (!array_key_exists($hash, $duplicateList)) {
$isNew = true;
$taxId = CSaleOrderTax::Add($fields);
}
if ($orderId > 0) {
\Bitrix\Sale\OrderHistory::addLog('TAX', $orderId, $isNew ? 'TAX_ADD' : 'TAX_UPDATE', $taxId, null, array("NAME" => $itemData["NAME"], "CODE" => $itemData["CODE"]), \Bitrix\Sale\OrderHistory::SALE_ORDER_HISTORY_LOG_LEVEL_1);
$isChanged = true;
}
}
}
foreach ($idList as $code => $id) {
CSaleOrderTax::Delete($id);
if ($orderId > 0) {
\Bitrix\Sale\OrderHistory::addLog('TAX', $orderId, 'TAX_DELETED', $id, null, array(), \Bitrix\Sale\OrderHistory::SALE_ORDER_HISTORY_LOG_LEVEL_1);
}
}
if (!empty($duplicateList)) {
foreach ($duplicateList as $hash => $id) {
CSaleOrderTax::Delete($id);
\Bitrix\Sale\OrderHistory::addLog('TAX', $orderId, 'TAX_DUPLICATE_DELETED', $id, null, array(), \Bitrix\Sale\OrderHistory::SALE_ORDER_HISTORY_LOG_LEVEL_1);
}
}
if ($isChanged) {
\Bitrix\Sale\OrderHistory::addAction('TAX', $orderId, "TAX_SAVED");
}
}