From 11890b423162d965aaeedf5128a50f96e809e160 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 10 Apr 2024 11:14:57 +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=A3=E0=B8=AD=E0=B8=9A=E0=B8=95=E0=B8=B8?= =?UTF-8?q?=E0=B8=A5=E0=B8=B2=E0=B8=84=E0=B8=A1=20(gov2-08)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 9e511f3..2776ff8 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -2076,9 +2076,9 @@ export class ReportController extends Controller { // } /** - * API คำสั่งเลื่อนเงินเดือน รอบเมษายน + * API คำสั่งเลื่อนเงินเดือน รอบเมษายน และรอบตุลาคม * - * @summary คำสั่งเลื่อนเงินเดือน รอบเมษายน + * @summary คำสั่งเลื่อนเงินเดือน รอบเมษายน และรอบตุลาคม * * @param {string} rootId Guid, *Id Root * @param {string} salaryPeriodId Guid, *Id Period @@ -2088,6 +2088,7 @@ export class ReportController extends Controller { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, + isActive: true }, }); @@ -2102,7 +2103,7 @@ export class ReportController extends Controller { rootId: rootId, salaryPeriodId: salaryPeriodId, salaryPeriod: { - period: "APR", + period: salaryPeriod.period === "APR" ? "APR" : "OCT", }, }, }, @@ -2152,18 +2153,22 @@ export class ReportController extends Controller { `${item.type === "FULL" ? "หนึ่งขั้น" : ""}\n` + `${item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` + `${item.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` + - `${item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, // ห + `${item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, })); return new HttpSuccess({ - template: "gov1-07", - reportName: "gov1-07", + template: salaryPeriod.period === "APR" ? "gov1-07" : "gov2-08", + reportName: salaryPeriod.period === "APR" ? "gov1-07" : "gov2-08", 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}-04-01`)), - ), + date: salaryPeriod.period === "APR" + ? Extension.ToThaiNumber( + Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-04-01`)), + ) + : Extension.ToThaiNumber( + Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-10-01`)), + ), agency: root, data: formattedData, },