-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathece-file-detail.ts
65 lines (63 loc) · 2.12 KB
/
ece-file-detail.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { DisbursementValue } from "@sims/sims-db";
import { END_OF_LINE, round, StringBuilder } from "@sims/utilities";
import {
DATE_FORMAT,
NUMBER_FILLER,
RecordTypeCodes,
SPACE_FILLER,
} from "../models/ece-integration.model";
import { ECERequestFileLine } from "./ece-file-line";
/**
* Record of a ECE request file.
* The documentation about it is available on the document
* 'SIMSSFAS - Institution File layouts In Analysis Folder'.
*/
export class ECERequestFileDetail implements ECERequestFileLine {
recordTypeCode: RecordTypeCodes;
institutionCode: string;
disbursementValues: DisbursementValue[];
sin: string;
studentLastName: string;
studentGivenName: string;
birthDate: string;
applicationNumber: string;
institutionStudentNumber: string;
courseLoad: string;
studyStartDate: string;
studyEndDate: string;
disbursementDate: string;
getFixedFormat(): string {
const records = this.disbursementValues.map((disbursementValue) => {
const record = new StringBuilder();
record.append(this.recordTypeCode, 1);
record.append(this.institutionCode, 4);
record.appendWithStartFiller(
disbursementValue.id.toString(),
10,
NUMBER_FILLER,
);
record.append(disbursementValue.valueCode, 4);
record.appendWithStartFiller(
round(disbursementValue.valueAmount),
9,
NUMBER_FILLER,
);
record.append(this.sin, 9);
record.appendWithEndFiller(this.studentLastName, 25, SPACE_FILLER);
record.appendWithEndFiller(this.studentGivenName ?? "", 15, SPACE_FILLER);
record.appendDate(this.birthDate, DATE_FORMAT);
record.append(this.applicationNumber, 10);
record.appendWithEndFiller(
this.institutionStudentNumber,
12,
SPACE_FILLER,
);
record.append("100"); //Course load hardcoded to 100 as this file is only for FT.
record.appendDate(this.studyStartDate, DATE_FORMAT);
record.appendDate(this.studyEndDate, DATE_FORMAT);
record.appendDate(this.disbursementDate, DATE_FORMAT);
return record.toString();
});
return records.join(END_OF_LINE);
}
}