fix issue #1357 ข้อมูลอายุราชการไม่แสดง

This commit is contained in:
Bright 2025-04-03 17:41:47 +07:00
parent 3ce2f932d6
commit 5837ca1724

View file

@ -47,17 +47,17 @@ export async function calculateGovAge(profileId: string, type: string) {
// type = OFFICER , EMPLOYEE // type = OFFICER , EMPLOYEE
const isEmployee = type === "EMPLOYEE"; const isEmployee = type === "EMPLOYEE";
const records = await AppDataSource.getRepository(ProfileSalary).find({ // const records = await AppDataSource.getRepository(ProfileSalary).find({
where: { // where: {
[isEmployee ? "profileEmployeeId" : "profileId"]: profileId, // [isEmployee ? "profileEmployeeId" : "profileId"]: profileId,
}, // },
select: ["commandDateAffect", "dateGovernment", "isGovernment"], // select: ["commandDateAffect", "dateGovernment", "isGovernment"],
order: { order: "ASC" }, // order: { order: "ASC" },
}); // });
if (!records || records.length === 0) { // if (!records || records.length === 0) {
return null; // return null;
} // }
let endDateFristRec: any = null; let endDateFristRec: any = null;
endDateFristRec = await AppDataSource.getRepository(ProfileSalary).findOne({ endDateFristRec = await AppDataSource.getRepository(ProfileSalary).findOne({