scheduler-node-models 1.0.90 → 1.0.92

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scheduler-node-models",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -12,7 +12,7 @@ import { ISpecialty, Specialty } from "./specialty";
12
12
  import { ILeave, Leave } from "./leave";
13
13
  import { Workday } from "./workday";
14
14
  import { AnnualLeave, IAnnualLeave } from "./balance";
15
- import { CompareWorkCode, Workcode } from '../labor/workcode';
15
+ import { Workcode } from '../labor/workcode';
16
16
  import { ChangeLeaveRequestResponse } from "./web";
17
17
  import { LaborCode } from "../labor/laborcode";
18
18
  /**
@@ -217,7 +217,7 @@ export declare class Employee implements IEmployee {
217
217
  * whether or not they are leave codes.
218
218
  * @returns A numeric (float) value for the number of hours the employee is forecast.
219
219
  */
220
- getForecastHours(labor: LaborCode, start: Date, end: Date, codes: CompareWorkCode[]): number;
220
+ getForecastHours(labor: LaborCode, start: Date, end: Date, codes: Map<string, Workcode>): number;
221
221
  /**************************************************************************************
222
222
  * Work Records section
223
223
  **************************************************************************************/
@@ -763,7 +763,7 @@ class Employee {
763
763
  // 2) see if they were supposed to be working on this
764
764
  // date, compare workday code to workcodes to ensure
765
765
  // they weren't on leave. If not on leave, add
766
- // standard work day.
766
+ // assigned hours.
767
767
  let current = new Date(start);
768
768
  while (current.getTime() <= end.getTime()) {
769
769
  if (current.getTime() > lastWorked.getTime()) {
@@ -775,11 +775,10 @@ class Employee {
775
775
  const wd = this.getWorkday(current);
776
776
  if (wd && wd.code !== '') {
777
777
  codes.forEach(code => {
778
- if (code.code.toLowerCase() === wd.code.toLowerCase() && !code.isLeave) {
779
- const std = this.getStandardWorkday(current);
778
+ if (code.id.toLowerCase() === wd.code.toLowerCase() && !code.isLeave) {
780
779
  this.assignments.forEach(asgmt => {
781
780
  if (asgmt.useAssignment(current, nextday, labor)) {
782
- answer += std;
781
+ answer += wd.hours;
783
782
  }
784
783
  });
785
784
  }
@@ -1,7 +1,7 @@
1
1
  import { Workbook, Worksheet } from "exceljs";
2
2
  import { Report } from "../../general";
3
3
  import { ISite } from "../sites";
4
- import { CompareWorkCode, IWorkcode, LaborCode } from "../labor";
4
+ import { IWorkcode, LaborCode, Workcode } from "../labor";
5
5
  import { Employee, IEmployee } from "../employees";
6
6
  import { User } from "../../users";
7
7
  import { Forecast } from "../sites/reports";
@@ -51,10 +51,10 @@ export declare class ChargeStatusReport extends Report {
51
51
  * used in constructing the employee's row.
52
52
  * @param current The boolean value which signifies whether only actual work performed
53
53
  * or add in forecast work hours in this report sheet.
54
- * @param compare A short workcode array, used to determine leaves and other non-work
54
+ * @param compare A map of workcode array, used to determine leaves and other non-work
55
55
  * periods.
56
56
  */
57
- employeeRow(sheet: Worksheet, lCode: LaborCode, row: number, emp: Employee, report: Forecast, current: boolean, compare: CompareWorkCode[]): number;
57
+ employeeRow(sheet: Worksheet, lCode: LaborCode, row: number, emp: Employee, report: Forecast, current: boolean, compare: Map<string, Workcode>): number;
58
58
  /**
59
59
  * This function will create the statistics page for the cover of the workbook, which
60
60
  * will hold all the formulas for overall labor usage.
@@ -279,13 +279,6 @@ class ChargeStatusReport extends general_1.Report {
279
279
  // create list of leave and work codes for comparison to determine working or
280
280
  // not working criteria
281
281
  let row = 4;
282
- const compareCodes = [];
283
- this.workcodes.forEach(wc => {
284
- compareCodes.push({
285
- code: wc.id,
286
- isLeave: wc.isLeave
287
- });
288
- });
289
282
  let column = 0;
290
283
  // this report is listed by labor code, then employees with hours
291
284
  report.laborCodes.forEach(lCode => {
@@ -294,14 +287,14 @@ class ChargeStatusReport extends general_1.Report {
294
287
  employees.forEach(emp => {
295
288
  // employee has used this labor code, if they have some actual or forecast hours.
296
289
  const actual = emp.getWorkedHours(report.startDate, report.endDate, lCode.chargeNumber, lCode.extension);
297
- const forecast = emp.getForecastHours(lCode, report.startDate, report.endDate, compareCodes);
290
+ const forecast = emp.getForecastHours(lCode, report.startDate, report.endDate, this.workcodes);
298
291
  if (actual > 0 || forecast > 0) {
299
292
  console.log(`${emp.name.lastname} = ${actual} - ${forecast}`);
300
293
  row++;
301
294
  if (emp.getLastWorkday().getTime() > lastWorked.getTime()) {
302
295
  lastWorked = new Date(emp.getLastWorkday());
303
296
  }
304
- const col = this.employeeRow(sheet, lCode, row, emp, report, current, compareCodes);
297
+ const col = this.employeeRow(sheet, lCode, row, emp, report, current, this.workcodes);
305
298
  if (col > column) {
306
299
  column = col;
307
300
  }
@@ -433,7 +426,7 @@ class ChargeStatusReport extends general_1.Report {
433
426
  * used in constructing the employee's row.
434
427
  * @param current The boolean value which signifies whether only actual work performed
435
428
  * or add in forecast work hours in this report sheet.
436
- * @param compare A short workcode array, used to determine leaves and other non-work
429
+ * @param compare A map of workcode array, used to determine leaves and other non-work
437
430
  * periods.
438
431
  */
439
432
  employeeRow(sheet, lCode, row, emp, report, current, compare) {
@@ -528,7 +521,7 @@ class ChargeStatusReport extends general_1.Report {
528
521
  if (last.getTime() > lastWorked.getTime()) {
529
522
  style.font = this.fonts.get('blue12');
530
523
  }
531
- hours += emp.getForecastHours(lCode, first, new Date(last.getTime() + (24 * 3600000)), compare);
524
+ hours += emp.getForecastHours(lCode, first, new Date(last.getTime() + (24 * 3600000)), this.workcodes);
532
525
  }
533
526
  let cellID = this.getCellID(column, row);
534
527
  this.setCell(sheet, cellID, cellID, style, hours);