Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-03-20 11:51:52 +07:00
commit 5bbda41b2f
2 changed files with 169 additions and 38 deletions

View file

@ -319,23 +319,148 @@ export class ReportController extends Controller {
? ""
: salaryPeriodAPR[0].salaryProfiles[0].root;
const formattedData = salaryPeriodAPR.map((org, index) => {
return {
group: `กลุ่มที่ ${Extension.ToThaiNumber(org.group == "GROUP1" ? "1" : "2")}`,
total: Extension.ToThaiNumber(org.total.toString()),
fifteenPercent: Extension.ToThaiNumber(org.fifteenPercent.toString()),
let data1 = salaryPeriodAPR.find((x) => x.group == "GROUP2");
let formattedData1;
if (data1 != null) {
formattedData1 = {
total: Extension.ToThaiNumber(data1.salaryProfiles.length.toString()),
fifteenPercent: Extension.ToThaiNumber(data1.fifteenPercent.toString()),
full: Extension.ToThaiNumber(
org.salaryProfiles.filter((x) => x.type == "FULL").length.toString(),
data1.salaryProfiles.filter((x) => x.type == "FULL").length.toString(),
),
haft: Extension.ToThaiNumber(
org.salaryProfiles.filter((x) => x.type == "HAFT").length.toString(),
data1.salaryProfiles.filter((x) => x.type == "HAFT").length.toString(),
),
notPromoted: Extension.ToThaiNumber(
org.salaryProfiles.filter((x) => x.type == "NONE").length.toString(),
data1.salaryProfiles.filter((x) => x.type == "NONE").length.toString(),
),
reason: null,
};
});
}
let data2 = salaryPeriodAPR.find((x) => x.group == "GROUP1");
let formattedData2;
if (data2 != null) {
formattedData2 = {
total: Extension.ToThaiNumber(
data2.salaryProfiles
.filter(
(x) =>
x.posLevel == "อาวุโส" ||
x.posLevel == "ชำนาญการพิเศษ" ||
(x.posLevel == "ต้น" && x.posType == "อำนวยการ"),
)
.length.toString(),
),
fifteenPercent: Extension.ToThaiNumber(data2.fifteenPercent.toString()),
full: Extension.ToThaiNumber(
data2.salaryProfiles
.filter(
(x) =>
x.posLevel == "อาวุโส" ||
x.posLevel == "ชำนาญการพิเศษ" ||
(x.posLevel == "ต้น" && x.posType == "อำนวยการ"),
)
.filter((x) => x.type == "FULL")
.length.toString(),
),
haft: Extension.ToThaiNumber(
data2.salaryProfiles
.filter(
(x) =>
x.posLevel == "อาวุโส" ||
x.posLevel == "ชำนาญการพิเศษ" ||
(x.posLevel == "ต้น" && x.posType == "อำนวยการ"),
)
.filter((x) => x.type == "HAFT")
.length.toString(),
),
notPromoted: Extension.ToThaiNumber(
data2.salaryProfiles
.filter(
(x) =>
x.posLevel == "อาวุโส" ||
x.posLevel == "ชำนาญการพิเศษ" ||
(x.posLevel == "ต้น" && x.posType == "อำนวยการ"),
)
.filter((x) => x.type == "NONE")
.length.toString(),
),
reason: null,
};
}
let data3 = salaryPeriodAPR.find((x) => x.group == "GROUP1");
let formattedData3;
if (data3 != null) {
formattedData3 = {
total: Extension.ToThaiNumber(
data3.salaryProfiles
.filter(
(x) =>
x.posLevel == "ปฏิบัติงาน" ||
x.posLevel == "ชำนาญงาน" ||
x.posLevel == "ปฏิบัติการ" ||
x.posLevel == "ชำนาญการ",
)
.length.toString(),
),
fifteenPercent: Extension.ToThaiNumber(data3.fifteenPercent.toString()),
full: Extension.ToThaiNumber(
data3.salaryProfiles
.filter(
(x) =>
x.posLevel == "ปฏิบัติงาน" ||
x.posLevel == "ชำนาญงาน" ||
x.posLevel == "ปฏิบัติการ" ||
x.posLevel == "ชำนาญการ",
)
.filter((x) => x.type == "FULL")
.length.toString(),
),
haft: Extension.ToThaiNumber(
data3.salaryProfiles
.filter(
(x) =>
x.posLevel == "ปฏิบัติงาน" ||
x.posLevel == "ชำนาญงาน" ||
x.posLevel == "ปฏิบัติการ" ||
x.posLevel == "ชำนาญการ",
)
.filter((x) => x.type == "HAFT")
.length.toString(),
),
notPromoted: Extension.ToThaiNumber(
data3.salaryProfiles
.filter(
(x) =>
x.posLevel == "ปฏิบัติงาน" ||
x.posLevel == "ชำนาญงาน" ||
x.posLevel == "ปฏิบัติการ" ||
x.posLevel == "ชำนาญการ",
)
.filter((x) => x.type == "NONE")
.length.toString(),
),
reason: null,
};
}
let data4 = salaryPeriodAPR.find((x) => x.group == "GROUP1");
let formattedData4;
if (data4 != null) {
formattedData4 = {
total: Extension.ToThaiNumber(data4.salaryProfiles.length.toString()),
fifteenPercent: Extension.ToThaiNumber(data4.fifteenPercent.toString()),
full: Extension.ToThaiNumber(
data4.salaryProfiles.filter((x) => x.type == "FULL").length.toString(),
),
haft: Extension.ToThaiNumber(
data4.salaryProfiles.filter((x) => x.type == "HAFT").length.toString(),
),
notPromoted: Extension.ToThaiNumber(
data4.salaryProfiles.filter((x) => x.type == "NONE").length.toString(),
),
reason: null,
};
}
return new HttpSuccess({
template: "gov1-02",
@ -346,7 +471,10 @@ export class ReportController extends Controller {
),
dateNow: Extension.ToThaiNumber(Extension.ToThaiFullDate(new Date())),
agency: agency,
data: formattedData,
data1: formattedData1,
data2: formattedData2,
data3: formattedData3,
data4: formattedData4,
},
});
}
@ -406,31 +534,34 @@ export class ReportController extends Controller {
],
});
const mapData = {
effectiveDate: salaryPeriod?.effectiveDate,
// root: salaryProfile[0]?.root,
profile: salaryProfile.map((item, index) => ({
no: Extension.ToThaiNumber(String(index + 1)),
fullname: item.prefix + item.firstName + " " + item.lastName,
position:
item.position +
"/" +
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") +
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") +
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") +
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") +
(item.root == undefined && item.root == null ? "" : item.root),
posLevel: item.posLevel,
posMasterNo: Extension.ToThaiNumber(String(item.posMasterNo)),
amount:
item.amount == undefined || item.amount == null
? ""
: Extension.ToThaiNumber(String(item.amount)),
score: null, //สรุปผลการประเมินฯ ระดับและคะแนน
remark: null, //หมายเหตุ
})),
};
return mapData;
return new HttpSuccess({
template: "gov1-03",
reportName: "gov1-03",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
root: salaryProfile[0]?.root,
profile: salaryProfile.map((item, index) => ({
no: Extension.ToThaiNumber(String(index + 1)),
fullname:
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") +
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") +
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") +
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") +
(item.root == undefined && item.root == null ? "" : item.root)+
"/" + item.prefix + item.firstName + " " + item.lastName, // สังกัด/ชื่อ-นามสกุล
posLevel: item.posLevel,
posMasterNo: Extension.ToThaiNumber(String(item.posMasterNo)),
amount:
item.amount == undefined || item.amount == null
? ""
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
salaryIncrease1: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า
salaryIncrease2: null, //การเลื่อนเงินเดือนปีก่อนหน้า
score: null, //ผลการประเมินฯ
remark: null, //หมายเหตุ
}))
}
});
}
/**