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

Activity

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

Attached fixed PostgreSQL functions.

Norbert Bede
May 23, 2015, 11:00 PM

confirm, tested, working well.

Carlos Ruiz
July 2, 2015, 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

Assignee

MarcoL

Reporter

Tomáš Švikruha

Labels

Tested By

Norbert Bede

Priority

Major
Configure