fix report kp7/kk1

This commit is contained in:
Bright 2024-09-05 09:36:53 +07:00
parent 4056a2aa7f
commit ccd544b8d5
2 changed files with 29 additions and 5 deletions

View file

@ -126,6 +126,11 @@ export class ProfileController extends Controller {
"current_holders.orgChild4",
],
where: { id: id },
order: {
profileSalary: {
date: "DESC"
}
}
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");

View file

@ -131,6 +131,11 @@ export class ProfileEmployeeController extends Controller {
"current_holders.orgChild4",
],
where: { id: id },
order: {
profileSalarys: {
date: "DESC"
}
}
});
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profile.id);
@ -194,6 +199,20 @@ export class ProfileEmployeeController extends Controller {
let _child3 = child3 == null || child3 == undefined ? "" : `${child3.orgChild3Name}/`;
let _child4 = child4 == null || child4 == undefined ? "" : `${child4.orgChild4Name}/`;
const educations = await this.educationRepository.find({
select: ["startDate", "endDate", "educationLevel", "degree", "field", "institute"],
where: { profileEmployeeId: id },
order: { lastUpdatedAt: "DESC" },
});
const Education = educations.map((item) => ({
Institute: item.institute,
Date:
item.startDate && item.endDate
? `${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.endDate))}`
: "",
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "",
}));
const mapData = {
Id: profile.id,
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
@ -213,11 +232,11 @@ export class ProfileEmployeeController extends Controller {
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
: "",
Education:
profile.profileEducations.length > 0 &&
profile.profileEducations[profile.profileEducations.length - 1].institute != null
? profile.profileEducations[profile.profileEducations.length - 1].institute
: "",
Education: Education,
// profile.profileEducations.length > 0 &&
// profile.profileEducations[profile.profileEducations.length - 1].institute != null
// ? profile.profileEducations[profile.profileEducations.length - 1].institute
// : "",
AppointText: profile.dateAppoint != null ? profile.dateAppoint : "",
SalaryDate:
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null