POWERED BY RBSOFT

Получение списка чеков из базы данных Сервера ККМ (Версия 3.61.4.0322 и выше)

> Сервер ККМ > СерверККМ V3 > Разработчикам
Дата обновления: 28 мая 2024 г. Дата публикации: 27 мая 2024 г.

Первый этап – получение токена авторизации на Сервере ККМ

Запрос POST http://localhost:4398/PrintService/api/v2/GetToken

В теле запроса необходимо передать логин и пароль, который устанавливается на веб-интерфейсе СККМ.

1

Тело запроса

{

   "login":"Admin",

   "password":"Admin"

}

Тело ответа

{

   "Result": {

       "tokenId": "1523dd5a-7f9a-4a94-835e-70e096b01a9c",

       "expire": "20220322152835"

   },

   "Code": 0,

   "Description": "OK",

   "success": true

}

TokenId необходим для взаимодействия с СККМ API.

Второй этап – поиск смен по диапазону дат

Запрос POST http://localhost:4398/PrintService/api/v2/GetShiftList

Необходимо указать диапазон дат, From – от, To – до. Так же имя устройства, с которого печаталось открытие и закрытие смен.

Тело запроса

{

 "From": "2022-03-21T00:00:00",

 "To": "2022-03-21T23:00:00",

 "Token": "1523dd5a-7f9a-4a94-835e-70e096b01a9c",

 "DeviceName": "shtrih"

}

Тело ответа

{

   "Result": [

       {

           "From": "0001-01-01T00:00:00",

           "To": "2022-03-21T09:42:00",

           "Number": 1,

           "OpenShift": 0,

           "CloseShift": 18

       },

       {

           "From": "0001-01-01T00:00:00",

           "To": "0001-01-01T00:00:00",

           "Number": 2,

           "OpenShift": 0,

           "CloseShift": 0

       },

       {

           "From": "0001-01-01T00:00:00",

           "To": "2022-03-21T13:32:00",

           "Number": 5,

           "OpenShift": 0,

           "CloseShift": 34

       },

       {

           "From": "0001-01-01T00:00:00",

           "To": "2022-03-21T14:53:00",

           "Number": 6,

           "OpenShift": 0,

           "CloseShift": 36

       },

       {

           "From": "0001-01-01T00:00:00",

           "To": "2022-03-21T15:04:54.7670075",

           "Number": 0,

           "OpenShift": 0,

           "CloseShift": 1

       },

       {

           "From": "0001-01-01T00:00:00",

           "To": "2022-03-21T15:35:00",

           "Number": 7,

           "OpenShift": 0,

           "CloseShift": 42

       },

       {

           "From": "0001-01-01T00:00:00",

           "To": "0001-01-01T00:00:00",

           "Number": 8,

           "OpenShift": 0,

           "CloseShift": 0

       }

   ],

   "Code": 0,

   "Description": "OK",

   "success": true

}

В примере ответа указаны номера смен и даты их открытия или закрытия. В данном случае, есть примеры дат, которые начинаются “0001-01-01T”, это говорит о том, что в базе данных существуют чеки с данной сменой, однако документы открытия и закрытия смен печатались ВНЕ Сервера ККМ.

Третий этап – получение списка чеков по указанной смене

Запрос POST http://localhost:4398/PrintService/api/v2/GetChecksFiltered

Указываем имя устройства и номер смены.

Тело запроса

{

   "Token": "1523dd5a-7f9a-4a94-835e-70e096b01a9c",

   "DeviceName": "shtrih",

   "ShiftNumber" : 2

}

Пример тела ответа

{

   "Result": [

       {

           "CheckItems": [

               {

                   "Name": "Пакет",

                   "Quantity": 2.0,

                   "Price": 5.0,

                   "DiscountValue": 0.0,

                   "DiscountInfoValue": 3.0,

                   "Department": 0,

                   "isreturn": false,

                   "Summ": 10.0,

                   "AdditionalAttribute": null,

                   "isFiscal": true,

                   "TaxValue": -1,

                   "PaymentMode": 4,

                   "ItemType": 1,

                   "TaxSum": 0.0,

                   "Barcode": {

                       "BarcodeType": null,

                       "BarcodeText": null

                   },

                   "Picture": null,

                   "AgentDataItem": null,

                   "PurveyorDataItem": null,

                   "SignSubjectCalculationAgent": null,

                   "After": null,

                   "Before": null,

                   "CountryOfOrigin": null,

                   "CustomsDeclaration": null,

                   "ExciseAmount": 0.0,

                   "MeasurementUnit": null,

                   "MarkingCode": null,

                   "MeasureOfQuantity": null,

                   "FractionalQuantityNumerator": null,

                   "FractionalQuantityDenominator": null,

                   "IndustryAttribute": null,

                   "ImcParams": null,

                   "ProductCode": null

               },

               {

                   "Name": "Доставка",

                   "Quantity": 3.0,

                   "Price": 2.0,

                   "DiscountValue": 0.0,

                   "DiscountInfoValue": 2.0,

                   "Department": 1,

                   "isreturn": false,

                   "Summ": 6.0,

                   "AdditionalAttribute": null,

                   "isFiscal": true,

                   "TaxValue": -1,

                   "PaymentMode": 4,

                   "ItemType": 4,

                   "TaxSum": 0.0,

                   "Barcode": {

                       "BarcodeType": null,

                       "BarcodeText": null

                   },

                   "Picture": null,

                   "AgentDataItem": null,

                   "PurveyorDataItem": null,

                   "SignSubjectCalculationAgent": null,

                   "After": null,

                   "Before": null,

                   "CountryOfOrigin": null,

                   "CustomsDeclaration": null,

                   "ExciseAmount": 0.0,

                   "MeasurementUnit": null,

                   "MarkingCode": null,

                   "MeasureOfQuantity": null,

                   "FractionalQuantityNumerator": null,

                   "FractionalQuantityDenominator": null,

                   "IndustryAttribute": null,

                   "ImcParams": null,

                   "ProductCode": null

               }

           ],

           "Paid": 0.0,

           "Department": null,

           "Bonus": 0.0,

           "BonusLeft": 0.0,

           "DiscountValue": 0.0,

           "TypeClose": 0,

           "TrustedInFn": false,

           "CheckNumber": 32,

           "Change": 0.0000,

           "CashPayment": {

               "Summ": 16.0,

               "TypeClose": 0,

               "Discount": 0.0,

               "BeforePrint": null,

               "AfterPrint": null

           },

           "ElectronicPayment": null,

           "CreditPayment": null,

           "AdvancePayment": null,

           "CashProvisionPayment": null,

           "ItemsSumm": 16.0,

           "Summ": 16.0,

           "InjectSumm": 0.0,

           "Password": null,

           "CheckType": 1,

           "CheckMode": 1,

           "ClientContact": "online@mail.ru",

           "IsFiscal": true,

           "TaxType": 0,

           "SenderEmail": null,

           "CustomerDetail": null,

           "CustomerEmail": null,

           "AgentSign": null,

           "AdditionalAttribute": null,

           "UserAttribute": null,

           "OperationalAttribute": null,

           "IndustryAttribute": null,

           "AgentData": null,

           "PurveyorData": null,

           "CustomerInfo": null,

           "CustomerINN": null,

           "DockId": "5177f224-0f0b-4538-a5a6-39f6be7986be",

           "TerminalId": null,

           "DeviceId": "5b4a74ce-3f95-4c2c-b68a-19f8387b07fd",

           "Before": [

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "Чек розничной продажи с отправкой по почте без печати чека на ленте",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               }

           ],

           "After": [

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " ",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " РБ-Софт: Сервер ККМ",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " http://www.rbsoft.ru",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "Время печати:21.03.2022 12:57:44",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " ",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               }

           ],

           "SessionNumber": 5,

           "Date": "2022-03-21T13:01:00",

           "DocNumber": 32,

           "DocNumberInShift": 37,

           "FiscalSign": "973769261",

           "Fn": "9999078902012910",

           "DocType": 0,

           "ResultCode": 0,

           "ResultDescription": "Ошибок нет",

           "Cashier": "Иванов И.И.",

           "CashierVATIN": null,

           "Ver": null,

           "QRData": {

               "Date": "2022-03-21T13:01:00",

               "Amount": 16.0,

               "Fn": "9999078902012910",

               "Fd": 32,

               "Fp": "973769261",

               "N": 1

           },

           "DocumentHeader": {

               "OrganizationInfo": "",

               "ZnKKT": "0636580012202304",

               "INN": "0326031413",

               "Cashier": null,

               "RnKKT": "0000000000000798    ",

               "FN": "9999078902012910",

               "FnsSite": "www.nalog.ru",

               "ShiftNumber": null,

               "CheckNumber": null,

               "ShiftTotal": null,

               "OverallTotals": null

           },

           "OutputParameters": null,

           "PrinterName": null,

           "SaleAddress": null,

           "SaleLocation": null

       },

       {

           "CheckItems": [

               {

                   "Name": "Пакет",

                   "Quantity": 2.0,

                   "Price": 5.0,

                   "DiscountValue": 0.0,

                   "DiscountInfoValue": 3.0,

                   "Department": 0,

                   "isreturn": false,

                   "Summ": 10.0,

                   "AdditionalAttribute": null,

                   "isFiscal": true,

                   "TaxValue": -1,

                   "PaymentMode": 4,

                   "ItemType": 1,

                   "TaxSum": 0.0,

                   "Barcode": {

                       "BarcodeType": null,

                       "BarcodeText": null

                   },

                   "Picture": null,

                   "AgentDataItem": null,

                   "PurveyorDataItem": null,

                   "SignSubjectCalculationAgent": null,

                   "After": null,

                   "Before": null,

                   "CountryOfOrigin": null,

                   "CustomsDeclaration": null,

                   "ExciseAmount": 0.0,

                   "MeasurementUnit": null,

                   "MarkingCode": null,

                   "MeasureOfQuantity": null,

                   "FractionalQuantityNumerator": null,

                   "FractionalQuantityDenominator": null,

                   "IndustryAttribute": null,

                   "ImcParams": null,

                   "ProductCode": null

               },

               {

                   "Name": "Доставка",

                   "Quantity": 3.0,

                   "Price": 2.0,

                   "DiscountValue": 0.0,

                   "DiscountInfoValue": 2.0,

                   "Department": 1,

                   "isreturn": false,

                   "Summ": 6.0,

                   "AdditionalAttribute": null,

                   "isFiscal": true,

                   "TaxValue": -1,

                   "PaymentMode": 4,

                   "ItemType": 4,

                   "TaxSum": 0.0,

                   "Barcode": {

                       "BarcodeType": null,

                       "BarcodeText": null

                   },

                   "Picture": null,

                   "AgentDataItem": null,

                   "PurveyorDataItem": null,

                   "SignSubjectCalculationAgent": null,

                   "After": null,

                   "Before": null,

                   "CountryOfOrigin": null,

                   "CustomsDeclaration": null,

                   "ExciseAmount": 0.0,

                   "MeasurementUnit": null,

                   "MarkingCode": null,

                   "MeasureOfQuantity": null,

                   "FractionalQuantityNumerator": null,

                   "FractionalQuantityDenominator": null,

                   "IndustryAttribute": null,

                   "ImcParams": null,

                   "ProductCode": null

               }

           ],

           "Paid": 0.0,

           "Department": null,

           "Bonus": 0.0,

           "BonusLeft": 0.0,

           "DiscountValue": 0.0,

           "TypeClose": 0,

           "TrustedInFn": false,

           "CheckNumber": 33,

           "Change": 0.0000,

           "CashPayment": {

               "Summ": 16.0,

               "TypeClose": 0,

               "Discount": 0.0,

               "BeforePrint": null,

               "AfterPrint": null

           },

           "ElectronicPayment": null,

           "CreditPayment": null,

           "AdvancePayment": null,

           "CashProvisionPayment": null,

           "ItemsSumm": 16.0,

           "Summ": 16.0,

           "InjectSumm": 0.0,

           "Password": null,

           "CheckType": 1,

           "CheckMode": 1,

           "ClientContact": "online@mail.ru",

           "IsFiscal": true,

           "TaxType": 0,

           "SenderEmail": null,

           "CustomerDetail": null,

           "CustomerEmail": null,

           "AgentSign": null,

           "AdditionalAttribute": null,

           "UserAttribute": null,

           "OperationalAttribute": null,

           "IndustryAttribute": null,

           "AgentData": null,

           "PurveyorData": null,

           "CustomerInfo": null,

           "CustomerINN": null,

           "DockId": "97221267-bac4-4767-a795-91540266b224",

           "TerminalId": null,

           "DeviceId": "5b4a74ce-3f95-4c2c-b68a-19f8387b07fd",

           "Before": [

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "Чек розничной продажи с отправкой по почте без печати чека на ленте",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               }

           ],

           "After": [

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " ",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " РБ-Софт: Сервер ККМ",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " http://www.rbsoft.ru",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "_________________________",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": "Время печати:21.03.2022 12:57:44",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               },

               {

                   "Line": " ",

                   "Alignment": 0,

                   "Font": 0,

                   "Wrap": true

               }

           ],

           "SessionNumber": 5,

           "Date": "2022-03-21T13:11:00",

           "DocNumber": 33,

           "DocNumberInShift": 38,

           "FiscalSign": "833715422",

           "Fn": "9999078902012910",

           "DocType": 0,

           "ResultCode": 0,

           "ResultDescription": "Ошибок нет",

           "Cashier": "Иванов И.И.",

           "CashierVATIN": null,

           "Ver": null,

           "QRData": {

               "Date": "2022-03-21T13:11:00",

               "Amount": 16.0,

               "Fn": "9999078902012910",

               "Fd": 33,

               "Fp": "833715422",

               "N": 1

           },

           "DocumentHeader": {

               "OrganizationInfo": "",

               "ZnKKT": "0636580012202304",

               "INN": "0326031413",

               "Cashier": null,

               "RnKKT": "0000000000000798    ",

               "FN": "9999078902012910",

               "FnsSite": "www.nalog.ru",

               "ShiftNumber": null,

               "CheckNumber": null,

               "ShiftTotal": null,

               "OverallTotals": null

           },

           "OutputParameters": null,

           "PrinterName": null,

           "SaleAddress": null,

           "SaleLocation": null

       }

   ],

   "Code": 0,

   "Description": "OK",

   "success": true

}