From b788fdde9ddb9000b4d3093b820a6ee0528ce4d1 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 10 Apr 2024 11:43:23 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1=E0=B9=88?= =?UTF-8?q?=E0=B8=87=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7?= =?UTF-8?q?=E0=B8=AD=E0=B8=99=E0=B8=82=E0=B9=89=E0=B8=B2=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B9=80=E0=B8=81=E0=B8=A9?= =?UTF-8?q?=E0=B8=B5=E0=B8=A2=E0=B8=93=20=E0=B8=A3=E0=B8=AD=E0=B8=9A?= =?UTF-8?q?=E0=B8=95=E0=B8=B8=E0=B8=A5=E0=B8=B2=E0=B8=84=E0=B8=A1=20(gov2-?= =?UTF-8?q?07)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 95 +++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 2776ff8..9b3b277 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -2175,6 +2175,101 @@ export class ReportController extends Controller { }); } + /** + * API คำสั่งเลื่อนเงินเดือนข้าราชการเกษียณ รอบตุลาคม + * + * @summary คำสั่งเลื่อนเงินเดือนข้าราชการเกษียณ รอบตุลาคม + * + * @param {string} rootId Guid, *Id Root + * @param {string} salaryPeriodId Guid, *Id Period + */ + @Get("gov-07-01/{rootId}/{salaryPeriodId}") + async SalaryReport7retire(@Path() rootId: string, @Path() salaryPeriodId: string) { + const salaryPeriod = await this.salaryPeriodRepository.findOne({ + where: { + id: salaryPeriodId, + period: "OCT", + isActive: true, + }, + }); + + if (!salaryPeriod) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน"); + } + + const salaryProfile = await this.salaryProfileRepository.find({ + where: { + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + salaryPeriod: { + period: salaryPeriod.period + }, + }, + isRetired: true // เฉพาะคนที่เกษียณ + }, + order: { + type: "DESC", + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + const _root = await this.salaryOrgRepository.findOne({ + where: { + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }); + const root = _root?.root == null ? "" : _root.root; + + const formattedData = 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), + posType: item.posType, + 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())), + positionSalaryAmount: + item.positionSalaryAmount == undefined || item.positionSalaryAmount == null + ? "๐" + : Extension.ToThaiNumber(String(item.positionSalaryAmount.toLocaleString())) + + (item.amountSpecial > 0 + ? `(${Extension.ToThaiNumber(String(item.positionSalaryAmount))})` + : ""), + remark: + `${item.type === "FULL" ? "หนึ่งขั้น" : ""}\n` + + `${item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` + + `${item.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` + + `${item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, + })); + + return new HttpSuccess({ + template: "gov2-07", + reportName: "gov2-07", + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + yearOld: Extension.ToThaiNumber((salaryPeriod.year + 542).toString()), + date: Extension.ToThaiNumber(Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-10-01`))), + agency: root, + data: formattedData, + }, + }); + } + /** * APIคำสั่งค่าตอบแทนพิเศษ และผู้ไม่ได้เลื่อน รอบเมษายน *