From f078d02462060ced637246e60fbcc8c6e00e7a6a Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 9 Apr 2024 15:54:49 +0700 Subject: [PATCH 1/4] no message --- src/controllers/ReportController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 807a57c..f74a2b2 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -215,9 +215,9 @@ export class ReportController extends Controller { } /** - * API รายชื่อข้าราชการผู้ที่ครองตำแหน่ง รอบเมษายน และตุลาคม + * API รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 มีนาคม(รอบเมษายน) และ ณ วันที่ 1 กันยายน(รอบตุลาคม) * - * @summary รายชื่อข้าราชการผู้ที่ครองตำแหน่ง รอบเมษายน และตุลาคม + * @summary รายชื่อข้าราชการผู้ที่ครองตำแหน่ง ณ วันที่ 1 มีนาคม(รอบเมษายน) และ ณ วันที่ 1 กันยายน(รอบตุลาคม) * */ @Get("gov-01/{rootId}/{salaryPeriodId}") From 9132d4cd9949bbc12ff12cc051e53bc876227330 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 9 Apr 2024 16:20:53 +0700 Subject: [PATCH 2/4] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=E0=B8=A5=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B9=81=E0=B8=AA?= =?UTF-8?q?=E0=B8=94=E0=B8=87=E0=B9=83=E0=B8=99report=E0=B9=83=E0=B8=AB?= =?UTF-8?q?=E0=B9=89=E0=B8=95=E0=B8=A3=E0=B8=87=E0=B8=81=E0=B8=B1=E0=B8=9A?= =?UTF-8?q?=E0=B8=AB=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B9=80=E0=B8=A7=E0=B9=87?= =?UTF-8?q?=E0=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 110 +++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 3 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index f74a2b2..a92cf18 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -230,21 +230,125 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + // const _salaryPeriod = await this.salaryProfileRepository.find({ + // relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + // where: { + // salaryOrg: { + // snapshot: "SNAP1", + // rootId: rootId, + // salaryPeriodId: salaryPeriodId, + // }, + // }, + // order: { + // orgShortName: "ASC", + // posMasterNo: "ASC", + // }, + // }); + + const _salaryPeriod1 = await this.salaryProfileRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { salaryOrg: { snapshot: "SNAP1", rootId: rootId, salaryPeriodId: salaryPeriodId, + group: "GROUP1", }, + type: "HAFT" }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + citizenId: "ASC", + isReserve: "ASC", + }, + }); + const _salaryPeriod2 = await this.salaryProfileRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP1", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + group: "GROUP1", + }, + type: "FULL" + }, + order: { + citizenId: "ASC", + isReserve: "ASC", + }, + }); + const _salaryPeriod3 = await this.salaryProfileRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP1", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + group: "GROUP1", + }, + type: "NONE" + }, + order: { + citizenId: "ASC", + isReserve: "ASC", + }, + }); + const _salaryPeriod4 = await this.salaryProfileRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP1", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + group: "GROUP2", + }, + type: "HAFT" + }, + order: { + citizenId: "ASC", + isReserve: "ASC", + }, + }); + const _salaryPeriod5 = await this.salaryProfileRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP1", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + group: "GROUP2", + }, + type: "FULL" + }, + order: { + citizenId: "ASC", + isReserve: "ASC", + }, + }); + const _salaryPeriod6 = await this.salaryProfileRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP1", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + group: "GROUP2", + }, + type: "NONE" + }, + order: { + citizenId: "ASC", + isReserve: "ASC", }, }); + const _salaryPeriod = _salaryPeriod1.concat( + _salaryPeriod2, + _salaryPeriod3, + _salaryPeriod4, + _salaryPeriod5, + _salaryPeriod6 + ); if (!_salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } From 0d42cf022cec1c9584c416cea4195d0157966a87 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 9 Apr 2024 16:47:04 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B8=9F=E0=B8=B4=E0=B8=A5=E0=B8=94=E0=B9=8C=20yearSl?= =?UTF-8?q?ice=20=E0=B8=9A=E0=B8=B1=E0=B8=8D=E0=B8=8A=E0=B8=B5=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=84=E0=B8=B3=E0=B8=99=E0=B8=A7=E0=B8=93?= =?UTF-8?q?=E0=B9=82=E0=B8=84=E0=B8=A7=E0=B8=95=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index a92cf18..9e511f3 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -556,11 +556,12 @@ export class ReportController extends Controller { template: "gov1-02", reportName: "gov1-02", data: { - date: Extension.ToThaiNumber( - Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)), - ), + // date: Extension.ToThaiNumber( + // Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)), + // ), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())), + yearSlice: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)).slice(-2)), + // dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())), agency: agency, data1: formattedData1, data2: formattedData2, @@ -1025,11 +1026,12 @@ export class ReportController extends Controller { template: "gov2-02", reportName: "gov2-02", data: { - date: Extension.ToThaiNumber( - Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)), - ), + // date: Extension.ToThaiNumber( + // Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)), + // ), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())), + yearSlice: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)).slice(-2)), + // dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())), agency: agency, data1: formattedData1, data2: formattedData2, From 11890b423162d965aaeedf5128a50f96e809e160 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 10 Apr 2024 11:14:57 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B9=88=E0=B8=AD?= =?UTF-8?q?=E0=B8=99=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80=E0=B8=94?= =?UTF-8?q?=E0=B8=B7=E0=B8=AD=E0=B8=99=E0=B8=A3=E0=B8=AD=E0=B8=9A=E0=B8=95?= =?UTF-8?q?=E0=B8=B8=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, },