scheduler-node-models 1.1.37 → 1.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/package.json +6 -6
  2. package/general/emailer.d.ts +0 -1
  3. package/general/emailer.js +0 -31
  4. package/general/general.d.ts +0 -12
  5. package/general/general.js +0 -2
  6. package/general/index.d.ts +0 -5
  7. package/general/index.js +0 -21
  8. package/general/logger.d.ts +0 -10
  9. package/general/logger.js +0 -90
  10. package/general/report.d.ts +0 -25
  11. package/general/report.js +0 -76
  12. package/general/reportStyle.d.ts +0 -0
  13. package/general/reportStyle.js +0 -1
  14. package/general/viewstate.d.ts +0 -5
  15. package/general/viewstate.js +0 -9
  16. package/index.d.ts +0 -0
  17. package/index.js +0 -1
  18. package/metrics/images.d.ts +0 -22
  19. package/metrics/images.js +0 -33
  20. package/metrics/index.d.ts +0 -5
  21. package/metrics/index.js +0 -21
  22. package/metrics/mission.d.ts +0 -47
  23. package/metrics/mission.js +0 -81
  24. package/metrics/missionSensorOutage.d.ts +0 -11
  25. package/metrics/missionSensorOutage.js +0 -14
  26. package/metrics/missionsensor.d.ts +0 -67
  27. package/metrics/missionsensor.js +0 -128
  28. package/metrics/outage.d.ts +0 -43
  29. package/metrics/outage.js +0 -55
  30. package/metrics/reports/drawSummary.d.ts +0 -24
  31. package/metrics/reports/drawSummary.js +0 -311
  32. package/metrics/reports/index.d.ts +0 -5
  33. package/metrics/reports/index.js +0 -21
  34. package/metrics/reports/missionDay.d.ts +0 -8
  35. package/metrics/reports/missionDay.js +0 -23
  36. package/metrics/reports/missionSummary.d.ts +0 -25
  37. package/metrics/reports/missionSummary.js +0 -421
  38. package/metrics/reports/missionType.d.ts +0 -20
  39. package/metrics/reports/missionType.js +0 -314
  40. package/metrics/reports/outageDay.d.ts +0 -8
  41. package/metrics/reports/outageDay.js +0 -23
  42. package/metrics/systemdata/classifications.d.ts +0 -18
  43. package/metrics/systemdata/classifications.js +0 -23
  44. package/metrics/systemdata/communications.d.ts +0 -21
  45. package/metrics/systemdata/communications.js +0 -40
  46. package/metrics/systemdata/dcgs.d.ts +0 -19
  47. package/metrics/systemdata/dcgs.js +0 -29
  48. package/metrics/systemdata/exploitations.d.ts +0 -18
  49. package/metrics/systemdata/exploitations.js +0 -23
  50. package/metrics/systemdata/groundSystems.d.ts +0 -86
  51. package/metrics/systemdata/groundSystems.js +0 -143
  52. package/metrics/systemdata/index.d.ts +0 -7
  53. package/metrics/systemdata/index.js +0 -23
  54. package/metrics/systemdata/platform.d.ts +0 -124
  55. package/metrics/systemdata/platform.js +0 -176
  56. package/metrics/systemdata/systeminfo.d.ts +0 -28
  57. package/metrics/systemdata/systeminfo.js +0 -64
  58. package/scheduler/employees/assignment.d.ts +0 -139
  59. package/scheduler/employees/assignment.js +0 -304
  60. package/scheduler/employees/balance.d.ts +0 -35
  61. package/scheduler/employees/balance.js +0 -39
  62. package/scheduler/employees/companyinfo.d.ts +0 -16
  63. package/scheduler/employees/companyinfo.js +0 -6
  64. package/scheduler/employees/contact.d.ts +0 -36
  65. package/scheduler/employees/contact.js +0 -40
  66. package/scheduler/employees/employee.d.ts +0 -427
  67. package/scheduler/employees/employee.js +0 -1887
  68. package/scheduler/employees/employeename.d.ts +0 -48
  69. package/scheduler/employees/employeename.js +0 -97
  70. package/scheduler/employees/index.d.ts +0 -14
  71. package/scheduler/employees/index.js +0 -30
  72. package/scheduler/employees/labor.d.ts +0 -31
  73. package/scheduler/employees/labor.js +0 -39
  74. package/scheduler/employees/leave.d.ts +0 -58
  75. package/scheduler/employees/leave.js +0 -73
  76. package/scheduler/employees/leaverequest.d.ts +0 -105
  77. package/scheduler/employees/leaverequest.js +0 -226
  78. package/scheduler/employees/specialty.d.ts +0 -35
  79. package/scheduler/employees/specialty.js +0 -40
  80. package/scheduler/employees/variation.d.ts +0 -80
  81. package/scheduler/employees/variation.js +0 -132
  82. package/scheduler/employees/web.d.ts +0 -6
  83. package/scheduler/employees/web.js +0 -2
  84. package/scheduler/employees/work.d.ts +0 -96
  85. package/scheduler/employees/work.js +0 -133
  86. package/scheduler/employees/workday.d.ts +0 -91
  87. package/scheduler/employees/workday.js +0 -170
  88. package/scheduler/labor/index.d.ts +0 -2
  89. package/scheduler/labor/index.js +0 -18
  90. package/scheduler/labor/laborcode.d.ts +0 -33
  91. package/scheduler/labor/laborcode.js +0 -55
  92. package/scheduler/labor/workcode.d.ts +0 -28
  93. package/scheduler/labor/workcode.js +0 -35
  94. package/scheduler/reports/chargeStatus.d.ts +0 -66
  95. package/scheduler/reports/chargeStatus.js +0 -752
  96. package/scheduler/reports/cofsReports.d.ts +0 -11
  97. package/scheduler/reports/cofsReports.js +0 -36
  98. package/scheduler/reports/enterpriseSchedule.d.ts +0 -18
  99. package/scheduler/reports/enterpriseSchedule.js +0 -159
  100. package/scheduler/reports/index.d.ts +0 -6
  101. package/scheduler/reports/index.js +0 -22
  102. package/scheduler/reports/leaveReport.d.ts +0 -52
  103. package/scheduler/reports/leaveReport.js +0 -755
  104. package/scheduler/reports/leaves.d.ts +0 -24
  105. package/scheduler/reports/leaves.js +0 -110
  106. package/scheduler/reports/scheduleReport.d.ts +0 -17
  107. package/scheduler/reports/scheduleReport.js +0 -311
  108. package/scheduler/sites/index.d.ts +0 -1
  109. package/scheduler/sites/index.js +0 -17
  110. package/scheduler/sites/reports/cofsReport.d.ts +0 -41
  111. package/scheduler/sites/reports/cofsReport.js +0 -104
  112. package/scheduler/sites/reports/forecast.d.ts +0 -57
  113. package/scheduler/sites/reports/forecast.js +0 -205
  114. package/scheduler/sites/reports/index.d.ts +0 -4
  115. package/scheduler/sites/reports/index.js +0 -20
  116. package/scheduler/sites/reports/period.d.ts +0 -11
  117. package/scheduler/sites/reports/period.js +0 -27
  118. package/scheduler/sites/reports/section.d.ts +0 -63
  119. package/scheduler/sites/reports/section.js +0 -186
  120. package/scheduler/sites/site.d.ts +0 -39
  121. package/scheduler/sites/site.js +0 -68
  122. package/scheduler/sites/workcenters/index.d.ts +0 -3
  123. package/scheduler/sites/workcenters/index.js +0 -19
  124. package/scheduler/sites/workcenters/position.d.ts +0 -27
  125. package/scheduler/sites/workcenters/position.js +0 -36
  126. package/scheduler/sites/workcenters/shift.d.ts +0 -32
  127. package/scheduler/sites/workcenters/shift.js +0 -47
  128. package/scheduler/sites/workcenters/workcenter.d.ts +0 -43
  129. package/scheduler/sites/workcenters/workcenter.js +0 -123
  130. package/scheduler/teams/company/company.d.ts +0 -99
  131. package/scheduler/teams/company/company.js +0 -256
  132. package/scheduler/teams/company/holiday.d.ts +0 -61
  133. package/scheduler/teams/company/holiday.js +0 -116
  134. package/scheduler/teams/company/index.d.ts +0 -3
  135. package/scheduler/teams/company/index.js +0 -19
  136. package/scheduler/teams/company/modperiod.d.ts +0 -21
  137. package/scheduler/teams/company/modperiod.js +0 -24
  138. package/scheduler/teams/contact.d.ts +0 -18
  139. package/scheduler/teams/contact.js +0 -23
  140. package/scheduler/teams/index.d.ts +0 -3
  141. package/scheduler/teams/index.js +0 -19
  142. package/scheduler/teams/specialty.d.ts +0 -18
  143. package/scheduler/teams/specialty.js +0 -23
  144. package/scheduler/teams/team.d.ts +0 -95
  145. package/scheduler/teams/team.js +0 -351
  146. package/users/index.d.ts +0 -2
  147. package/users/index.js +0 -18
  148. package/users/user.d.ts +0 -130
  149. package/users/user.js +0 -256
  150. package/users/web.d.ts +0 -48
  151. package/users/web.js +0 -2
@@ -1,24 +0,0 @@
1
- import { Leave } from "../employees";
2
- import { Holiday } from "../teams/company";
3
- export declare class LeavePeriod {
4
- code: string;
5
- start: Date;
6
- end: Date;
7
- status: string;
8
- leaves: Leave[];
9
- constructor(leave?: Leave);
10
- compareTo(other?: LeavePeriod): number;
11
- getHours(type?: string, actual?: boolean): number;
12
- addLeave(leave: Leave): void;
13
- }
14
- export declare class LeaveMonth {
15
- month: Date;
16
- holiday?: Holiday;
17
- disabled: boolean;
18
- periods: LeavePeriod[];
19
- standard: number;
20
- constructor(start: Date, std: number, disabled: boolean, holiday?: Holiday);
21
- compareTo(other?: LeaveMonth): number;
22
- getHours(type?: string, actuals?: boolean): number;
23
- addLeave(leave: Leave): void;
24
- }
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LeaveMonth = exports.LeavePeriod = void 0;
4
- const employees_1 = require("../employees");
5
- const company_1 = require("../teams/company");
6
- class LeavePeriod {
7
- code;
8
- start;
9
- end;
10
- status;
11
- leaves;
12
- constructor(leave) {
13
- this.code = (leave) ? leave.code : '';
14
- this.start = (leave) ? new Date(leave.leavedate) : new Date(0);
15
- this.end = (leave) ? new Date(leave.leavedate) : new Date(0);
16
- this.status = (leave) ? leave.status : 'approved';
17
- this.leaves = [];
18
- if (leave) {
19
- this.leaves.push(new employees_1.Leave(leave));
20
- }
21
- }
22
- compareTo(other) {
23
- if (other) {
24
- return (this.start.getTime() < other.start.getTime()) ? -1 : 1;
25
- }
26
- return -1;
27
- }
28
- getHours(type, actual) {
29
- let hours = 0.0;
30
- if (type && type.toLowerCase() === 'v') {
31
- this.leaves.forEach(lv => {
32
- if (lv.code.toLowerCase() === 'v') {
33
- if (actual && lv.status.toLowerCase() === 'actual') {
34
- hours += lv.hours;
35
- }
36
- else if (!actual && lv.status.toLowerCase() !== 'actual') {
37
- hours += lv.hours;
38
- }
39
- }
40
- });
41
- }
42
- else {
43
- this.leaves.forEach(lv => {
44
- hours += lv.hours;
45
- });
46
- }
47
- return hours;
48
- }
49
- addLeave(leave) {
50
- this.leaves.push(new employees_1.Leave(leave));
51
- this.end = new Date(leave.leavedate);
52
- }
53
- }
54
- exports.LeavePeriod = LeavePeriod;
55
- class LeaveMonth {
56
- month;
57
- holiday;
58
- disabled;
59
- periods;
60
- standard;
61
- constructor(start, std, disabled, holiday) {
62
- this.month = new Date(start);
63
- this.standard = std;
64
- this.disabled = disabled;
65
- this.periods = [];
66
- this.holiday = undefined;
67
- if (holiday) {
68
- this.holiday = new company_1.Holiday(holiday);
69
- }
70
- }
71
- compareTo(other) {
72
- if (other) {
73
- if (this.holiday && other.holiday) {
74
- if (this.holiday.id.toLowerCase() === other.holiday.id.toLowerCase()) {
75
- return (this.holiday.sort < other.holiday.sort) ? -1 : 1;
76
- }
77
- return (this.holiday.id.toLowerCase() === 'h') ? -1 : 1;
78
- }
79
- else {
80
- return (this.month.getTime() < other.month.getTime()) ? -1 : 1;
81
- }
82
- }
83
- return -1;
84
- }
85
- getHours(type, actuals) {
86
- let hours = 0.0;
87
- this.periods.forEach(prd => {
88
- hours += prd.getHours(type, actuals);
89
- });
90
- return hours;
91
- }
92
- addLeave(leave) {
93
- let bAdded = false;
94
- if (leave.hours === this.standard) {
95
- this.periods.forEach((prd, p) => {
96
- if (!bAdded && leave.code.toLowerCase() === prd.code.toLowerCase()
97
- && leave.status.toLowerCase() === prd.status.toLowerCase()
98
- && leave.leavedate.getDate() === prd.end.getDate() + 1) {
99
- bAdded = true;
100
- prd.addLeave(leave);
101
- this.periods[p] = prd;
102
- }
103
- });
104
- }
105
- if (!bAdded) {
106
- this.periods.push(new LeavePeriod(leave));
107
- }
108
- }
109
- }
110
- exports.LeaveMonth = LeaveMonth;
@@ -1,17 +0,0 @@
1
- import { Workbook, Worksheet } from "exceljs";
2
- import { Report } from "../../general";
3
- import { Workcode } from "../labor";
4
- import { ISite } from "../sites";
5
- import { Employee, IEmployee } from "../employees";
6
- import { User } from "../../users";
7
- export declare class ScheduleReport extends Report {
8
- private styles;
9
- private workcodes;
10
- private site;
11
- constructor(workcodes: Map<string, Workcode>, isite: ISite);
12
- create(user: User, year: number, site: string, iEmps: IEmployee[]): Workbook;
13
- createStyles(): void;
14
- addMonth(workbook: Workbook, start: Date, iEmps: IEmployee[]): void;
15
- createEmployeeRow(sheet: Worksheet, start: Date, end: Date, row: number, emp: Employee): void;
16
- createLegendSheet(workbook: Workbook): void;
17
- }
@@ -1,311 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ScheduleReport = void 0;
4
- const exceljs_1 = require("exceljs");
5
- const general_1 = require("../../general");
6
- const sites_1 = require("../sites");
7
- const employees_1 = require("../employees");
8
- class ScheduleReport extends general_1.Report {
9
- styles;
10
- workcodes;
11
- site;
12
- constructor(workcodes, isite) {
13
- super();
14
- this.styles = new Map();
15
- this.workcodes = workcodes;
16
- this.site = new sites_1.Site(isite);
17
- }
18
- create(user, year, site, iEmps) {
19
- const workbook = new exceljs_1.Workbook();
20
- workbook.creator = user.getFullName();
21
- workbook.created = new Date();
22
- this.createStyles();
23
- let start = new Date(Date.UTC(year, 0, 1));
24
- const end = new Date(Date.UTC(year, 11, 31, 59, 59, 59));
25
- while (start.getTime() < end.getTime()) {
26
- this.addMonth(workbook, start, iEmps);
27
- start = new Date(Date.UTC(start.getFullYear(), start.getMonth() + 1, 1));
28
- }
29
- this.createLegendSheet(workbook);
30
- const sheet = workbook.getWorksheet('Sheet1');
31
- if (sheet) {
32
- workbook.removeWorksheet(sheet.id);
33
- }
34
- return workbook;
35
- }
36
- createStyles() {
37
- // set style
38
- this.workcodes.forEach((wc, key) => {
39
- if (wc.backcolor.toLowerCase() !== 'ffffff') {
40
- const style = {
41
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ff${wc.backcolor}` } },
42
- font: { bold: true, size: 11, color: { argb: `ff${wc.textcolor}` } },
43
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
44
- border: {
45
- top: { style: 'thin', color: { argb: 'ff000000' } },
46
- left: { style: 'thin', color: { argb: 'ff000000' } },
47
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
48
- right: { style: 'thin', color: { argb: 'ff000000' } }
49
- }
50
- };
51
- this.styles.set(wc.id, style);
52
- }
53
- });
54
- let style = {
55
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ffc0c0c0` } },
56
- font: { bold: true, size: 11, color: { argb: `ff000000` } },
57
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
58
- border: {
59
- top: { style: 'thin', color: { argb: 'ff000000' } },
60
- left: { style: 'thin', color: { argb: 'ff000000' } },
61
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
62
- right: { style: 'thin', color: { argb: 'ff000000' } }
63
- }
64
- };
65
- this.styles.set('evenday', style);
66
- this.styles.set('oddday', {
67
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ffffffff` } },
68
- font: { bold: true, size: 11, color: { argb: `ff000000` } },
69
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
70
- border: {
71
- top: { style: 'thin', color: { argb: 'ff000000' } },
72
- left: { style: 'thin', color: { argb: 'ff000000' } },
73
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
74
- right: { style: 'thin', color: { argb: 'ff000000' } }
75
- }
76
- });
77
- this.styles.set('evenend', {
78
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ff00e6e6` } },
79
- font: { bold: true, size: 11, color: { argb: `ff000000` } },
80
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
81
- border: {
82
- top: { style: 'thin', color: { argb: 'ff000000' } },
83
- left: { style: 'thin', color: { argb: 'ff000000' } },
84
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
85
- right: { style: 'thin', color: { argb: 'ff000000' } }
86
- }
87
- });
88
- this.styles.set('oddend', {
89
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ffccffff` } },
90
- font: { bold: true, size: 11, color: { argb: `ff000000` } },
91
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
92
- border: {
93
- top: { style: 'thin', color: { argb: 'ff000000' } },
94
- left: { style: 'thin', color: { argb: 'ff000000' } },
95
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
96
- right: { style: 'thin', color: { argb: 'ff000000' } }
97
- }
98
- });
99
- this.styles.set('month', {
100
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ffde5d12` } },
101
- font: { bold: true, size: 11, color: { argb: `ff000000` } },
102
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
103
- border: {
104
- top: { style: 'thin', color: { argb: 'ff000000' } },
105
- left: { style: 'thin', color: { argb: 'ff000000' } },
106
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
107
- right: { style: 'thin', color: { argb: 'ff000000' } }
108
- }
109
- });
110
- this.styles.set('wkctr', {
111
- fill: { type: 'pattern', pattern: 'solid', fgColor: { argb: `ff000000` } },
112
- font: { bold: true, size: 11, color: { argb: `ffffffff` } },
113
- alignment: { horizontal: 'center', vertical: 'middle', wrapText: true },
114
- border: {
115
- top: { style: 'thin', color: { argb: 'ff000000' } },
116
- left: { style: 'thin', color: { argb: 'ff000000' } },
117
- bottom: { style: 'thin', color: { argb: 'ff000000' } },
118
- right: { style: 'thin', color: { argb: 'ff000000' } }
119
- }
120
- });
121
- }
122
- addMonth(workbook, start, iEmps) {
123
- const startDate = new Date(start);
124
- const endDate = new Date(Date.UTC(start.getFullYear(), start.getMonth() + 1, 1));
125
- const months = ['January', 'Febuary', 'March', 'April', 'May', 'June', 'July',
126
- 'August', 'September', 'October', 'November', 'December'];
127
- const weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
128
- // first ensure the workcenter positions and shifts are clear of employees
129
- this.site.workcenters.forEach(wkctr => {
130
- wkctr.positions?.forEach((pos, p) => {
131
- pos.employees = [];
132
- wkctr.positions[p] = pos;
133
- });
134
- wkctr.shifts?.forEach((shft, s) => {
135
- shft.employees = [];
136
- wkctr.shifts[s] = shft;
137
- });
138
- });
139
- iEmps.forEach(iEmp => {
140
- const emp = new employees_1.Employee(iEmp);
141
- if (emp.atSite(this.site.id, startDate, endDate)) {
142
- let position = false;
143
- this.site.workcenters.forEach((wkctr, w) => {
144
- wkctr.positions?.forEach((pos, p) => {
145
- pos.assigned.forEach(asgn => {
146
- if (asgn === emp.id) {
147
- position = true;
148
- pos.employees?.push(emp);
149
- }
150
- });
151
- if (position) {
152
- wkctr.positions[p] = pos;
153
- this.site.workcenters[w] = wkctr;
154
- }
155
- });
156
- });
157
- if (!position) {
158
- const wd = emp.getAssignmentForPeriod(startDate, endDate);
159
- this.site.workcenters.forEach((wkctr, w) => {
160
- if (wkctr.id.toLowerCase() === wd.workcenter.toLowerCase()) {
161
- wkctr.shifts?.forEach((shft, s) => {
162
- let bShift = false;
163
- shft.associatedCodes.forEach(code => {
164
- if (code.toLowerCase() === wd.code.toLowerCase()) {
165
- bShift = true;
166
- }
167
- });
168
- if (bShift) {
169
- shft.employees?.push(emp);
170
- wkctr.shifts[s] = shft;
171
- this.site.workcenters[w] = wkctr;
172
- }
173
- });
174
- }
175
- });
176
- }
177
- }
178
- });
179
- const sheetLabel = `${months[startDate.getMonth()]}`
180
- + `${startDate.getFullYear().toString().substring(2)}`;
181
- // add a worksheet to the workbook and set the page options (landscape, etc)
182
- const sheet = workbook.addWorksheet(sheetLabel, {
183
- pageSetup: {
184
- paperSize: undefined,
185
- orientation: 'landscape',
186
- fitToHeight: 1,
187
- fitToWidth: 1,
188
- blackAndWhite: false,
189
- fitToPage: true,
190
- showGridLines: false,
191
- horizontalCentered: true,
192
- verticalCentered: true
193
- }
194
- });
195
- sheet.properties.defaultRowHeight = 20;
196
- sheet.properties.defaultColWidth = 4;
197
- // set all the column widths for the month with the first column width of 17.0
198
- // and days of the month at 4.0
199
- sheet.getColumn(1).width = 17.0;
200
- const endofMonth = (new Date(endDate.getTime() - (24 * 3600000))).getDate();
201
- const now = new Date();
202
- let style = this.styles.get('month');
203
- this.setCell(sheet, this.getCellID(0, 1), this.getCellID(0, 1), style, months[startDate.getMonth()]);
204
- const formatter = new Intl.DateTimeFormat('en-US', {
205
- month: '2-digit',
206
- day: '2-digit',
207
- year: 'numeric'
208
- });
209
- this.setCell(sheet, this.getCellID(0, 2), this.getCellID(0, 2), style, formatter.format(now));
210
- let current = new Date(startDate);
211
- while (current.getTime() < endDate.getTime()) {
212
- let styleID = 'evenday';
213
- if (current.getDay() === 0 || current.getDay() === 6) {
214
- styleID = 'evenend';
215
- }
216
- style = this.styles.get(styleID);
217
- let cellID = this.getCellID(current.getDate(), 1);
218
- this.setCell(sheet, cellID, cellID, style, weekdays[current.getDay()]);
219
- cellID = this.getCellID(current.getDate(), 2);
220
- this.setCell(sheet, cellID, cellID, style, current.getDate());
221
- current = new Date(current.getTime() + (24 * 3600000));
222
- }
223
- // now add row for workcenter header, then the employees under that workcenter
224
- let row = 2;
225
- this.site.workcenters.forEach(wkctr => {
226
- row++;
227
- style = this.styles.get('wkctr');
228
- this.setCell(sheet, this.getCellID(0, row), this.getCellID(endofMonth, row), style, wkctr.name);
229
- // sort positions, then add a row for each employee for the positions.
230
- if (wkctr.positions && wkctr.positions.length > 0) {
231
- wkctr.positions.sort((a, b) => a.compareTo(b));
232
- wkctr.positions.forEach(pos => {
233
- if (pos.employees && pos.employees.length > 0) {
234
- pos.employees.sort((a, b) => a.compareTo(b));
235
- pos.employees.forEach(emp => {
236
- row++;
237
- this.createEmployeeRow(sheet, startDate, endDate, row, emp);
238
- });
239
- }
240
- });
241
- }
242
- if (wkctr.shifts && wkctr.shifts.length > 0) {
243
- wkctr.shifts.forEach(shft => {
244
- if (shft.employees && shft.employees.length > 0) {
245
- shft.employees.sort((a, b) => a.compareTo(b));
246
- shft.employees.forEach(emp => {
247
- row++;
248
- this.createEmployeeRow(sheet, startDate, endDate, row, emp);
249
- });
250
- }
251
- });
252
- }
253
- });
254
- }
255
- createEmployeeRow(sheet, start, end, row, emp) {
256
- let styleID = 'oddday';
257
- if (row % 2 === 0) {
258
- styleID = 'evenday';
259
- }
260
- const lastWorked = emp.getLastWorkday();
261
- let style = this.styles.get(styleID);
262
- const name = `${emp.name.lastname}, ${emp.name.firstname.substring(0, 1)}`;
263
- this.setCell(sheet, this.getCellID(0, row), this.getCellID(0, row), style, name);
264
- let current = new Date(start);
265
- while (current.getTime() < end.getTime()) {
266
- let stID = styleID;
267
- let code = '';
268
- const wd = emp.getWorkday(current);
269
- if (wd && wd.code !== '') {
270
- code = wd.code.toUpperCase();
271
- if (this.styles.has(wd.code)) {
272
- stID = wd.code;
273
- }
274
- }
275
- if (stID === 'oddday' || stID === 'evenday') {
276
- if (current.getDay() === 0 || current.getDay() === 6) {
277
- stID = (row % 2 === 0) ? 'evenend' : 'oddend';
278
- }
279
- }
280
- style = this.styles.get(stID);
281
- const cellID = this.getCellID(current.getDate(), row);
282
- this.setCell(sheet, cellID, cellID, style, code);
283
- current = new Date(current.getTime() + (24 * 3600000));
284
- }
285
- }
286
- createLegendSheet(workbook) {
287
- const sheet = workbook.addWorksheet('Legend', {
288
- pageSetup: {
289
- paperSize: undefined,
290
- orientation: 'landscape',
291
- fitToHeight: 1,
292
- fitToWidth: 1,
293
- blackAndWhite: false,
294
- fitToPage: true,
295
- showGridLines: false
296
- }
297
- });
298
- sheet.getColumn(1).width = 30;
299
- let row = 0;
300
- this.workcodes.forEach(wc => {
301
- if (wc.backcolor.toLowerCase() !== 'ffffff') {
302
- row++;
303
- sheet.getRow(row).height = 20;
304
- const style = this.styles.get(wc.id);
305
- const cellID = this.getCellID(1, row);
306
- this.setCell(sheet, cellID, cellID, style, wc.title);
307
- }
308
- });
309
- }
310
- }
311
- exports.ScheduleReport = ScheduleReport;
@@ -1 +0,0 @@
1
- export * from './site';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./site"), exports);
@@ -1,41 +0,0 @@
1
- import { Employee } from "../../employees";
2
- import { Workcode } from "../../labor";
3
- import { ISection, Section } from "./section";
4
- /**
5
- * This interface will define the data members associated with a CofS Report.
6
- */
7
- export interface ICofSReport {
8
- id: number;
9
- name: string;
10
- shortname: string;
11
- unit: string;
12
- startdate: Date;
13
- enddate: Date;
14
- sections?: ISection[];
15
- }
16
- /**
17
- * This class implements the interface data members plus actions.
18
- */
19
- export declare class CofSReport implements ICofSReport {
20
- id: number;
21
- name: string;
22
- shortname: string;
23
- unit: string;
24
- startdate: Date;
25
- enddate: Date;
26
- sections: Section[];
27
- constructor(rpt?: ICofSReport);
28
- compareTo(other?: CofSReport): number;
29
- use(start: Date, end: Date): boolean;
30
- /**
31
- * This function will create an XML file from a CofS Report description.
32
- * @param start The date object used for the start of the report period.
33
- * @param end The date object used to signify the end of the period, but not included
34
- * in the report (1st day of next month).
35
- * @param workcodes The list of work codes used to signify shift or leave.
36
- * @param employees The list of possible employees used in this report. Usually a list
37
- * of the site's employees.
38
- * @returns A File object for the XML data.
39
- */
40
- create(start: Date, end: Date, workcodes: Map<string, Workcode>, employees: Employee[]): File;
41
- }
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CofSReport = void 0;
4
- const section_1 = require("./section");
5
- /**
6
- * This class implements the interface data members plus actions.
7
- */
8
- class CofSReport {
9
- id;
10
- name;
11
- shortname;
12
- unit;
13
- startdate;
14
- enddate;
15
- sections;
16
- constructor(rpt) {
17
- this.id = (rpt) ? rpt.id : 0;
18
- this.name = (rpt) ? rpt.name : '';
19
- this.shortname = (rpt) ? rpt.shortname : '';
20
- this.unit = (rpt) ? rpt.unit : '';
21
- this.startdate = (rpt) ? new Date(rpt.startdate) : new Date(0);
22
- this.enddate = (rpt) ? new Date(rpt.enddate) : new Date(0);
23
- this.sections = [];
24
- if (rpt && rpt.sections && rpt.sections.length) {
25
- rpt.sections.forEach(sec => {
26
- this.sections.push(new section_1.Section(sec));
27
- });
28
- this.sections.sort((a, b) => a.compareTo(b));
29
- }
30
- }
31
- compareTo(other) {
32
- if (other) {
33
- if (this.startdate.getTime() === other.startdate.getTime()) {
34
- return (this.name < other.name) ? -1 : 1;
35
- }
36
- return (this.startdate.getTime() < other.startdate.getTime()) ? -1 : 1;
37
- }
38
- return -1;
39
- }
40
- use(start, end) {
41
- return (this.startdate.getTime() <= end.getTime()
42
- && this.enddate.getTime() >= start.getTime());
43
- }
44
- /**
45
- * This function will create an XML file from a CofS Report description.
46
- * @param start The date object used for the start of the report period.
47
- * @param end The date object used to signify the end of the period, but not included
48
- * in the report (1st day of next month).
49
- * @param workcodes The list of work codes used to signify shift or leave.
50
- * @param employees The list of possible employees used in this report. Usually a list
51
- * of the site's employees.
52
- * @returns A File object for the XML data.
53
- */
54
- create(start, end, workcodes, employees) {
55
- const options = { type: 'text/xml' };
56
- const now = new Date();
57
- const filename = `${this.shortname}-${now.getFullYear()}`
58
- + `${(now.getMonth() + 1).toString().padStart(2, '0')}`
59
- + `${now.getDate().toString().padStart(2, '0')}.xml`;
60
- let content = '';
61
- const remarks = [];
62
- // Create the xml formated output and attach to content string.
63
- // 1. start with the standard header for xml plus entries for month and year,
64
- // and unit.
65
- const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
66
- 'Nov', 'Dec'];
67
- content += '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>\n'
68
- + '<fields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n'
69
- + `\t<Month-Year>${months[start.getMonth()]}-${start.getFullYear()}`
70
- + '</Month-Year>\n'
71
- + `\t<Month-Year1>${months[start.getMonth()]}-${start.getFullYear()}`
72
- + '</Month-Year1>\n'
73
- + `\t<Unit>${this.unit}</Unit>\n`
74
- + `\t<Unit1>${this.unit}</Unit1>\n`;
75
- // next add in the report sections, which produce a table.
76
- this.sections.forEach((section, sid) => {
77
- const result = section.createReportSection(start, end, workcodes, employees, sid + 1, this.unit);
78
- if (result.output !== '') {
79
- const lines = result.output.split('\n');
80
- lines.forEach(line => {
81
- content += `\t${line}\n`;
82
- });
83
- }
84
- if (result.remarks.length > 0) {
85
- result.remarks.forEach(rmk => {
86
- remarks.push(rmk);
87
- });
88
- }
89
- });
90
- // lastly, add in the remarks section as a series of strings
91
- if (remarks.length > 0) {
92
- content += `\t<REMARKS>\n`;
93
- remarks.forEach(rmk => {
94
- content += `${rmk}\n`;
95
- });
96
- content += `\t</REMARKS>\n`;
97
- }
98
- // close the xml tag and finish.
99
- content += '</fields>\n';
100
- const xmlFile = new File([content], filename, options);
101
- return xmlFile;
102
- }
103
- }
104
- exports.CofSReport = CofSReport;