scheduler-node-models 1.0.81 → 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.
- package/general/emailer.d.ts +1 -0
- package/general/emailer.js +31 -0
- package/general/general.d.ts +12 -0
- package/general/general.js +2 -0
- package/general/index.d.ts +4 -0
- package/general/index.js +20 -0
- package/general/report.d.ts +12 -0
- package/general/report.js +70 -0
- package/general/reportStyle.d.ts +0 -0
- package/general/reportStyle.js +1 -0
- package/general/viewstate.d.ts +5 -0
- package/general/viewstate.js +9 -0
- package/index.d.ts +0 -0
- package/metrics/images.d.ts +22 -0
- package/metrics/images.js +33 -0
- package/metrics/index.d.ts +5 -0
- package/metrics/index.js +21 -0
- package/metrics/mission.d.ts +47 -0
- package/metrics/mission.js +81 -0
- package/metrics/missionSensorOutage.d.ts +11 -0
- package/metrics/missionSensorOutage.js +14 -0
- package/metrics/missionsensor.d.ts +67 -0
- package/metrics/missionsensor.js +128 -0
- package/metrics/outage.d.ts +43 -0
- package/metrics/outage.js +55 -0
- package/metrics/reports/drawSummary.d.ts +24 -0
- package/metrics/reports/drawSummary.js +311 -0
- package/metrics/reports/index.d.ts +5 -0
- package/metrics/reports/index.js +21 -0
- package/metrics/reports/missionDay.d.ts +8 -0
- package/metrics/reports/missionDay.js +23 -0
- package/metrics/reports/missionSummary.d.ts +25 -0
- package/metrics/reports/missionSummary.js +421 -0
- package/metrics/reports/missionType.d.ts +20 -0
- package/metrics/reports/missionType.js +314 -0
- package/metrics/reports/outageDay.d.ts +8 -0
- package/metrics/reports/outageDay.js +23 -0
- package/metrics/systemdata/classifications.d.ts +18 -0
- package/metrics/systemdata/classifications.js +23 -0
- package/metrics/systemdata/communications.d.ts +21 -0
- package/metrics/systemdata/communications.js +40 -0
- package/metrics/systemdata/dcgs.d.ts +19 -0
- package/metrics/systemdata/dcgs.js +29 -0
- package/metrics/systemdata/exploitations.d.ts +18 -0
- package/metrics/systemdata/exploitations.js +23 -0
- package/metrics/systemdata/groundSystems.d.ts +86 -0
- package/metrics/systemdata/groundSystems.js +143 -0
- package/metrics/systemdata/index.d.ts +7 -0
- package/metrics/systemdata/index.js +23 -0
- package/metrics/systemdata/platform.d.ts +124 -0
- package/metrics/systemdata/platform.js +176 -0
- package/metrics/systemdata/systeminfo.d.ts +28 -0
- package/metrics/systemdata/systeminfo.js +64 -0
- package/package.json +2 -2
- package/scheduler/employees/assignment.d.ts +139 -0
- package/scheduler/employees/assignment.js +304 -0
- package/scheduler/employees/balance.d.ts +35 -0
- package/scheduler/employees/balance.js +39 -0
- package/scheduler/employees/companyinfo.d.ts +16 -0
- package/scheduler/employees/companyinfo.js +6 -0
- package/scheduler/employees/contact.d.ts +36 -0
- package/scheduler/employees/contact.js +40 -0
- package/scheduler/employees/employee.d.ts +420 -0
- package/scheduler/employees/employee.js +1862 -0
- package/scheduler/employees/employeename.d.ts +48 -0
- package/scheduler/employees/employeename.js +97 -0
- package/scheduler/employees/index.d.ts +14 -0
- package/scheduler/employees/index.js +30 -0
- package/scheduler/employees/labor.d.ts +31 -0
- package/scheduler/employees/labor.js +39 -0
- package/scheduler/employees/leave.d.ts +58 -0
- package/scheduler/employees/leave.js +73 -0
- package/scheduler/employees/leaverequest.d.ts +105 -0
- package/scheduler/employees/leaverequest.js +226 -0
- package/scheduler/employees/specialty.d.ts +35 -0
- package/scheduler/employees/specialty.js +40 -0
- package/scheduler/employees/variation.d.ts +80 -0
- package/scheduler/employees/variation.js +132 -0
- package/scheduler/employees/web.d.ts +6 -0
- package/scheduler/employees/web.js +2 -0
- package/scheduler/employees/work.d.ts +96 -0
- package/scheduler/employees/work.js +133 -0
- package/scheduler/employees/workday.d.ts +91 -0
- package/scheduler/employees/workday.js +170 -0
- package/scheduler/labor/index.d.ts +2 -0
- package/scheduler/labor/index.js +18 -0
- package/scheduler/labor/laborcode.d.ts +33 -0
- package/scheduler/labor/laborcode.js +55 -0
- package/scheduler/labor/workcode.d.ts +28 -0
- package/scheduler/labor/workcode.js +35 -0
- package/scheduler/reports/chargeStatus.d.ts +66 -0
- package/scheduler/reports/chargeStatus.js +702 -0
- package/scheduler/reports/cofsReports.d.ts +11 -0
- package/scheduler/reports/cofsReports.js +36 -0
- package/scheduler/reports/enterpriseSchedule.d.ts +18 -0
- package/scheduler/reports/enterpriseSchedule.js +159 -0
- package/scheduler/reports/index.d.ts +4 -0
- package/scheduler/reports/index.js +20 -0
- package/scheduler/reports/scheduleReport.d.ts +17 -0
- package/scheduler/reports/scheduleReport.js +311 -0
- package/scheduler/sites/index.d.ts +1 -0
- package/scheduler/sites/index.js +17 -0
- package/scheduler/sites/reports/cofsReport.d.ts +41 -0
- package/scheduler/sites/reports/cofsReport.js +104 -0
- package/scheduler/sites/reports/forecast.d.ts +57 -0
- package/scheduler/sites/reports/forecast.js +205 -0
- package/scheduler/sites/reports/index.d.ts +4 -0
- package/scheduler/sites/reports/index.js +20 -0
- package/scheduler/sites/reports/period.d.ts +11 -0
- package/scheduler/sites/reports/period.js +27 -0
- package/scheduler/sites/reports/section.d.ts +63 -0
- package/scheduler/sites/reports/section.js +174 -0
- package/scheduler/sites/site.d.ts +39 -0
- package/scheduler/sites/site.js +61 -0
- package/scheduler/sites/workcenters/index.d.ts +3 -0
- package/scheduler/sites/workcenters/index.js +19 -0
- package/scheduler/sites/workcenters/position.d.ts +27 -0
- package/scheduler/sites/workcenters/position.js +36 -0
- package/scheduler/sites/workcenters/shift.d.ts +32 -0
- package/scheduler/sites/workcenters/shift.js +47 -0
- package/scheduler/sites/workcenters/workcenter.d.ts +43 -0
- package/scheduler/sites/workcenters/workcenter.js +123 -0
- package/scheduler/teams/company/company.d.ts +99 -0
- package/scheduler/teams/company/company.js +256 -0
- package/scheduler/teams/company/holiday.d.ts +55 -0
- package/scheduler/teams/company/holiday.js +108 -0
- package/scheduler/teams/company/index.d.ts +3 -0
- package/scheduler/teams/company/index.js +19 -0
- package/scheduler/teams/company/modperiod.d.ts +21 -0
- package/scheduler/teams/company/modperiod.js +24 -0
- package/scheduler/teams/contact.d.ts +18 -0
- package/scheduler/teams/contact.js +23 -0
- package/scheduler/teams/index.d.ts +3 -0
- package/scheduler/teams/index.js +19 -0
- package/scheduler/teams/specialty.d.ts +18 -0
- package/scheduler/teams/specialty.js +23 -0
- package/scheduler/teams/team.d.ts +95 -0
- package/scheduler/teams/team.js +351 -0
- package/users/index.d.ts +2 -0
- package/users/index.js +18 -0
- package/users/user.d.ts +130 -0
- package/users/user.js +254 -0
- package/users/web.d.ts +22 -0
- package/users/web.js +2 -0
@@ -0,0 +1,104 @@
|
|
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')}`;
|
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;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { ILaborCode, LaborCode } from "../../labor";
|
2
|
+
import { IPeriod, Period } from "./period";
|
3
|
+
export interface IForecast {
|
4
|
+
id: number;
|
5
|
+
name: string;
|
6
|
+
startDate: Date;
|
7
|
+
endDate: Date;
|
8
|
+
periods?: IPeriod[];
|
9
|
+
laborCodes?: ILaborCode[];
|
10
|
+
companyid?: string;
|
11
|
+
sortfirst?: boolean;
|
12
|
+
}
|
13
|
+
export declare class Forecast implements IForecast {
|
14
|
+
id: number;
|
15
|
+
name: string;
|
16
|
+
startDate: Date;
|
17
|
+
endDate: Date;
|
18
|
+
periods: Period[];
|
19
|
+
laborCodes: LaborCode[];
|
20
|
+
companyid: string;
|
21
|
+
sortfirst: boolean;
|
22
|
+
constructor(fore?: IForecast);
|
23
|
+
compareTo(other?: Forecast): number;
|
24
|
+
/**
|
25
|
+
* This function is used to change the standard work period dates based on the day of
|
26
|
+
* the week the period ends. This function will ensure that the reports period all end
|
27
|
+
* on the day of the week provided.
|
28
|
+
* @param weekday The numeric value for the weekday the periods are to end at.
|
29
|
+
*/
|
30
|
+
changePeriodsStart(weekday: number): void;
|
31
|
+
/**
|
32
|
+
* This function is used to remove forecast periods that have no subperiods.
|
33
|
+
*/
|
34
|
+
removeUnusedPeriods(): void;
|
35
|
+
/**
|
36
|
+
* This function will move a single sub-period from one month to another adjacent
|
37
|
+
* month.
|
38
|
+
* @param from The date object representing the month period for the giving subperiod.
|
39
|
+
* @param to The date object representing the month period for the receiving subperiod.
|
40
|
+
*/
|
41
|
+
movePeriodBetweenMonths(from: Date, to: Date): void;
|
42
|
+
/**
|
43
|
+
* This function adds a sub period to the list of periods where it fits best or add a
|
44
|
+
* new period for the subperiod.
|
45
|
+
* @param dt The date object for the sub period to add
|
46
|
+
*/
|
47
|
+
addOutofCycleSubPeriod(dt: Date): void;
|
48
|
+
/**
|
49
|
+
* This function is used to determine if a forecast report is to be used for a report
|
50
|
+
* date requested.
|
51
|
+
* @param date The date object used for the testing.
|
52
|
+
* @param company The string value for company identifier for the testing.
|
53
|
+
* @returns A boolean value to indicate if the date is between the start and end dates
|
54
|
+
* of this forecast report and is for the company indicated.
|
55
|
+
*/
|
56
|
+
use(date: Date, company: string): boolean;
|
57
|
+
}
|
@@ -0,0 +1,205 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Forecast = void 0;
|
4
|
+
const labor_1 = require("../../labor");
|
5
|
+
const period_1 = require("./period");
|
6
|
+
class Forecast {
|
7
|
+
id;
|
8
|
+
name;
|
9
|
+
startDate;
|
10
|
+
endDate;
|
11
|
+
periods;
|
12
|
+
laborCodes;
|
13
|
+
companyid;
|
14
|
+
sortfirst;
|
15
|
+
constructor(fore) {
|
16
|
+
this.id = (fore) ? fore.id : 0;
|
17
|
+
this.name = (fore) ? fore.name : '';
|
18
|
+
this.startDate = (fore) ? new Date(fore.startDate) : new Date(0);
|
19
|
+
this.endDate = (fore) ? new Date(fore.endDate) : new Date(0);
|
20
|
+
this.periods = [];
|
21
|
+
if (fore && fore.periods && fore.periods.length > 0) {
|
22
|
+
fore.periods.forEach(per => {
|
23
|
+
this.periods.push(new period_1.Period(per));
|
24
|
+
});
|
25
|
+
this.periods.sort((a, b) => a.compareTo(b));
|
26
|
+
}
|
27
|
+
this.laborCodes = [];
|
28
|
+
if (fore && fore.laborCodes && fore.laborCodes.length > 0) {
|
29
|
+
fore.laborCodes.forEach(lc => {
|
30
|
+
this.laborCodes.push(new labor_1.LaborCode(lc));
|
31
|
+
});
|
32
|
+
this.laborCodes.sort((a, b) => a.compareTo(b));
|
33
|
+
}
|
34
|
+
this.companyid = (fore && fore.companyid) ? fore.companyid : '';
|
35
|
+
this.sortfirst = (fore && fore.sortfirst) ? fore.sortfirst : false;
|
36
|
+
}
|
37
|
+
compareTo(other) {
|
38
|
+
if (other) {
|
39
|
+
if (this.startDate.getTime() === other.startDate.getTime()) {
|
40
|
+
if (this.endDate.getTime() === other.endDate.getTime()) {
|
41
|
+
return (this.name < other.name) ? -1 : 1;
|
42
|
+
}
|
43
|
+
return (this.endDate.getTime() < other.endDate.getTime()) ? -1 : 1;
|
44
|
+
}
|
45
|
+
return (this.startDate.getTime() < other.startDate.getTime()) ? -1 : 1;
|
46
|
+
}
|
47
|
+
return -1;
|
48
|
+
}
|
49
|
+
/**
|
50
|
+
* This function is used to change the standard work period dates based on the day of
|
51
|
+
* the week the period ends. This function will ensure that the reports period all end
|
52
|
+
* on the day of the week provided.
|
53
|
+
* @param weekday The numeric value for the weekday the periods are to end at.
|
54
|
+
*/
|
55
|
+
changePeriodsStart(weekday) {
|
56
|
+
let end = new Date(Date.UTC(this.endDate.getFullYear(), this.endDate.getMonth(), this.endDate.getDate()));
|
57
|
+
while (end.getDay() !== weekday) {
|
58
|
+
end = new Date(end.getTime() + (24 * 3600000));
|
59
|
+
}
|
60
|
+
let start = new Date(Date.UTC(this.startDate.getFullYear(), this.startDate.getMonth(), this.startDate.getDate()));
|
61
|
+
while (start.getDay() !== weekday) {
|
62
|
+
start = new Date(start.getTime() + (24 * 3600000));
|
63
|
+
}
|
64
|
+
// clear the old periods' subperiods.
|
65
|
+
this.periods.forEach(per => {
|
66
|
+
per.periods = [];
|
67
|
+
});
|
68
|
+
while (start.getTime() < end.getTime()) {
|
69
|
+
let found = false;
|
70
|
+
this.periods.forEach((per, p) => {
|
71
|
+
if (per.month.getFullYear() === start.getFullYear()
|
72
|
+
&& per.month.getMonth() === start.getMonth()) {
|
73
|
+
per.periods.push(new Date(start));
|
74
|
+
per.sortSubperiods();
|
75
|
+
found = true;
|
76
|
+
this.periods[p] = per;
|
77
|
+
}
|
78
|
+
});
|
79
|
+
if (!found) {
|
80
|
+
const month = new period_1.Period({
|
81
|
+
month: new Date(Date.UTC(start.getFullYear(), start.getMonth(), 1)),
|
82
|
+
periods: [start]
|
83
|
+
});
|
84
|
+
this.periods.push(month);
|
85
|
+
this.periods.sort((a, b) => a.compareTo(b));
|
86
|
+
}
|
87
|
+
start = new Date(start.getTime() + (7 * 24 * 3600000));
|
88
|
+
}
|
89
|
+
this.removeUnusedPeriods();
|
90
|
+
}
|
91
|
+
/**
|
92
|
+
* This function is used to remove forecast periods that have no subperiods.
|
93
|
+
*/
|
94
|
+
removeUnusedPeriods() {
|
95
|
+
for (let p = this.periods.length - 1; p >= 0; p--) {
|
96
|
+
if (this.periods[p].periods.length === 0) {
|
97
|
+
this.periods.splice(p, 1);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
this.periods.sort((a, b) => a.compareTo(b));
|
101
|
+
}
|
102
|
+
/**
|
103
|
+
* This function will move a single sub-period from one month to another adjacent
|
104
|
+
* month.
|
105
|
+
* @param from The date object representing the month period for the giving subperiod.
|
106
|
+
* @param to The date object representing the month period for the receiving subperiod.
|
107
|
+
*/
|
108
|
+
movePeriodBetweenMonths(from, to) {
|
109
|
+
let fromPrd;
|
110
|
+
let toPrd;
|
111
|
+
let fromPos = -1;
|
112
|
+
let toPos = -1;
|
113
|
+
// determine the two periods the sub period will be move from and to.
|
114
|
+
this.periods.sort((a, b) => a.compareTo(b));
|
115
|
+
this.periods.forEach((prd, p) => {
|
116
|
+
if (prd.month.getTime() === from.getTime()) {
|
117
|
+
fromPrd = new period_1.Period(prd);
|
118
|
+
fromPos = p;
|
119
|
+
}
|
120
|
+
else if (prd.month.getTime() === to.getTime()) {
|
121
|
+
toPrd = new period_1.Period(prd);
|
122
|
+
toPos = p;
|
123
|
+
}
|
124
|
+
});
|
125
|
+
// if the to period isn't selected, create a new one for the month prior to 0
|
126
|
+
if (toPos < 0) {
|
127
|
+
toPrd = new period_1.Period({
|
128
|
+
month: to,
|
129
|
+
periods: []
|
130
|
+
});
|
131
|
+
this.periods.push(toPrd);
|
132
|
+
toPos = this.periods.length - 1;
|
133
|
+
}
|
134
|
+
// now sort the subperiod of the from period
|
135
|
+
if (fromPrd && toPrd) {
|
136
|
+
fromPrd.sortSubperiods();
|
137
|
+
if (from.getTime() < to.getTime()) {
|
138
|
+
// when the from period is before the to period
|
139
|
+
// we will pop a period from the end of the list and push it onto the end of
|
140
|
+
// the to period then sort it
|
141
|
+
const sprd = fromPrd.periods.pop();
|
142
|
+
if (sprd) {
|
143
|
+
toPrd.periods.push(new Date(sprd));
|
144
|
+
}
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
// else pull the first sub period and push it to the to period
|
148
|
+
const sprd = fromPrd.periods.shift();
|
149
|
+
if (sprd) {
|
150
|
+
toPrd.periods.push(new Date(sprd));
|
151
|
+
}
|
152
|
+
}
|
153
|
+
toPrd.sortSubperiods();
|
154
|
+
// re-set the from and to periods, then re-sort the periods and remove unused periods.
|
155
|
+
this.periods[fromPos] = fromPrd;
|
156
|
+
this.periods[toPos] = toPrd;
|
157
|
+
this.periods.sort((a, b) => a.compareTo(b));
|
158
|
+
this.removeUnusedPeriods();
|
159
|
+
}
|
160
|
+
}
|
161
|
+
/**
|
162
|
+
* This function adds a sub period to the list of periods where it fits best or add a
|
163
|
+
* new period for the subperiod.
|
164
|
+
* @param dt The date object for the sub period to add
|
165
|
+
*/
|
166
|
+
addOutofCycleSubPeriod(dt) {
|
167
|
+
const periodID = new Date(Date.UTC(dt.getFullYear(), dt.getMonth(), 1));
|
168
|
+
let found = false;
|
169
|
+
this.periods.forEach((prd, p) => {
|
170
|
+
if (prd.month.getTime() === periodID.getTime()) {
|
171
|
+
prd.periods.forEach((sprd, sp) => {
|
172
|
+
if (sprd.getTime() === dt.getTime()) {
|
173
|
+
found = true;
|
174
|
+
}
|
175
|
+
});
|
176
|
+
if (!found) {
|
177
|
+
prd.periods.push(new Date(dt));
|
178
|
+
prd.sortSubperiods();
|
179
|
+
this.periods[p] = prd;
|
180
|
+
}
|
181
|
+
found = true;
|
182
|
+
}
|
183
|
+
});
|
184
|
+
if (!found) {
|
185
|
+
const prd = new period_1.Period({
|
186
|
+
month: periodID
|
187
|
+
});
|
188
|
+
prd.periods.push(new Date(dt));
|
189
|
+
}
|
190
|
+
}
|
191
|
+
/**
|
192
|
+
* This function is used to determine if a forecast report is to be used for a report
|
193
|
+
* date requested.
|
194
|
+
* @param date The date object used for the testing.
|
195
|
+
* @param company The string value for company identifier for the testing.
|
196
|
+
* @returns A boolean value to indicate if the date is between the start and end dates
|
197
|
+
* of this forecast report and is for the company indicated.
|
198
|
+
*/
|
199
|
+
use(date, company) {
|
200
|
+
return (date.getTime() >= this.startDate.getTime()
|
201
|
+
&& date.getTime() <= this.endDate.getTime()
|
202
|
+
&& company.toLowerCase() === this.companyid.toLowerCase());
|
203
|
+
}
|
204
|
+
}
|
205
|
+
exports.Forecast = Forecast;
|
@@ -0,0 +1,20 @@
|
|
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("./cofsReport"), exports);
|
18
|
+
__exportStar(require("./forecast"), exports);
|
19
|
+
__exportStar(require("./period"), exports);
|
20
|
+
__exportStar(require("./section"), exports);
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Period = void 0;
|
4
|
+
class Period {
|
5
|
+
month;
|
6
|
+
periods;
|
7
|
+
constructor(per) {
|
8
|
+
this.month = (per) ? new Date(per.month) : new Date(0);
|
9
|
+
this.periods = [];
|
10
|
+
if (per && per.periods && per.periods.length > 0) {
|
11
|
+
per.periods.forEach(p => {
|
12
|
+
this.periods.push(new Date(p));
|
13
|
+
});
|
14
|
+
per.periods.sort((a, b) => (a.getTime() < b.getTime()) ? -1 : 1);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
compareTo(other) {
|
18
|
+
if (other) {
|
19
|
+
return (this.month.getTime() < other.month.getTime()) ? -1 : 1;
|
20
|
+
}
|
21
|
+
return -1;
|
22
|
+
}
|
23
|
+
sortSubperiods() {
|
24
|
+
this.periods.sort((a, b) => (a.getTime() < b.getTime()) ? -1 : 1);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
exports.Period = Period;
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { Employee } from "../../employees";
|
2
|
+
import { ILaborCode, LaborCode, Workcode } from "../../labor";
|
3
|
+
/**
|
4
|
+
* This interface will define the data members for a report section of a CofS report
|
5
|
+
* definition.
|
6
|
+
*/
|
7
|
+
export interface ISection {
|
8
|
+
id: number;
|
9
|
+
company: string;
|
10
|
+
label: string;
|
11
|
+
signature: string;
|
12
|
+
laborcodes?: ILaborCode[];
|
13
|
+
showunit: boolean;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* This class implements the data members and actions for CofS report sections.
|
17
|
+
*/
|
18
|
+
export declare class Section implements ISection {
|
19
|
+
id: number;
|
20
|
+
company: string;
|
21
|
+
label: string;
|
22
|
+
signature: string;
|
23
|
+
laborcodes: LaborCode[];
|
24
|
+
showunit: boolean;
|
25
|
+
constructor(sec?: ISection);
|
26
|
+
compareTo(other?: Section): number;
|
27
|
+
/**
|
28
|
+
* This function will produce a Certificate of Service report section, which usually
|
29
|
+
* holds the employees and their work hours in respect to the period provided as an
|
30
|
+
* XML output string.
|
31
|
+
* @param start The date object used for the start of the report period.
|
32
|
+
* @param end The date object to mark the end of the period, but not included in the
|
33
|
+
* period.
|
34
|
+
* @param workcodes A mapped list of workcodes to be used in this report.
|
35
|
+
* @param employees A list of employees that may or may not have worked on labor codes
|
36
|
+
* associated with this section.
|
37
|
+
* @param sectionID The numeric value (integer) for the position this section holds
|
38
|
+
* within the overall report file.
|
39
|
+
* @param unit The string value for the unit the report is associated with.
|
40
|
+
* @returns An interface consisting of the xml output for section's data, plus
|
41
|
+
* an array of strings for remarks created during the section creation.
|
42
|
+
*/
|
43
|
+
createReportSection(start: Date, end: Date, workcodes: Map<string, Workcode>, employees: Employee[], sectionID: number, unit: string): {
|
44
|
+
output: string;
|
45
|
+
remarks: string[];
|
46
|
+
};
|
47
|
+
/**
|
48
|
+
* This function will create a CofS Section's employee row data based on the information
|
49
|
+
* provided
|
50
|
+
* @param count The numeric value for the position the employee is in the section list
|
51
|
+
* @param coCount The section identifier, numeric value Section count.
|
52
|
+
* @param emp The employee object for the row of data
|
53
|
+
* @param start The date object representing the start of the report period.
|
54
|
+
* @param end The date object for the end of the report period (not included in report)
|
55
|
+
* @param workcodes A mapped list of the workcodes to be used within the report.
|
56
|
+
* @returns An interface consisting of the xml output for the employee row data, plus
|
57
|
+
* an array of strings for remarks created during the row creation.
|
58
|
+
*/
|
59
|
+
createEmployeeSectionData(count: number, coCount: number, emp: Employee, start: Date, end: Date, workcodes: Map<string, Workcode>): {
|
60
|
+
output: string;
|
61
|
+
remarks: string[];
|
62
|
+
};
|
63
|
+
}
|
@@ -0,0 +1,174 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Section = void 0;
|
4
|
+
const labor_1 = require("../../labor");
|
5
|
+
/**
|
6
|
+
* This class implements the data members and actions for CofS report sections.
|
7
|
+
*/
|
8
|
+
class Section {
|
9
|
+
id;
|
10
|
+
company;
|
11
|
+
label;
|
12
|
+
signature;
|
13
|
+
laborcodes;
|
14
|
+
showunit;
|
15
|
+
constructor(sec) {
|
16
|
+
this.id = (sec) ? sec.id : 0;
|
17
|
+
this.company = (sec) ? sec.company : '';
|
18
|
+
this.label = (sec) ? sec.label : '';
|
19
|
+
this.signature = (sec) ? sec.signature : '';
|
20
|
+
this.showunit = (sec) ? sec.showunit : false;
|
21
|
+
this.laborcodes = [];
|
22
|
+
if (sec && sec.laborcodes && sec.laborcodes.length) {
|
23
|
+
sec.laborcodes.forEach(lc => {
|
24
|
+
this.laborcodes.push(new labor_1.LaborCode(lc));
|
25
|
+
});
|
26
|
+
this.laborcodes.sort((a, b) => a.compareTo(b));
|
27
|
+
}
|
28
|
+
}
|
29
|
+
compareTo(other) {
|
30
|
+
if (other) {
|
31
|
+
return (this.id < other.id) ? -1 : 1;
|
32
|
+
}
|
33
|
+
return -1;
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* This function will produce a Certificate of Service report section, which usually
|
37
|
+
* holds the employees and their work hours in respect to the period provided as an
|
38
|
+
* XML output string.
|
39
|
+
* @param start The date object used for the start of the report period.
|
40
|
+
* @param end The date object to mark the end of the period, but not included in the
|
41
|
+
* period.
|
42
|
+
* @param workcodes A mapped list of workcodes to be used in this report.
|
43
|
+
* @param employees A list of employees that may or may not have worked on labor codes
|
44
|
+
* associated with this section.
|
45
|
+
* @param sectionID The numeric value (integer) for the position this section holds
|
46
|
+
* within the overall report file.
|
47
|
+
* @param unit The string value for the unit the report is associated with.
|
48
|
+
* @returns An interface consisting of the xml output for section's data, plus
|
49
|
+
* an array of strings for remarks created during the section creation.
|
50
|
+
*/
|
51
|
+
createReportSection(start, end, workcodes, employees, sectionID, unit) {
|
52
|
+
const remarks = [];
|
53
|
+
let output = '';
|
54
|
+
output += `<Company${sectionID}>${this.label}</Company${sectionID}>\n`
|
55
|
+
+ `<Section${sectionID}_Lead>${this.signature}</Section${sectionID}_Lead>\n`;
|
56
|
+
if (this.showunit) {
|
57
|
+
output += `<Unit${sectionID}>${unit}</Unit${sectionID}>\n`;
|
58
|
+
}
|
59
|
+
let count = 0;
|
60
|
+
employees.forEach(emp => {
|
61
|
+
if (emp.isActive(start) || emp.isActive(end)) {
|
62
|
+
let hours = 0.0;
|
63
|
+
let bPrimary = false;
|
64
|
+
this.laborcodes.forEach(lc => {
|
65
|
+
hours += emp.getWorkedHours(start, end, lc.chargeNumber, lc.extension);
|
66
|
+
if (emp.isPrimaryCode(start, lc)) {
|
67
|
+
bPrimary = true;
|
68
|
+
}
|
69
|
+
});
|
70
|
+
if (hours > 0.0 || bPrimary) {
|
71
|
+
count++;
|
72
|
+
const result = this.createEmployeeSectionData(count, sectionID, emp, start, end, workcodes);
|
73
|
+
if (result.output !== '') {
|
74
|
+
const lines = result.output.split('\n');
|
75
|
+
lines.forEach(line => {
|
76
|
+
output += `\t${line}\n`;
|
77
|
+
});
|
78
|
+
}
|
79
|
+
if (result.remarks.length > 0) {
|
80
|
+
result.remarks.forEach(rmk => {
|
81
|
+
remarks.push(rmk);
|
82
|
+
});
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
});
|
87
|
+
return { output: output, remarks: remarks };
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* This function will create a CofS Section's employee row data based on the information
|
91
|
+
* provided
|
92
|
+
* @param count The numeric value for the position the employee is in the section list
|
93
|
+
* @param coCount The section identifier, numeric value Section count.
|
94
|
+
* @param emp The employee object for the row of data
|
95
|
+
* @param start The date object representing the start of the report period.
|
96
|
+
* @param end The date object for the end of the report period (not included in report)
|
97
|
+
* @param workcodes A mapped list of the workcodes to be used within the report.
|
98
|
+
* @returns An interface consisting of the xml output for the employee row data, plus
|
99
|
+
* an array of strings for remarks created during the row creation.
|
100
|
+
*/
|
101
|
+
createEmployeeSectionData(count, coCount, emp, start, end, workcodes) {
|
102
|
+
const remarks = [];
|
103
|
+
let output = '';
|
104
|
+
let total = 0.0;
|
105
|
+
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
|
106
|
+
'Nov', 'Dec'];
|
107
|
+
// every employee row starts with name and job title.
|
108
|
+
let label = `NameRow${count}`;
|
109
|
+
if (coCount > 1) {
|
110
|
+
label += `_${coCount}`;
|
111
|
+
}
|
112
|
+
output += `<${label}>${emp.name.getLastFirst()}</${label}>\n`;
|
113
|
+
label = `PositionRow${count}`;
|
114
|
+
if (coCount > 1) {
|
115
|
+
label += `_${coCount}`;
|
116
|
+
}
|
117
|
+
output += `<${label}>${emp.companyinfo.jobtitle}</${label}>\n`;
|
118
|
+
// next add the daily information
|
119
|
+
let current = new Date(Date.UTC(start.getFullYear(), start.getMonth(), start.getDate()));
|
120
|
+
while (current.getTime() < end.getTime()) {
|
121
|
+
let hours = 0.0;
|
122
|
+
label = `Section${coCount}Row${count}_${current.getDate().toString().padStart(2, '0')}`;
|
123
|
+
this.laborcodes.forEach(lc => {
|
124
|
+
hours += emp.getWorkedHours(current, new Date(current.getTime() + (24 * 3600000)), lc.chargeNumber, lc.extension);
|
125
|
+
});
|
126
|
+
if (hours > 0.0) {
|
127
|
+
total += hours;
|
128
|
+
const iHours = Math.floor(hours * 10);
|
129
|
+
const icHours = Math.floor(hours) * 10;
|
130
|
+
if (icHours === iHours) {
|
131
|
+
output += `<${label}>${hours.toFixed(0)}</${label}>\n`;
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
output += `<${label}>${hours.toFixed(1)}</${label}>\n`;
|
135
|
+
}
|
136
|
+
if (hours > 12.0) {
|
137
|
+
const remark = `${this.company.toUpperCase()}: ${emp.name.getFirstLast()} `
|
138
|
+
+ `received a safety briefing for working over 12 hours on `
|
139
|
+
+ `${current.getDate().toString().padStart(2, '0')} ${months[current.getMonth()]}`;
|
140
|
+
remarks.push(remark);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
else {
|
144
|
+
const wd = emp.getWorkday(current, 'actuals', this.laborcodes);
|
145
|
+
if (wd && wd.code !== '') {
|
146
|
+
let wc = workcodes.get(wd.code);
|
147
|
+
if (wc && wc.altcode && wc.altcode !== '') {
|
148
|
+
output += `<${label}>${wc.altcode}</${label}>\n`;
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
output += `<${label}/>\n`;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
else {
|
155
|
+
output += `<${label}/>\n`;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
current = new Date(current.getTime() + (24 * 3600000));
|
159
|
+
}
|
160
|
+
// add total hours information
|
161
|
+
label = `TotalHoursRow${count}`;
|
162
|
+
if (coCount > 1) {
|
163
|
+
label += `_${coCount}`;
|
164
|
+
}
|
165
|
+
output += `<${label}>${total.toFixed(1)}</${label}>\n`;
|
166
|
+
if (total > 200.0) {
|
167
|
+
const remark = `${this.company.toUpperCase()}: ${emp.name.getFirstLast()} exceeded `
|
168
|
+
+ '200 hours to support ops tempo.';
|
169
|
+
remarks.push(remark);
|
170
|
+
}
|
171
|
+
return { output: output, remarks: remarks };
|
172
|
+
}
|
173
|
+
}
|
174
|
+
exports.Section = Section;
|