scheduler-node-models 1.0.99 → 1.0.101

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.99",
3
+ "version": "1.0.101",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -92,9 +92,9 @@ class Assignment {
92
92
  let answer = false;
93
93
  if (labor && date2) {
94
94
  this.laborcodes.forEach(lc => {
95
- console.log(`${labor.chargeNumber} ${lc.chargeNumber} & ${labor.extension === lc.extension}`);
96
- if (labor.chargeNumber && lc.chargeNumber && labor.extension && lc.extension) {
97
- if (labor.chargeNumber.toLowerCase() === lc.chargeNumber.toLowerCase()
95
+ console.log(`${labor.chargeNumber} ${lc.chargenumber} & ${labor.extension === lc.extension}`);
96
+ if (labor.chargeNumber && lc.chargenumber && labor.extension && lc.extension) {
97
+ if (labor.chargeNumber.toLowerCase() === lc.chargenumber.toLowerCase()
98
98
  && labor.extension.toLowerCase() === lc.extension.toLowerCase()
99
99
  && date.getTime() <= this.endDate.getTime()
100
100
  && date2.getTime() >= this.startDate.getTime()) {
@@ -268,7 +268,7 @@ class Assignment {
268
268
  // first check to see if the charge number and extension is listed in this assignment.
269
269
  let found = false;
270
270
  for (let l = 0; l < this.laborcodes.length && !found; l++) {
271
- if (this.laborcodes[l].chargeNumber.toLowerCase() === chgno.toLowerCase()
271
+ if (this.laborcodes[l].chargenumber.toLowerCase() === chgno.toLowerCase()
272
272
  && this.laborcodes[l].extension.toLowerCase() === ext.toLowerCase()) {
273
273
  found = true;
274
274
  }
@@ -276,7 +276,7 @@ class Assignment {
276
276
  // if not found, add it as an employee labor code object.
277
277
  if (!found) {
278
278
  this.laborcodes.push(new labor_1.EmployeeLaborCode({
279
- chargeNumber: chgno,
279
+ chargenumber: chgno,
280
280
  extension: ext
281
281
  }));
282
282
  this.laborcodes.sort((a, b) => a.compareTo(b));
@@ -291,7 +291,7 @@ class Assignment {
291
291
  removeLaborCode(chgno, ext) {
292
292
  let found = -1;
293
293
  for (let l = 0; l < this.laborcodes.length && !found; l++) {
294
- if (this.laborcodes[l].chargeNumber.toLowerCase() === chgno.toLowerCase()
294
+ if (this.laborcodes[l].chargenumber.toLowerCase() === chgno.toLowerCase()
295
295
  && this.laborcodes[l].extension.toLowerCase() === ext.toLowerCase()) {
296
296
  found = l;
297
297
  }
@@ -417,7 +417,7 @@ class Employee {
417
417
  wday = asgmt.getWorkday(date);
418
418
  labor?.forEach(lc => {
419
419
  asgmt.laborcodes.forEach(alc => {
420
- if (lc.chargeNumber.toLowerCase() === alc.chargeNumber.toLowerCase()
420
+ if (lc.chargenumber.toLowerCase() === alc.chargenumber.toLowerCase()
421
421
  && lc.extension.toLowerCase() === alc.extension.toLowerCase()) {
422
422
  bPrimary = true;
423
423
  }
@@ -613,7 +613,7 @@ class Employee {
613
613
  this.assignments.forEach(asgmt => {
614
614
  if (asgmt.useAssignment(date)) {
615
615
  asgmt.laborcodes.forEach(lc => {
616
- if (labor.chargeNumber.toLowerCase() === lc.chargeNumber.toLowerCase()
616
+ if (labor.chargenumber.toLowerCase() === lc.chargenumber.toLowerCase()
617
617
  && labor.extension.toLowerCase() === lc.extension.toLowerCase()) {
618
618
  answer = true;
619
619
  }
@@ -632,7 +632,7 @@ class Employee {
632
632
  let found = false;
633
633
  this.assignments.forEach(asgmt => {
634
634
  asgmt.laborcodes.forEach(lc => {
635
- if (lc.chargeNumber.toLowerCase() === chargeNumber.toLowerCase()
635
+ if (lc.chargenumber.toLowerCase() === chargeNumber.toLowerCase()
636
636
  && lc.extension.toLowerCase() === extension.toLowerCase()) {
637
637
  found = true;
638
638
  }
@@ -653,7 +653,7 @@ class Employee {
653
653
  this.assignments.forEach(asgmt => {
654
654
  if (asgmt.useAssignment(date)) {
655
655
  asgmt.laborcodes.forEach(lc => {
656
- if (lc.chargeNumber.toLowerCase() === chgNo.toLowerCase()
656
+ if (lc.chargenumber.toLowerCase() === chgNo.toLowerCase()
657
657
  && lc.extension.toLowerCase() === ext.toLowerCase()) {
658
658
  found = true;
659
659
  }
@@ -730,9 +730,6 @@ class Employee {
730
730
  end = new Date(Date.UTC(end.getFullYear(), end.getMonth(), end.getDate()));
731
731
  // Check for assignment during period
732
732
  let found = false;
733
- if (this.name.lastname.toLowerCase() === 'erne') {
734
- console.log(`${start} - ${end} - ${JSON.stringify(labor)}`);
735
- }
736
733
  this.assignments.forEach(asgmt => {
737
734
  if (asgmt.useAssignment(start, end, labor)) {
738
735
  found = true;
@@ -741,18 +738,12 @@ class Employee {
741
738
  if (!found) {
742
739
  return 0.0;
743
740
  }
744
- if (this.name.lastname.toLowerCase() === 'erne') {
745
- console.log('use assignment');
746
- }
747
741
  // check if labor code is applicable during period
748
742
  if (!labor.startDate || !labor.endDate
749
743
  || labor.endDate.getTime() < start.getTime()
750
744
  || labor.startDate.getTime() > end.getTime()) {
751
745
  return 0.0;
752
746
  }
753
- if (this.name.lastname.toLowerCase() === 'erne') {
754
- console.log('labor code');
755
- }
756
747
  // determine last worked day from work records
757
748
  let lastWorked = new Date(0);
758
749
  if (this.work && this.work.length > 0) {
@@ -766,9 +757,6 @@ class Employee {
766
757
  lastWorked = new Date(lv.leavedate);
767
758
  }
768
759
  });
769
- if (this.name.lastname.toLowerCase() === 'erne') {
770
- console.log('lastWorked');
771
- }
772
760
  // now step through the days of the period to:
773
761
  // 1) see if they had worked any charge numbers during
774
762
  // the period, if working add 0 hours
@@ -785,7 +773,6 @@ class Employee {
785
773
  if (current.getTime() >= labor.startDate.getTime()
786
774
  && current.getTime() <= labor.endDate.getTime()) {
787
775
  const wd = this.getWorkday(current);
788
- console.log(JSON.stringify(wd));
789
776
  if (wd && wd.code !== '') {
790
777
  codes.forEach(code => {
791
778
  if (code.id.toLowerCase() === wd.code.toLowerCase() && !code.isLeave) {
@@ -800,6 +787,7 @@ class Employee {
800
787
  }
801
788
  }
802
789
  }
790
+ current = new Date(current.getTime() + (24 * 3600000));
803
791
  }
804
792
  return answer;
805
793
  }
@@ -7,7 +7,7 @@
7
7
  * This interface will be used to assign an employee a labor code.
8
8
  */
9
9
  export interface IEmployeeLaborCode {
10
- chargeNumber: string;
10
+ chargenumber: string;
11
11
  extension: string;
12
12
  }
13
13
  /**
@@ -16,7 +16,7 @@ export interface IEmployeeLaborCode {
16
16
  * extension (string value to entend the charge number to specific work assignments)
17
17
  */
18
18
  export declare class EmployeeLaborCode implements IEmployeeLaborCode {
19
- chargeNumber: string;
19
+ chargenumber: string;
20
20
  extension: string;
21
21
  constructor(elc?: IEmployeeLaborCode);
22
22
  /**
@@ -12,10 +12,10 @@ exports.EmployeeLaborCode = void 0;
12
12
  * extension (string value to entend the charge number to specific work assignments)
13
13
  */
14
14
  class EmployeeLaborCode {
15
- chargeNumber;
15
+ chargenumber;
16
16
  extension;
17
17
  constructor(elc) {
18
- this.chargeNumber = (elc) ? elc.chargeNumber : '';
18
+ this.chargenumber = (elc) ? elc.chargenumber : '';
19
19
  this.extension = (elc) ? elc.extension : '';
20
20
  }
21
21
  /**
@@ -28,10 +28,10 @@ class EmployeeLaborCode {
28
28
  */
29
29
  compareTo(other) {
30
30
  if (other) {
31
- if (this.chargeNumber === other.chargeNumber) {
31
+ if (this.chargenumber === other.chargenumber) {
32
32
  return (this.extension < other.extension) ? -1 : 1;
33
33
  }
34
- return (this.chargeNumber < other.chargeNumber) ? -1 : 1;
34
+ return (this.chargenumber < other.chargenumber) ? -1 : 1;
35
35
  }
36
36
  return -1;
37
37
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Section = void 0;
4
+ const employees_1 = require("../../employees");
4
5
  const labor_1 = require("../../labor");
5
6
  /**
6
7
  * This class implements the data members and actions for CofS report sections.
@@ -63,7 +64,9 @@ class Section {
63
64
  let bPrimary = false;
64
65
  this.laborcodes.forEach(lc => {
65
66
  hours += emp.getWorkedHours(start, end, lc.chargeNumber, lc.extension);
66
- if (emp.isPrimaryCode(start, lc)) {
67
+ if (emp.isPrimaryCode(start, new employees_1.EmployeeLaborCode({
68
+ chargenumber: lc.chargeNumber, extension: lc.extension
69
+ }))) {
67
70
  bPrimary = true;
68
71
  }
69
72
  });
@@ -99,6 +102,12 @@ class Section {
99
102
  * an array of strings for remarks created during the row creation.
100
103
  */
101
104
  createEmployeeSectionData(count, coCount, emp, start, end, workcodes) {
105
+ const empLaborCodes = [];
106
+ this.laborcodes.forEach(lc => {
107
+ empLaborCodes.push(new employees_1.EmployeeLaborCode({ chargenumber: lc.chargeNumber,
108
+ extension: lc.extension
109
+ }));
110
+ });
102
111
  const remarks = [];
103
112
  let output = '';
104
113
  let total = 0.0;
@@ -141,7 +150,7 @@ class Section {
141
150
  }
142
151
  }
143
152
  else {
144
- const wd = emp.getWorkday(current, 'actuals', this.laborcodes);
153
+ const wd = emp.getWorkday(current, 'actuals', empLaborCodes);
145
154
  if (wd && wd.code !== '') {
146
155
  let wc = workcodes.get(wd.code);
147
156
  if (wc && wc.altcode && wc.altcode !== '') {