diff --git a/ramls/acq-models b/ramls/acq-models index c06778a4..d6dac0a6 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit c06778a484802db30023f1e5388a6d2972606ae1 +Subproject commit d6dac0a62d1dc2c95a74c6463976147965b1e9d2 diff --git a/src/main/resources/templates/db_scripts/all_finance_data_view.sql b/src/main/resources/templates/db_scripts/all_finance_data_view.sql index 79454f98..8fabd814 100644 --- a/src/main/resources/templates/db_scripts/all_finance_data_view.sql +++ b/src/main/resources/templates/db_scripts/all_finance_data_view.sql @@ -11,6 +11,8 @@ SELECT 'fundStatus', fund.jsonb ->>'fundStatus', 'fundTags', jsonb_build_object('tagList', fund.jsonb -> 'tags' -> 'tagList'), 'fundAcqUnitIds', fund.jsonb ->'acqUnitIds', + 'ledgerId', ledger.id, + 'ledgerCode', ledger.jsonb ->> 'code', 'budgetId', budget.id, 'budgetName', budget.jsonb ->>'name', 'budgetStatus', budget.jsonb ->>'budgetStatus', @@ -18,12 +20,18 @@ SELECT 'budgetCurrentAllocation', budget.jsonb ->>'allocated', 'budgetAllowableExpenditure', budget.jsonb ->>'allowableExpenditure', 'budgetAllowableEncumbrance', budget.jsonb ->>'allowableEncumbrance', - 'budgetAcqUnitIds', budget.jsonb ->'acqUnitIds' + 'budgetAcqUnitIds', budget.jsonb ->'acqUnitIds', + 'groupId', groups.id, + 'groupCode', groups.jsonb ->> 'code' ) as jsonb FROM ${myuniversity}_${mymodule}.fiscal_year LEFT OUTER JOIN ${myuniversity}_${mymodule}.ledger - ON ledger.fiscalyearoneid = fiscal_year.id + ON ledger.fiscalyearoneid = fiscal_year.id LEFT OUTER JOIN ${myuniversity}_${mymodule}.fund - ON fund.ledgerid = ledger.id + ON fund.ledgerid = ledger.id LEFT OUTER JOIN ${myuniversity}_${mymodule}.budget - ON fund.id = budget.fundid; + ON fund.id = budget.fundid +LEFT OUTER JOIN ${myuniversity}_${mymodule}.group_fund_fiscal_year + ON fund.id = (group_fund_fiscal_year.jsonb ->> 'fundId')::uuid +LEFT OUTER JOIN ${myuniversity}_${mymodule}.groups + ON (group_fund_fiscal_year.jsonb ->> 'groupId')::uuid = groups.id;