scheduler-node-models 1.0.78 → 1.0.79
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/package.json +22 -4
- package/general/emailer.d.ts +0 -1
- package/general/emailer.js +0 -31
- package/general/general.d.ts +0 -12
- package/general/general.js +0 -2
- package/general/index.d.ts +0 -4
- package/general/index.js +0 -20
- package/general/report.d.ts +0 -12
- package/general/report.js +0 -70
- package/general/reportStyle.d.ts +0 -0
- package/general/reportStyle.js +0 -1
- package/general/viewstate.d.ts +0 -5
- package/general/viewstate.js +0 -9
- package/index.d.ts +0 -0
- package/metrics/images.d.ts +0 -22
- package/metrics/images.js +0 -33
- package/metrics/index.d.ts +0 -5
- package/metrics/index.js +0 -21
- package/metrics/mission.d.ts +0 -47
- package/metrics/mission.js +0 -81
- package/metrics/missionSensorOutage.d.ts +0 -11
- package/metrics/missionSensorOutage.js +0 -14
- package/metrics/missionsensor.d.ts +0 -67
- package/metrics/missionsensor.js +0 -128
- package/metrics/outage.d.ts +0 -43
- package/metrics/outage.js +0 -55
- package/metrics/reports/drawSummary.d.ts +0 -24
- package/metrics/reports/drawSummary.js +0 -311
- package/metrics/reports/index.d.ts +0 -5
- package/metrics/reports/index.js +0 -21
- package/metrics/reports/missionDay.d.ts +0 -8
- package/metrics/reports/missionDay.js +0 -23
- package/metrics/reports/missionSummary.d.ts +0 -25
- package/metrics/reports/missionSummary.js +0 -421
- package/metrics/reports/missionType.d.ts +0 -20
- package/metrics/reports/missionType.js +0 -314
- package/metrics/reports/outageDay.d.ts +0 -8
- package/metrics/reports/outageDay.js +0 -23
- package/metrics/systemdata/classifications.d.ts +0 -18
- package/metrics/systemdata/classifications.js +0 -23
- package/metrics/systemdata/communications.d.ts +0 -21
- package/metrics/systemdata/communications.js +0 -40
- package/metrics/systemdata/dcgs.d.ts +0 -19
- package/metrics/systemdata/dcgs.js +0 -29
- package/metrics/systemdata/exploitations.d.ts +0 -18
- package/metrics/systemdata/exploitations.js +0 -23
- package/metrics/systemdata/groundSystems.d.ts +0 -86
- package/metrics/systemdata/groundSystems.js +0 -143
- package/metrics/systemdata/index.d.ts +0 -7
- package/metrics/systemdata/index.js +0 -23
- package/metrics/systemdata/platform.d.ts +0 -124
- package/metrics/systemdata/platform.js +0 -176
- package/metrics/systemdata/systeminfo.d.ts +0 -28
- package/metrics/systemdata/systeminfo.js +0 -64
- package/scheduler/employees/assignment.d.ts +0 -139
- package/scheduler/employees/assignment.js +0 -304
- package/scheduler/employees/balance.d.ts +0 -35
- package/scheduler/employees/balance.js +0 -39
- package/scheduler/employees/companyinfo.d.ts +0 -16
- package/scheduler/employees/companyinfo.js +0 -6
- package/scheduler/employees/contact.d.ts +0 -36
- package/scheduler/employees/contact.js +0 -40
- package/scheduler/employees/employee.d.ts +0 -420
- package/scheduler/employees/employee.js +0 -1862
- package/scheduler/employees/employeename.d.ts +0 -48
- package/scheduler/employees/employeename.js +0 -97
- package/scheduler/employees/index.d.ts +0 -14
- package/scheduler/employees/index.js +0 -30
- package/scheduler/employees/labor.d.ts +0 -31
- package/scheduler/employees/labor.js +0 -39
- package/scheduler/employees/leave.d.ts +0 -58
- package/scheduler/employees/leave.js +0 -73
- package/scheduler/employees/leaverequest.d.ts +0 -105
- package/scheduler/employees/leaverequest.js +0 -226
- package/scheduler/employees/specialty.d.ts +0 -35
- package/scheduler/employees/specialty.js +0 -40
- package/scheduler/employees/variation.d.ts +0 -80
- package/scheduler/employees/variation.js +0 -132
- package/scheduler/employees/web.d.ts +0 -6
- package/scheduler/employees/web.js +0 -2
- package/scheduler/employees/work.d.ts +0 -96
- package/scheduler/employees/work.js +0 -133
- package/scheduler/employees/workday.d.ts +0 -91
- package/scheduler/employees/workday.js +0 -170
- package/scheduler/labor/index.d.ts +0 -2
- package/scheduler/labor/index.js +0 -18
- package/scheduler/labor/laborcode.d.ts +0 -33
- package/scheduler/labor/laborcode.js +0 -55
- package/scheduler/labor/workcode.d.ts +0 -28
- package/scheduler/labor/workcode.js +0 -35
- package/scheduler/reports/chargeStatus.d.ts +0 -66
- package/scheduler/reports/chargeStatus.js +0 -702
- package/scheduler/reports/cofsReports.d.ts +0 -11
- package/scheduler/reports/cofsReports.js +0 -36
- package/scheduler/reports/enterpriseSchedule.d.ts +0 -18
- package/scheduler/reports/enterpriseSchedule.js +0 -159
- package/scheduler/reports/index.d.ts +0 -4
- package/scheduler/reports/index.js +0 -20
- package/scheduler/reports/scheduleReport.d.ts +0 -17
- package/scheduler/reports/scheduleReport.js +0 -311
- package/scheduler/sites/index.d.ts +0 -1
- package/scheduler/sites/index.js +0 -17
- package/scheduler/sites/reports/cofsReport.d.ts +0 -41
- package/scheduler/sites/reports/cofsReport.js +0 -104
- package/scheduler/sites/reports/forecast.d.ts +0 -57
- package/scheduler/sites/reports/forecast.js +0 -205
- package/scheduler/sites/reports/index.d.ts +0 -4
- package/scheduler/sites/reports/index.js +0 -20
- package/scheduler/sites/reports/period.d.ts +0 -11
- package/scheduler/sites/reports/period.js +0 -27
- package/scheduler/sites/reports/section.d.ts +0 -63
- package/scheduler/sites/reports/section.js +0 -174
- package/scheduler/sites/site.d.ts +0 -39
- package/scheduler/sites/site.js +0 -61
- package/scheduler/sites/workcenters/index.d.ts +0 -3
- package/scheduler/sites/workcenters/index.js +0 -19
- package/scheduler/sites/workcenters/position.d.ts +0 -27
- package/scheduler/sites/workcenters/position.js +0 -36
- package/scheduler/sites/workcenters/shift.d.ts +0 -32
- package/scheduler/sites/workcenters/shift.js +0 -47
- package/scheduler/sites/workcenters/workcenter.d.ts +0 -43
- package/scheduler/sites/workcenters/workcenter.js +0 -123
- package/scheduler/teams/company/company.d.ts +0 -99
- package/scheduler/teams/company/company.js +0 -256
- package/scheduler/teams/company/holiday.d.ts +0 -55
- package/scheduler/teams/company/holiday.js +0 -108
- package/scheduler/teams/company/index.d.ts +0 -3
- package/scheduler/teams/company/index.js +0 -19
- package/scheduler/teams/company/modperiod.d.ts +0 -21
- package/scheduler/teams/company/modperiod.js +0 -24
- package/scheduler/teams/contact.d.ts +0 -18
- package/scheduler/teams/contact.js +0 -23
- package/scheduler/teams/index.d.ts +0 -3
- package/scheduler/teams/index.js +0 -19
- package/scheduler/teams/specialty.d.ts +0 -18
- package/scheduler/teams/specialty.js +0 -23
- package/scheduler/teams/team.d.ts +0 -95
- package/scheduler/teams/team.js +0 -351
- package/users/index.d.ts +0 -2
- package/users/index.js +0 -18
- package/users/user.d.ts +0 -130
- package/users/user.js +0 -254
- package/users/web.d.ts +0 -22
- package/users/web.js +0 -2
@@ -1,11 +0,0 @@
|
|
1
|
-
import AdmZip from "adm-zip";
|
2
|
-
import { IEmployee } from "../employees";
|
3
|
-
import { Workcode } from "../labor";
|
4
|
-
import { ISite } from "../sites";
|
5
|
-
/**
|
6
|
-
* This report formatter will be used by the application to compile the site's Certificate
|
7
|
-
* of service reports into a single zip file to be passed/downloaded for use.
|
8
|
-
*/
|
9
|
-
export declare class CofSReports {
|
10
|
-
create(isite: ISite, iemployees: IEmployee[], workcodes: Map<string, Workcode>, start: Date): AdmZip;
|
11
|
-
}
|
@@ -1,36 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.CofSReports = void 0;
|
7
|
-
const adm_zip_1 = __importDefault(require("adm-zip"));
|
8
|
-
const employees_1 = require("../employees");
|
9
|
-
const sites_1 = require("../sites");
|
10
|
-
/**
|
11
|
-
* This report formatter will be used by the application to compile the site's Certificate
|
12
|
-
* of service reports into a single zip file to be passed/downloaded for use.
|
13
|
-
*/
|
14
|
-
class CofSReports {
|
15
|
-
create(isite, iemployees, workcodes, start) {
|
16
|
-
const zip = new adm_zip_1.default();
|
17
|
-
const startDate = new Date(Date.UTC(start.getFullYear(), start.getMonth(), 1));
|
18
|
-
const endDate = new Date(Date.UTC(start.getFullYear(), start.getMonth() + 1, 1));
|
19
|
-
const site = new sites_1.Site(isite);
|
20
|
-
const employees = [];
|
21
|
-
iemployees.forEach(iEmp => {
|
22
|
-
const emp = new employees_1.Employee(iEmp);
|
23
|
-
if (emp.atSite(site.id, startDate, endDate)) {
|
24
|
-
employees.push(emp);
|
25
|
-
}
|
26
|
-
});
|
27
|
-
site.cofs.forEach(async (cofs) => {
|
28
|
-
if (cofs.use(startDate, endDate)) {
|
29
|
-
const file = cofs.create(startDate, endDate, workcodes, employees);
|
30
|
-
await zip.addFile(file.name, Buffer.from(await file.arrayBuffer()));
|
31
|
-
}
|
32
|
-
});
|
33
|
-
return zip;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
exports.CofSReports = CofSReports;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import { Workbook, Worksheet } from "exceljs";
|
2
|
-
import { Report } from "../../general";
|
3
|
-
import { User } from "../../users";
|
4
|
-
import { Workcode } from "../labor";
|
5
|
-
import { Employee, IEmployee } from "../employees";
|
6
|
-
export declare class EnterpriseSchedule extends Report {
|
7
|
-
private fonts;
|
8
|
-
private fills;
|
9
|
-
private borders;
|
10
|
-
private alignments;
|
11
|
-
private workcodes;
|
12
|
-
constructor(workcodes: Map<string, Workcode>);
|
13
|
-
create(user: User, year: number, site: string, iEmps: IEmployee[]): Workbook;
|
14
|
-
createStyles(): void;
|
15
|
-
addMonth(workbook: Workbook, start: Date, site: string, iEmps: IEmployee[]): void;
|
16
|
-
createEmployeeRow(sheet: Worksheet, start: Date, end: Date, row: number, emp: Employee): void;
|
17
|
-
getDateValue(code: string, hours: number): string;
|
18
|
-
}
|
@@ -1,159 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.EnterpriseSchedule = void 0;
|
4
|
-
const exceljs_1 = require("exceljs");
|
5
|
-
const general_1 = require("../../general");
|
6
|
-
const employees_1 = require("../employees");
|
7
|
-
class EnterpriseSchedule extends general_1.Report {
|
8
|
-
fonts;
|
9
|
-
fills;
|
10
|
-
borders;
|
11
|
-
alignments;
|
12
|
-
workcodes;
|
13
|
-
constructor(workcodes) {
|
14
|
-
super();
|
15
|
-
this.fonts = new Map();
|
16
|
-
this.fills = new Map();
|
17
|
-
this.borders = new Map();
|
18
|
-
this.alignments = new Map();
|
19
|
-
this.workcodes = workcodes;
|
20
|
-
}
|
21
|
-
create(user, year, site, iEmps) {
|
22
|
-
const workbook = new exceljs_1.Workbook();
|
23
|
-
workbook.creator = user.getFullName();
|
24
|
-
workbook.created = new Date();
|
25
|
-
this.createStyles();
|
26
|
-
let start = new Date(Date.UTC(year, 0, 1));
|
27
|
-
const end = new Date(Date.UTC(year, 11, 31, 59, 59, 59));
|
28
|
-
while (start.getTime() < end.getTime()) {
|
29
|
-
this.addMonth(workbook, start, site, iEmps);
|
30
|
-
start = new Date(Date.UTC(start.getFullYear(), start.getMonth() + 1, 1));
|
31
|
-
}
|
32
|
-
const sheet = workbook.getWorksheet('Sheet1');
|
33
|
-
if (sheet) {
|
34
|
-
workbook.removeWorksheet(sheet.id);
|
35
|
-
}
|
36
|
-
return workbook;
|
37
|
-
}
|
38
|
-
createStyles() {
|
39
|
-
// set fonts
|
40
|
-
this.fonts.set("bold11", { bold: true, size: 11, color: { argb: 'ff000000' } });
|
41
|
-
this.fonts.set("bold11white", { bold: true, size: 11, color: { argb: 'ffffffff' } });
|
42
|
-
// set fills
|
43
|
-
this.fills.set('evenday', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffc0c0c0' } });
|
44
|
-
this.fills.set('weekend', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffccffff' } });
|
45
|
-
this.fills.set('evenend', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ff00e6e6' } });
|
46
|
-
this.fills.set('weekday', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffffffff' } });
|
47
|
-
this.fills.set('month', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ffde5d12' } });
|
48
|
-
this.fills.set('wkctr', { type: 'pattern', pattern: 'solid', fgColor: { argb: 'ff000000' } });
|
49
|
-
// set borders
|
50
|
-
this.borders.set('blackthin', {
|
51
|
-
top: { style: 'thin', color: { argb: 'ff000000' } },
|
52
|
-
left: { style: 'thin', color: { argb: 'ff000000' } },
|
53
|
-
bottom: { style: 'thin', color: { argb: 'ff000000' } },
|
54
|
-
right: { style: 'thin', color: { argb: 'ff000000' } }
|
55
|
-
});
|
56
|
-
// set alignments
|
57
|
-
this.alignments.set('center', { horizontal: 'center', vertical: 'middle', wrapText: true });
|
58
|
-
}
|
59
|
-
addMonth(workbook, start, site, iEmps) {
|
60
|
-
const startDate = new Date(Date.UTC(start.getFullYear(), start.getMonth(), 1));
|
61
|
-
const endDate = new Date(Date.UTC(start.getFullYear(), start.getMonth() + 1, 1));
|
62
|
-
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
|
63
|
-
'Nov', 'Dec'];
|
64
|
-
const weekdays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
65
|
-
const sheetLabel = `${months[startDate.getMonth()]}`
|
66
|
-
+ `${startDate.getFullYear().toString().substring(2)}`;
|
67
|
-
const employees = [];
|
68
|
-
iEmps.forEach(iEmp => {
|
69
|
-
const emp = new employees_1.Employee(iEmp);
|
70
|
-
if (emp.atSite(site, startDate, endDate)) {
|
71
|
-
employees.push(emp);
|
72
|
-
}
|
73
|
-
});
|
74
|
-
employees.sort((a, b) => a.compareTo(b));
|
75
|
-
// add a worksheet to the workbook and set the page options (landscape, etc)
|
76
|
-
const sheet = workbook.addWorksheet(sheetLabel, {
|
77
|
-
pageSetup: {
|
78
|
-
paperSize: undefined,
|
79
|
-
orientation: 'landscape',
|
80
|
-
fitToHeight: 1,
|
81
|
-
fitToWidth: 1,
|
82
|
-
blackAndWhite: false,
|
83
|
-
fitToPage: true,
|
84
|
-
showGridLines: false,
|
85
|
-
horizontalCentered: true,
|
86
|
-
verticalCentered: true
|
87
|
-
}
|
88
|
-
});
|
89
|
-
sheet.properties.defaultColWidth = 5.0;
|
90
|
-
sheet.properties.defaultRowHeight = 20;
|
91
|
-
// set the widths of the columns: 1 = 17.0 and the rest are 4.0
|
92
|
-
let current = new Date(startDate);
|
93
|
-
sheet.getColumn(1).width = 17.0;
|
94
|
-
while (current.getTime() < endDate.getTime()) {
|
95
|
-
sheet.getColumn(current.getDate() + 1).width = 4.0;
|
96
|
-
current = new Date(current.getTime() + (24 * 3600000));
|
97
|
-
}
|
98
|
-
// label the first three rows with data
|
99
|
-
let style = {
|
100
|
-
border: this.borders.get('blackthin'),
|
101
|
-
fill: this.fills.get('weekday'),
|
102
|
-
font: this.fonts.get('bold11'),
|
103
|
-
alignment: this.alignments.get('center')
|
104
|
-
};
|
105
|
-
current = new Date(startDate);
|
106
|
-
while (current.getTime() < endDate.getTime()) {
|
107
|
-
this.setCell(sheet, this.getCellID(current.getDate(), 1), this.getCellID(current.getDate(), 1), style, months[current.getMonth()]);
|
108
|
-
this.setCell(sheet, this.getCellID(current.getDate(), 2), this.getCellID(current.getDate(), 2), style, weekdays[current.getDay()]);
|
109
|
-
this.setCell(sheet, this.getCellID(current.getDate(), 3), this.getCellID(current.getDate(), 3), style, current.getDate());
|
110
|
-
current = new Date(current.getTime() + (24 * 3600000));
|
111
|
-
}
|
112
|
-
let row = 3;
|
113
|
-
employees.forEach(emp => {
|
114
|
-
row++;
|
115
|
-
this.createEmployeeRow(sheet, startDate, endDate, row, emp);
|
116
|
-
});
|
117
|
-
}
|
118
|
-
createEmployeeRow(sheet, start, end, row, emp) {
|
119
|
-
let style = {
|
120
|
-
border: this.borders.get('blackthin'),
|
121
|
-
fill: this.fills.get('weekday'),
|
122
|
-
font: this.fonts.get('bold11'),
|
123
|
-
alignment: this.alignments.get('center')
|
124
|
-
};
|
125
|
-
this.setCell(sheet, this.getCellID(0, row), this.getCellID(0, row), style, emp.name.getFirstLast());
|
126
|
-
let current = new Date(start);
|
127
|
-
while (current.getTime() < end.getTime()) {
|
128
|
-
const wd = emp.getWorkday(current, 'general');
|
129
|
-
const cell = this.getCellID(current.getDate(), row);
|
130
|
-
let code = '';
|
131
|
-
if (wd && wd.code !== '') {
|
132
|
-
code = this.getDateValue(wd.code, wd.hours);
|
133
|
-
}
|
134
|
-
this.setCell(sheet, cell, cell, style, code);
|
135
|
-
current = new Date(current.getTime() + (24 * 3600000));
|
136
|
-
}
|
137
|
-
}
|
138
|
-
getDateValue(code, hours) {
|
139
|
-
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
140
|
-
let answer = '';
|
141
|
-
if (code !== '') {
|
142
|
-
const wc = this.workcodes.get(code);
|
143
|
-
if (wc) {
|
144
|
-
if (wc.isLeave && wc.altcode) {
|
145
|
-
answer = wc.altcode;
|
146
|
-
}
|
147
|
-
else if (!wc.isLeave) {
|
148
|
-
answer = wc.start.toString().padStart(2, '0');
|
149
|
-
const iHours = Math.floor(hours);
|
150
|
-
if (iHours > 0) {
|
151
|
-
answer += letters.substring(iHours - 1, iHours);
|
152
|
-
}
|
153
|
-
}
|
154
|
-
}
|
155
|
-
}
|
156
|
-
return answer;
|
157
|
-
}
|
158
|
-
}
|
159
|
-
exports.EnterpriseSchedule = EnterpriseSchedule;
|
@@ -1,20 +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("./cofsReports"), exports);
|
18
|
-
__exportStar(require("./enterpriseSchedule"), exports);
|
19
|
-
__exportStar(require("./scheduleReport"), exports);
|
20
|
-
__exportStar(require("./chargeStatus"), exports);
|
@@ -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';
|
package/scheduler/sites/index.js
DELETED
@@ -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
|
-
}
|