Preview Ledger Fiscal Year Rollover
Author | Andrei Makaranka |
---|---|
JIRA task | |
Business Requirements | |
Architects Review | Raman Auramau DONE |
PO review | Dennis Bridges DONE |
Revision History
Version | Date | Owner | Description | Reason |
---|---|---|---|---|
v1.0 | 06.14.2022 | Andrei Makaranka | Initial version | |
v2.0 | 06.22.2022 | Schema changed and WBS added | ||
v2.1 | 06.30.2022 | Status for preview added | ||
v3.0 | 07.07.2022 | Andrei Makaranka | Redesign and rollover logs functionality added | Requirements changed |
v4.0 | 08.03.2022 | Andrei Makaranka | Rename "action" field tp "rolloverType" |
Overview
Allow user to generate a rollover report that will tell the user what errors may occur if rolling over with current data.
Preview report should contain : finance rollover errors (budget errors) and clone of new generated budgets.
Constraints
- The current approach can cover rollover for the only one ledger though in real life there can be several ledgers - but this needs to be considered
Assumptions, dependencies
- Ledger Fiscal Year Rollover already implemented.
- It is likely that we will be creating upwards of 75000 - 100000 encumbrances during this process. (statistics from Library).
- Prepare report with Unpaid invoices is UI responsibility.
Out of Scope
- Prepare report for orders rollover.
- Prepare report for encumbrances rollover.
- Support exchange rate.
Architecturally Significant Requirements
- The preview process should not make changes in real tables, but store the results in a temporary or separate tables.
- Finance rollover preview should be done by the same SQL script as used for Real rollover process.
- Must be compatible with PostgreSQL 10.x
Solution Design
- Current scheme for rollover records - add a column/flag to mark every rollover if it is a real or a preview one - this will also keep the history of completed previews
- mod-finance-storage-master\src\main\resources\templates\db_scripts\budget_encumbrances_rollover.sql - make this script parameterizable; pass a real/preview flag as the input parameter; use different tables depending on the flag value. This will allow not to duplicate the SQL script, but to use the same script for both the real rollover and the preview, and thereby get the correct results for the preview.
- Add another table to store preview data, including Export budget and errors that have occurred; data from this table can then be exported to any convenient format or displayed on the UI
Data Model
Update schema "ledger_fiscal_year_rollover" with new "action" field
Property | Type | Read Only | Default | Required | Notes |
---|---|---|---|---|---|
rolloverType | enum ["Preview", "Commit", "Rollback"] | false | Commit | Y |
|
Create ledger fiscal year rollover Budget schemas
Shema name : ledger_fiscal_year_rollover_budget
Schema should be copy of ramls/acq-models/mod-finance/schemas/budget.json where all amounts are "persistent"(remove readOnly flag from all amounts). Also link on Ledger Rollover ("ledgerRolloverId")
Schema name: ledger_fiscal_year_rollover_budget_collection
Create new DB Table "ledger_fiscal_year_rollover_budget" → schema.json
In the database will be stored records with type of "ledger_fiscal_year_rollover_budget"
Create ledger fiscal year rollover Logs schemas
Schema name : ledger_fiscal_year_rollover_log
Property | Type | Read Only | Default | Required | Notes |
---|---|---|---|---|---|
ledgerRolloverId | UUID | true | NA | Y | |
startDate | date-time | true | NA | Y | This is "creratedDate" from rollover metadata. |
endDate | date-time | true | NA | This is "updatedDate" from rollover metadata. Should be provided only when "status" is "Success" or "Error". | |
rolloverStatus | ramls/acq-models/mod-finance/schemas/rollover_status.json | true | NA | Y | |
errorsLink | String or pattern | true | NA | N | If possible Link should included environment URL : https://okapi-bugfest-lotus.int.aws.folio.org/finance/ledger-rollovers-errors?query=ledgerRolloverId=={id}fff-e-errors |
budgetsLink | String or pattern | true | NA | N | If possible Link should included environment URL : https://okapi-bugfest-lotus.int.aws.folio.org/finance/ledger-rollovers-budgets?query=ledgerRolloverId=={id}fff- |
ledgerRolloverType | enum ["Preview", "Commit", "Rollback"] | true | NA | Y |
Schema name : ledger_fiscal_year_rollover_log_collection
APIs
Ledger Rollover generated Budgets Business API
Method | Path | Request | Response | Description | Interface | Notes |
---|---|---|---|---|---|---|
GET | /finance/ledger-rollovers-budgets/{id} | NA | ledger_fiscal_year_rollover_budget | GET budgets of the ledger fiscal year rollover by id | finance.ledger-rollovers-budgets.item.get | Status : 200 |
GET | /finance/ledger-rollovers-budgets | NA | ledger_fiscal_year_rollover_budget_collection | GET budgets of the ledger fiscal year rollovers | finance.ledger-rollovers-budgets.collection.get | Status : 200 |
Ledger Rollover generated Budgets Storage API
Method | Path | Request | Response | Description | Interface | Notes |
---|---|---|---|---|---|---|
GET | /finance/ledger-rollovers-budgets/{id} | NA | ledger_fiscal_year_rollover_budget | GET budgets of the ledger fiscal year rollover by id | finance.ledger-rollovers-budgets.item.get | Status : 200 |
GET | /finance/ledger-rollovers-budgets | NA | ledger_fiscal_year_rollover_budget_collection | GET budgets of the ledger fiscal year rollovers | finance.ledger-rollovers-budgets.collection.get | Status : 200 |
Ledger Rollover Logs Business API
Method | Path | Request | Response | Description | Interface | Notes |
---|---|---|---|---|---|---|
GET | /finance/ledger-rollovers-logs/{id} | NA | ledger_fiscal_year_rollover_log | GET logs of the ledger fiscal year rollover by id | finance.ledger-rollovers-logs.item.get | Status : 200 |
GET | /finance/ledger-rollovers-logs | NA | ledger_fiscal_year_rollover_log_collection | GET logs of the ledger fiscal year rollovers | finance.ledger-rollovers-logs.collection.get | Status : 200 |
Design
Work Breakdown Structure
Work | Comments | Story | ~ Estimate | |
---|---|---|---|---|
1 |
2.1. Create ledger fiscal year rollover Budget schemas | acq-models, mod-finance-storage, mod-finance | 1 | |
2 |
| mod-finance-storage | 1 | |
3 |
| mod-finance | 1 | |
4 |
| mod-finance-storage All all open technical questions should be resolved | 5 | |
5 |
| mod-finance-storage | ||
6 | Implement Preview rollover flow and update budgets with all calculated amounts
1.1 Rollover script run (field LedgerFiscalYearRollover."action" = "Preview") 2. Update delete rollover logic : org.folio.service.rollover.LedgerRolloverService#deleteRollover. Rollover record deletion should happened together with rollover budgets in scope of one DB transaction | mod-finance-storage | ||
7 | Replace unique index in the table "ledger_fiscal_year_rollover" with uniqueness logic in the code
2.1 If incoming rollover is real with action "Commit", then rollover record should be unique for pair "ledgerId, fromFiscalYearId" (the same as in the index) 2.2 If incoming rollover is real with action "Preview", then rollover record should not be unique for pair "ledgerId, fromFiscalYearId" and it possible to have many previews for one ledger and same fiscal year. | mod-finance-storage | ||
8 |
| mod-finance | ||
9 |
| mod-finance |
Open Items
Question | Answer | Story |
---|