Fix รายชื่อข้าราชการผู้ที่ได้รับการเสนอขอเลื่อนเงินเดือนทั้งปีสองขั้น #1391

This commit is contained in:
Bright 2025-06-27 13:51:38 +07:00
parent 2fc4fd3121
commit 8721fcaf30

View file

@ -1091,7 +1091,7 @@ export class ReportController extends Controller {
group: convertGroup,
},
});
//รอบเมษา
if (salaryPeriod.period === "APR") {
let salaryProfileGroup1: any;
let salaryProfileGroup2: any;
@ -1297,60 +1297,61 @@ export class ReportController extends Controller {
remark: item.remark, //หมายเหตุ
}))
: null,
profileGroup2: salaryProfileGroup2
? salaryProfileGroup2.map((item: any, index: any) => ({
no: Extension.ToThaiNumber(String(index + 1)),
affiliation:
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") +
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") +
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") +
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") +
(item.root == undefined && item.root == null ? "" : item.root),
// สังกัด/ชื่อ-นามสกุล
fullName: item.prefix + item.firstName + " " + item.lastName,
posLevel: item.posLevel,
posMasterNo:
Extension.ToThaiNumber(item.orgShortName) +
" " +
Extension.ToThaiNumber(String(item.posMasterNo.toLocaleString())),
amount:
item.amount == undefined || item.amount == null
? ""
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
salaryIncrease1:
salaryProfile1.length > 0
? (() => {
const filteredType = salaryProfile1
.filter((profile) => profile.citizenId === item.citizenId)
.map((profile) => profile.type);
const Type = filteredType[0];
return Type === "HAFT"
? "ครึ่งขั้น"
: Type === "FULL"
? "หนึ่งขั้น"
: "ไม่ได้เลื่อนขั้น";
})()
: "-", //การเลื่อนเงินเดือนปีก่อนๆหน้า
salaryIncrease2:
salaryProfile2.length > 0
? (() => {
const filteredType = salaryProfile2
.filter((profile) => profile.citizenId === item.citizenId)
.map((profile) => profile.type);
const Type = filteredType[0];
return Type === "HAFT"
? "ครึ่งขั้น"
: Type === "FULL"
? "หนึ่งขั้น"
: "ไม่ได้เลื่อนขั้น";
})()
: "-", //การเลื่อนเงินเดือนปีก่อนหน้า
score: item.result, //ผลการประเมินฯ
remark: item.remark, //หมายเหตุ
}))
: null,
// profileGroup2: salaryProfileGroup2
// ? salaryProfileGroup2.map((item: any, index: any) => ({
// no: Extension.ToThaiNumber(String(index + 1)),
// affiliation:
// (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") +
// (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") +
// (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") +
// (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") +
// (item.root == undefined && item.root == null ? "" : item.root),
// // สังกัด/ชื่อ-นามสกุล
// fullName: item.prefix + item.firstName + " " + item.lastName,
// posLevel: item.posLevel,
// posMasterNo:
// Extension.ToThaiNumber(item.orgShortName) +
// " " +
// Extension.ToThaiNumber(String(item.posMasterNo.toLocaleString())),
// amount:
// item.amount == undefined || item.amount == null
// ? ""
// : Extension.ToThaiNumber(String(item.amount.toLocaleString())),
// salaryIncrease1:
// salaryProfile1.length > 0
// ? (() => {
// const filteredType = salaryProfile1
// .filter((profile) => profile.citizenId === item.citizenId)
// .map((profile) => profile.type);
// const Type = filteredType[0];
// return Type === "HAFT"
// ? "ครึ่งขั้น"
// : Type === "FULL"
// ? "หนึ่งขั้น"
// : "ไม่ได้เลื่อนขั้น";
// })()
// : "-", //การเลื่อนเงินเดือนปีก่อนๆหน้า
// salaryIncrease2:
// salaryProfile2.length > 0
// ? (() => {
// const filteredType = salaryProfile2
// .filter((profile) => profile.citizenId === item.citizenId)
// .map((profile) => profile.type);
// const Type = filteredType[0];
// return Type === "HAFT"
// ? "ครึ่งขั้น"
// : Type === "FULL"
// ? "หนึ่งขั้น"
// : "ไม่ได้เลื่อนขั้น";
// })()
// : "-", //การเลื่อนเงินเดือนปีก่อนหน้า
// score: item.result, //ผลการประเมินฯ
// remark: item.remark, //หมายเหตุ
// }))
// : null,
},
});
//รอบตุลา
} else if (salaryOrg && salaryPeriod.period === "OCT") {
// find period APR
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
@ -1524,90 +1525,15 @@ export class ReportController extends Controller {
pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2,
root: salaryOrg?.root,
profile: salaryProfile_current
? salaryProfile_current
.filter(
(item: any) => salaryProfile_APR.some((x: any) => x.citizenId === item.citizenId), // ตรวจสอบว่า citizenId ของ item มีอยู่ใน salaryProfile_APR หรือไม่
)
.map((item: any, index: any) => ({
no: Extension.ToThaiNumber(String(index + 1)),
affiliation:
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") +
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") +
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") +
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") +
(item.root == undefined && item.root == null ? "" : item.root),
fullName: item.prefix + item.firstName + " " + item.lastName,
posLevel: item.posLevel,
posMasterNo:
Extension.ToThaiNumber(item.orgShortName) +
" " +
Extension.ToThaiNumber(String(item.posMasterNo.toLocaleString())),
amount:
item.amount == undefined || item.amount == null
? ""
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
salaryIncrease1:
salaryProfile1.length > 0
? (() => {
const filteredType = salaryProfile1
.filter((profile) => profile.citizenId === item.citizenId)
.map((profile) => profile.type);
const Type = filteredType[0];
return Type === "HAFT"
? "ครึ่งขั้น"
: Type === "FULL"
? "หนึ่งขั้น"
: Type === "FULLHAFT"
? "หนึ่งขั้นครึ่ง"
: "ไม่ได้เลื่อนขั้น";
})()
: "-", //การเลื่อนเงินเดือนปีก่อนๆหน้า
salaryIncrease2:
salaryProfile2.length > 0
? (() => {
const filteredType = salaryProfile2
.filter((profile) => profile.citizenId === item.citizenId)
.map((profile) => profile.type);
const Type = filteredType[0];
return Type === "HAFT"
? "ครึ่งขั้น"
: Type === "FULL"
? "หนึ่งขั้น"
: Type === "FULLHAFT"
? "หนึ่งขั้นครึ่ง"
: "ไม่ได้เลื่อนขั้น";
})()
: "-", //การเลื่อนเงินเดือนปีก่อนหน้า
salaryIncreaseAPR:
salaryProfile_APR.length > 0
? (() => {
const filteredType = salaryProfile_APR
.filter((profile) => profile.citizenId === item.citizenId)
.map((profile) => profile.type);
const Type = filteredType[0];
return Type === "HAFT"
? "ครึ่งขั้น"
: Type === "FULL"
? "หนึ่งขั้น"
: Type === "FULLHAFT"
? "หนึ่งขั้นครึ่ง"
: "ไม่ได้เลื่อนขั้น";
})()
: "-", //การเลื่อนเงินเดือนรอบเมษา
Type:
item.type === "FULL"
? "หนึ่งขั้น"
: item.type === "FULLHAFT"
? "หนึ่งขั้นครึ่ง"
: "-",
score1: item.result ?? "-", //ผลการประเมินฯ ครั้งที่ 1
score2: "-", //ผลการประเมินฯ ครั้งที่ 2
}))
: null,
profileGroup2: salaryProfile_current
? salaryProfile_current
.filter((item: any) =>
salaryProfile_APR.some((x: any) => x.citizenId === item.citizenId),
salaryProfile_APR.some((x: any) =>
x.citizenId === item.citizenId &&
(
x.type === "HAFT" && ["FULLHAFT"].includes(item.type) ||
x.type === "FULL" && ["FULL", "FULLHAFT"].includes(item.type)
)
)
)
.map((item: any, index: any) => ({
no: Extension.ToThaiNumber(String(index + 1)),
@ -1685,6 +1611,87 @@ export class ReportController extends Controller {
score2: "-", //ผลการประเมินฯ ครั้งที่ 2
}))
: null,
// profileGroup2: salaryProfile_current
// ? salaryProfile_current
// .filter((item: any) =>
// salaryProfile_APR.some((x: any) => x.citizenId === item.citizenId),
// )
// .map((item: any, index: any) => ({
// no: Extension.ToThaiNumber(String(index + 1)),
// affiliation:
// (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") +
// (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") +
// (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") +
// (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") +
// (item.root == undefined && item.root == null ? "" : item.root),
// fullName: item.prefix + item.firstName + " " + item.lastName,
// posLevel: item.posLevel,
// posMasterNo:
// Extension.ToThaiNumber(item.orgShortName) +
// " " +
// Extension.ToThaiNumber(String(item.posMasterNo.toLocaleString())),
// amount:
// item.amount == undefined || item.amount == null
// ? ""
// : Extension.ToThaiNumber(String(item.amount.toLocaleString())),
// salaryIncrease1:
// salaryProfile1.length > 0
// ? (() => {
// const filteredType = salaryProfile1
// .filter((profile) => profile.citizenId === item.citizenId)
// .map((profile) => profile.type);
// const Type = filteredType[0];
// return Type === "HAFT"
// ? "ครึ่งขั้น"
// : Type === "FULL"
// ? "หนึ่งขั้น"
// : Type === "FULLHAFT"
// ? "หนึ่งขั้นครึ่ง"
// : "ไม่ได้เลื่อนขั้น";
// })()
// : "-", //การเลื่อนเงินเดือนปีก่อนๆหน้า
// salaryIncrease2:
// salaryProfile2.length > 0
// ? (() => {
// const filteredType = salaryProfile2
// .filter((profile) => profile.citizenId === item.citizenId)
// .map((profile) => profile.type);
// const Type = filteredType[0];
// return Type === "HAFT"
// ? "ครึ่งขั้น"
// : Type === "FULL"
// ? "หนึ่งขั้น"
// : Type === "FULLHAFT"
// ? "หนึ่งขั้นครึ่ง"
// : "ไม่ได้เลื่อนขั้น";
// })()
// : "-", //การเลื่อนเงินเดือนปีก่อนหน้า
// salaryIncreaseAPR:
// salaryProfile_APR.length > 0
// ? (() => {
// const filteredType = salaryProfile_APR
// .filter((profile) => profile.citizenId === item.citizenId)
// .map((profile) => profile.type);
// const Type = filteredType[0];
// return Type === "HAFT"
// ? "ครึ่งขั้น"
// : Type === "FULL"
// ? "หนึ่งขั้น"
// : Type === "FULLHAFT"
// ? "หนึ่งขั้นครึ่ง"
// : "ไม่ได้เลื่อนขั้น";
// })()
// : "-", //การเลื่อนเงินเดือนรอบเมษา
// Type:
// item.type === "FULL"
// ? "หนึ่งขั้น"
// : item.type === "FULLHAFT"
// ? "หนึ่งขั้นครึ่ง"
// : "-",
// score1: item.result ?? "-", //ผลการประเมินฯ ครั้งที่ 1
// score2: "-", //ผลการประเมินฯ ครั้งที่ 2
// }))
// : null,
},
});
}