SBX - Search With Button

SBX - Forum Post Title

Should Cash flow forecast be including Invoiced sales orders or not?

Microsoft Dynamics AX Forum

Mette Nielsen asked a question on 12 Jul 2018 9:51 AM

Question Status

Suggested Answer

Hi,

I'm struggling to get the Cash flow forecast to run within any decent time. I'm running it in batch, and it takes a very long time (>1 day) and ends up locking the LedgerCov table.

I've been looking in the code to see what the job does (LedgerCovTotal), and I have also seen that most of my time is spent updating sales orders.

The documentation here: https://docs.microsoft.com/en-us/dynamics365/unified-operations/financials/cash-bank-management/cash-flow-forecasting

says that "Sales orders that aren't yet invoiced, and that result in physical or financial sales." are considered. 

However, SalesTableType.updateLedgerCov() calls SalesTableType.mustCovBePlanned() to see if a given sales order should be processed. And mustCovBePlanned() returns true for all sales orders which have SalesStatus = Invoiced (I'm on Ax2009).

To me that looks like all historical sales orders, which are invoiced, are being processed every time the cash flow forecast is run (for Total). Since the processing of a sales order includes calculating totals and all types of amounts on the order, I'm beginnign to see where my time is getting lost. 

So returning to the statement in the documentation that sales orders which aren't invoiced are considered, I'm confused as to if those invoice sales orders are supposed to be processed or not? I realize the documentation link is for D365, so is it a possibility that this has changed since Ax2009?

Reply

Hi,

Does the cash flow calculation finish if you run it in a different demo/test system?

If it is also slow there can you extract the cash flow relevant data with the help of the AX cubes?

They make use of aggregated data and things should be much faster using them.

Best regards,

Ludwig

Reply
Mette Nielsen responded on 13 Jul 2018 3:45 AM

Q: Does the cash flow calculation finish if you run it in a different demo/test system?

A: I'm running in a sandbox which is equivalent to our live system. I have two companies with a lot less transactions than the main company; Here I can execute in about 1 and 14 hours respectively. I have added some timing to the logs which shows me that 85-90% of the time is spent on updates to SalesTable and PurchTable (the updateLedgerCov() calls).

Q: If it is also slow there can you extract the cash flow relevant data with the help of the AX cubes?

A: Haven't looked at cubes. I'm interested right now in getting the cash flow forecast job to run.

The problem seems to be that because Sales and Purchase orders with status Invoiced are always included, then over time, as the order count increases, the cash flow forecast job will take increasingly long time. This takes me back to the original question: The documentation link I posted states that orders not invoiced are included, while the code includes invoiced orders?

Reply
Suggested Answer

Hello Mette,

The cash flow forecast should include invoiced but unpaid and not invoiced transactions because you need to know how much money you either have to pay for purchases or how much money you will receive for sales.

Do you always make a total calculation or only one for the new items?

The new option should run much faster.

Best regards,

Ludwig

Reply
Suggested Answer

Hello Mette,

The cash flow forecast should include invoiced but unpaid and not invoiced transactions because you need to know how much money you either have to pay for purchases or how much money you will receive for sales.

Do you always make a total calculation or only one for the new items?

The new option should run much faster.

Best regards,

Ludwig

Reply

SBX - Two Col Forum

SBX - Migrated JS