scheduler-node-models 1.2.19 → 1.2.21

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 (33) hide show
  1. package/general/reportStyle.d.ts +0 -0
  2. package/general/reportStyle.js +1 -0
  3. package/metrics/reports/drawSummary.d.ts +24 -0
  4. package/metrics/reports/drawSummary.js +311 -0
  5. package/metrics/reports/index.d.ts +5 -0
  6. package/metrics/reports/index.js +21 -0
  7. package/metrics/reports/missionDay.d.ts +8 -0
  8. package/metrics/reports/missionDay.js +23 -0
  9. package/metrics/reports/missionSummary.d.ts +25 -0
  10. package/metrics/reports/missionSummary.js +421 -0
  11. package/metrics/reports/missionType.d.ts +20 -0
  12. package/metrics/reports/missionType.js +314 -0
  13. package/metrics/reports/outageDay.d.ts +8 -0
  14. package/metrics/reports/outageDay.js +23 -0
  15. package/package.json +3 -2
  16. package/scheduler/employees/variation.d.ts +14 -6
  17. package/scheduler/employees/variation.js +18 -6
  18. package/scheduler/employees/web.d.ts +15 -0
  19. package/scheduler/employees/workday.js +23 -0
  20. package/scheduler/reports/chargeStatus.d.ts +66 -0
  21. package/scheduler/reports/chargeStatus.js +752 -0
  22. package/scheduler/reports/cofsReports.d.ts +11 -0
  23. package/scheduler/reports/cofsReports.js +36 -0
  24. package/scheduler/reports/enterpriseSchedule.d.ts +18 -0
  25. package/scheduler/reports/enterpriseSchedule.js +159 -0
  26. package/scheduler/reports/index.d.ts +6 -0
  27. package/scheduler/reports/index.js +22 -0
  28. package/scheduler/reports/leaveReport.d.ts +52 -0
  29. package/scheduler/reports/leaveReport.js +755 -0
  30. package/scheduler/reports/leaves.d.ts +24 -0
  31. package/scheduler/reports/leaves.js +110 -0
  32. package/scheduler/reports/scheduleReport.d.ts +17 -0
  33. package/scheduler/reports/scheduleReport.js +311 -0
@@ -0,0 +1,314 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MissionType = void 0;
4
+ const mission_1 = require("../mission");
5
+ class MissionType {
6
+ exploitation;
7
+ platform;
8
+ missions;
9
+ constructor(exp, platform) {
10
+ this.exploitation = exp;
11
+ this.platform = platform;
12
+ this.missions = [];
13
+ }
14
+ addMission(msn) {
15
+ this.missions.push(new mission_1.Mission(msn));
16
+ this.missions.sort((a, b) => a.compareTo(b));
17
+ }
18
+ getScheduled(exploit, sensors) {
19
+ let answer = 0;
20
+ if ((exploit.toLowerCase() === 'primary'
21
+ && this.exploitation.toLowerCase() === 'primary')
22
+ || (exploit.toLowerCase() !== 'primary'
23
+ && this.exploitation.toLowerCase() !== 'primary')) {
24
+ if (sensors.length === 0) {
25
+ answer = this.missions.length;
26
+ }
27
+ else {
28
+ this.missions.forEach(msn => {
29
+ let found = false;
30
+ msn.sensors.forEach(msnSen => {
31
+ sensors.forEach(sensor => {
32
+ if (msnSen.sensorID.toLowerCase() === sensor.toLowerCase()) {
33
+ if (!found) {
34
+ answer++;
35
+ found = true;
36
+ }
37
+ }
38
+ });
39
+ });
40
+ });
41
+ }
42
+ }
43
+ return answer;
44
+ }
45
+ getExecuted(exploit, sensors) {
46
+ let answer = 0;
47
+ if ((exploit.toLowerCase() === 'primary'
48
+ && this.exploitation.toLowerCase() === 'primary')
49
+ || (exploit.toLowerCase() !== 'primary'
50
+ && this.exploitation.toLowerCase() !== 'primary')) {
51
+ if (sensors.length === 0) {
52
+ this.missions.forEach(msn => {
53
+ if (!msn.aborted && !msn.cancelled && !msn.indefDelay) {
54
+ answer++;
55
+ }
56
+ });
57
+ }
58
+ else {
59
+ this.missions.forEach(msn => {
60
+ let found = false;
61
+ if (!msn.aborted && !msn.cancelled && !msn.indefDelay) {
62
+ msn.sensors.forEach(msnSen => {
63
+ sensors.forEach(sensor => {
64
+ if (msnSen.sensorID.toLowerCase() === sensor.toLowerCase()) {
65
+ if (!found) {
66
+ answer++;
67
+ found = true;
68
+ }
69
+ }
70
+ });
71
+ });
72
+ }
73
+ });
74
+ }
75
+ }
76
+ return answer;
77
+ }
78
+ getCancelled(exploit, sensors) {
79
+ let answer = 0;
80
+ if ((exploit.toLowerCase() === 'primary'
81
+ && this.exploitation.toLowerCase() === 'primary')
82
+ || (exploit.toLowerCase() !== 'primary'
83
+ && this.exploitation.toLowerCase() !== 'primary')) {
84
+ if (sensors.length === 0) {
85
+ this.missions.forEach(msn => {
86
+ if (msn.cancelled || msn.indefDelay) {
87
+ answer++;
88
+ }
89
+ });
90
+ }
91
+ else {
92
+ this.missions.forEach(msn => {
93
+ let found = false;
94
+ if (msn.cancelled || msn.indefDelay) {
95
+ msn.sensors.forEach(msnSen => {
96
+ sensors.forEach(sensor => {
97
+ if (msnSen.sensorID.toLowerCase() === sensor.toLowerCase()) {
98
+ if (!found) {
99
+ answer++;
100
+ found = true;
101
+ }
102
+ }
103
+ });
104
+ });
105
+ }
106
+ });
107
+ }
108
+ }
109
+ return answer;
110
+ }
111
+ getAborted(exploit, sensors) {
112
+ let answer = 0;
113
+ if ((exploit.toLowerCase() === 'primary'
114
+ && this.exploitation.toLowerCase() === 'primary')
115
+ || (exploit.toLowerCase() !== 'primary'
116
+ && this.exploitation.toLowerCase() !== 'primary')) {
117
+ if (sensors.length === 0) {
118
+ this.missions.forEach(msn => {
119
+ if (msn.aborted) {
120
+ answer++;
121
+ }
122
+ });
123
+ }
124
+ else {
125
+ this.missions.forEach(msn => {
126
+ let found = false;
127
+ if (msn.aborted) {
128
+ msn.sensors.forEach(msnSen => {
129
+ sensors.forEach(sensor => {
130
+ if (msnSen.sensorID.toLowerCase() === sensor.toLowerCase()) {
131
+ if (!found) {
132
+ answer++;
133
+ found = true;
134
+ }
135
+ }
136
+ });
137
+ });
138
+ }
139
+ });
140
+ }
141
+ }
142
+ return answer;
143
+ }
144
+ getPremissionTime(sensors, enclave, gs) {
145
+ let answer = 0;
146
+ this.missions.forEach(msn => {
147
+ let senMax = 0;
148
+ if (gs && gs.checkForUse) {
149
+ if (msn.equipmentInUse(gs.id)) {
150
+ msn.sensors.forEach(mSen => {
151
+ if (gs.useSensor(msn.platformID, mSen.sensorID, msn.exploitation, msn.communications, enclave)) {
152
+ if (senMax < mSen.preflightMinutes) {
153
+ senMax = mSen.preflightMinutes;
154
+ }
155
+ }
156
+ });
157
+ }
158
+ }
159
+ else {
160
+ msn.sensors.forEach(mSen => {
161
+ sensors.forEach(sen => {
162
+ if (sen.toLowerCase() === mSen.sensorID.toLowerCase()
163
+ && senMax < mSen.preflightMinutes) {
164
+ senMax = mSen.preflightMinutes;
165
+ }
166
+ });
167
+ });
168
+ }
169
+ answer += senMax;
170
+ });
171
+ return answer;
172
+ }
173
+ getPostmissionTime(sensors, enclave, gs) {
174
+ let answer = 0;
175
+ this.missions.forEach(msn => {
176
+ let senMax = 0;
177
+ if (gs && gs.checkForUse) {
178
+ if (msn.equipmentInUse(gs.id)) {
179
+ msn.sensors.forEach(mSen => {
180
+ if (gs.useSensor(msn.platformID, mSen.sensorID, msn.exploitation, msn.communications, enclave)) {
181
+ if (senMax < mSen.postflightMinutes) {
182
+ senMax = mSen.postflightMinutes;
183
+ }
184
+ }
185
+ });
186
+ }
187
+ }
188
+ else {
189
+ msn.sensors.forEach(mSen => {
190
+ sensors.forEach(sen => {
191
+ if (sen.toLowerCase() === mSen.sensorID.toLowerCase()
192
+ && senMax < mSen.postflightMinutes) {
193
+ senMax = mSen.postflightMinutes;
194
+ }
195
+ });
196
+ });
197
+ }
198
+ answer += senMax;
199
+ });
200
+ return answer;
201
+ }
202
+ getScheduledTime(sensors, enclave, gs) {
203
+ let answer = 0;
204
+ this.missions.forEach(msn => {
205
+ let senMax = 0;
206
+ if (gs && gs.checkForUse) {
207
+ if (msn.equipmentInUse(gs.id)) {
208
+ msn.sensors.forEach(mSen => {
209
+ if (gs.useSensor(msn.platformID, mSen.sensorID, msn.exploitation, msn.communications, enclave)) {
210
+ if (senMax < mSen.scheduledMinutes) {
211
+ senMax = mSen.scheduledMinutes;
212
+ }
213
+ }
214
+ });
215
+ }
216
+ }
217
+ else {
218
+ msn.sensors.forEach(mSen => {
219
+ sensors.forEach(sen => {
220
+ if (sen.toLowerCase() === mSen.sensorID.toLowerCase()
221
+ && senMax < mSen.scheduledMinutes) {
222
+ senMax = mSen.scheduledMinutes;
223
+ }
224
+ });
225
+ });
226
+ }
227
+ answer += senMax;
228
+ });
229
+ return answer;
230
+ }
231
+ getExecutedTime(sensors, enclave, gs) {
232
+ let answer = 0;
233
+ this.missions.forEach(msn => {
234
+ let senMax = 0;
235
+ if (gs && gs.checkForUse) {
236
+ if (msn.equipmentInUse(gs.id)) {
237
+ msn.sensors.forEach(mSen => {
238
+ if (gs.useSensor(msn.platformID, mSen.sensorID, msn.exploitation, msn.communications, enclave)) {
239
+ if (senMax < mSen.executedMinutes) {
240
+ senMax = mSen.executedMinutes;
241
+ }
242
+ }
243
+ });
244
+ }
245
+ }
246
+ else {
247
+ msn.sensors.forEach(mSen => {
248
+ sensors.forEach(sen => {
249
+ if (sen.toLowerCase() === mSen.sensorID.toLowerCase()
250
+ && senMax < mSen.executedMinutes) {
251
+ senMax = mSen.executedMinutes;
252
+ }
253
+ });
254
+ });
255
+ }
256
+ answer += senMax;
257
+ });
258
+ return answer;
259
+ }
260
+ getAdditionalTime(sensors, enclave, gs) {
261
+ let answer = 0;
262
+ this.missions.forEach(msn => {
263
+ let senMax = 0;
264
+ if (gs && gs.checkForUse) {
265
+ if (msn.equipmentInUse(gs.id)) {
266
+ msn.sensors.forEach(mSen => {
267
+ if (gs.useSensor(msn.platformID, mSen.sensorID, msn.exploitation, msn.communications, enclave)) {
268
+ if (senMax < mSen.additionalMinutes) {
269
+ senMax = mSen.additionalMinutes;
270
+ }
271
+ }
272
+ });
273
+ }
274
+ }
275
+ else {
276
+ msn.sensors.forEach(mSen => {
277
+ sensors.forEach(sen => {
278
+ if (sen.toLowerCase() === mSen.sensorID.toLowerCase()
279
+ && senMax < mSen.additionalMinutes) {
280
+ senMax = mSen.additionalMinutes;
281
+ }
282
+ });
283
+ });
284
+ }
285
+ answer += senMax;
286
+ });
287
+ return answer;
288
+ }
289
+ getOverlap() {
290
+ let answer = 0;
291
+ this.missions.forEach(msn => {
292
+ answer += msn.missionOverlap;
293
+ });
294
+ return answer;
295
+ }
296
+ getSensorList() {
297
+ const answer = [];
298
+ this.missions.forEach(msn => {
299
+ msn.sensors.forEach(mSen => {
300
+ let found = false;
301
+ answer.forEach(sen => {
302
+ if (mSen.sensorID.toLowerCase() === sen.toLowerCase()) {
303
+ found = true;
304
+ }
305
+ });
306
+ if (!found) {
307
+ answer.push(mSen.sensorID);
308
+ }
309
+ });
310
+ });
311
+ return answer;
312
+ }
313
+ }
314
+ exports.MissionType = MissionType;
@@ -0,0 +1,8 @@
1
+ import { Outage } from "../outage";
2
+ export declare class OutageDay {
3
+ outageDate: Date;
4
+ outages: Outage[];
5
+ constructor(date: Date);
6
+ compareTo(other?: OutageDay): number;
7
+ use(date: Date): boolean;
8
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutageDay = void 0;
4
+ class OutageDay {
5
+ outageDate;
6
+ outages;
7
+ constructor(date) {
8
+ this.outageDate = new Date(date);
9
+ this.outages = [];
10
+ }
11
+ compareTo(other) {
12
+ if (other) {
13
+ return (this.outageDate.getTime() < other.outageDate.getTime()) ? -1 : 1;
14
+ }
15
+ return -1;
16
+ }
17
+ use(date) {
18
+ return (this.outageDate.getFullYear() === date.getFullYear()
19
+ && this.outageDate.getMonth() === date.getMonth()
20
+ && this.outageDate.getDate() === date.getDate());
21
+ }
22
+ }
23
+ exports.OutageDay = OutageDay;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-node-models",
3
- "version": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -16,13 +16,14 @@
16
16
  "description": "",
17
17
  "devDependencies": {
18
18
  "@types/adm-zip": "^0.5.7",
19
+ "@types/bcrypt": "^6.0.0",
19
20
  "@types/exceljs": "^0.5.3",
20
21
  "@types/nodemailer": "^7.0.0",
21
22
  "typescript": "^5.9.2"
22
23
  },
23
24
  "dependencies": {
24
25
  "adm-zip": "^0.5.16",
25
- "bcrypt-ts": "^7.1.0",
26
+ "bcrypt": "^6.0.0",
26
27
  "exceljs": "^4.4.0",
27
28
  "mongodb": "^6.18.0",
28
29
  "nodemailer": "^7.0.5"
@@ -61,13 +61,21 @@ export declare class Variation implements IVariation {
61
61
  */
62
62
  getWorkday(date: Date): Workday;
63
63
  /**
64
- * This function will set the workday's values from the client app where they are set.
65
- * @param wdID The numeric value for the identifier of the particular workday.
66
- * @param wkctr The string value representing the workcenter.
67
- * @param code The string value for the work code to use on the day.
68
- * @param hours The numeric value (float) for the number of hours to work on that day.
64
+ * This function is used to completely change a variation's workday
65
+ * @param wdID The numeric value to identity which of the schedule's workday to change
66
+ * @param wkctr The string value for the new workcenter.
67
+ * @param code The string value for the new work code.
68
+ * @param hours The numeric valur for the hours to work.
69
+ */
70
+ changeWorkday(wdID: number, wkctr: string, code: string, hours: number): void;
71
+ /**
72
+ * This function is used to update a single field in a schedule's workday.
73
+ * @param wdID The numeric value to identify which of the schedule's workdays to update
74
+ * @param field The string value to identify which field within the workday to update
75
+ * @param value The string value (string or numeric string) to update the value of the
76
+ * data member.
69
77
  */
70
- updateWorkday(wdID: number, wkctr: string, code: string, hours: number): void;
78
+ updateWorkday(wdID: number, field: string, value: string): void;
71
79
  /**
72
80
  * This function will set the workday's values from the client app the day of the
73
81
  * schedule from a date.
@@ -100,15 +100,27 @@ class Variation {
100
100
  return this.schedule.getWorkday(iDay);
101
101
  }
102
102
  /**
103
- * This function will set the workday's values from the client app where they are set.
104
- * @param wdID The numeric value for the identifier of the particular workday.
105
- * @param wkctr The string value representing the workcenter.
106
- * @param code The string value for the work code to use on the day.
107
- * @param hours The numeric value (float) for the number of hours to work on that day.
103
+ * This function is used to completely change a variation's workday
104
+ * @param wdID The numeric value to identity which of the schedule's workday to change
105
+ * @param wkctr The string value for the new workcenter.
106
+ * @param code The string value for the new work code.
107
+ * @param hours The numeric valur for the hours to work.
108
108
  */
109
- updateWorkday(wdID, wkctr, code, hours) {
109
+ changeWorkday(wdID, wkctr, code, hours) {
110
+ let found = false;
110
111
  this.schedule.changeWorkday(wdID, wkctr, code, hours);
111
112
  }
113
+ /**
114
+ * This function is used to update a single field in a schedule's workday.
115
+ * @param wdID The numeric value to identify which of the schedule's workdays to update
116
+ * @param field The string value to identify which field within the workday to update
117
+ * @param value The string value (string or numeric string) to update the value of the
118
+ * data member.
119
+ */
120
+ updateWorkday(wdID, field, value) {
121
+ let found = false;
122
+ this.schedule.updateWorkday(wdID, field, value);
123
+ }
112
124
  /**
113
125
  * This function will set the workday's values from the client app the day of the
114
126
  * schedule from a date.
@@ -4,3 +4,18 @@ export interface ChangeLeaveRequestResponse {
4
4
  leaverequest: LeaveRequest | undefined;
5
5
  error: Error | undefined;
6
6
  }
7
+ export interface NewEmployeeAssignment {
8
+ employee: string;
9
+ site: string;
10
+ workcenter: string;
11
+ start: Date;
12
+ scheduledays: number;
13
+ }
14
+ export interface ChangeAssignment {
15
+ employee: string;
16
+ asgmt: number;
17
+ schedule?: number;
18
+ workday?: number;
19
+ field: string;
20
+ value: string;
21
+ }
@@ -133,6 +133,29 @@ class Schedule {
133
133
  case 'hours':
134
134
  wd.hours = Number(value);
135
135
  break;
136
+ case 'copy':
137
+ let oldWkd = undefined;
138
+ let oWkID = w;
139
+ let bExit = false;
140
+ while (!oldWkd && !bExit) {
141
+ oWkID--;
142
+ if (oWkID < 0) {
143
+ oWkID = this.workdays.length - 1;
144
+ }
145
+ if (oWkID === w) {
146
+ bExit = true;
147
+ }
148
+ let tWkd = this.workdays[oWkID];
149
+ if (tWkd.code !== '' && tWkd.workcenter !== '' && tWkd.hours > 0.0) {
150
+ oldWkd = new Workday(tWkd);
151
+ }
152
+ }
153
+ if (oldWkd) {
154
+ wd.workcenter = oldWkd.workcenter;
155
+ wd.code = oldWkd.code;
156
+ wd.hours = oldWkd.hours;
157
+ }
158
+ break;
136
159
  }
137
160
  this.workdays[w] = wd;
138
161
  }
@@ -0,0 +1,66 @@
1
+ import { Workbook, Worksheet } from "exceljs";
2
+ import { Report } from "../../general";
3
+ import { ISite } from "../sites";
4
+ import { IWorkcode, LaborCode, Workcode } from "../labor";
5
+ import { Employee, IEmployee } from "../employees";
6
+ import { User } from "../../users";
7
+ import { Forecast } from "../sites/reports";
8
+ export declare class ChargeStatusReport extends Report {
9
+ private site;
10
+ private workcodes;
11
+ private lastWorked;
12
+ private fonts;
13
+ private fills;
14
+ private borders;
15
+ private alignments;
16
+ private numformats;
17
+ constructor(isite: ISite, workcodes: IWorkcode[]);
18
+ create(user: User, iEmps: IEmployee[], companyID: string, reqDate: Date): Workbook;
19
+ /**
20
+ * This function will create the basic style information to be used within the sheet
21
+ * cells, which consists for font styles, cell fill styles, borders, and alignments for
22
+ * the text within the cell. Plus a late addition of the various number formats to
23
+ * present.
24
+ */
25
+ createStyles(): void;
26
+ /**
27
+ * This function will create the various pages of the workbook which hold the actual
28
+ * data for the workbook. They will consist of a header section, then list the
29
+ * employee's work/forecast work hours by labor code. lastly, if the stats worksheet
30
+ * is provided, it will add the statistics formulas to the rows of data on this sheet,
31
+ * by report type (current or forecast);
32
+ * @param workbook A reference to the workbook object so worksheet creation is possible
33
+ * @param type A string value to indicate if the report is for current or forecast data
34
+ * @param report The forecast object used to define the period and labor codes for use
35
+ * @param employees The list of site employees used for the report.
36
+ * @param stats A reference to the statistics worksheet to allow this to add the
37
+ * correct formulas to it.
38
+ * @param statsRow The numeric value for the last row used in the statistics worksheet.
39
+ * @return The numeric value for the last row used in the statistics worksheet.
40
+ */
41
+ addReport(workbook: Workbook, type: string, report: Forecast, employees: Employee[], stats?: Worksheet, statsRow?: number): number | undefined;
42
+ /**
43
+ * This function focuses on an employee, who has hours in the labor code provided. This
44
+ * will create a row of data on the worksheet for this employee's work in this
45
+ * category
46
+ * @param sheet The reference to the worksheet to add a row of data to.
47
+ * @param lCode The labor code object, which allows the work to focus on a single code.
48
+ * @param row The numeric value for the worksheet row to use in filling in the data
49
+ * @param emp The employee object to pull the work data.
50
+ * @param report The forecast report object which provides the periods and other data
51
+ * used in constructing the employee's row.
52
+ * @param current The boolean value which signifies whether only actual work performed
53
+ * or add in forecast work hours in this report sheet.
54
+ * @param compare A map of workcode array, used to determine leaves and other non-work
55
+ * periods.
56
+ */
57
+ employeeRow(sheet: Worksheet, lCode: LaborCode, row: number, emp: Employee, report: Forecast, current: boolean, compare: Map<string, Workcode>, lastWorked: Date): number;
58
+ /**
59
+ * This function will create the statistics page for the cover of the workbook, which
60
+ * will hold all the formulas for overall labor usage.
61
+ * @param workbook The excel workbook object use for creating worksheets within it.
62
+ * @returns The reference to the statistics worksheet to allow other functions to fill
63
+ * in the formulas to use.
64
+ */
65
+ createStatisticsSheet(workbook: Workbook): Worksheet;
66
+ }