save profile salary
This commit is contained in:
parent
3a0fc39397
commit
479e9a3938
14 changed files with 817 additions and 129 deletions
|
|
@ -99,7 +99,7 @@ export class ProfileController extends Controller {
|
|||
private profileFamilyFatherHistoryRepo = AppDataSource.getRepository(ProfileFamilyFatherHistory);
|
||||
private trainingRepository = AppDataSource.getRepository(ProfileTraining);
|
||||
private disciplineRepository = AppDataSource.getRepository(ProfileDiscipline);
|
||||
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
|
||||
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
||||
private profileEducationRepo = AppDataSource.getRepository(ProfileEducation);
|
||||
private provinceRepo = AppDataSource.getRepository(Province);
|
||||
private districtRepo = AppDataSource.getRepository(District);
|
||||
|
|
@ -221,7 +221,7 @@ export class ProfileController extends Controller {
|
|||
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
|
||||
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
|
||||
|
||||
const salary_raw = await this.salaryRepository.find({
|
||||
const salary_raw = await this.salaryRepo.find({
|
||||
select: [
|
||||
"date",
|
||||
"position",
|
||||
|
|
@ -580,7 +580,7 @@ export class ProfileController extends Controller {
|
|||
field: "-",
|
||||
},
|
||||
];
|
||||
const salary_raw = await this.salaryRepository.find({
|
||||
const salary_raw = await this.salaryRepo.find({
|
||||
select: [
|
||||
"date",
|
||||
"position",
|
||||
|
|
@ -1403,12 +1403,12 @@ export class ProfileController extends Controller {
|
|||
let condition: any = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
};
|
||||
// if (body.isDirector == true) {
|
||||
condition = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
isDirector: true,
|
||||
};
|
||||
// }
|
||||
if (body.isDirector == true) {
|
||||
condition = {
|
||||
orgRootId: posMaster.orgRootId || "",
|
||||
isDirector: true,
|
||||
};
|
||||
}
|
||||
const [lists, total] = await AppDataSource.getRepository(viewDirectorActing)
|
||||
.createQueryBuilder("viewDirectorActing")
|
||||
.andWhere(condition)
|
||||
|
|
@ -2034,6 +2034,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2056,6 +2058,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2098,10 +2107,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2111,14 +2120,22 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await Promise.all([this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.salaryRepo.save(profileSalary)]);
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2138,6 +2155,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2173,6 +2192,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2209,10 +2235,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2222,15 +2248,23 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2250,6 +2284,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2284,6 +2320,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2320,10 +2363,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2333,15 +2376,23 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2361,6 +2412,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2395,6 +2448,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2431,10 +2491,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2444,31 +2504,23 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
// //เพิ่มวินัย
|
||||
// const profileDiscipline: ProfileDiscipline = Object.assign(new ProfileDiscipline(), {
|
||||
// date: body.date,
|
||||
// profileId: body.profileId,
|
||||
// refCommandNo: body.refCommandNo,
|
||||
// createdUserId: req.user.sub,
|
||||
// createdFullName: req.user.name,
|
||||
// lastUpdateUserId: req.user.sub,
|
||||
// lastUpdateFullName: req.user.name,
|
||||
// createdAt: new Date(),
|
||||
// lastUpdatedAt: new Date(),
|
||||
// });
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
await Promise.all([
|
||||
this.profileRepo.save(_profile),
|
||||
this.salaryRepository.save(profileSalary),
|
||||
// this.profileDisciplineRepo.save(profileDiscipline)
|
||||
]);
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2488,6 +2540,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2522,6 +2576,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2558,10 +2619,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2571,15 +2632,23 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2599,6 +2668,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2632,6 +2703,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2668,10 +2746,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2681,15 +2759,23 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await removeProfileInOrganize(profile.id, "OFFICER");
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.profileRepo.save(_profile), this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2709,6 +2795,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2736,6 +2824,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2772,10 +2867,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2785,14 +2880,22 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await Promise.all([this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2812,6 +2915,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2839,6 +2944,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2875,10 +2987,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2888,14 +3000,22 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await Promise.all([this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2915,6 +3035,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -2942,6 +3064,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -2979,10 +3108,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -2992,14 +3121,22 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await Promise.all([this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -3019,6 +3156,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -3046,6 +3185,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -3082,10 +3228,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -3095,14 +3241,22 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await Promise.all([this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -3122,6 +3276,8 @@ export class ProfileController extends Controller {
|
|||
date: Date | null;
|
||||
refCommandNo: string | null;
|
||||
salaryRef: string | null;
|
||||
refCommandCode?: string | null;
|
||||
refCommandName?: string | null;
|
||||
},
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -3149,6 +3305,13 @@ export class ProfileController extends Controller {
|
|||
orgRevisionIsDraft: false,
|
||||
},
|
||||
});
|
||||
const orgRevisionRef =
|
||||
profile?.current_holders?.find((x) => x.orgRevisionId == orgRevision?.id) ?? null;
|
||||
const orgRootRef = orgRevisionRef?.orgRoot ?? null;
|
||||
const orgChild1Ref = orgRevisionRef?.orgChild1 ?? null;
|
||||
const orgChild2Ref = orgRevisionRef?.orgChild2 ?? null;
|
||||
const orgChild3Ref = orgRevisionRef?.orgChild3 ?? null;
|
||||
const orgChild4Ref = orgRevisionRef?.orgChild4 ?? null;
|
||||
const shortName =
|
||||
!profile.current_holders || profile.current_holders.length == 0
|
||||
? null
|
||||
|
|
@ -3186,10 +3349,10 @@ export class ProfileController extends Controller {
|
|||
position: profile.position,
|
||||
positionType: profile.posType.posTypeName,
|
||||
positionLevel: profile.posLevel.posLevelName,
|
||||
posNo: shortName ? shortName : "-",
|
||||
positionLine: position?.positionField ?? "-",
|
||||
positionPathSide: position?.positionArea ?? "-",
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
|
||||
posNo: shortName ? shortName : null,
|
||||
positionLine: position?.positionField ?? null,
|
||||
positionPathSide: position?.positionArea ?? null,
|
||||
positionExecutive: position?.posExecutive?.posExecutiveName ?? null,
|
||||
amount: profile.amount,
|
||||
positionSalaryAmount: profile.positionSalaryAmount,
|
||||
mouthSalaryAmount: profile.mouthSalaryAmount,
|
||||
|
|
@ -3199,14 +3362,22 @@ export class ProfileController extends Controller {
|
|||
? profile.profileSalary[0].order + 1
|
||||
: 1
|
||||
: null,
|
||||
orgRoot: orgRootRef?.orgRootName ?? null,
|
||||
orgChild1: orgChild1Ref?.orgChild1Name ?? null,
|
||||
orgChild2: orgChild2Ref?.orgChild2Name ?? null,
|
||||
orgChild3: orgChild3Ref?.orgChild3Name ?? null,
|
||||
orgChild4: orgChild4Ref?.orgChild4Name ?? null,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
refCommandDate: new Date(),
|
||||
refCommandCode: body.refCommandCode,
|
||||
refCommandName: body.refCommandName,
|
||||
});
|
||||
await Promise.all([this.salaryRepository.save(profileSalary)]);
|
||||
await Promise.all([this.salaryRepo.save(profileSalary)]);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -8183,7 +8354,7 @@ export class ProfileController extends Controller {
|
|||
const _null: any = null;
|
||||
const profiles = await Promise.all(
|
||||
profile.map(async (_data) => {
|
||||
const salary = await this.salaryRepository.findOne({
|
||||
const salary = await this.salaryRepo.findOne({
|
||||
where: {
|
||||
profileId: _data.id,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue