prorating direct charges can result in fractional-cent fund debits and rounding errors

Bug #2035370 reported by Galen Charlton
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Confirmed
Medium
Unassigned

Bug Description

The method used to prorate direct charges an invoice uses floating point math and can come up with amounts that have fractions of a penny unless the charge happens be evenly divisible among the funds it should be billed against.

This can result in at least two problems:

- The total of the pro-rated direct charges as stored in acq.invoice_item can be off by a penny or two due to rounding errors. Because the amount_paid and cost_billed columns in that table are NUMERIC(8,2), any fractional pennies get rounded during the type conversion.
- The total of the fund debits as stored in acq.fund_debit can also be off, and the individual debits an have sub-penny fractions because the type of that column is a NUMERIC. As a consequence, individual fund debit amounts can have sub-penny amounts (though this is hidden in the user interface by an implicit rounding during display). As another consequence, reports based on direct charges can come of with totals that a different from reports based on the corresponding fund debits.

The proration process should be fixed so that (a) the resulting direct charge amounts and fund debits cannot be anything other than a whole multiple of a penny and (b) there is a guarantee that the total of the direct charges prior to proration is the same after proration.

This can still leave a lot of fund debits with fractional-penny amounts in databases that have been using acq for a while. A possible, though ugly approach to improve this might be update the fund debits to match the invoiced amounts. While this won't fix the rounding issues that result in the direct charge total being off after proration, this approach might at least guarantee that the direct charge and fund debit amounts are consistent.

This is a long-standing issue.

Revision history for this message
Galen Charlton (gmc) wrote :

Noting that for invoices that were created from EDI messages, the original EDI message could potentially be used to identify cases where the direct charge total after proration doesn't match what was sent in the INVOIC message.

Galen Charlton (gmc)
Changed in evergreen:
importance: Undecided → Medium
Changed in evergreen:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.