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