Comment 1 for bug 1860015

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

For reference, here's the comment describing acq.attribute_debits() calculation:

"Function to attribute expenditures and encumbrances to funding source credits,
and thereby to funding sources.

Read the debits in chonological order, attributing each one to one or
more funding source credits. Constraints:

1. Don't attribute more to a credit than the amount of the credit.

2. For a given fund, don't attribute more to a funding source than the
source has allocated to that fund.

3. Attribute debits to credits with deadlines before attributing them to
credits without deadlines. Otherwise attribute to the earliest credits
first, based on the deadline date when present, or on the effective date
when there is no deadline. Use funding_source_credit.id as a tie-breaker.
This ordering is defined by an ORDER BY clause on the view
acq.ordered_funding_source_credit.

Start by truncating the table acq.debit_attribution. Then insert a row
into that table for each attribution. If a debit cannot be fully
attributed, insert a row for the unattributable balance, with the
funding_source_credit and credit_amount columns NULL."