In the standard report Custopmer Balance To Date, there seems to be an issue when an invoice has unappliesd entries related to it as it shows it as closed when in reality it is not as at the date provided in the report. Example below;
Customer ABC123 has a customer ledger entry dated 01/06/2022 with Document Type = Invoice for an amount of $1000.
A payment dated 11/01/2023 has been allocated to this invoice. Users realised that this was a mistake so the payment was allocated from the invoice and reversed.
A new payment dated 19/01/2023 was posted and allocated to the invoice.
When running the Customer Balance To Date report as at 31/12/2022, the invoice is not showing and it is being considered as closed/fully paid off. This is not the case as the payment is dated 2023, so technically, the invoice was closed off in 2023 and still open in 2022.
I checked the code behind the report and from my understanding it checks if there are any unapplied detailed customer ledger entries linked to the Initial Entry (i.e. the invoice) and if it finds such entries, the customer ledger entry is skipped from being printed out. How does this make sense?
Below is reference to the code reviewed;
In my case, the procedure CheckUnappliedEntryExists is returning true but then it is being reversed by the not when the function is called initially and exits.
Could anyone shed some light on the above reported issue, please?
Thanks in advance!