Use case
As an integrator, I want to import sales invoices into Procountor. I also want to set dimensions for the sales. Dimension can be for example ‘Cost center’.
Note: In Procountor software, the dimensions are related to the accounting page of the invoice. The invoice itself does not have dimensions, so you are not able to import dimensions by using invoice related endpoints. A successfully saved invoice always includes also the accounting page (ledgerReceipt in API). The accounting page has all accounting related data, so dimensions should be set/updated to the accounting page of the invoice (ledgerReceipt in API). Please follow the instructions below to set dimensions to the accounting page of the imported invoice.
Used endpoints
GET /dimensions endpoint retrieves all dimensions and dimension items saved in Procountor. Dimension items should be targeted to the dimensions of source system first.
POST /invoices endpoint creates a new invoice. Status of new invoice is always “UNFINISHED”. The successfully saved invoice returns invoice data including also ledgerReceiptId of the invoice. The ledgerReceiptId is needed for updating or adding dimensions and/or accounts to the accounting page of the invoice. POST invoice request should include the extraInfo > accountingByRow > true.
GET /ledgerreceipts{id} endpoint retrieves the accounting page of the saved invoice.
PUT /ledgerreceipts{id} endpoint updates the accounting page of the saved invoice. When putting dimensions for the accounting page of the saved invoice, copy first the content of GET request and add wanted dimensions for the transactions rows, which types are ‘ENTRY’. Dimensions and dimension items are set by using their ids in the section transactions > dimensionItemValues.
Sample: Dimensions set for transaction row
{
"transactionId": 99660228,
"transactionType": "ENTRY",
"account": "3000",
"accountingValue": -755,
"vatPercent": 24,
"description": "Project work",
"dimensionItemValues": [
{
"dimensionId": 85919,
"itemId": 136341,
"value": -755
},
{
"dimensionId": 85920,
"itemId": 136524,
"value": -755
},
{
"dimensionId": 85924,
"itemId": 140056,
"value": -755
}
]
},
Targeting transaction rows to invoice rows may be challenging as Procountor software does not specify the linking between invoice rows and transaction rows. We can recommend the following workaround solution to facilitate the recognition of transaction rows:
Source system could add its own identification to the beginning of invoice row or invoice comment row when posting an invoice. By using this own identification, which will be copied to the description of the transaction row, the source system can identify rows.
Sample: the sample of invoice row with own identification at the beginning of invoice row (field “product”)
"invoiceRows": [
{
"product": "1 Project work",
"quantity": 1,
"unit": "PIECE",
"unitPrice": 755,
"discountPercent": 0,
"vatPercent": 24
},
Sample: sample of transactions row with own identification at the beginning of transaction row (field “description”). Content of the description field is copied from invoice rows automatically by the system.
"transactions": [
{
"transactionId": 99660228,
"transactionType": "ENTRY",
"account": "3000",
"accountingValue": -755,
"vatPercent": 24,
"description": "1 Project work",
"dimensionItemValues": [
{
"dimensionId": 85919,
"itemId": 136341,
"value": -755
},
{
"dimensionId": 85920,
"itemId": 136524,
"value": -755
},
{
"dimensionId": 85924,
"itemId": 140056,
"value": -755
}
]
},
An alternative way to set wanted dimensions to the transactions rows of the accounting page is to re-write all ‘ENTRY’ typed transaction rows.
The ids of saved invoice and its ledger receipt are useful to be stored. By using the ids, you can search, update or invalidate objects later via API if needed. Updating or invalidating might be forbidden because of status of the object.
Other information
Chart of accounts is available via Procountor API
- GET /coa
Used VAT status codes are available via Procountor API
- GET /vats/default