fixed cron job
This commit is contained in:
parent
d093953fbe
commit
5ea111a3c5
1 changed files with 202 additions and 78 deletions
|
|
@ -84,19 +84,31 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _position.slice(1).map((curr: any, index: number) => ({
|
? _position.slice(1).map((curr: any, index: number) => ({
|
||||||
positionName: _position[index]?.positionName,
|
positionName: _position[index]?.positionName,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
? Math.floor(Number(curr.Years))
|
||||||
|
: 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
|
day:
|
||||||
|
curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
const currentTenure = mapPosition.find((curr: any) => curr.positionName == x.position);
|
const currentTenure = mapPosition.find((curr: any) => curr.positionName == x.position);
|
||||||
if (currentTenure) {
|
if (currentTenure) {
|
||||||
|
const normalized = normalizeDurationSumSimple(
|
||||||
|
currentTenure.year,
|
||||||
|
currentTenure.month,
|
||||||
|
currentTenure.day,
|
||||||
|
);
|
||||||
const mapData: any = {
|
const mapData: any = {
|
||||||
profileId: x.id,
|
profileId: x.id,
|
||||||
positionName: currentTenure.positionName,
|
positionName: currentTenure.positionName,
|
||||||
year: currentTenure.year,
|
Years: normalized.years,
|
||||||
month: currentTenure.month,
|
Months: normalized.months,
|
||||||
day: currentTenure.day,
|
Days: normalized.days,
|
||||||
};
|
};
|
||||||
data.push(mapData);
|
data.push(mapData);
|
||||||
}
|
}
|
||||||
|
|
@ -129,19 +141,31 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _position.slice(1).map((curr: any, index: number) => ({
|
? _position.slice(1).map((curr: any, index: number) => ({
|
||||||
positionName: _position[index]?.positionName,
|
positionName: _position[index]?.positionName,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
? Math.floor(Number(curr.Years))
|
||||||
|
: 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
|
day:
|
||||||
|
curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
const currentTenure = mapPosition.find((curr: any) => curr.positionName == x.position);
|
const currentTenure = mapPosition.find((curr: any) => curr.positionName == x.position);
|
||||||
if (currentTenure) {
|
if (currentTenure) {
|
||||||
|
const normalized = normalizeDurationSumSimple(
|
||||||
|
currentTenure.year,
|
||||||
|
currentTenure.month,
|
||||||
|
currentTenure.day,
|
||||||
|
);
|
||||||
const mapData: any = {
|
const mapData: any = {
|
||||||
profileEmployeeId: x.id,
|
profileEmployeeId: x.id,
|
||||||
positionName: currentTenure.positionName,
|
positionName: currentTenure.positionName,
|
||||||
year: currentTenure.year,
|
Years: normalized.years,
|
||||||
month: currentTenure.month,
|
Months: normalized.months,
|
||||||
day: currentTenure.day,
|
Days: normalized.days,
|
||||||
};
|
};
|
||||||
data.push(mapData);
|
data.push(mapData);
|
||||||
}
|
}
|
||||||
|
|
@ -175,6 +199,16 @@ export class ProfileSalaryController extends Controller {
|
||||||
positionType: _positionLevel[index]?.positionType,
|
positionType: _positionLevel[index]?.positionType,
|
||||||
positionLevel: _positionLevel[index]?.positionLevel,
|
positionLevel: _positionLevel[index]?.positionLevel,
|
||||||
positionCee: _positionLevel[index]?.positionCee,
|
positionCee: _positionLevel[index]?.positionCee,
|
||||||
|
year:
|
||||||
|
curr.Years !== null && curr.Years !== undefined
|
||||||
|
? Math.floor(Number(curr.Years))
|
||||||
|
: 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
|
day:
|
||||||
|
curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
const calDayDiff = mapPositionLevel
|
const calDayDiff = mapPositionLevel
|
||||||
|
|
@ -189,21 +223,35 @@ export class ProfileSalaryController extends Controller {
|
||||||
acc.positionType = curr.positionType;
|
acc.positionType = curr.positionType;
|
||||||
acc.positionLevel = curr.positionLevel;
|
acc.positionLevel = curr.positionLevel;
|
||||||
acc.positionCee = curr.positionCee;
|
acc.positionCee = curr.positionCee;
|
||||||
|
acc.year += curr.year;
|
||||||
|
acc.month += curr.month;
|
||||||
|
acc.day += curr.day;
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{ days_diff: 0, positionType: null, positionLevel: null, positionCee: null },
|
{
|
||||||
|
days_diff: 0,
|
||||||
|
positionType: null,
|
||||||
|
positionLevel: null,
|
||||||
|
positionCee: null,
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
const years = calDayDiff.days_diff / 365;
|
const normalized = normalizeDurationSumSimple(
|
||||||
const normalized = normalizeDurationSumSimple(years, 0, 0);
|
calDayDiff.year,
|
||||||
|
calDayDiff.month,
|
||||||
|
calDayDiff.day,
|
||||||
|
);
|
||||||
const mapData: any = {
|
const mapData: any = {
|
||||||
profileId: x.id,
|
profileId: x.id,
|
||||||
positionType: calDayDiff.positionType,
|
positionType: calDayDiff.positionType,
|
||||||
positionLevel: calDayDiff.positionLevel,
|
positionLevel: calDayDiff.positionLevel,
|
||||||
positionCee: calDayDiff.positionCee,
|
positionCee: calDayDiff.positionCee,
|
||||||
days_diff: calDayDiff.days_diff,
|
days_diff: calDayDiff.days_diff,
|
||||||
Years: x.posLevel == null ? 0 : normalized.years.toFixed(4),
|
Years: x.posLevel == null ? 0 : normalized.years,
|
||||||
Months: x.posLevel == null ? 0 : normalized.months.toFixed(4),
|
Months: x.posLevel == null ? 0 : normalized.months,
|
||||||
Days: x.posLevel == null ? 0 : normalized.days.toFixed(4),
|
Days: x.posLevel == null ? 0 : normalized.days,
|
||||||
};
|
};
|
||||||
data.push(mapData);
|
data.push(mapData);
|
||||||
}
|
}
|
||||||
|
|
@ -236,6 +284,16 @@ export class ProfileSalaryController extends Controller {
|
||||||
positionType: _positionLevel[index]?.positionType,
|
positionType: _positionLevel[index]?.positionType,
|
||||||
positionLevel: _positionLevel[index]?.positionLevel,
|
positionLevel: _positionLevel[index]?.positionLevel,
|
||||||
positionCee: _positionLevel[index]?.positionCee,
|
positionCee: _positionLevel[index]?.positionCee,
|
||||||
|
year:
|
||||||
|
curr.Years !== null && curr.Years !== undefined
|
||||||
|
? Math.floor(Number(curr.Years))
|
||||||
|
: 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
|
day:
|
||||||
|
curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
const calDayDiff = mapPositionLevel
|
const calDayDiff = mapPositionLevel
|
||||||
|
|
@ -250,21 +308,35 @@ export class ProfileSalaryController extends Controller {
|
||||||
acc.positionType = curr.positionType;
|
acc.positionType = curr.positionType;
|
||||||
acc.positionLevel = curr.positionLevel;
|
acc.positionLevel = curr.positionLevel;
|
||||||
acc.positionCee = curr.positionCee;
|
acc.positionCee = curr.positionCee;
|
||||||
|
acc.year += curr.year;
|
||||||
|
acc.month += curr.month;
|
||||||
|
acc.day += curr.day;
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{ days_diff: 0, positionType: null, positionLevel: null, positionCee: null },
|
{
|
||||||
|
days_diff: 0,
|
||||||
|
positionType: null,
|
||||||
|
positionLevel: null,
|
||||||
|
positionCee: null,
|
||||||
|
year: 0,
|
||||||
|
month: 0,
|
||||||
|
day: 0,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
const years = calDayDiff.days_diff / 365;
|
const normalized = normalizeDurationSumSimple(
|
||||||
const normalized = normalizeDurationSumSimple(years, 0, 0);
|
calDayDiff.year,
|
||||||
|
calDayDiff.month,
|
||||||
|
calDayDiff.day,
|
||||||
|
);
|
||||||
const mapData: any = {
|
const mapData: any = {
|
||||||
profileEmployeeId: x.id,
|
profileEmployeeId: x.id,
|
||||||
positionType: calDayDiff.positionType,
|
positionType: calDayDiff.positionType,
|
||||||
positionLevel: calDayDiff.positionLevel,
|
positionLevel: calDayDiff.positionLevel,
|
||||||
positionCee: calDayDiff.positionCee,
|
positionCee: calDayDiff.positionCee,
|
||||||
days_diff: calDayDiff.days_diff,
|
days_diff: calDayDiff.days_diff,
|
||||||
Years: x.posLevel == null ? 0 : normalized.years.toFixed(4),
|
Years: x.posLevel == null ? 0 : normalized.years,
|
||||||
Months: x.posLevel == null ? 0 : normalized.months.toFixed(4),
|
Months: x.posLevel == null ? 0 : normalized.months,
|
||||||
Days: x.posLevel == null ? 0 : normalized.days.toFixed(4),
|
Days: x.posLevel == null ? 0 : normalized.days,
|
||||||
};
|
};
|
||||||
data.push(mapData);
|
data.push(mapData);
|
||||||
}
|
}
|
||||||
|
|
@ -316,6 +388,16 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _position.slice(1).map((curr: any, index: number) => ({
|
? _position.slice(1).map((curr: any, index: number) => ({
|
||||||
days_diff: curr.days_diff,
|
days_diff: curr.days_diff,
|
||||||
positionExecutive: _position[index]?.positionExecutive,
|
positionExecutive: _position[index]?.positionExecutive,
|
||||||
|
year:
|
||||||
|
curr.Years !== null && curr.Years !== undefined
|
||||||
|
? Math.floor(Number(curr.Years))
|
||||||
|
: 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
|
day:
|
||||||
|
curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
}))
|
}))
|
||||||
: [];
|
: [];
|
||||||
const _posExecutiveName = position?.posExecutive?.posExecutiveName;
|
const _posExecutiveName = position?.posExecutive?.posExecutiveName;
|
||||||
|
|
@ -325,19 +407,25 @@ export class ProfileSalaryController extends Controller {
|
||||||
(acc: any, curr: any) => {
|
(acc: any, curr: any) => {
|
||||||
acc.days_diff += Number(curr.days_diff) || 0;
|
acc.days_diff += Number(curr.days_diff) || 0;
|
||||||
acc.positionExecutive = curr.positionExecutive;
|
acc.positionExecutive = curr.positionExecutive;
|
||||||
|
acc.year += curr.year;
|
||||||
|
acc.month += curr.month;
|
||||||
|
acc.day += curr.day;
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{ days_diff: 0, positionExecutive: null },
|
{ days_diff: 0, positionExecutive: null, year: 0, month: 0, day: 0 },
|
||||||
);
|
);
|
||||||
const years = calDayDiff.days_diff / 365;
|
const normalized = normalizeDurationSumSimple(
|
||||||
const normalized = normalizeDurationSumSimple(years, 0, 0);
|
calDayDiff.year,
|
||||||
|
calDayDiff.month,
|
||||||
|
calDayDiff.day,
|
||||||
|
);
|
||||||
const mapData: any = {
|
const mapData: any = {
|
||||||
profileId: x.id,
|
profileId: x.id,
|
||||||
positionExecutiveName: calDayDiff.positionExecutive,
|
positionExecutiveName: calDayDiff.positionExecutive,
|
||||||
days_diff: calDayDiff.days_diff,
|
days_diff: calDayDiff.days_diff,
|
||||||
Years: normalized.years.toFixed(4),
|
Years: normalized.years,
|
||||||
Months: normalized.months.toFixed(4),
|
Months: normalized.months,
|
||||||
Days: normalized.days.toFixed(4),
|
Days: normalized.days,
|
||||||
};
|
};
|
||||||
data.push(mapData);
|
data.push(mapData);
|
||||||
}
|
}
|
||||||
|
|
@ -589,8 +677,12 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _position.slice(1).map((curr: any, index: number) => ({
|
? _position.slice(1).map((curr: any, index: number) => ({
|
||||||
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
name: _position[index]?.positionName,
|
name: _position[index]?.positionName,
|
||||||
}))
|
}))
|
||||||
|
|
@ -606,16 +698,18 @@ export class ProfileSalaryController extends Controller {
|
||||||
existing.month += curr.month;
|
existing.month += curr.month;
|
||||||
existing.day += curr.day;
|
existing.day += curr.day;
|
||||||
} else {
|
} else {
|
||||||
existing = { name: curr.name, days: curr.days, year: curr.year, month: curr.month, day: curr.day };
|
existing = {
|
||||||
|
name: curr.name,
|
||||||
|
days: curr.days,
|
||||||
|
year: curr.year,
|
||||||
|
month: curr.month,
|
||||||
|
day: curr.day,
|
||||||
|
};
|
||||||
acc.push(existing);
|
acc.push(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the summed values using calendar arithmetic
|
// Normalize the summed values using calendar arithmetic
|
||||||
const normalized = normalizeDurationSumSimple(
|
const normalized = normalizeDurationSumSimple(existing.year, existing.month, existing.day);
|
||||||
existing.year,
|
|
||||||
existing.month,
|
|
||||||
existing.day
|
|
||||||
);
|
|
||||||
existing.year = normalized.years;
|
existing.year = normalized.years;
|
||||||
existing.month = normalized.months;
|
existing.month = normalized.months;
|
||||||
existing.day = normalized.days;
|
existing.day = normalized.days;
|
||||||
|
|
@ -634,8 +728,12 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _posLevel.slice(1).map((curr: any, index: number) => ({
|
? _posLevel.slice(1).map((curr: any, index: number) => ({
|
||||||
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
name:
|
name:
|
||||||
!_posLevel[index]?.positionType && _posLevel[index]?.positionCee
|
!_posLevel[index]?.positionType && _posLevel[index]?.positionCee
|
||||||
|
|
@ -657,16 +755,18 @@ export class ProfileSalaryController extends Controller {
|
||||||
existing.month += curr.month;
|
existing.month += curr.month;
|
||||||
existing.day += curr.day;
|
existing.day += curr.day;
|
||||||
} else {
|
} else {
|
||||||
existing = { name: curr.name, days: curr.days, year: curr.year, month: curr.month, day: curr.day };
|
existing = {
|
||||||
|
name: curr.name,
|
||||||
|
days: curr.days,
|
||||||
|
year: curr.year,
|
||||||
|
month: curr.month,
|
||||||
|
day: curr.day,
|
||||||
|
};
|
||||||
acc.push(existing);
|
acc.push(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the summed values using calendar arithmetic
|
// Normalize the summed values using calendar arithmetic
|
||||||
const normalized = normalizeDurationSumSimple(
|
const normalized = normalizeDurationSumSimple(existing.year, existing.month, existing.day);
|
||||||
existing.year,
|
|
||||||
existing.month,
|
|
||||||
existing.day
|
|
||||||
);
|
|
||||||
existing.year = normalized.years;
|
existing.year = normalized.years;
|
||||||
existing.month = normalized.months;
|
existing.month = normalized.months;
|
||||||
existing.day = normalized.days;
|
existing.day = normalized.days;
|
||||||
|
|
@ -686,8 +786,12 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _posExecutive.slice(1).map((curr: any, index: number) => ({
|
? _posExecutive.slice(1).map((curr: any, index: number) => ({
|
||||||
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
name: _posExecutive[index]?.positionExecutive,
|
name: _posExecutive[index]?.positionExecutive,
|
||||||
}))
|
}))
|
||||||
|
|
@ -703,16 +807,18 @@ export class ProfileSalaryController extends Controller {
|
||||||
existing.month += curr.month;
|
existing.month += curr.month;
|
||||||
existing.day += curr.day;
|
existing.day += curr.day;
|
||||||
} else {
|
} else {
|
||||||
existing = { name: curr.name, days: curr.days, year: curr.year, month: curr.month, day: curr.day };
|
existing = {
|
||||||
|
name: curr.name,
|
||||||
|
days: curr.days,
|
||||||
|
year: curr.year,
|
||||||
|
month: curr.month,
|
||||||
|
day: curr.day,
|
||||||
|
};
|
||||||
acc.push(existing);
|
acc.push(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the summed values using calendar arithmetic
|
// Normalize the summed values using calendar arithmetic
|
||||||
const normalized = normalizeDurationSumSimple(
|
const normalized = normalizeDurationSumSimple(existing.year, existing.month, existing.day);
|
||||||
existing.year,
|
|
||||||
existing.month,
|
|
||||||
existing.day
|
|
||||||
);
|
|
||||||
existing.year = normalized.years;
|
existing.year = normalized.years;
|
||||||
existing.month = normalized.months;
|
existing.month = normalized.months;
|
||||||
existing.day = normalized.days;
|
existing.day = normalized.days;
|
||||||
|
|
@ -759,8 +865,12 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _position.slice(1).map((curr: any, index: number) => ({
|
? _position.slice(1).map((curr: any, index: number) => ({
|
||||||
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
name: _position[index]?.positionName,
|
name: _position[index]?.positionName,
|
||||||
}))
|
}))
|
||||||
|
|
@ -776,16 +886,18 @@ export class ProfileSalaryController extends Controller {
|
||||||
existing.month += curr.month;
|
existing.month += curr.month;
|
||||||
existing.day += curr.day;
|
existing.day += curr.day;
|
||||||
} else {
|
} else {
|
||||||
existing = { name: curr.name, days: curr.days, year: curr.year, month: curr.month, day: curr.day };
|
existing = {
|
||||||
|
name: curr.name,
|
||||||
|
days: curr.days,
|
||||||
|
year: curr.year,
|
||||||
|
month: curr.month,
|
||||||
|
day: curr.day,
|
||||||
|
};
|
||||||
acc.push(existing);
|
acc.push(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the summed values using calendar arithmetic
|
// Normalize the summed values using calendar arithmetic
|
||||||
const normalized = normalizeDurationSumSimple(
|
const normalized = normalizeDurationSumSimple(existing.year, existing.month, existing.day);
|
||||||
existing.year,
|
|
||||||
existing.month,
|
|
||||||
existing.day
|
|
||||||
);
|
|
||||||
existing.year = normalized.years;
|
existing.year = normalized.years;
|
||||||
existing.month = normalized.months;
|
existing.month = normalized.months;
|
||||||
existing.day = normalized.days;
|
existing.day = normalized.days;
|
||||||
|
|
@ -805,8 +917,12 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _posLevel.slice(1).map((curr: any, index: number) => ({
|
? _posLevel.slice(1).map((curr: any, index: number) => ({
|
||||||
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
name:
|
name:
|
||||||
!_posLevel[index]?.positionType && _posLevel[index]?.positionCee
|
!_posLevel[index]?.positionType && _posLevel[index]?.positionCee
|
||||||
|
|
@ -828,16 +944,18 @@ export class ProfileSalaryController extends Controller {
|
||||||
existing.month += curr.month;
|
existing.month += curr.month;
|
||||||
existing.day += curr.day;
|
existing.day += curr.day;
|
||||||
} else {
|
} else {
|
||||||
existing = { name: curr.name, days: curr.days, year: curr.year, month: curr.month, day: curr.day };
|
existing = {
|
||||||
|
name: curr.name,
|
||||||
|
days: curr.days,
|
||||||
|
year: curr.year,
|
||||||
|
month: curr.month,
|
||||||
|
day: curr.day,
|
||||||
|
};
|
||||||
acc.push(existing);
|
acc.push(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the summed values using calendar arithmetic
|
// Normalize the summed values using calendar arithmetic
|
||||||
const normalized = normalizeDurationSumSimple(
|
const normalized = normalizeDurationSumSimple(existing.year, existing.month, existing.day);
|
||||||
existing.year,
|
|
||||||
existing.month,
|
|
||||||
existing.day
|
|
||||||
);
|
|
||||||
existing.year = normalized.years;
|
existing.year = normalized.years;
|
||||||
existing.month = normalized.months;
|
existing.month = normalized.months;
|
||||||
existing.day = normalized.days;
|
existing.day = normalized.days;
|
||||||
|
|
@ -857,8 +975,12 @@ export class ProfileSalaryController extends Controller {
|
||||||
? _posExecutive.slice(1).map((curr: any, index: number) => ({
|
? _posExecutive.slice(1).map((curr: any, index: number) => ({
|
||||||
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
days: curr.days_diff ? Number(curr.days_diff) : 0,
|
||||||
// Use stored procedure's calculated values (calendar arithmetic)
|
// Use stored procedure's calculated values (calendar arithmetic)
|
||||||
year: curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
year:
|
||||||
month: curr.Months !== null && curr.Months !== undefined ? Math.floor(Number(curr.Months)) : 0,
|
curr.Years !== null && curr.Years !== undefined ? Math.floor(Number(curr.Years)) : 0,
|
||||||
|
month:
|
||||||
|
curr.Months !== null && curr.Months !== undefined
|
||||||
|
? Math.floor(Number(curr.Months))
|
||||||
|
: 0,
|
||||||
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
day: curr.Days !== null && curr.Days !== undefined ? Math.floor(Number(curr.Days)) : 0,
|
||||||
name: _posExecutive[index]?.positionExecutive,
|
name: _posExecutive[index]?.positionExecutive,
|
||||||
}))
|
}))
|
||||||
|
|
@ -874,16 +996,18 @@ export class ProfileSalaryController extends Controller {
|
||||||
existing.month += curr.month;
|
existing.month += curr.month;
|
||||||
existing.day += curr.day;
|
existing.day += curr.day;
|
||||||
} else {
|
} else {
|
||||||
existing = { name: curr.name, days: curr.days, year: curr.year, month: curr.month, day: curr.day };
|
existing = {
|
||||||
|
name: curr.name,
|
||||||
|
days: curr.days,
|
||||||
|
year: curr.year,
|
||||||
|
month: curr.month,
|
||||||
|
day: curr.day,
|
||||||
|
};
|
||||||
acc.push(existing);
|
acc.push(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the summed values using calendar arithmetic
|
// Normalize the summed values using calendar arithmetic
|
||||||
const normalized = normalizeDurationSumSimple(
|
const normalized = normalizeDurationSumSimple(existing.year, existing.month, existing.day);
|
||||||
existing.year,
|
|
||||||
existing.month,
|
|
||||||
existing.day
|
|
||||||
);
|
|
||||||
existing.year = normalized.years;
|
existing.year = normalized.years;
|
||||||
existing.month = normalized.months;
|
existing.month = normalized.months;
|
||||||
existing.day = normalized.days;
|
existing.day = normalized.days;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue