-
Notifications
You must be signed in to change notification settings - Fork 13
#5525 - Update Disbursement Report to include Forecast Date #5579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4490c27
5473752
9d9bf1c
adf1df3
34fd44a
5005dba
c9b9687
a25eeea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { MigrationInterface, QueryRunner } from "typeorm"; | ||
| import { getSQLFileData } from "../utilities/sqlLoader"; | ||
|
|
||
| /** | ||
| * Update the disbursement reports to include the "Forecast Date" column. | ||
| */ | ||
| export class UpdateDisbursementReportForecastDate1767653404966 implements MigrationInterface { | ||
| /** | ||
| * Update the disbursement reports to include the "Forecast Date" column. | ||
| * @param queryRunner the query runner. | ||
| */ | ||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| getSQLFileData("Update-disbursement-report-forecast-date.sql", "Reports"), | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Rollback the disbursement reports update that included the "Forecast Date" column. | ||
| * @param queryRunner the query runner. | ||
| */ | ||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query( | ||
| getSQLFileData( | ||
| "Rollback-update-disbursement-report-forecast-date.sql", | ||
| "Reports", | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| -- Rollback the disbursement report SQL to the previous version before the forecast date update. | ||
| UPDATE | ||
| sims.report_configs | ||
| SET | ||
| report_sql = $$ ( | ||
| 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 = ANY(:offeringIntensity) | ||
| AND dr.disburse_date BETWEEN :startDate | ||
| AND :endDate | ||
| 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", | ||
| dv.value_code AS "Funding Code", | ||
| dv.effective_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.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 = ANY(:offeringIntensity) | ||
| AND dr.funding_type <> 'FE' | ||
| AND drv.grant_type = 'BCSG' | ||
| AND dv.value_type = 'BC Grant' | ||
| AND dr.disburse_date BETWEEN :startDate | ||
| AND :endDate | ||
| 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 = ANY(:offeringIntensity) | ||
| AND dr.disburse_date BETWEEN :startDate | ||
| AND :endDate | ||
| ) | ||
| ORDER BY | ||
| "Date of Disbursement", | ||
| "Certificate Number" $$ | ||
| WHERE | ||
| report_name = 'Disbursement_Report'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| -- Update the Disbursements Report to include the "Forecast Date" column. | ||
| UPDATE | ||
| sims.report_configs | ||
| SET | ||
| report_sql = $$ ( | ||
| SELECT | ||
| to_char(ds.disbursement_date, 'YYYY-MM-DD') AS "Forecast Date", | ||
| 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 = ANY(:offeringIntensity) | ||
| AND dr.disburse_date BETWEEN :startDate | ||
| AND :endDate | ||
| UNION | ||
| ALL | ||
| SELECT | ||
| to_char(ds.disbursement_date, 'YYYY-MM-DD') AS "Forecast Date", | ||
| 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.effective_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.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 = ANY(:offeringIntensity) | ||
| AND dr.funding_type <> 'FE' | ||
| AND drv.grant_type = 'BCSG' | ||
| AND dv.value_type = 'BC Grant' | ||
| AND dr.disburse_date BETWEEN :startDate | ||
| AND :endDate | ||
| UNION | ||
| ALL | ||
| SELECT | ||
| to_char(ds.disbursement_date, 'YYYY-MM-DD') AS "Forecast Date", | ||
| 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 = ANY(:offeringIntensity) | ||
| AND dr.disburse_date BETWEEN :startDate | ||
| AND :endDate | ||
| ) | ||
| ORDER BY | ||
| "Date of Disbursement", | ||
| "Certificate Number", | ||
| "Funding Code" $$ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Is this a new requirement? I don't see an AC for it.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not part of the AC
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tiago-graf I believe the strict equal/equal(one among the 2) does not enforce the order. If that is added for tests I would ask to remove it as we can handle the assertion.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can also shift the disbursementDate by a day on federal or provincial to get a consistent date sort. |
||
| WHERE | ||
| report_name = 'Disbursement_Report'; | ||
Uh oh!
There was an error while loading. Please reload this page.