1
0
mirror of synced 2024-11-25 23:06:08 +03:00

ref #77474 Добавлена передача НДС товаров (#301)

This commit is contained in:
Uryvskiy Dima 2023-07-03 10:05:52 +03:00 committed by GitHub
parent 17e3b00dd7
commit c7cec20c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 75 additions and 16 deletions

View File

@ -1,3 +1,6 @@
## 2023-06-30 v.6.3.16
- Добавлена передача НДС товаров
## 2023-06-22 v.6.3.15 ## 2023-06-22 v.6.3.15
- Исправлено зависание агента выгрузки заказов - Исправлено зависание агента выгрузки заказов

View File

@ -1035,8 +1035,17 @@ class RetailCrmHistory
if ($item instanceof \Bitrix\Sale\BasketItem) { if ($item instanceof \Bitrix\Sale\BasketItem) {
$elem = self::getInfoElement($product['offer']['externalId']); $elem = self::getInfoElement($product['offer']['externalId']);
$vatRate = null;
$item->setFields(array( if (RetailcrmConfigProvider::getOrderVat() === 'Y') {
if ($product['vatRate'] === 0) {
$vatRate = 0;
} elseif($product['vatRate'] !== null) {
$vatRate = $product['vatRate'] / 100;
}
}
$item->setFields([
'CURRENCY' => $newOrder->getCurrency(), 'CURRENCY' => $newOrder->getCurrency(),
'LID' => $site, 'LID' => $site,
'BASE_PRICE' => $collectItems[$product['offer']['externalId']]['initialPrice_max'], 'BASE_PRICE' => $collectItems[$product['offer']['externalId']]['initialPrice_max'],
@ -1047,8 +1056,10 @@ class RetailCrmHistory
'WEIGHT' => $elem['WEIGHT'], 'WEIGHT' => $elem['WEIGHT'],
'NOTES' => GetMessage('PRICE_TYPE'), 'NOTES' => GetMessage('PRICE_TYPE'),
'PRODUCT_XML_ID' => $elem["XML_ID"], 'PRODUCT_XML_ID' => $elem["XML_ID"],
'CATALOG_XML_ID' => $elem["IBLOCK_XML_ID"] 'CATALOG_XML_ID' => $elem["IBLOCK_XML_ID"],
)); 'VAT_INCLUDED' => $vatRate !== null ? 'Y' : 'N',
'VAT_RATE' => $vatRate,
]);
} else { } else {
RCrmActions::eventLog( RCrmActions::eventLog(
'RetailCrmHistory::orderHistory', 'RetailCrmHistory::orderHistory',

View File

@ -301,6 +301,14 @@ class RetailCrmOrder
$item['initialPrice'] = $product['PRICE']; $item['initialPrice'] = $product['PRICE'];
} }
if (
!empty($product['VAT_INCLUDED'])
&& $product['VAT_INCLUDED'] === 'Y'
&& RetailcrmConfigProvider::getOrderVat() === 'Y'
) {
$item['vatRate'] = $product['VAT_RATE'] * 100;
}
$order['items'][] = $item; $order['items'][] = $item;
if ($send && $dimensionsSetting === 'Y') { if ($send && $dimensionsSetting === 'Y') {

View File

@ -1 +1 @@
- Исправлено зависание агента выгрузки заказов - Добавлена передача НДС товаров

View File

@ -1,6 +1,6 @@
<?php <?php
$arModuleVersion = [ $arModuleVersion = [
'VERSION' => '6.3.15', 'VERSION' => '6.3.16',
'VERSION_DATE' => '2023-06-22 15:30:00' 'VERSION_DATE' => '2023-06-30 18:00:00'
]; ];

View File

@ -62,7 +62,8 @@ $MESS ['ORDER_UPL_START'] = 'Start uploading';
$MESS ['UPLOAD_ORDERS_OPTIONS'] = 'Manual uploading'; $MESS ['UPLOAD_ORDERS_OPTIONS'] = 'Manual uploading';
$MESS ['OTHER_OPTIONS'] = 'Other settings'; $MESS ['OTHER_OPTIONS'] = 'Other settings';
$MESS ['ORDERS_OPTIONS'] = 'Order settings'; $MESS ['ORDERS_OPTIONS'] = 'Order settings';
$MESS ['ORDER_NUMBERS'] = 'Send order numbers to the store for orders created in CRM'; $MESS ['ORDER_NUMBERS'] = 'Transferring order numbers to the store for orders created in CRM';
$MESS ['ORDER_VAT'] = 'Transfer VAT of goods';
$MESS ['CRM_API_VERSION'] = 'API version'; $MESS ['CRM_API_VERSION'] = 'API version';
$MESS ['CURRENCY'] = 'Currency set in the order when uploading from CRM'; $MESS ['CURRENCY'] = 'Currency set in the order when uploading from CRM';
$MESS ['ORDER_DIMENSIONS'] = 'Send dimensions and weight of the products in the order'; $MESS ['ORDER_DIMENSIONS'] = 'Send dimensions and weight of the products in the order';

View File

@ -76,7 +76,8 @@ $MESS ['LOYALTY_PROGRAM_TITLE'] = 'Программа лояльности';
$MESS ['LOYALTY_PROGRAM_TOGGLE_MSG'] = 'Включить программу лояльности'; $MESS ['LOYALTY_PROGRAM_TOGGLE_MSG'] = 'Включить программу лояльности';
$MESS ['OTHER_OPTIONS'] = 'Прочие настройки'; $MESS ['OTHER_OPTIONS'] = 'Прочие настройки';
$MESS ['ORDERS_OPTIONS'] = 'Настройки заказов'; $MESS ['ORDERS_OPTIONS'] = 'Настройки заказов';
$MESS ['ORDER_NUMBERS'] = 'Транслировать номера заказов созданных в црм в магазин'; $MESS ['ORDER_NUMBERS'] = 'Транслировать номера заказов созданных в CRM в магазин';
$MESS ['ORDER_VAT'] = 'Передавать НДС товаров';
$MESS ['CRM_API_VERSION'] = 'Версия API клиента'; $MESS ['CRM_API_VERSION'] = 'Версия API клиента';
$MESS ['CURRENCY'] = 'Валюта, устанавливаемая в заказе при выгрузке из CRM'; $MESS ['CURRENCY'] = 'Валюта, устанавливаемая в заказе при выгрузке из CRM';

View File

@ -66,6 +66,9 @@ class ConfigProvider
/** @var bool|null|string $orderNumbers */ /** @var bool|null|string $orderNumbers */
protected static $orderNumbers; protected static $orderNumbers;
/** @var bool|null|string $orderVat */
protected static $orderVat;
/** @var array $orderTypes */ /** @var array $orderTypes */
protected static $orderTypes; protected static $orderTypes;
@ -614,6 +617,20 @@ class ConfigProvider
return self::$orderNumbers; return self::$orderNumbers;
} }
/**
* getOrderVat
*
* @return bool|string|null
*/
public static function getOrderVat()
{
if (self::isEmptyNotZero(self::$orderVat)) {
self::$orderVat = static::getOption(Constants::CRM_ORDER_VAT);
}
return self::$orderVat;
}
/** /**
* getOrderHistoryDate * getOrderHistoryDate
* *

View File

@ -43,6 +43,7 @@ class Constants
public const CRM_CONTRAGENT_TYPE = 'contragent_type'; public const CRM_CONTRAGENT_TYPE = 'contragent_type';
public const CRM_SITES_LIST_CORPORATE = 'shops-corporate'; public const CRM_SITES_LIST_CORPORATE = 'shops-corporate';
public const CRM_ORDER_NUMBERS = 'order_numbers'; public const CRM_ORDER_NUMBERS = 'order_numbers';
public const CRM_ORDER_VAT = 'order_vat';
public const CRM_CANCEL_ORDER = 'cansel_order'; public const CRM_CANCEL_ORDER = 'cansel_order';
public const CRM_INVENTORIES_UPLOAD = 'inventories_upload'; public const CRM_INVENTORIES_UPLOAD = 'inventories_upload';
public const CRM_STORES = 'stores'; public const CRM_STORES = 'stores';

View File

@ -38,6 +38,7 @@ $CRM_CUSTOM_FIELDS = 'custom_fields';
$CRM_CONTRAGENT_TYPE = 'contragent_type'; $CRM_CONTRAGENT_TYPE = 'contragent_type';
$CRM_SITES_LIST = 'sites_list'; $CRM_SITES_LIST = 'sites_list';
$CRM_ORDER_NUMBERS = 'order_numbers'; $CRM_ORDER_NUMBERS = 'order_numbers';
$CRM_ORDER_VAT = 'order_vat';
$CRM_CANSEL_ORDER = 'cansel_order'; $CRM_CANSEL_ORDER = 'cansel_order';
$CRM_INVENTORIES_UPLOAD = 'inventories_upload'; $CRM_INVENTORIES_UPLOAD = 'inventories_upload';
$CRM_STORES = 'stores'; $CRM_STORES = 'stores';
@ -400,9 +401,10 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
} }
//order numbers //order numbers
$orderNumbers = htmlspecialchars(trim($_POST['order-numbers'])) ? htmlspecialchars(trim($_POST['order-numbers'])) : 'N'; $orderVat = htmlspecialchars(trim($_POST['order-vat'])) ?: 'N';
$orderDimensions = htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) ? htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) : 'N'; $orderNumbers = htmlspecialchars(trim($_POST['order-numbers'])) ?: 'N';
$sendPaymentAmount = htmlspecialchars(trim($_POST[RetailcrmConstants::SEND_PAYMENT_AMOUNT])) ? htmlspecialchars(trim($_POST[RetailcrmConstants::SEND_PAYMENT_AMOUNT])) : 'N'; $orderDimensions = htmlspecialchars(trim($_POST[$CRM_DIMENSIONS])) ?: 'N';
$sendPaymentAmount = htmlspecialchars(trim($_POST[RetailcrmConstants::SEND_PAYMENT_AMOUNT])) ?: 'N';
//stores //stores
$bitrixStoresArr = []; $bitrixStoresArr = [];
@ -805,6 +807,11 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$CRM_ORDER_NUMBERS, $CRM_ORDER_NUMBERS,
$orderNumbers $orderNumbers
); );
COption::SetOptionString(
$mid,
$CRM_ORDER_VAT,
$orderVat
);
COption::SetOptionString( COption::SetOptionString(
$mid, $mid,
$CRM_CANSEL_ORDER, $CRM_CANSEL_ORDER,
@ -1007,6 +1014,7 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
$optionsLegalDetails = unserialize(COption::GetOptionString($mid, $CRM_LEGAL_DETAILS, 0)); $optionsLegalDetails = unserialize(COption::GetOptionString($mid, $CRM_LEGAL_DETAILS, 0));
$optionsCustomFields = unserialize(COption::GetOptionString($mid, $CRM_CUSTOM_FIELDS, 0)); $optionsCustomFields = unserialize(COption::GetOptionString($mid, $CRM_CUSTOM_FIELDS, 0));
$optionsOrderNumbers = COption::GetOptionString($mid, $CRM_ORDER_NUMBERS, 0); $optionsOrderNumbers = COption::GetOptionString($mid, $CRM_ORDER_NUMBERS, 0);
$optionsOrderVat= COption::GetOptionString($mid, $CRM_ORDER_VAT, 0);
$canselOrderArr = unserialize(COption::GetOptionString($mid, $CRM_CANSEL_ORDER, 0)); $canselOrderArr = unserialize(COption::GetOptionString($mid, $CRM_CANSEL_ORDER, 0));
$optionInventotiesUpload = COption::GetOptionString($mid, $CRM_INVENTORIES_UPLOAD, 0); $optionInventotiesUpload = COption::GetOptionString($mid, $CRM_INVENTORIES_UPLOAD, 0);
@ -2138,9 +2146,18 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
<tr> <tr>
<td colspan="2" class="option-head option-other-top option-other-bottom"> <td colspan="2" class="option-head option-other-top option-other-bottom">
<b> <b>
<label><input class="addr" type="checkbox" name="order-numbers" value="Y" <?php if ($optionsOrderNumbers === 'Y') { <label><input class="addr" type="checkbox" name="order-vat" value="Y" <?php if ($optionsOrderVat === 'Y') {
echo "checked"; echo "checked";
} ?>> <?php echo GetMessage('ORDER_NUMBERS'); ?></label> } ?>> <?php echo GetMessage('ORDER_VAT'); ?></label>
</b>
</td>
</tr>
<tr>
<td colspan="2" class="option-head option-other-top option-other-bottom">
<b>
<label>
<input class="addr" type="checkbox" name="<?php echo RetailcrmConstants::SEND_PAYMENT_AMOUNT; ?>" value="Y" <?php if(RetailcrmConfigProvider::shouldSendPaymentAmount()) echo "checked"; ?>> <?php echo GetMessage('SEND_PAYMENT_AMOUNT'); ?>
</label>
</b> </b>
</td> </td>
</tr> </tr>
@ -2158,9 +2175,9 @@ if (isset($_POST['Update']) && ($_POST['Update'] === 'Y')) {
<tr> <tr>
<td colspan="2" class="option-head option-other-top option-other-bottom"> <td colspan="2" class="option-head option-other-top option-other-bottom">
<b> <b>
<label> <label><input class="addr" type="checkbox" name="order-numbers" value="Y" <?php if ($optionsOrderNumbers === 'Y') {
<input class="addr" type="checkbox" name="<?php echo RetailcrmConstants::SEND_PAYMENT_AMOUNT; ?>" value="Y" <?php if(RetailcrmConfigProvider::shouldSendPaymentAmount()) echo "checked"; ?>> <?php echo GetMessage('SEND_PAYMENT_AMOUNT'); ?> echo "checked";
</label> } ?>> <?php echo GetMessage('ORDER_NUMBERS'); ?></label>
</b> </b>
</td> </td>
</tr> </tr>