Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2025-07-02 15:51:04 +07:00
commit 56241eda4f

View file

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