Skip to content

Commit 64ea48f

Browse files
guru-aotguru-aot
and
guru-aot
authored
#3946-Update BC Grants displayed (#4190)
Report changed to show the values of BC Grant. ![image](https://github.com/user-attachments/assets/0c2e7f64-b878-4d21-b5a9-d50f5962b9c6) Migration revert Screenshot ![image](https://github.com/user-attachments/assets/f22e5eba-1ae2-43f7-8193-9a12cea4ee4a) Sample query to run and check in the DB > (select to_char(dr.disburse_date, 'YYYY-MM-DD') as "Date of Disbursement", dr.student_sin as "SIN", app.application_number as "Application Number", ds.document_number as "Certificate Number", drv.grant_type as "Funding Code", drv.grant_amount as "Disbursement Amount" from sims.disbursement_receipts dr inner join sims.disbursement_receipt_values drv on drv.disbursement_receipt_id = dr.id inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id inner join sims.student_assessments sa on sa.id = ds.student_assessment_id inner join sims.applications app on app.id = sa.application_id inner join sims.education_programs_offerings epo on epo.id = sa.offering_id where epo.offering_intensity = 'Full Time' and dr.disburse_date between '2024-01-01' and '2025-01-01' union all select to_char(dr.disburse_date, 'YYYY-MM-DD') as "Date of Disbursement", dr.student_sin as "SIN", app.application_number as "Application Number", ds.document_number as "Certificate Number", case when dr.funding_type = 'BC' then 'BCSL' when dr.funding_type = 'FE' then 'CSL' end as "Funding Code", dr.total_disbursed_amount as "Disbursement Amount" from sims.disbursement_receipts dr inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id inner join sims.student_assessments sa on sa.id = ds.student_assessment_id inner join sims.applications app on app.id = sa.application_id inner join sims.education_programs_offerings epo on epo.id = sa.offering_id where epo.offering_intensity = 'Full Time' and dr.disburse_date between '2024-01-01' and '2025-01-01' union all select distinct to_char(dr.disburse_date, 'YYYY-MM-DD') as "Date of Disbursement", dr.student_sin as "SIN", app.application_number as "Application Number", ds.document_number as "Certificate Number", dv.value_code as "Funding Code", dv.value_amount as "Disbursement Amount" from sims.disbursement_receipts dr inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id inner join sims.disbursement_values dv on dv.disbursement_schedule_id = ds.id inner join sims.student_assessments sa on sa.id = ds.student_assessment_id inner join sims.applications app on app.id = sa.application_id inner join sims.education_programs_offerings epo on epo.id = sa.offering_id where epo.offering_intensity = 'Full Time' and dv.value_type = 'BC Grant' and dr.disburse_date between '2024-01-01' and '2025-01-01' ) order by "Date of Disbursement", "Certificate Number" Execution plan: ![image](https://github.com/user-attachments/assets/ea7901d5-4221-4877-82d6-e68890490dd8) --------- Co-authored-by: guru-aot <[email protected]>
1 parent b35b5f1 commit 64ea48f

File tree

3 files changed

+148
-0
lines changed

3 files changed

+148
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
import { getSQLFileData } from "../utilities/sqlLoader";
3+
4+
export class UpdateDisbursementReportsBCGrants1735584931753
5+
implements MigrationInterface
6+
{
7+
public async up(queryRunner: QueryRunner): Promise<void> {
8+
await queryRunner.query(
9+
getSQLFileData("Update-disbursements-report-bc-grants.sql", "Reports"),
10+
);
11+
}
12+
public async down(queryRunner: QueryRunner): Promise<void> {
13+
await queryRunner.query(
14+
getSQLFileData(
15+
"Rollback-update-disbursements-report-bc-grants.sql",
16+
"Reports",
17+
),
18+
);
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
UPDATE
2+
sims.report_configs
3+
SET
4+
report_sql = (
5+
'(
6+
select
7+
to_char(dr.disburse_date, ''YYYY-MM-DD'') as "Date of Disbursement",
8+
dr.student_sin as "SIN",
9+
app.application_number as "Application Number",
10+
ds.document_number as "Certificate Number",
11+
drv.grant_type as "Funding Code",
12+
drv.grant_amount as "Disbursement Amount"
13+
from
14+
sims.disbursement_receipts dr
15+
inner join sims.disbursement_receipt_values drv on drv.disbursement_receipt_id = dr.id
16+
inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id
17+
inner join sims.student_assessments sa on sa.id = ds.student_assessment_id
18+
inner join sims.applications app on app.id = sa.application_id
19+
inner join sims.education_programs_offerings epo on epo.id = sa.offering_id
20+
where
21+
epo.offering_intensity = any(:offeringIntensity)
22+
and dr.disburse_date between :startDate
23+
and :endDate
24+
union
25+
all
26+
select
27+
to_char(dr.disburse_date, ''YYYY-MM-DD'') as "Date of Disbursement",
28+
dr.student_sin as "SIN",
29+
app.application_number as "Application Number",
30+
ds.document_number as "Certificate Number",
31+
case
32+
when dr.funding_type = ''BC'' then ''BCSL''
33+
when dr.funding_type = ''FE'' then ''CSL''
34+
end as "Funding Code",
35+
dr.total_disbursed_amount as "Disbursement Amount"
36+
from
37+
sims.disbursement_receipts dr
38+
inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id
39+
inner join sims.student_assessments sa on sa.id = ds.student_assessment_id
40+
inner join sims.applications app on app.id = sa.application_id
41+
inner join sims.education_programs_offerings epo on epo.id = sa.offering_id
42+
where
43+
epo.offering_intensity = any(:offeringIntensity)
44+
and dr.disburse_date between :startDate
45+
and :endDate
46+
)
47+
order by
48+
"Date of Disbursement",
49+
"Certificate Number"'
50+
)
51+
WHERE
52+
report_name = 'Disbursement_Report';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
UPDATE
2+
sims.report_configs
3+
SET
4+
report_sql = (
5+
'(
6+
select
7+
to_char(dr.disburse_date, ''YYYY-MM-DD'') as "Date of Disbursement",
8+
dr.student_sin as "SIN",
9+
app.application_number as "Application Number",
10+
ds.document_number as "Certificate Number",
11+
drv.grant_type as "Funding Code",
12+
drv.grant_amount as "Disbursement Amount"
13+
from
14+
sims.disbursement_receipts dr
15+
inner join sims.disbursement_receipt_values drv on drv.disbursement_receipt_id = dr.id
16+
inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id
17+
inner join sims.student_assessments sa on sa.id = ds.student_assessment_id
18+
inner join sims.applications app on app.id = sa.application_id
19+
inner join sims.education_programs_offerings epo on epo.id = sa.offering_id
20+
where
21+
epo.offering_intensity = any(:offeringIntensity)
22+
and dr.disburse_date between :startDate
23+
and :endDate
24+
union
25+
all
26+
select
27+
to_char(dr.disburse_date, ''YYYY-MM-DD'') as "Date of Disbursement",
28+
dr.student_sin as "SIN",
29+
app.application_number as "Application Number",
30+
ds.document_number as "Certificate Number",
31+
dv.value_code as "Funding Code",
32+
dv.effective_amount as "Disbursement Amount"
33+
from
34+
sims.disbursement_receipts dr
35+
inner join sims.disbursement_receipt_values drv on drv.disbursement_receipt_id = dr.id
36+
inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id
37+
inner join sims.disbursement_values dv on dv.disbursement_schedule_id = ds.id
38+
inner join sims.student_assessments sa on sa.id = ds.student_assessment_id
39+
inner join sims.applications app on app.id = sa.application_id
40+
inner join sims.education_programs_offerings epo on epo.id = sa.offering_id
41+
where
42+
epo.offering_intensity = any(:offeringIntensity)
43+
and dr.funding_type <> ''FE''
44+
and drv.grant_type = ''BCSG''
45+
and dv.value_type = ''BC Grant''
46+
and dr.disburse_date between :startDate
47+
and :endDate
48+
union
49+
all
50+
select
51+
to_char(dr.disburse_date, ''YYYY-MM-DD'') as "Date of Disbursement",
52+
dr.student_sin as "SIN",
53+
app.application_number as "Application Number",
54+
ds.document_number as "Certificate Number",
55+
case
56+
when dr.funding_type = ''BC'' then ''BCSL''
57+
when dr.funding_type = ''FE'' then ''CSL''
58+
end as "Funding Code",
59+
dr.total_disbursed_amount as "Disbursement Amount"
60+
from
61+
sims.disbursement_receipts dr
62+
inner join sims.disbursement_schedules ds on ds.id = dr.disbursement_schedule_id
63+
inner join sims.student_assessments sa on sa.id = ds.student_assessment_id
64+
inner join sims.applications app on app.id = sa.application_id
65+
inner join sims.education_programs_offerings epo on epo.id = sa.offering_id
66+
where
67+
epo.offering_intensity = any(:offeringIntensity)
68+
and dr.disburse_date between :startDate
69+
and :endDate
70+
)
71+
order by
72+
"Date of Disbursement",
73+
"Certificate Number"'
74+
)
75+
WHERE
76+
report_name = 'Disbursement_Report';

0 commit comments

Comments
 (0)