Export Supplier invoices (e-invoice)
Prerequisites
Exporting supplier invoices from Next Project requires that the customer uses the module Next e-Invoice as the initial system for handling supplier invoices.
Process
For general information on how the e-Invoice module works, consult the user documentation (only available in Swedish for now)
Export criteria
A filter should be used in /supplierinvoice/ to determine which supplier invoices to export to the accounting system:
- All supplier invoices will pass two approval steps before it is considered approved. Filter should therefore be used to only fetch invoices with
approval2
= true. - Only export Supplier invoices that have not already been exported. I.e. only look for supplier invoices where
externalno
is not set. - If
disablepayment
is true, the invoice should be exported, but not be included in payment files generated by the accounting system (blocked for payment).
Flow
The flow for supplier invoices is:
- The suppliers of the supplier invoices are exported from Next to the accounting system (created if new, and updated if already existing)
- The projects on the supplier invoice accounting rows need to exist in the accounting system. Create the projects in the accounting system if necessary.
- The supplier invoice and its related accounting rows are exported from Next e-Invoice, using the endpoint and filter in the export criteria above, to the accounting system to update the accounts receivable and the ledger
- To get accounting details for a supplier invoice you can use endpoint /supplierinvoice/{supplierinvoice_id}/accounting/
- Supplier invoice info is updated in Next e-Invoice through PUT /supplierinvoice/{supplierinvoice_id}
externalno
= supplier invoice number in accounting systemintegrationmessage
- for example “Successfully exported” or error messageexporteddate
- date for export
- voucher rows are imported from accounting system to Next to generate costs in projects (see separate scenario for voucher rows)
Enriching voucher rows with E-invoice information
In step 5 above, importing voucher rows from accounting system to Next, it is sometimes desirable to get information from the Next e-invoice module to enrich the voucher row that is being posted.
There are usually three fields that are desired to transfer from the e-invoice accounting row to the corresponding voucher row being posted (they exist in both endpoints):
activitycode
locationcode
invoiceable
This should be done by you as an integrator through the following steps:
1 ) Call the endpoint List Supplierinvoices with a filter on externalno
(by using the invoice number assigned in the accounting system to the voucher row you're posting). If you get a hit you know that the current voucher row being processed has its origin in e-invoice and can proceed with the next steps. Read the field id
in that case to use in the next endpoint.
2 ) Call endpoint Get Invoiceaccounting For Supplierinvoice filling mandatory field supplierinvoice_id
Also set a filter string on the following fields using the corresponding POST voucher row values:
projectno
workorderno
accountno
addition
(indiciates if referenced workorder is additional/variation order)amount
(should match valueinvoiceamount
in voucher row)
If you don't get a unique hit using this filter, you should try again with a tweaked amount
, by setting a range consisiting of the amount rounded up and down to nearest integer. If you still don't get a unique hit you should try by setting a minus sign before the same amount
range. This should give you a unique hit but if you still don't get a unique hit you should throw an error message in the integration so that it can be investigated manually. For example "Could not find corresponding e-invoice accounting row for voucher row with externalno ... projectno ... workorderno ... accountno ... addition ... invoiceamount ..."
3 ) When you have your hit you should transfer the desired fields from the supplier invoice accounting row to the voucher row - usually the three mentioned above.
Updated 23 days ago