scheduler-node-models 1.0.154 → 1.0.155
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
@@ -28,7 +28,7 @@ export interface IEmployee {
|
|
28
28
|
companyinfo: ICompanyInfo;
|
29
29
|
assignments?: IAssignment[];
|
30
30
|
variations?: IVariation[];
|
31
|
-
|
31
|
+
balances?: IAnnualLeave[];
|
32
32
|
leaves?: ILeave[];
|
33
33
|
requests?: ILeaveRequest[];
|
34
34
|
laborCodes?: IEmployeeLaborCode[];
|
@@ -47,7 +47,7 @@ export declare class Employee implements IEmployee {
|
|
47
47
|
companyinfo: ICompanyInfo;
|
48
48
|
assignments: Assignment[];
|
49
49
|
variations: Variation[];
|
50
|
-
|
50
|
+
balances: AnnualLeave[];
|
51
51
|
leaves: Leave[];
|
52
52
|
requests: LeaveRequest[];
|
53
53
|
laborCodes: EmployeeLaborCode[];
|
@@ -23,7 +23,7 @@ class Employee {
|
|
23
23
|
companyinfo;
|
24
24
|
assignments;
|
25
25
|
variations;
|
26
|
-
|
26
|
+
balances;
|
27
27
|
leaves;
|
28
28
|
requests;
|
29
29
|
laborCodes;
|
@@ -56,12 +56,12 @@ class Employee {
|
|
56
56
|
});
|
57
57
|
this.variations.sort((a, b) => a.compareTo(b));
|
58
58
|
}
|
59
|
-
this.
|
60
|
-
if (emp && emp.
|
61
|
-
emp.
|
62
|
-
this.
|
59
|
+
this.balances = [];
|
60
|
+
if (emp && emp.balances && emp.balances.length > 0) {
|
61
|
+
emp.balances.forEach(b => {
|
62
|
+
this.balances.push(new balance_1.AnnualLeave(b));
|
63
63
|
});
|
64
|
-
this.
|
64
|
+
this.balances.sort((a, b) => a.compareTo(b));
|
65
65
|
}
|
66
66
|
this.leaves = [];
|
67
67
|
if (emp && emp.leaves && emp.leaves.length > 0) {
|
@@ -182,10 +182,10 @@ class Employee {
|
|
182
182
|
}
|
183
183
|
}
|
184
184
|
// purge old leave balances
|
185
|
-
this.
|
186
|
-
for (let b = this.
|
187
|
-
if (this.
|
188
|
-
this.
|
185
|
+
this.balances.sort((a, b) => a.compareTo(b));
|
186
|
+
for (let b = this.balances.length - 1; b >= 0; b--) {
|
187
|
+
if (this.balances[b].year < date.getUTCFullYear()) {
|
188
|
+
this.balances.splice(b, 1);
|
189
189
|
}
|
190
190
|
}
|
191
191
|
// return as to whether the employee quit before date
|
@@ -880,7 +880,7 @@ class Employee {
|
|
880
880
|
let found = false;
|
881
881
|
let lastAnnual = 0.0;
|
882
882
|
let lastCarry = 0.0;
|
883
|
-
this.
|
883
|
+
this.balances.forEach(bal => {
|
884
884
|
if (bal.year === year) {
|
885
885
|
found = true;
|
886
886
|
}
|
@@ -908,8 +908,8 @@ class Employee {
|
|
908
908
|
});
|
909
909
|
bal.carryover = carry;
|
910
910
|
}
|
911
|
-
this.
|
912
|
-
this.
|
911
|
+
this.balances.push(bal);
|
912
|
+
this.balances.sort((a, b) => a.compareTo(b));
|
913
913
|
}
|
914
914
|
}
|
915
915
|
/**
|
@@ -922,10 +922,10 @@ class Employee {
|
|
922
922
|
*/
|
923
923
|
updateLeaveBalance(year, annual, carry) {
|
924
924
|
let found = false;
|
925
|
-
for (let lb = 0; lb < this.
|
926
|
-
if (this.
|
927
|
-
this.
|
928
|
-
this.
|
925
|
+
for (let lb = 0; lb < this.balances.length && !found; lb++) {
|
926
|
+
if (this.balances[lb].year === year) {
|
927
|
+
this.balances[lb].annual = annual;
|
928
|
+
this.balances[lb].carryover = carry;
|
929
929
|
}
|
930
930
|
}
|
931
931
|
if (!found) {
|
@@ -934,9 +934,9 @@ class Employee {
|
|
934
934
|
annual: annual,
|
935
935
|
carryover: carry
|
936
936
|
});
|
937
|
-
this.
|
937
|
+
this.balances.push(lb);
|
938
938
|
}
|
939
|
-
this.
|
939
|
+
this.balances.sort((a, b) => a.compareTo(b));
|
940
940
|
}
|
941
941
|
/**
|
942
942
|
* This function will remove a leave balance from the employee's leave balance list.
|
@@ -944,13 +944,13 @@ class Employee {
|
|
944
944
|
*/
|
945
945
|
deleteLeaveBalance(year) {
|
946
946
|
let found = -1;
|
947
|
-
this.
|
947
|
+
this.balances.forEach((bal, i) => {
|
948
948
|
if (bal.year === year) {
|
949
949
|
found = i;
|
950
950
|
}
|
951
951
|
});
|
952
952
|
if (found >= 0) {
|
953
|
-
this.
|
953
|
+
this.balances.splice(found, 1);
|
954
954
|
}
|
955
955
|
}
|
956
956
|
/**
|
@@ -212,11 +212,7 @@ class LeaveReport extends general_1.Report {
|
|
212
212
|
employeePTOHolidaySection(sheet, emp, row, year, showHoliday) {
|
213
213
|
let annual = 0.0;
|
214
214
|
let carry = 0.0;
|
215
|
-
|
216
|
-
console.log(JSON.stringify(emp.balance));
|
217
|
-
}
|
218
|
-
emp.balance.forEach(bal => {
|
219
|
-
console.log(JSON.stringify(bal));
|
215
|
+
emp.balances.forEach(bal => {
|
220
216
|
if (bal.year === year) {
|
221
217
|
annual = bal.annual;
|
222
218
|
carry = bal.carryover;
|