PurposeCreating an Expenditure Invoice
Request typeAsynchronous
Supported agent version, shv1 — SH4, SH5
v2 — SH5


In SH4, the type of accounting in which a document is created is obtained from the rights of the user through whom authorization occurs — it is specified in the configurator on the Store House tab.Если у пользователя есть права и на учет и спец. учет, то будет выведена ошибка 210.

In SH5:

  • The document code consists of only one part, which is filled in the textcode field.
  • It is not possible to add a note to the invoice being created.
  • If a VAT percentage rate is specified, it should already be entered into Store House as standard.
  • You can specify both the VAT amount and the percentage rate at the same time.
  • The document activity is determined by the attribute activated by the recipient. It is transmitted via the API.

Request format

{
   "taskType":"ShDocDashingReport",
   "params":{
    "async": {
      "objectId": number,
       "timeout": number
    },
    "sync": {
      "objectId": number,
       "timeout": number
    },
      "doc":{
         "items":[
            {
               "rid": number,
               "quantity": number,
               "mu": number,
               "sum": number,
               "vatSum": number,
               "vatrate": number
            }
         ],
         "date":"YYYY-MM-DD",
         "corr": number,
         "store": number,
         "active": number,
         "dueDate": number,
         "note":"string",
         "textCode":"string",
         "numCode":"string"
      }
   }
}

Parameter

Type

Mandatory

Description

taskTypestringyesTask type
async

Asynchronous method call: either synchronous or asynchronous
sync

Synchronous method call: either synchronous or asynchronous
timeoutintnoAgent response time in seconds. Default is 120 seconds
objectIdintyesRestaurant code in the licensing system
doc
yes
datestringyesThe date for which the invoice will be created
corrintyesrid of the correspondent
storeintyesrid of the warehouse/division
activeint
Activate the invoice: 0 — no, 1 — yes
dueDateint
Place the invoice first by date: 0 — no, 1 — yes
notestring

Comment
Not used in SH5

textCodestring

Text part of the document code
In SH5, you need to specify the full document code in the field

numCodestring

Digital part of the document number
In SH5 the field is not used

itemsarray

ridint
item rid
quantitydecimal
Quantity, fractional values ​​supported
muint
unit rid
sumint
Amount without VAT * 100
vatSumint

VAT amount * 100
If the field is not filled in, the amount will be calculated based on the VAT percentage

vatRateint

VAT rate * 100
SH5 should already have this rate set as standard.

Response format

{
   "responseCommon":{
      "taskGuid":"guid",
      "taskType":"ShDocDashingReport",
      "objectId": number
   },
   "error":{
      "wsError":{
         "code":"string",
         "desc":"string"
      }
   }
}

Parameter

Type

Description

taskGuidguidThe unique code of this task is used when receiving the task through the queue
taskTypestring enumTask type
objectIdintRestaurant code in the licensing system
error
Error container

Asynchronous response format

// Successful response
{
   "taskResponse":{
      "doc":{
         "rid": number,
         "textCode": "string",
         "numCode": "string"
      }
   },
   "responseCommon":{
      "taskGuid": "string",
      "taskType": "ShDocDashingReport",
      "objectId": number
   }
}
    
// Answer with error
{
  "responseCommon": {
    "taskGuid": "string",
    "taskType": "ShDocDashingReport",
    "objectId": number
  },
  "error": {
    "wsError": {
      "code": "string",
      "desc": "string"
    },
    "agentError": {
      "code": "string",
      "desc": "string"
    }
  }
}

Parameter

Parameter type

Mandatory

Description

doc
yes
ridint
rid of the created document
textCodestring
Text part of the created document number
In SH5 this field contains the entire document number.
numCodestring
The digital part of the created document number
In SH5 it is not filled
errorstring enum
Error container