My Products
Help
Jeroen Bijl
CONTRIBUTOR **

Accounts Payable and Receivable at year end

by Jeroen Bijl

Hi,

I am attempting to fetch AR/AP, "Reskontro", for suppliers and customers. I have arrived at a possible solution, but I believe there must be a simpler way, so if someone has done it I would appreciate some feedback/comments.

 

I need to find the remaining balance on all customer/supplier accounts on 31.12.


Current solution:
- Fetch from "v1/supplierDocument"(or customer) *supplier endpoint has no date filtering of sorts, so I fetch all supplier documents. 
- This means paging is a must, and I end up fetching thousands of records. 
- Then I filter them based on a logic with "closedFinancialPeriod" and "financialPeriod"
- Since the response is "date-independent" and not point in time etc, the balance I get returned is wrong for invoices which are paid in intervals/some in 2022 and some in 2023.
Example; an invoice from 04.2022, paid monthly for 12 months, is done in 03.2023. Which means at 31.12 there should be a remainder balance, but the endpoint returns balance as 0 (because it is paid of at the time of the api request). In order to figure out the remaining balance at 31.12 I have to fetch from "v1/supplierPayment".
- This means an api call for each invoice in order to figure out if there was a remaining balance/calculate it.

In conclusion I end up with a lot of api-calls.


Non working attempts/endpoints:
- "customerinvoices?status=Open" (or supplierinvoices)  -> with or without financialPeriod filter. 
The problem is it checks the current status of invoices, not what they were at year end or sepcified financialPeriod. 
The customerInvoices endpoint also only contains invoices, so creditNotes are not returned even though there is a documentType filter. 

Anyone have a good way to fetch this data for a given date/period?

3 REPLIES 3

by Magnus Johnsen

Hi,

You should be able to use the generalLedgerBalance endpoint to get this data, just specify account/ledger:
2023-04-13 10_23_53-Visma.net Integrations Documentation - Brave.png

Jeroen Bijl
CONTRIBUTOR **

Does this fetch "reskontro"? I find no supplier/customer data on the response from that endpoint. Im not looking for just the 1500 account etc, I want to see all unpaid customer/supplier transactions/invoices at 31.12

Jeroen Bijl
CONTRIBUTOR **

by Jeroen Bijl

Not a solution, but further issues.
When an invoice i in a currency other than nok, I get Agio lines to deal with as well.
So in order to calculate the remaining balance I have to foreach the payments -> fetch journalTransactionLines on a batchnumber from the payment, then find the agio line and use it in the calculation.

At this point I'm at (Documents/1000) -> filter to find whatever was open at 31.12 (this case ~100 documents) -> so 100 api calls to get payment data -> worst case I get 10+ payments to find agio lines for, foreach of those payments. So it's more than 1000 api calls to create a simple accounts payable report. This can't be the only way?