Details
-
Story
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
None
-
None
-
-
ACQ Sprint 65, ACQ Sprint 66
-
5
-
Thunderjet
Description
Overview:
When an invoice transitions to "Approved" status, a voucher and associated voucher lines should be generated.
- Obtain a system generated voucher number via GET /voucher-storage/voucher-number
- Apply fund distributions and calculate totals for each voucher-line.
- There's one voucher line for each externalAccountNumber.
- Multiple funds can have the same externalAccountNumber
- Apply exchange rate calculations for each voucher-line
- Calculate voucher-level totals from all of the voucher-line totals (after exchange rate has been applied to each line)
- For now, ignore invoice adjustments. Adjustments will be covered in a separate story
The JSR 354 JavaMoney API should be used. For now the default currencyExchangeProvider configuration is sufficient. Fine-tuning may take place in later stories.
Example:
Invoice
- currency: EUR
- status: Approved
- total: €40
- invoiceLines:
- InvoiceLine-1
- total: €10
- fundDistributions:
- FD001 - Fund A: 50%
- FD002 - Fund B: 50%
- InvoiceLine-2
- total: €10
- fundDistributions:
- FD003 - Fund B: 50%
- FD004 - Fund C: 50%
- InvoiceLine-3
- total: €20
- fundDistributions:
- FD005 - Fund B: 25%
- FD006 - Fund D: 75%
- InvoiceLine-1
Fund A
- externalAccountNo: 123456
Fund B
- externalAccountNo: 234567
Fund C
- externalAccountNo: 123456
Fund D
- externalAccountNo: 345678
Voucher
- systemCurrency: USD
- invoiceCurrency: EUR
- exchangeRate: 1.10
- voucherAmount: $44.00
- voucherLines:
- VoucherLine-1
- externalAccountNo: 123456
- sourceIds:
- UUID of InvoiceLine-1
- UUID of InvoiceLine-2
- fundDistributions:
- FD001 -> Fund A: €5 (InvoiceLine-1)
- FD004 -> Fund C: €5 (InvoiceLine-2)
- voucherLineAmount: $11.00
- VoucherLine-2
- externalAccountNo: 234567
- sourceIds:
- UUID of InvoiceLine-1
- UUID of InvoiceLine-2
- UUID of InvoiceLine-3
- fundDistributions:
- FD002 -> Fund B: €5 (InvoiceLine-1)
- FD003 -> Fund B: €5 (InvoiceLine-2)
- FD005 -> Fund B: €5 (InvoiceLine-3)
- voucherLineAmount: $16.50
- VoucherLine-3
- externalAccountNo: 345678
- sourceIds:
- UUID of InvoiceLine-3
- fundDistributions:
- FD006 -> Fund D: €15 (InvoiceLine-3)
- voucherLineAmount: $16.50
- VoucherLine-1
I've also attached a text file with more basic examples of an invoice, invoiceLines, funds, voucher, voucherLines in json format: https://issues.folio.org/secure/attachment/18280/voucher_json_example.txt
Acceptance Criteria:
- Vouchers are created as described above upon invoice transition to "Approved"
- Unit tests are updated
- API tests will be handled in a separate story
- JavaMoney is used for calculations and currency exchanges
TestRail: Results
Attachments
Issue Links
- earliest end is start of
-
MODINVOICE-36 Mark voucher as paid on transition to invoice status "Paid"
-
- Closed
-
-
MODINVOICE-46 voucherNumber Generation
-
- Closed
-
- has to be done after
-
MODFISTO-8 Fund Schema Updates
-
- Closed
-
-
MODINVOICE-42 Invoice/Invoice-line schema updates
-
- Closed
-
-
MODINVOICE-49 Voucher/VoucherLine schema updates
-
- Closed
-
- has to be done before
-
MODINVOICE-56 API tests for voucher/voucherLine creation
-
- Closed
-
-
MODINVOICE-74 Transpose invoice acquisitions-units to voucher upon voucher creation
-
- Closed
-
- relates to
-
MODINVOICE-44 Implement GET /exchange-rate/<from>/<to>
-
- Closed
-
-
UIU-1040 Primary Currency Setting
-
- Closed
-
-
UXPROD-703 Ability to "process" invoice
-
- Closed
-