scheduler-node-models 1.0.79 → 1.0.83

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 (144) hide show
  1. package/general/emailer.d.ts +1 -0
  2. package/general/emailer.js +31 -0
  3. package/general/general.d.ts +12 -0
  4. package/general/general.js +2 -0
  5. package/general/index.d.ts +4 -0
  6. package/general/index.js +20 -0
  7. package/general/report.d.ts +12 -0
  8. package/general/report.js +70 -0
  9. package/general/reportStyle.d.ts +0 -0
  10. package/general/reportStyle.js +1 -0
  11. package/general/viewstate.d.ts +5 -0
  12. package/general/viewstate.js +9 -0
  13. package/index.d.ts +0 -0
  14. package/metrics/images.d.ts +22 -0
  15. package/metrics/images.js +33 -0
  16. package/metrics/index.d.ts +5 -0
  17. package/metrics/index.js +21 -0
  18. package/metrics/mission.d.ts +47 -0
  19. package/metrics/mission.js +81 -0
  20. package/metrics/missionSensorOutage.d.ts +11 -0
  21. package/metrics/missionSensorOutage.js +14 -0
  22. package/metrics/missionsensor.d.ts +67 -0
  23. package/metrics/missionsensor.js +128 -0
  24. package/metrics/outage.d.ts +43 -0
  25. package/metrics/outage.js +55 -0
  26. package/metrics/reports/drawSummary.d.ts +24 -0
  27. package/metrics/reports/drawSummary.js +311 -0
  28. package/metrics/reports/index.d.ts +5 -0
  29. package/metrics/reports/index.js +21 -0
  30. package/metrics/reports/missionDay.d.ts +8 -0
  31. package/metrics/reports/missionDay.js +23 -0
  32. package/metrics/reports/missionSummary.d.ts +25 -0
  33. package/metrics/reports/missionSummary.js +421 -0
  34. package/metrics/reports/missionType.d.ts +20 -0
  35. package/metrics/reports/missionType.js +314 -0
  36. package/metrics/reports/outageDay.d.ts +8 -0
  37. package/metrics/reports/outageDay.js +23 -0
  38. package/metrics/systemdata/classifications.d.ts +18 -0
  39. package/metrics/systemdata/classifications.js +23 -0
  40. package/metrics/systemdata/communications.d.ts +21 -0
  41. package/metrics/systemdata/communications.js +40 -0
  42. package/metrics/systemdata/dcgs.d.ts +19 -0
  43. package/metrics/systemdata/dcgs.js +29 -0
  44. package/metrics/systemdata/exploitations.d.ts +18 -0
  45. package/metrics/systemdata/exploitations.js +23 -0
  46. package/metrics/systemdata/groundSystems.d.ts +86 -0
  47. package/metrics/systemdata/groundSystems.js +143 -0
  48. package/metrics/systemdata/index.d.ts +7 -0
  49. package/metrics/systemdata/index.js +23 -0
  50. package/metrics/systemdata/platform.d.ts +124 -0
  51. package/metrics/systemdata/platform.js +176 -0
  52. package/metrics/systemdata/systeminfo.d.ts +28 -0
  53. package/metrics/systemdata/systeminfo.js +64 -0
  54. package/package.json +2 -2
  55. package/scheduler/employees/assignment.d.ts +139 -0
  56. package/scheduler/employees/assignment.js +304 -0
  57. package/scheduler/employees/balance.d.ts +35 -0
  58. package/scheduler/employees/balance.js +39 -0
  59. package/scheduler/employees/companyinfo.d.ts +16 -0
  60. package/scheduler/employees/companyinfo.js +6 -0
  61. package/scheduler/employees/contact.d.ts +36 -0
  62. package/scheduler/employees/contact.js +40 -0
  63. package/scheduler/employees/employee.d.ts +420 -0
  64. package/scheduler/employees/employee.js +1862 -0
  65. package/scheduler/employees/employeename.d.ts +48 -0
  66. package/scheduler/employees/employeename.js +97 -0
  67. package/scheduler/employees/index.d.ts +14 -0
  68. package/scheduler/employees/index.js +30 -0
  69. package/scheduler/employees/labor.d.ts +31 -0
  70. package/scheduler/employees/labor.js +39 -0
  71. package/scheduler/employees/leave.d.ts +58 -0
  72. package/scheduler/employees/leave.js +73 -0
  73. package/scheduler/employees/leaverequest.d.ts +105 -0
  74. package/scheduler/employees/leaverequest.js +226 -0
  75. package/scheduler/employees/specialty.d.ts +35 -0
  76. package/scheduler/employees/specialty.js +40 -0
  77. package/scheduler/employees/variation.d.ts +80 -0
  78. package/scheduler/employees/variation.js +132 -0
  79. package/scheduler/employees/web.d.ts +6 -0
  80. package/scheduler/employees/web.js +2 -0
  81. package/scheduler/employees/work.d.ts +96 -0
  82. package/scheduler/employees/work.js +133 -0
  83. package/scheduler/employees/workday.d.ts +91 -0
  84. package/scheduler/employees/workday.js +170 -0
  85. package/scheduler/labor/index.d.ts +2 -0
  86. package/scheduler/labor/index.js +18 -0
  87. package/scheduler/labor/laborcode.d.ts +33 -0
  88. package/scheduler/labor/laborcode.js +55 -0
  89. package/scheduler/labor/workcode.d.ts +28 -0
  90. package/scheduler/labor/workcode.js +35 -0
  91. package/scheduler/reports/chargeStatus.d.ts +66 -0
  92. package/scheduler/reports/chargeStatus.js +702 -0
  93. package/scheduler/reports/cofsReports.d.ts +11 -0
  94. package/scheduler/reports/cofsReports.js +36 -0
  95. package/scheduler/reports/enterpriseSchedule.d.ts +18 -0
  96. package/scheduler/reports/enterpriseSchedule.js +159 -0
  97. package/scheduler/reports/index.d.ts +4 -0
  98. package/scheduler/reports/index.js +20 -0
  99. package/scheduler/reports/scheduleReport.d.ts +17 -0
  100. package/scheduler/reports/scheduleReport.js +311 -0
  101. package/scheduler/sites/index.d.ts +1 -0
  102. package/scheduler/sites/index.js +17 -0
  103. package/scheduler/sites/reports/cofsReport.d.ts +41 -0
  104. package/scheduler/sites/reports/cofsReport.js +104 -0
  105. package/scheduler/sites/reports/forecast.d.ts +57 -0
  106. package/scheduler/sites/reports/forecast.js +205 -0
  107. package/scheduler/sites/reports/index.d.ts +4 -0
  108. package/scheduler/sites/reports/index.js +20 -0
  109. package/scheduler/sites/reports/period.d.ts +11 -0
  110. package/scheduler/sites/reports/period.js +27 -0
  111. package/scheduler/sites/reports/section.d.ts +63 -0
  112. package/scheduler/sites/reports/section.js +174 -0
  113. package/scheduler/sites/site.d.ts +39 -0
  114. package/scheduler/sites/site.js +61 -0
  115. package/scheduler/sites/workcenters/index.d.ts +3 -0
  116. package/scheduler/sites/workcenters/index.js +19 -0
  117. package/scheduler/sites/workcenters/position.d.ts +27 -0
  118. package/scheduler/sites/workcenters/position.js +36 -0
  119. package/scheduler/sites/workcenters/shift.d.ts +32 -0
  120. package/scheduler/sites/workcenters/shift.js +47 -0
  121. package/scheduler/sites/workcenters/workcenter.d.ts +43 -0
  122. package/scheduler/sites/workcenters/workcenter.js +123 -0
  123. package/scheduler/teams/company/company.d.ts +99 -0
  124. package/scheduler/teams/company/company.js +256 -0
  125. package/scheduler/teams/company/holiday.d.ts +55 -0
  126. package/scheduler/teams/company/holiday.js +108 -0
  127. package/scheduler/teams/company/index.d.ts +3 -0
  128. package/scheduler/teams/company/index.js +19 -0
  129. package/scheduler/teams/company/modperiod.d.ts +21 -0
  130. package/scheduler/teams/company/modperiod.js +24 -0
  131. package/scheduler/teams/contact.d.ts +18 -0
  132. package/scheduler/teams/contact.js +23 -0
  133. package/scheduler/teams/index.d.ts +3 -0
  134. package/scheduler/teams/index.js +19 -0
  135. package/scheduler/teams/specialty.d.ts +18 -0
  136. package/scheduler/teams/specialty.js +23 -0
  137. package/scheduler/teams/team.d.ts +95 -0
  138. package/scheduler/teams/team.js +351 -0
  139. package/users/index.d.ts +2 -0
  140. package/users/index.js +18 -0
  141. package/users/user.d.ts +130 -0
  142. package/users/user.js +254 -0
  143. package/users/web.d.ts +22 -0
  144. package/users/web.js +2 -0
@@ -0,0 +1,139 @@
1
+ import { LaborCode } from "../labor/laborcode";
2
+ import { EmployeeLaborCode, IEmployeeLaborCode } from "./labor";
3
+ import { ISchedule, Schedule, Workday } from "./workday";
4
+ /**
5
+ * Assignments are the first level of scheduling. It defines the current normal work
6
+ * schedule(s). It should start with the employee's initial hire date and the employee's
7
+ * last assignment will have the employee's departure date from the company. Each time an
8
+ * employee's schedule permanently changes, a new assignment needs to be created to
9
+ * maintain a work history.
10
+ */
11
+ /**
12
+ * This interface defines a work assignment for an employee.
13
+ */
14
+ export interface IAssignment {
15
+ id: number;
16
+ site: string;
17
+ workcenter: string;
18
+ startDate: Date;
19
+ endDate: Date;
20
+ schedules: ISchedule[];
21
+ rotationdate?: Date;
22
+ rotationdays?: number;
23
+ laborcodes?: IEmployeeLaborCode[];
24
+ }
25
+ /**
26
+ * This class defines an employee's work assignment. The data members are:
27
+ * id (numeric value for the key to this assignment)
28
+ * site (the string value for the work site within the team)
29
+ * workcenter (the string value for the work center the schedule applies to)
30
+ * startdate (date object to define the start of the assignment.)
31
+ * enddate (date object to define the end of an assignment, to no longer use)
32
+ * rotationdate (Optional - defines a base date when multiple schedule are used in an
33
+ * assignment, especially for schedules that rotate every ### number of days.)
34
+ * rotationdays (Optional - defines the number of days to rotate upon from the base
35
+ * rotation date. It must be a multiple of the number of days in the schedule.)
36
+ * laborcodes (an array of employeelaborcode objects to define the assigned labor codes
37
+ * for consideration)
38
+ */
39
+ export declare class Assignment {
40
+ id: number;
41
+ site: string;
42
+ workcenter: string;
43
+ startDate: Date;
44
+ endDate: Date;
45
+ schedules: Schedule[];
46
+ rotationdate?: Date;
47
+ rotationdays?: number;
48
+ laborcodes: EmployeeLaborCode[];
49
+ constructor(asgmt?: IAssignment);
50
+ /**
51
+ * This function is used in sorting of the assignment from others. It used the
52
+ * assignment start and end dates for sorting comparison.
53
+ * @param other An assignment object to use in comparison
54
+ * @returns A numeric value to indicate whether this object is before or after the other
55
+ * object. -1 is before, 1 for after or 0 for equal.
56
+ */
57
+ compareTo(other?: Assignment): number;
58
+ /**
59
+ * This function is used to determine if this assignment should be used at a particular
60
+ * site and date.
61
+ * @param site The string value of a site designation.
62
+ * @param date The date object to compare with the start and end dates.
63
+ * @returns The boolean value for whether this assignment is for a site and between
64
+ * this start and end dates.
65
+ */
66
+ useSiteAssignment(site: string, date: Date): boolean;
67
+ /**
68
+ * This function is used to determine if this assignment should be used based on the
69
+ * date provided.
70
+ * @param date The date object used in comparision
71
+ * @returns The boolean value for whether this assignment is between the start and end
72
+ * dates.
73
+ */
74
+ useAssignment(date: Date, date2?: Date, labor?: LaborCode): boolean;
75
+ /**
76
+ * This function will provide the daily standard work day hours, based on a count of
77
+ * the schedule's workdays and a 40 hour work week.
78
+ * @returns A numeric value for the standard day's work hours.
79
+ */
80
+ getStandardWorkHours(): number;
81
+ /**
82
+ * This function is used to provide the workday object for a particular date.
83
+ * @param date The date object used to find the workday
84
+ * @returns A workday object if the schedule can be used or undefined if not.
85
+ */
86
+ getWorkday(date: Date): Workday | undefined;
87
+ /**
88
+ * This function adds a new schedule with a set number of days in the schedule.
89
+ * @param days The numeric value for the number of workday objects within the schedule.
90
+ * This must be a multiple of 7.
91
+ */
92
+ addSchedule(days: number): Error | undefined;
93
+ /**
94
+ * This function will change the number of workdays within an existing schedule.
95
+ * @param schID The numeric value for the schedule's identifier to change.
96
+ * @param days The numeric value for the number of workday objects to change the
97
+ * schedule to. This must be a multiple of 7.
98
+ */
99
+ changeScheduleDays(schID: number, days: number): Error | undefined;
100
+ /**
101
+ * This function is used to completely change a schedule's workday
102
+ * @param schID The numeric value to identify the schedule to update
103
+ * @param wdID The numeric value to identity which of the schedule's workday to change
104
+ * @param wkctr The string value for the new workcenter.
105
+ * @param code The string value for the new work code.
106
+ * @param hours The numeric valur for the hours to work.
107
+ */
108
+ changeWorkday(schID: number, wdID: number, wkctr: string, code: string, hours: number): void;
109
+ /**
110
+ * This function is used to update a single field in a schedule's workday.
111
+ * @param schID The numeric value to identify the schedule to update
112
+ * @param wdID The numeric value to identify which of the schedule's workdays to update
113
+ * @param field The string value to identify which field within the workday to update
114
+ * @param value The string value (string or numeric string) to update the value of the
115
+ * data member.
116
+ */
117
+ updateWorkday(schID: number, wdID: number, field: string, value: string): void;
118
+ /**
119
+ * This function is used to remove a schedule from this assignment. An assignment must
120
+ * have a minimum of one schedule, so if removal put the schedule list below 1, a new
121
+ * schedule is added and empty.
122
+ * @param schid The numeric value key for the schedule to remove.
123
+ */
124
+ removeSchedule(schid: number): void;
125
+ /**
126
+ * This function will add a new labor code (charge number and extension) to this
127
+ * assignment's labor code list.
128
+ * @param chgno The string value for the charge number to add
129
+ * @param ext The string value for the extension to add
130
+ */
131
+ addLaborCode(chgno: string, ext: string): void;
132
+ /**
133
+ * This function will remove an employee labor code from the list, based on its
134
+ * charge number and extension.
135
+ * @param chgno The string value for the charge number to remove
136
+ * @param ext The string value for the extension to remove
137
+ */
138
+ removeLaborCode(chgno: string, ext: string): void;
139
+ }
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Assignment = void 0;
4
+ const labor_1 = require("./labor");
5
+ const workday_1 = require("./workday");
6
+ /**
7
+ * This class defines an employee's work assignment. The data members are:
8
+ * id (numeric value for the key to this assignment)
9
+ * site (the string value for the work site within the team)
10
+ * workcenter (the string value for the work center the schedule applies to)
11
+ * startdate (date object to define the start of the assignment.)
12
+ * enddate (date object to define the end of an assignment, to no longer use)
13
+ * rotationdate (Optional - defines a base date when multiple schedule are used in an
14
+ * assignment, especially for schedules that rotate every ### number of days.)
15
+ * rotationdays (Optional - defines the number of days to rotate upon from the base
16
+ * rotation date. It must be a multiple of the number of days in the schedule.)
17
+ * laborcodes (an array of employeelaborcode objects to define the assigned labor codes
18
+ * for consideration)
19
+ */
20
+ class Assignment {
21
+ id;
22
+ site;
23
+ workcenter;
24
+ startDate;
25
+ endDate;
26
+ schedules;
27
+ rotationdate;
28
+ rotationdays;
29
+ laborcodes;
30
+ constructor(asgmt) {
31
+ this.id = (asgmt) ? asgmt.id : 0;
32
+ this.site = (asgmt) ? asgmt.site : '';
33
+ this.workcenter = (asgmt) ? asgmt.workcenter : '';
34
+ this.startDate = (asgmt) ? new Date(asgmt.startDate) : new Date(0);
35
+ this.endDate = (asgmt) ? new Date(asgmt.endDate) : new Date(Date.UTC(9999, 11, 31));
36
+ this.schedules = [];
37
+ if (asgmt && asgmt.schedules.length > 0) {
38
+ asgmt.schedules.forEach(sch => {
39
+ this.schedules.push(new workday_1.Schedule(sch));
40
+ });
41
+ this.schedules.sort((a, b) => a.compareTo(b));
42
+ }
43
+ this.rotationdate = (asgmt && asgmt.rotationdate)
44
+ ? new Date(asgmt.rotationdate) : undefined;
45
+ this.rotationdays = (asgmt && asgmt.rotationdays && asgmt.rotationdays > 0)
46
+ ? asgmt.rotationdays : undefined;
47
+ this.laborcodes = [];
48
+ if (asgmt && asgmt.laborcodes && asgmt.laborcodes?.length > 0) {
49
+ asgmt.laborcodes.forEach(lc => {
50
+ this.laborcodes.push(new labor_1.EmployeeLaborCode(lc));
51
+ });
52
+ this.laborcodes.sort((a, b) => a.compareTo(b));
53
+ }
54
+ }
55
+ /**
56
+ * This function is used in sorting of the assignment from others. It used the
57
+ * assignment start and end dates for sorting comparison.
58
+ * @param other An assignment object to use in comparison
59
+ * @returns A numeric value to indicate whether this object is before or after the other
60
+ * object. -1 is before, 1 for after or 0 for equal.
61
+ */
62
+ compareTo(other) {
63
+ if (other) {
64
+ if (this.startDate.getTime() === other.startDate.getTime()) {
65
+ return (this.endDate.getTime() < other.endDate.getTime()) ? -1 : 1;
66
+ }
67
+ return (this.startDate.getTime() < other.startDate.getTime()) ? -1 : 1;
68
+ }
69
+ return -1;
70
+ }
71
+ /**
72
+ * This function is used to determine if this assignment should be used at a particular
73
+ * site and date.
74
+ * @param site The string value of a site designation.
75
+ * @param date The date object to compare with the start and end dates.
76
+ * @returns The boolean value for whether this assignment is for a site and between
77
+ * this start and end dates.
78
+ */
79
+ useSiteAssignment(site, date) {
80
+ return (this.site.toLowerCase() === site.toLowerCase()
81
+ && this.startDate.getTime() <= date.getTime()
82
+ && this.endDate.getTime() >= date.getTime());
83
+ }
84
+ /**
85
+ * This function is used to determine if this assignment should be used based on the
86
+ * date provided.
87
+ * @param date The date object used in comparision
88
+ * @returns The boolean value for whether this assignment is between the start and end
89
+ * dates.
90
+ */
91
+ useAssignment(date, date2, labor) {
92
+ let answer = false;
93
+ if (labor && date2) {
94
+ this.laborcodes.forEach(lc => {
95
+ if (labor.chargeNumber && lc.chargeNumber && labor.extension && lc.extension) {
96
+ if (labor.chargeNumber.toLowerCase() === lc.chargeNumber.toLowerCase()
97
+ && labor.extension.toLowerCase() === lc.extension.toLowerCase()
98
+ && date.getTime() <= this.endDate.getTime()
99
+ && date2.getTime() >= this.startDate.getTime()) {
100
+ answer = true;
101
+ }
102
+ }
103
+ });
104
+ }
105
+ else {
106
+ answer = (this.startDate.getTime() <= date.getTime()
107
+ && this.endDate.getTime() >= date.getTime());
108
+ }
109
+ return answer;
110
+ }
111
+ /**
112
+ * This function will provide the daily standard work day hours, based on a count of
113
+ * the schedule's workdays and a 40 hour work week.
114
+ * @returns A numeric value for the standard day's work hours.
115
+ */
116
+ getStandardWorkHours() {
117
+ let count = 0;
118
+ const sched = this.schedules[0];
119
+ sched.workdays.forEach(wd => {
120
+ if (wd.code !== '') {
121
+ count++;
122
+ }
123
+ });
124
+ const weeks = Math.floor(sched.workdays.length / 7);
125
+ return (40.0 * weeks) / count;
126
+ }
127
+ /**
128
+ * This function is used to provide the workday object for a particular date.
129
+ * @param date The date object used to find the workday
130
+ * @returns A workday object if the schedule can be used or undefined if not.
131
+ */
132
+ getWorkday(date) {
133
+ // ensure the assignment base date is on a sunday.
134
+ let start = new Date(this.startDate);
135
+ while (start.getDay() !== 0) {
136
+ start = new Date(start.getTime() - (24 * 60 * 60 * 1000));
137
+ }
138
+ // determine the number of days since the base date for the date provided
139
+ const days = Math.floor((date.getTime() - start.getTime()) / (24 * 3600000));
140
+ // determine whether to use a single schedule or to rotate between multiple schedules
141
+ // based on rotation date and days. if rotationday is undefined or 0, use single or
142
+ // if only one schedule is provided. Else use multiple schedule and rotate between
143
+ // them.
144
+ if (this.schedules.length === 1 || !this.rotationdays || this.rotationdays === 0) {
145
+ const iDay = days % this.schedules[0].workdays.length;
146
+ return this.schedules[0].getWorkday(iDay);
147
+ }
148
+ else if (this.schedules.length > 1) {
149
+ const schID = Math.floor((days / this.rotationdays) % this.schedules.length);
150
+ const iDay = days % this.schedules[schID].workdays.length;
151
+ return this.schedules[schID].getWorkday(iDay);
152
+ }
153
+ return undefined;
154
+ }
155
+ /**
156
+ * This function adds a new schedule with a set number of days in the schedule.
157
+ * @param days The numeric value for the number of workday objects within the schedule.
158
+ * This must be a multiple of 7.
159
+ */
160
+ addSchedule(days) {
161
+ if ((days % 7) !== 0) {
162
+ return new Error('Schedule days must be multiple of 7');
163
+ }
164
+ const newSchedule = new workday_1.Schedule();
165
+ this.schedules.sort((a, b) => a.compareTo(b));
166
+ newSchedule.id = this.schedules[this.schedules.length - 1].id + 1;
167
+ newSchedule.setScheduleDays(days);
168
+ this.schedules.push(newSchedule);
169
+ }
170
+ /**
171
+ * This function will change the number of workdays within an existing schedule.
172
+ * @param schID The numeric value for the schedule's identifier to change.
173
+ * @param days The numeric value for the number of workday objects to change the
174
+ * schedule to. This must be a multiple of 7.
175
+ */
176
+ changeScheduleDays(schID, days) {
177
+ if ((days % 7) !== 0) {
178
+ return new Error('Schedule must have a multiple of 7 days.');
179
+ }
180
+ this.schedules.forEach(sch => {
181
+ if (sch.id === schID) {
182
+ sch.setScheduleDays(days);
183
+ }
184
+ });
185
+ }
186
+ /**
187
+ * This function is used to completely change a schedule's workday
188
+ * @param schID The numeric value to identify the schedule to update
189
+ * @param wdID The numeric value to identity which of the schedule's workday to change
190
+ * @param wkctr The string value for the new workcenter.
191
+ * @param code The string value for the new work code.
192
+ * @param hours The numeric valur for the hours to work.
193
+ */
194
+ changeWorkday(schID, wdID, wkctr, code, hours) {
195
+ let found = false;
196
+ for (let s = 0; s < this.schedules.length && !found; s++) {
197
+ const sched = this.schedules[s];
198
+ if (sched.id === schID) {
199
+ found = true;
200
+ sched.changeWorkday(wdID, wkctr, code, hours);
201
+ this.schedules[s] = sched;
202
+ }
203
+ }
204
+ if (!found) {
205
+ throw new Error("Schedule not found!");
206
+ }
207
+ }
208
+ /**
209
+ * This function is used to update a single field in a schedule's workday.
210
+ * @param schID The numeric value to identify the schedule to update
211
+ * @param wdID The numeric value to identify which of the schedule's workdays to update
212
+ * @param field The string value to identify which field within the workday to update
213
+ * @param value The string value (string or numeric string) to update the value of the
214
+ * data member.
215
+ */
216
+ updateWorkday(schID, wdID, field, value) {
217
+ let found = false;
218
+ for (let s = 0; s < this.schedules.length && !found; s++) {
219
+ const sched = this.schedules[s];
220
+ if (sched.id === schID) {
221
+ found = true;
222
+ sched.updateWorkday(wdID, field, value);
223
+ this.schedules[s] = sched;
224
+ }
225
+ }
226
+ if (!found) {
227
+ throw new Error("Schedule not found!");
228
+ }
229
+ }
230
+ /**
231
+ * This function is used to remove a schedule from this assignment. An assignment must
232
+ * have a minimum of one schedule, so if removal put the schedule list below 1, a new
233
+ * schedule is added and empty.
234
+ * @param schid The numeric value key for the schedule to remove.
235
+ */
236
+ removeSchedule(schid) {
237
+ // first search the schedule list for the correct schedule to remove.
238
+ let found = -1;
239
+ for (let s = 0; s < this.schedules.length && found < 0; s++) {
240
+ if (this.schedules[s].id === schid) {
241
+ found = s;
242
+ }
243
+ }
244
+ // if the schedule is present, remove and check to ensure at least one schedule is
245
+ // present.
246
+ if (found >= 0) {
247
+ this.schedules.splice(found, 1);
248
+ if (this.schedules.length === 0) {
249
+ this.schedules.push(new workday_1.Schedule({
250
+ id: 0,
251
+ workdays: [],
252
+ showdates: false
253
+ }));
254
+ }
255
+ }
256
+ else {
257
+ throw new Error('Schedule not found');
258
+ }
259
+ }
260
+ /**
261
+ * This function will add a new labor code (charge number and extension) to this
262
+ * assignment's labor code list.
263
+ * @param chgno The string value for the charge number to add
264
+ * @param ext The string value for the extension to add
265
+ */
266
+ addLaborCode(chgno, ext) {
267
+ // first check to see if the charge number and extension is listed in this assignment.
268
+ let found = false;
269
+ for (let l = 0; l < this.laborcodes.length && !found; l++) {
270
+ if (this.laborcodes[l].chargeNumber.toLowerCase() === chgno.toLowerCase()
271
+ && this.laborcodes[l].extension.toLowerCase() === ext.toLowerCase()) {
272
+ found = true;
273
+ }
274
+ }
275
+ // if not found, add it as an employee labor code object.
276
+ if (!found) {
277
+ this.laborcodes.push(new labor_1.EmployeeLaborCode({
278
+ chargeNumber: chgno,
279
+ extension: ext
280
+ }));
281
+ this.laborcodes.sort((a, b) => a.compareTo(b));
282
+ }
283
+ }
284
+ /**
285
+ * This function will remove an employee labor code from the list, based on its
286
+ * charge number and extension.
287
+ * @param chgno The string value for the charge number to remove
288
+ * @param ext The string value for the extension to remove
289
+ */
290
+ removeLaborCode(chgno, ext) {
291
+ let found = -1;
292
+ for (let l = 0; l < this.laborcodes.length && !found; l++) {
293
+ if (this.laborcodes[l].chargeNumber.toLowerCase() === chgno.toLowerCase()
294
+ && this.laborcodes[l].extension.toLowerCase() === ext.toLowerCase()) {
295
+ found = l;
296
+ }
297
+ }
298
+ if (found >= 0) {
299
+ this.laborcodes.splice(found, 1);
300
+ this.laborcodes.sort((a, b) => a.compareTo(b));
301
+ }
302
+ }
303
+ }
304
+ exports.Assignment = Assignment;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Leave balance is used to keep track of the number of hours of ordinary leave (PTO or
3
+ * vacation) remains in an employee's year.
4
+ */
5
+ /**
6
+ * This interface describes a Leave balance of annual hours and number of hours to carry
7
+ * from previous year to next.
8
+ */
9
+ export interface IAnnualLeave {
10
+ year: number;
11
+ annual: number;
12
+ carryover: number;
13
+ }
14
+ /**
15
+ * This class describes an annual leave and carry hours. The data members are:
16
+ * year (the numeric value for the year it represents)
17
+ * annual (the numeric value (float) for the number of hours the employee earns in a full
18
+ * year).
19
+ * carryover (the numeric value (float) for the number of hours the employee didn't use
20
+ * in the previous year and carried forward to this year)
21
+ */
22
+ export declare class AnnualLeave implements IAnnualLeave {
23
+ year: number;
24
+ annual: number;
25
+ carryover: number;
26
+ constructor(anLeave?: IAnnualLeave);
27
+ /**
28
+ * This function is used in sorting between this balance and another. It is based on
29
+ * the year.
30
+ * @param other The balance object to be used in comparison
31
+ * @returns A numeric value to indicate whether this object is before or after the other
32
+ * object. -1 is before or 1 for after.
33
+ */
34
+ compareTo(other?: AnnualLeave): number;
35
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * Leave balance is used to keep track of the number of hours of ordinary leave (PTO or
4
+ * vacation) remains in an employee's year.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AnnualLeave = void 0;
8
+ /**
9
+ * This class describes an annual leave and carry hours. The data members are:
10
+ * year (the numeric value for the year it represents)
11
+ * annual (the numeric value (float) for the number of hours the employee earns in a full
12
+ * year).
13
+ * carryover (the numeric value (float) for the number of hours the employee didn't use
14
+ * in the previous year and carried forward to this year)
15
+ */
16
+ class AnnualLeave {
17
+ year;
18
+ annual;
19
+ carryover;
20
+ constructor(anLeave) {
21
+ this.year = (anLeave) ? anLeave.year : (new Date()).getUTCFullYear();
22
+ this.annual = (anLeave) ? anLeave.annual : 0.0;
23
+ this.carryover = (anLeave) ? anLeave.carryover : 0.0;
24
+ }
25
+ /**
26
+ * This function is used in sorting between this balance and another. It is based on
27
+ * the year.
28
+ * @param other The balance object to be used in comparison
29
+ * @returns A numeric value to indicate whether this object is before or after the other
30
+ * object. -1 is before or 1 for after.
31
+ */
32
+ compareTo(other) {
33
+ if (other) {
34
+ return (this.year < other.year) ? -1 : 1;
35
+ }
36
+ return -1;
37
+ }
38
+ }
39
+ exports.AnnualLeave = AnnualLeave;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The company info provides for the employee's company, company id, an alternate
3
+ * company id, job title, rank/grade, a cost center and division
4
+ */
5
+ /**
6
+ * This interface defines an employee's company information.
7
+ */
8
+ export interface ICompanyInfo {
9
+ company: string;
10
+ employeeid: string;
11
+ alternateid?: string;
12
+ jobtitle?: string;
13
+ rank?: string;
14
+ costcenter?: string;
15
+ division?: string;
16
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * The company info provides for the employee's company, company id, an alternate
4
+ * company id, job title, rank/grade, a cost center and division
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A contact record provides a reference to a list of possible contact types and
3
+ * a string value to be used
4
+ */
5
+ /**
6
+ * This interface defines a contact reference between the team contact type list and
7
+ * the employee's information
8
+ */
9
+ export interface IContact {
10
+ id: number;
11
+ typeid: number;
12
+ sort: number;
13
+ value: string;
14
+ }
15
+ /**
16
+ * This class defines a contact reference. The data members are:
17
+ * id (a numeric value for the identifier to this reference)
18
+ * typeid (a numeric value for the reference to the team's contact type list)
19
+ * sort (a numeric value for sorting this contact with another)
20
+ * value (a string value for the contact information for the employee)
21
+ */
22
+ export declare class Contact implements IContact {
23
+ id: number;
24
+ typeid: number;
25
+ sort: number;
26
+ value: string;
27
+ constructor(ct?: IContact);
28
+ /**
29
+ * This function is used to sort this contact reference to another. It uses the sort
30
+ * value in sorting.
31
+ * @param other A contact object used in the comparison
32
+ * @returns A numeric value to indicate whether this object is before or after the other
33
+ * object. -1 is before, 1 for after or 0 for equal.
34
+ */
35
+ compareTo(other?: Contact): number;
36
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ /**
3
+ * A contact record provides a reference to a list of possible contact types and
4
+ * a string value to be used
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.Contact = void 0;
8
+ /**
9
+ * This class defines a contact reference. The data members are:
10
+ * id (a numeric value for the identifier to this reference)
11
+ * typeid (a numeric value for the reference to the team's contact type list)
12
+ * sort (a numeric value for sorting this contact with another)
13
+ * value (a string value for the contact information for the employee)
14
+ */
15
+ class Contact {
16
+ id;
17
+ typeid;
18
+ sort;
19
+ value;
20
+ constructor(ct) {
21
+ this.id = (ct) ? ct.id : 0;
22
+ this.typeid = (ct) ? ct.typeid : 0;
23
+ this.sort = (ct) ? ct.sort : 0;
24
+ this.value = (ct) ? ct.value : '';
25
+ }
26
+ /**
27
+ * This function is used to sort this contact reference to another. It uses the sort
28
+ * value in sorting.
29
+ * @param other A contact object used in the comparison
30
+ * @returns A numeric value to indicate whether this object is before or after the other
31
+ * object. -1 is before, 1 for after or 0 for equal.
32
+ */
33
+ compareTo(other) {
34
+ if (other) {
35
+ return (this.sort < other.sort) ? -1 : 1;
36
+ }
37
+ return -1;
38
+ }
39
+ }
40
+ exports.Contact = Contact;