From 9132d4cd9949bbc12ff12cc051e53bc876227330 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 9 Apr 2024 16:20:53 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=A5?= =?UTF-8?q?=E0=B8=B3=E0=B8=94=E0=B8=B1=E0=B8=9A=E0=B9=81=E0=B8=AA=E0=B8=94?= =?UTF-8?q?=E0=B8=87=E0=B9=83=E0=B8=99report=E0=B9=83=E0=B8=AB=E0=B9=89?= =?UTF-8?q?=E0=B8=95=E0=B8=A3=E0=B8=87=E0=B8=81=E0=B8=B1=E0=B8=9A=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B9=80=E0=B8=A7=E0=B9=87=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, "ไม่พบข้อมูล"); }