9Localization\Loc::loadMessages(__FILE__);
41 $dateTime = $data[
'date_create'];
43 $phone = \NormalizePhone($data[
'client_phone']);
44 if (is_string($phone))
46 if ($phone[0] ===
'7')
54 $client = $data[
'client_email'];
64 'timestamp' => $dateTime->format(
'd.m.Y H:i:s'),
65 'external_id' => static::buildUuid(static::UUID_TYPE_CHECK, $data[
'unique_id']),
67 'zn' => (string)$this->
getField(
'NUMBER_KKM'),
69 'emailOrPhone' => $client,
73 'total' => (float)$data[
'total_sum']
76 foreach ($data[
'payments'] as $payment)
78 $result[
'payments'][] = [
80 'sum' => (float)$payment[
'sum']
84 foreach ($data[
'items'] as $item)
104 'type' =>
'position',
105 'name' => $item[
'name'],
106 'price' => (float)$item[
'price'],
107 'quantity' => $item[
'quantity'],
108 'amount' => (
float)$item[
'sum'],
109 'paymentMethod' => $checkTypeMap[$checkData[
'type']],
110 'paymentObject' => $paymentObjectMap[$item[
'payment_object']],
112 'type' => $this->
mapVatValue($checkData[
'type'], $vat)
116 if (isset($item[
'supplier_info']))
118 $position[
'supplierInfo'] = [
119 'phones' => $item[
'supplier_info'][
'phones'],
120 'name' => $item[
'supplier_info'][
'name'],
121 'vatin' => $item[
'supplier_info'][
'inn']
125 if (isset($item[
'nomenclature_code']))
127 $position[
'nomenclatureCode'] = base64_encode($item[
'nomenclature_code']);
141 self::CODE_VAT_10 => [
149 self::CODE_VAT_20 => [
159 return $map[$vat][$checkType] ?? $vat;
197 return Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_TITLE');
233 $settings = parent::getSettings($modelId);
235 $kkmList = static::getSupportedKkmModels();
236 if (isset($kkmList[$modelId]))
239 'LABEL' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SETTINGS_SNO'),
244 'LABEL' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SETTINGS_SNO_LABEL'),
247 'osn' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SNO_OSN'),
248 'usnIncome' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SNO_UI'),
249 'usnIncomeOutcome' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SNO_UIO'),
250 'envd' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SNO_ENVD'),
251 'esn' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SNO_ESN'),
252 'patent' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SNO_PATENT')
259 $settings[
'CLIENT'] = [
260 'LABEL' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SETTINGS_CLIENT'),
265 'LABEL' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SETTINGS_CLIENT_INFO'),
267 'EMAIL' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SETTINGS_CLIENT_EMAIL'),
268 'PHONE' => Localization\Loc::getMessage(
'SALE_CASHBOX_BITRIX_V2_SETTINGS_CLIENT_PHONE'),
283 return $request->get(
'SETTINGS');
330 $result = parent::getCashboxList($data);
332 foreach ($result as $zn => $cashbox)
334 if (!isset($cashbox[
'ID']))
341 if ($current[
'HANDLER'] !==
'\\'.static::class)
343 $cashbox[
'HANDLER'] =
'\\'.static::class;
344 $cashbox[
'SETTINGS'] = static::convertSettings($cashbox[
'KKM_ID'], $cashbox[
'SETTINGS']);
346 $result[$zn] = $cashbox;
366 $currentModel = static::getSupportedKkmModels()[$kkmId];
368 foreach ($settings as $key => $setting)
370 if ($key ===
'PAYMENT_TYPE')
372 $result[$key] = $currentModel[
'SETTINGS'][
'PAYMENT_TYPE'];
374 elseif ($key ===
'VAT')
376 $result[$key][
'NOT_VAT']= $currentModel[
'SETTINGS'][
'VAT'][
'NOT_VAT'];
378 if (Main\Loader::includeModule(
'catalog'))
380 $dbRes = Catalog\VatTable::getList(array(
'filter' => array(
'ACTIVE' =>
'Y')));
381 $vatList = $dbRes->fetchAll();
384 foreach ($vatList as $vat)
386 if (isset($currentModel[
'SETTINGS'][
'VAT'][(
int)$vat[
'RATE']]))
388 $result[$key][(int)$vat[
'ID']] = $currentModel[
'SETTINGS'][
'VAT'][(
int)$vat[
'RATE']];
392 $result[$key][(int)$vat[
'ID']] = $currentModel[
'SETTINGS'][
'VAT'][
'NOT_VAT'];
400 $result[$key] = $setting;
const CALCULATED_SIGN_INCOME
const PAYMENT_TYPE_ADVANCE
const PAYMENT_TYPE_CREDIT
const PAYMENT_TYPE_CASHLESS
static extractSettingsFromRequest(Main\HttpRequest $request)
mapVatValue($checkType, $vat)
static getSettings($modelId=0)
static getCashboxList(array $data)
static getSupportedKkmModels()
buildPosition(array $checkData, array $item)
static convertSettings($kkmId, array $settings)
buildCheckQuery(Check $check)
getValueFromSettings($name, $code)
const PAYMENT_OBJECT_EXCISE
const PAYMENT_OBJECT_LOTTERY
const PAYMENT_OBJECT_COMPOSITE
const PAYMENT_OBJECT_LOTTERY_PRIZE
const PAYMENT_OBJECT_COMMODITY_MARKING_EXCISE
const PAYMENT_OBJECT_NON_OPERATING_GAIN
const PAYMENT_OBJECT_COMMODITY_MARKING_NO_MARKING_EXCISE
const PAYMENT_OBJECT_RESORT_FEE
const PAYMENT_OBJECT_PROPERTY_RIGHT
const PAYMENT_OBJECT_GAMBLING_PRIZE
const PAYMENT_OBJECT_COMMODITY_MARKING
const PAYMENT_OBJECT_COMMODITY
const PAYMENT_OBJECT_AGENT_COMMISSION
const PAYMENT_OBJECT_ANOTHER
const PAYMENT_OBJECT_SERVICE
const PAYMENT_OBJECT_INTELLECTUAL_ACTIVITY
const PAYMENT_OBJECT_PAYMENT
const PAYMENT_OBJECT_GAMBLING_BET
const PAYMENT_OBJECT_COMMODITY_MARKING_NO_MARKING
const PAYMENT_OBJECT_SALES_TAX
static getCashboxFromCache($cashboxId)