Aging display Invoices with negative amount and Payment Schedules

Description

BUG:
Report Aging doesn't display Invoices with negative amount and records in Payment Schedule.

FIX:
There are three DB functions which calculates Open amounts for Invoices and should be fixed:

1. invoiceopen(p_c_invoice_id numeric, p_c_invoicepayschedule_id numeric)
2. invoiceopentodate(p_c_invoice_id numeric,p_c_invoicepayschedule_id numeric,p_dateacct date)
3. invoiceopentodate(p_c_invoice_id numeric,p_c_invoicepayschedule_id numeric,p_dateacct timestamp with time zone)

In each function is part with:

IF (s.DueAmt - v_Remaining < 0) THEN
v_TotalOpenAmt := 0;

which should be replaced by:

IF (abs(s.DueAmt) - v_Remaining < 0) THEN
v_TotalOpenAmt := 0;

to support also negative invoices.

Environment

None

Attachments

3
  • 21 May 2015, 01:54 PM
  • 21 May 2015, 01:54 PM
  • 21 May 2015, 01:54 PM

Activity

Show:

Carlos Ruiz July 2, 2015 at 1:08 AM

Hi , I think instead of ABS function, it must take into account the variable v_MultiplierCM to make the comparison.

Using ABS can lead to errors as you could be comparing a negative DueAmt with a negative PaidAmt.

Regards,

Carlos Ruiz

Norbert Bede May 23, 2015 at 11:00 PM

confirm, tested, working well.

Tomáš Švikruha May 21, 2015 at 1:55 PM

Attached fixed PostgreSQL functions.

Details

Assignee

Reporter

Labels

Tested By

Norbert Bede

Priority

Created May 21, 2015 at 1:53 PM
Updated March 18, 2022 at 3:49 PM