Uploaded image for project: 'mod-invoice'
  1. mod-invoice
  2. MODINVOICE-114

Check remaining amount expendable upon invoice approval

    XMLWordPrintable

Details

    • 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:

      1. Generate the voucher, voucherLines, and persist
      2. For each fund distribution roll up the amounts on a per-fund basis
      3. 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
      4. Create an invoice-transaction-summary w/ expected number of pending payments and payments/credits
      5. 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.
      6. 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

            Activity

              People

                Andrei_Makaranka Andrei Makaranka
                cmcnally Craig McNally
                Craig McNally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases