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, },