เงินเดือนลูกจ้าง

This commit is contained in:
Kittapath 2024-03-16 12:05:45 +07:00
parent 4f178cffa0
commit 29f95d3ae2
8 changed files with 1317 additions and 28 deletions

View file

@ -271,10 +271,6 @@ export class ProfileEmployeeController extends Controller {
return new HttpSuccess({ data: formattedData, total: formattedData.length });
}
// if (!profile) {
// return new HttpSuccess([]);
// }
const formattedData = profile.map((item) => ({
id: item.id,
prefix: item.prefix,
@ -1028,10 +1024,10 @@ export class ProfileEmployeeController extends Controller {
orgShortName = item.orgChild4?.orgChild4ShortName;
}
// const amount =
// item.current_holder == null || item.current_holder.profileSalary.length == 0
// ? null
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
const amount =
item.current_holder == null || item.current_holder.profileSalary.length == 0
? null
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
let datePeriodStart = new Date(
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
);
@ -1064,9 +1060,7 @@ export class ProfileEmployeeController extends Controller {
position: item.current_holder.position,
posType: item.current_holder.posType.posTypeName,
posLevel: item.current_holder.posLevel.posLevelName,
amount: null,
// amount: amount ? amount : null,
// revisionId: item.orgRevisionId,
amount: amount ? amount : null,
rootId: item.orgRootId,
root: item.orgRoot?.orgRootName ? item.orgRoot.orgRootName : null,
child1Id: item.orgChild1Id,
@ -1079,19 +1073,18 @@ export class ProfileEmployeeController extends Controller {
child4: item.orgChild4?.orgChild4Name ? item.orgChild4.orgChild4Name : null,
result: null,
duration: null,
isPunish: false,
// isPunish:
// item.current_holder.profileDiscipline.filter(
// (x: any) =>
// new Date(
// `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
// ) >= datePeriodStart &&
// new Date(
// `${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
// ) <= datePeriodEnd,
// ).length > 0
// ? true
// : false,
isPunish:
item.current_holder.profileDiscipline.filter(
(x: any) =>
new Date(
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
) >= datePeriodStart &&
new Date(
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
) <= datePeriodEnd,
).length > 0
? true
: false,
isSuspension: item.current_holder.dateRetire == null ? false : true,
isAbsent: false,
isLeave: false,