fix blank row report kk1
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m40s

This commit is contained in:
harid 2026-03-20 17:51:39 +07:00
parent 2fdf5e5854
commit 5a4b7c92a3
2 changed files with 80 additions and 76 deletions

View file

@ -1385,6 +1385,10 @@ export class ProfileController extends Controller {
} }
}); });
if (leaves.length === 0) {
leaves.push({year:""});
}
const leave2_raw = await this.profileLeaveRepository const leave2_raw = await this.profileLeaveRepository
.createQueryBuilder("profileLeave") .createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType") .leftJoinAndSelect("profileLeave.leaveType", "leaveType")
@ -1730,16 +1734,6 @@ export class ProfileController extends Controller {
}); });
} }
} }
else {
_assistances.push({
date: "",
position: "",
commandName: "",
agency: "",
note: "",
document: "",
});
}
// Merge รักษาการ และ ช่วยราชาร // Merge รักษาการ และ ช่วยราชาร
const actposition = [..._actpositions, ..._assistances]; const actposition = [..._actpositions, ..._assistances];

View file

@ -1379,6 +1379,10 @@ export class ProfileEmployeeController extends Controller {
} }
}); });
if (leaves.length === 0) {
leaves.push({year:""});
}
const leave2_raw = await this.profileLeaveRepository const leave2_raw = await this.profileLeaveRepository
.createQueryBuilder("profileLeave") .createQueryBuilder("profileLeave")
.leftJoinAndSelect("profileLeave.leaveType", "leaveType") .leftJoinAndSelect("profileLeave.leaveType", "leaveType")
@ -1536,72 +1540,78 @@ export class ProfileEmployeeController extends Controller {
}, },
]; ];
// ลูกจ้างยังไม่มีรักษาการและช่วยราชการ // ลูกจ้างยังไม่มีรักษาการและช่วยราชการ
const actposition_raw = await this.profileActpositionRepo.find({ // const actposition_raw = await this.profileActpositionRepo.find({
select: ["dateStart", "dateEnd", "position", "isDeleted"], // select: ["dateStart", "dateEnd", "position", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false }, // where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" }, // order: { createdAt: "ASC" },
}); // });
const assistance_raw = await this.profileAssistanceRepository.find({ // const assistance_raw = await this.profileAssistanceRepository.find({
select: ["dateStart", "dateEnd", "commandName", "agency", "document", "isDeleted"], // select: ["dateStart", "dateEnd", "commandName", "agency", "document", "isDeleted"],
where: { profileEmployeeId: id, isDeleted: false }, // where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" }, // order: { createdAt: "ASC" },
}); // });
const _actposition = // const _actposition =
actposition_raw.length > 0 // actposition_raw.length > 0
? actposition_raw.map((item) => ({ // ? actposition_raw.map((item) => ({
date: // date:
item.dateStart && item.dateEnd // item.dateStart && item.dateEnd
? Extension.ToThaiNumber( // ? Extension.ToThaiNumber(
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`, // `${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
) // )
: item.dateStart // : item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart)) // ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: item.dateEnd // : item.dateEnd
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd)) // ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
: "", // : "",
position: item.position ? Extension.ToThaiNumber(item.position) : "", // position: item.position ? Extension.ToThaiNumber(item.position) : "",
commandName: "รักษาการในตำแหน่ง", // commandName: "รักษาการในตำแหน่ง",
agency: "", // agency: "",
document: "", // document: "",
})) // }))
: [ // : [
{ // {
date: "", // date: "",
position: "", // position: "",
commandName: "", // commandName: "",
agency: "", // agency: "",
document: "", // document: "",
}, // },
]; // ];
const _assistance = // const _assistance =
assistance_raw.length > 0 // assistance_raw.length > 0
? assistance_raw.map((item) => ({ // ? assistance_raw.map((item) => ({
date: // date:
item.dateStart && item.dateEnd // item.dateStart && item.dateEnd
? Extension.ToThaiNumber( // ? Extension.ToThaiNumber(
`${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`, // `${Extension.ToThaiFullDate2(item.dateStart)} - ${Extension.ToThaiFullDate2(item.dateEnd)}`,
) // )
: item.dateStart // : item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart)) // ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: item.dateEnd // : item.dateEnd
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd)) // ? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
: "", // : "",
position: "", // position: "",
commandName: item.commandName ? Extension.ToThaiNumber(item.commandName) : "", // commandName: item.commandName ? Extension.ToThaiNumber(item.commandName) : "",
agency: item.agency ? Extension.ToThaiNumber(item.agency) : "", // agency: item.agency ? Extension.ToThaiNumber(item.agency) : "",
document: item.document ? Extension.ToThaiNumber(item.document) : "", // document: item.document ? Extension.ToThaiNumber(item.document) : "",
})) // }))
: [ // : [
{ // {
date: "", // date: "",
position: "", // position: "",
commandName: "", // commandName: "",
agency: "", // agency: "",
document: "", // document: "",
}, // },
]; // ];
const actposition = [..._actposition, ..._assistance]; const actposition = [{
date: "",
position: "",
commandName: "",
agency: "",
document: "",
}];
const duty_raw = await this.dutyRepository.find({ const duty_raw = await this.dutyRepository.find({
where: { profileEmployeeId: id, isDeleted: false }, where: { profileEmployeeId: id, isDeleted: false },
order: { createdAt: "ASC" }, order: { createdAt: "ASC" },
@ -1799,7 +1809,7 @@ export class ProfileEmployeeController extends Controller {
(_root == null ? "" : _root).trim() (_root == null ? "" : _root).trim()
const _position = profiles?.position != null ? const _position = profiles?.position != null ?
profiles?.posLevel != null profiles?.posLevel != null
? `${profiles.position}${profiles.posLevel.posLevelName}` ? Extension.ToThaiNumber(`${profiles.position}${profiles.posLevel.posLevelName}`)
: profiles.position : profiles.position
: "" : ""
const ocAssistance = await this.profileAssistanceRepository.findOne({ const ocAssistance = await this.profileAssistanceRepository.findOne({