File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,4 +23,12 @@ databaseChangeLog:
2323 runOnChange : true
2424 changes :
2525 - sqlFile :
26- path : src/views/fy_revenue_summary_v.sql
26+ path : src/views/fy_revenue_summary_v.sql
27+
28+ - changeSet :
29+ id : fy-disbursement-summary-view
30+ author : Jeff Schwartz
31+ runOnChange : true
32+ changes :
33+ - sqlFile :
34+ path : src/views/fy_disbursement_summary_v.sql
Original file line number Diff line number Diff line change 1+ CREATE OR REPLACE VIEW fy_disbursement_summary_v AS
2+ SELECT SUM (disbursement) disbursement,
3+ ' current' fy
4+ FROM disbursement d,
5+ period pe
6+ WHERE pe .period_id = d .period_id
7+ AND pe .period = ' Monthly'
8+ AND pe .fiscal_year = (
9+ SELECT max (fiscal_year)
10+ FROM period pe2
11+ WHERE exists (
12+ SELECT 1
13+ FROM revenue
14+ WHERE period_id = pe2 .period_id
15+ )
16+ )
17+ GROUP BY fy
18+ UNION
19+ SELECT SUM (disbursement) disbursement,
20+ ' previous' fy
21+ FROM disbursement d,
22+ period pe
23+ WHERE pe .period_id = d .period_id
24+ AND pe .period = ' Monthly'
25+ AND pe .fiscal_year = (
26+ SELECT max (fiscal_year) - 1
27+ FROM period pe2
28+ WHERE exists (
29+ SELECT 1
30+ FROM revenue
31+ WHERE period_id = pe2 .period_id
32+ )
33+ )
34+ AND pe .fiscal_month <= (
35+ SELECT max (fiscal_month)
36+ FROM period pe2
37+ WHERE fiscal_year = (
38+ SELECT max (fiscal_year)
39+ FROM period pe3
40+ WHERE exists (
41+ SELECT 1
42+ FROM production
43+ WHERE period_id = pe2 .period_id
44+ )
45+ )
46+ )
47+ GROUP BY fy;
You can’t perform that action at this time.
0 commit comments