Details
-
Story
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
None
-
-
ACQ Sprint 91, ACQ Sprint 92
-
3
-
Thunderjet
Description
Overview
When an invoice is approved, we need to check that there's enough money in each of the funds. This happens before we move money from encumbered to awaiting payment.
Approach
Upon approving an invoice:
- Generate the voucher, voucherLines, and persist
- For each fund distribution roll up the amounts on a per-fund basis
- Make a call to finance for each fund by the combined amount calculated above to make sure it's below the remaining amount we can expend for that budget
- Create an invoice-transaction-summary w/ expected number of pending payments and payments/credits
- For each fund distribution w/ an encumbrance, make a call to POST /finance/pending-payment to move money from encumbered to awaiting payment, and possibly release remaining encumbered money.
- Update the invoice status
bold items are in scope of this story
NOTE: While we're rolling up numbers on a per-external-account basis for the first step, we might be able to easily obtain and save the per-fund numbers for the 2nd/3rd steps along the way.
For (3), this is actually determined by several different criteria. See the wiki for details including a flowchart. There are a couple things that might allow you to bypass the following calculation (inactive budget, restrictExpenditures=false, etc.), but generally speaking this will come down to applying the following formula for each budget and comparing with the amounts from (2):
[remaining amount we can expend] = (allocated * allowableExpenditure) - (allocated - (unavailable + available)) - (awaitingPayment + expended)
Acceptance Criteria
- The checks described above are made against finance upon invoice approval
- Unit tests are updated
- API tests are updated
TestRail: Results
Attachments
Issue Links
- has to be done before
-
MODINVOICE-123 Update Voucher and voucherLInes when exchange rate is edited
-
- Closed
-
-
UINV-83 Prevent paying with Funds that have insufficient amounts to cover distribution
-
- Closed
-
-
UINV-144 Update error message for invoice can not be approved or paid
-
- Blocked
-
- is duplicated by
-
MODINVOICE-141 Validate budgets have sufficient money when creating pending payments
-
- Closed
-
- relates to
-
MODINVOICE-188 Adjustments fund distributions should counted during calculation of budget available amount for invoice approval
-
- Closed
-
-
MODINVOICE-192 Cannot approve invoice when ledger's fiscalYearOne not equal to current
-
- Closed
-
-
UXPROD-2428 Check FUND before invoice can be Approved and Fix adjustments
-
- Closed
-
-
MODINVOICE-113 Call awaiting-payment API upon invoice approval
-
- Closed
-