From 1730d19632f435f86e2681f6e4588c5bb6c39938 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 29 Mar 2024 15:29:31 +0700 Subject: [PATCH 1/4] emp2(11,13,17) --- src/controllers/TumReportController.ts | 258 +++++++++++++++++-------- 1 file changed, 179 insertions(+), 79 deletions(-) diff --git a/src/controllers/TumReportController.ts b/src/controllers/TumReportController.ts index e3fa166..27f3fad 100644 --- a/src/controllers/TumReportController.ts +++ b/src/controllers/TumReportController.ts @@ -74,21 +74,23 @@ import { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + type: Not("NONE"), + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + if (!_salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } @@ -112,17 +114,14 @@ import { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-11", + reportName: "emp2-11", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -147,28 +146,31 @@ import { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - if (!_salaryPeriod) { + const salaryProfile = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + isRetired: true, + isNext: true, + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; + const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root; - const formattedData = _salaryPeriod.map((profile, index) => { + const formattedData = salaryProfile.map((profile, index) => { const fullNameParts = [ profile.child4, profile.child3, @@ -185,17 +187,19 @@ import { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, reason: null, }; }); - + return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-13", + reportName: "emp2-13", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -220,28 +224,30 @@ import { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - if (!_salaryPeriod) { + const salaryProfile = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + isNext: true, + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; + const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root; - const formattedData = _salaryPeriod.map((profile, index) => { + const formattedData = salaryProfile.map((profile, index) => { const fullNameParts = [ profile.child4, profile.child3, @@ -258,17 +264,19 @@ import { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, reason: null, }; }); - + return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-17", + reportName: "emp2-17", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -283,22 +291,92 @@ import { * @summary 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร * */ - @Get("emp2-25/{rootId}/{salaryPeriodId}") - async SalaryReportEmp2_25(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ + @Get("emp2-25/{salaryPeriodId}") + async SalaryReportEmp2_25(@Path() salaryPeriodId: string) { + //งวดปีปัจจุบัน + const salaryPeriodOCT = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, }, }); - if (!salaryPeriod) { + if (!salaryPeriodOCT) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + + const salaryPeriodAPR = await this.salaryPeriodRepository.findOne({ + where: { + period: "APR", + year: salaryPeriodOCT.year, + }, + }); + if (!salaryPeriodAPR) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); + } + + //งวดปีก่อนหน้า + const perviousYearAPR = await this.salaryPeriodRepository.findOne({ + where:{ + period: "APR", + year: salaryPeriodOCT.year-1, + }, + }); + if (!perviousYearAPR) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า"); + } + + const perviousYearOCT = await this.salaryPeriodRepository.findOne({ + where:{ + period: "OCT", + year: salaryPeriodOCT.year-1, + }, + }); + if (!perviousYearOCT) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า"); + } + + //ปีก่อนหน้า + const salaryProfilePerviousAPR = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP2", + salaryPeriodId: perviousYearAPR.id, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfilePerviousAPR) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + + const salaryProfilePerviousOCT = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP2", + salaryPeriodId: perviousYearOCT.id, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfilePerviousOCT) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + + //ปีปัจุบัน + const salaryProfileCurrentAPR = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, + salaryOrg: { + snapshot: "SNAP2", salaryPeriodId: salaryPeriodId, }, }, @@ -308,13 +386,31 @@ import { }, }); - if (!_salaryPeriod) { + if (!salaryProfileCurrentAPR) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; + const salaryProfileCurrentOCT = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP2", + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfileCurrentOCT) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + + const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root; - const formattedData = _salaryPeriod.map((profile, index) => { + const formattedData = salaryProfileCurrentOCT.map((profile, index) => { const fullNameParts = [ profile.child4, profile.child3, @@ -331,23 +427,27 @@ import { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, + amountUseOld: null, + amountUse: null, reason: null, }; }); - + return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-25", + reportName: "emp2-25", data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriodOCT.year))), agency: agency, data: formattedData, }, - }); + }); } } \ No newline at end of file From 9bfa2dd8c591fadf97e485a1eb1b307ef9f8c899 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 29 Mar 2024 17:09:40 +0700 Subject: [PATCH 2/4] emp2-25 --- src/controllers/TumReportController.ts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/controllers/TumReportController.ts b/src/controllers/TumReportController.ts index 27f3fad..386867b 100644 --- a/src/controllers/TumReportController.ts +++ b/src/controllers/TumReportController.ts @@ -35,6 +35,7 @@ import { import { EmployeePosLevel } from "../entities/EmployeePosLevel"; import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee"; import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee"; +import { log } from "console"; @Route("api/v1/salary/report/tum") @Tags("Tum") @Security("bearerAuth") @@ -407,10 +408,25 @@ import { if (!salaryProfileCurrentOCT) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - - const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root; + const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root; + const formattedData = salaryProfileCurrentOCT.map((profile, index) => { + //งวดปีก่อนหน้า + const matchedAPRProfileOld = salaryProfilePerviousAPR.find(aprProfile_old => aprProfile_old.citizenId === profile.citizenId); + const matchedOCTProfileOld = salaryProfilePerviousOCT.find(octProfile_old => octProfile_old.citizenId === profile.citizenId); + const amountUseAPR_Old = matchedAPRProfileOld ? matchedAPRProfileOld.amountUse : 0; + const amountUseOCT_Old = matchedOCTProfileOld ? matchedOCTProfileOld.amountUse : 0; + const amountUseOld = amountUseAPR_Old + amountUseOCT_Old; + + //งวดปีปัจจุบัน + const matchedAPRProfile = salaryProfileCurrentAPR.find(aprProfile => aprProfile.citizenId === profile.citizenId); + const matchedOCTProfile = salaryProfileCurrentOCT.find(octProfile => octProfile.citizenId === profile.citizenId); + const amountUseAPR = matchedAPRProfile ? matchedAPRProfile.amountUse : 0; + const amountUseOCT = matchedOCTProfile ? matchedOCTProfile.amountUse : 0; + const amountUse = amountUseAPR + amountUseOCT; + + const fullNameParts = [ profile.child4, profile.child3, @@ -433,8 +449,8 @@ import { profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, - amountUseOld: null, - amountUse: null, + amountUseOld: amountUseOld ? Extension.ToThaiNumber(amountUseOld.toLocaleString()) : null, + amountUse: amountUse ? Extension.ToThaiNumber(amountUse.toLocaleString()) : null, reason: null, }; }); From 377e8a46de9cfbab7d535772e9cc260a17da6332 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 29 Mar 2024 17:35:28 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=E0=B8=A3=E0=B8=A7=E0=B8=A1=20report?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 269 ++++++++++---- src/controllers/TumReportController.ts | 469 ------------------------- 2 files changed, 192 insertions(+), 546 deletions(-) delete mode 100644 src/controllers/TumReportController.ts diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 80a59e1..5dfdadb 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -4733,21 +4733,23 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + type: Not("NONE"), + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + if (!_salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } @@ -4771,17 +4773,14 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-11", + reportName: "emp2-11", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -4841,28 +4840,31 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - if (!_salaryPeriod) { + const salaryProfile = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + isRetired: true, + isNext: true, + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; + const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root; - const formattedData = _salaryPeriod.map((profile, index) => { + const formattedData = salaryProfile.map((profile, index) => { const fullNameParts = [ profile.child4, profile.child3, @@ -4879,17 +4881,19 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, reason: null, }; }); - + return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-13", + reportName: "emp2-13", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -5112,28 +5116,30 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - if (!_salaryPeriod) { + const salaryProfile = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + isNext: true, + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfile) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; + const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root; - const formattedData = _salaryPeriod.map((profile, index) => { + const formattedData = salaryProfile.map((profile, index) => { const fullNameParts = [ profile.child4, profile.child3, @@ -5150,17 +5156,19 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, reason: null, }; }); - + return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-17", + reportName: "emp2-17", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -5578,20 +5586,90 @@ export class ReportController extends Controller { */ @Get("emp2-25/{rootId}/{salaryPeriodId}") async SalaryReportEmp2_25(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ + //งวดปีปัจจุบัน + const salaryPeriodOCT = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, }, }); - if (!salaryPeriod) { + if (!salaryPeriodOCT) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + + const salaryPeriodAPR = await this.salaryPeriodRepository.findOne({ + where: { + period: "APR", + year: salaryPeriodOCT.year, + }, + }); + if (!salaryPeriodAPR) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); + } + + //งวดปีก่อนหน้า + const perviousYearAPR = await this.salaryPeriodRepository.findOne({ + where:{ + period: "APR", + year: salaryPeriodOCT.year-1, + }, + }); + if (!perviousYearAPR) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า"); + } + + const perviousYearOCT = await this.salaryPeriodRepository.findOne({ + where:{ + period: "OCT", + year: salaryPeriodOCT.year-1, + }, + }); + if (!perviousYearOCT) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า"); + } + + //ปีก่อนหน้า + const salaryProfilePerviousAPR = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP2", + salaryPeriodId: perviousYearAPR.id, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfilePerviousAPR) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + + const salaryProfilePerviousOCT = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP2", + salaryPeriodId: perviousYearOCT.id, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfilePerviousOCT) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + + //ปีปัจุบัน + const salaryProfileCurrentAPR = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, + salaryOrg: { + snapshot: "SNAP2", salaryPeriodId: salaryPeriodId, }, }, @@ -5601,13 +5679,46 @@ export class ReportController extends Controller { }, }); - if (!_salaryPeriod) { + if (!salaryProfileCurrentAPR) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); } - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; + const salaryProfileCurrentOCT = await this.salaryProfileEmployeeRepository.find({ + relations: ["salaryOrg", "salaryOrg.salaryPeriod"], + where: { + salaryOrg: { + snapshot: "SNAP2", + salaryPeriodId: salaryPeriodId, + }, + }, + order: { + orgShortName: "ASC", + posMasterNo: "ASC", + }, + }); + + if (!salaryProfileCurrentOCT) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); + } + + const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root; + + const formattedData = salaryProfileCurrentOCT.map((profile, index) => { + //งวดปีก่อนหน้า + const matchedAPRProfileOld = salaryProfilePerviousAPR.find(aprProfile_old => aprProfile_old.citizenId === profile.citizenId); + const matchedOCTProfileOld = salaryProfilePerviousOCT.find(octProfile_old => octProfile_old.citizenId === profile.citizenId); + const amountUseAPR_Old = matchedAPRProfileOld ? matchedAPRProfileOld.amountUse : 0; + const amountUseOCT_Old = matchedOCTProfileOld ? matchedOCTProfileOld.amountUse : 0; + const amountUseOld = amountUseAPR_Old + amountUseOCT_Old; + + //งวดปีปัจจุบัน + const matchedAPRProfile = salaryProfileCurrentAPR.find(aprProfile => aprProfile.citizenId === profile.citizenId); + const matchedOCTProfile = salaryProfileCurrentOCT.find(octProfile => octProfile.citizenId === profile.citizenId); + const amountUseAPR = matchedAPRProfile ? matchedAPRProfile.amountUse : 0; + const amountUseOCT = matchedOCTProfile ? matchedOCTProfile.amountUse : 0; + const amountUse = amountUseAPR + amountUseOCT; + - const formattedData = _salaryPeriod.map((profile, index) => { const fullNameParts = [ profile.child4, profile.child3, @@ -5624,22 +5735,26 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, + position: profile.position, posLevel: profile.posLevel, posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, + amountUseOld: amountUseOld ? Extension.ToThaiNumber(amountUseOld.toLocaleString()) : null, + amountUse: amountUse ? Extension.ToThaiNumber(amountUse.toLocaleString()) : null, reason: null, }; }); - + return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp2-25", + reportName: "emp2-25", data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriodOCT.year))), agency: agency, data: formattedData, }, - }); + }); } } diff --git a/src/controllers/TumReportController.ts b/src/controllers/TumReportController.ts deleted file mode 100644 index 386867b..0000000 --- a/src/controllers/TumReportController.ts +++ /dev/null @@ -1,469 +0,0 @@ -import { - Controller, - Get, - Post, - Put, - Delete, - Patch, - Route, - Security, - Tags, - Body, - Path, - Request, - Example, - SuccessResponse, - Response, - Query, - } from "tsoa"; - import { AppDataSource } from "../database/data-source"; - import HttpSuccess from "../interfaces/http-success"; - import HttpStatusCode from "../interfaces/http-status"; - import HttpError from "../interfaces/http-error"; - import { In, Not, IsNull, MoreThan } from "typeorm"; - import { Salarys } from "../entities/Salarys"; - import { SalaryRanks } from "../entities/SalaryRanks"; - import { PosType } from "../entities/PosType"; - import { PosLevel } from "../entities/PosLevel"; - import { SalaryPeriod } from "../entities/SalaryPeriod"; - import { SalaryOrg } from "../entities/SalaryOrg"; - import { SalaryProfile } from "../entities/SalaryProfile"; - import Extension from "../interfaces/extension"; - import { SalaryEmployee } from "../entities/SalaryEmployee"; - import { SalaryRankEmployee } from "../entities/SalaryRankEmployee"; - import { EmployeePosType } from "../entities/EmployeePosType"; - import { EmployeePosLevel } from "../entities/EmployeePosLevel"; - import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee"; - import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee"; -import { log } from "console"; - @Route("api/v1/salary/report/tum") - @Tags("Tum") - @Security("bearerAuth") - @Response( - HttpStatusCode.INTERNAL_SERVER_ERROR, - "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", - ) - @SuccessResponse(HttpStatusCode.OK, "สำเร็จ") - export class TumReportController extends Controller { - private salaryPeriodRepository = AppDataSource.getRepository(SalaryPeriod); - private salaryRepository = AppDataSource.getRepository(Salarys); - private salaryEmployeeRepository = AppDataSource.getRepository(SalaryEmployee); - private salaryRankRepository = AppDataSource.getRepository(SalaryRanks); - private salaryEmployeeRankRepository = AppDataSource.getRepository(SalaryRankEmployee); - private poTypeRepository = AppDataSource.getRepository(PosType); - private poTypeEmployeeRepository = AppDataSource.getRepository(EmployeePosType); - private posLevelRepository = AppDataSource.getRepository(PosLevel); - private posLevelEmployeeRepository = AppDataSource.getRepository(EmployeePosLevel); - private salaryOrgRepository = AppDataSource.getRepository(SalaryOrg); - private salaryOrgEmployeeRepository = AppDataSource.getRepository(SalaryOrgEmployee); - private salaryProfileRepository = AppDataSource.getRepository(SalaryProfile); - private salaryProfileEmployeeRepository = AppDataSource.getRepository(SalaryProfileEmployee); - - /** - * API 11-รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น - * - * @summary 11-รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น - * - */ - @Get("emp2-11/{rootId}/{salaryPeriodId}") - async SalaryReportEmp2_11(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ - where: { - id: salaryPeriodId, - }, - }); - if (!salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - - const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - type: Not("NONE"), - salaryOrg: { - snapshot: "SNAP2", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!_salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; - - const formattedData = _salaryPeriod.map((profile, index) => { - const fullNameParts = [ - profile.child4, - profile.child3, - profile.child2, - profile.child1, - profile.root, - `${profile.prefix}${profile.firstName} ${profile.lastName}`, - ]; - - const fullName = fullNameParts - .filter((part) => part !== undefined && part !== null) - .join("/"); - - return { - no: Extension.ToThaiNumber((index + 1).toLocaleString()), - fullName: fullName, - position: profile.position, - posLevel: profile.posLevel, - }; - }); - - return new HttpSuccess({ - template: "emp2-11", - reportName: "emp2-11", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - agency: agency, - data: formattedData, - }, - }); - } - - /** - * API 13-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ - * - * @summary 13-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ - * - */ - @Get("emp2-13/{rootId}/{salaryPeriodId}") - async SalaryReportEmp2_13(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ - where: { - id: salaryPeriodId, - }, - }); - if (!salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - - const salaryProfile = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - isRetired: true, - isNext: true, - salaryOrg: { - snapshot: "SNAP2", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!salaryProfile) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root; - - const formattedData = salaryProfile.map((profile, index) => { - const fullNameParts = [ - profile.child4, - profile.child3, - profile.child2, - profile.child1, - profile.root, - `${profile.prefix}${profile.firstName} ${profile.lastName}`, - ]; - - const fullName = fullNameParts - .filter((part) => part !== undefined && part !== null) - .join("/"); - - return { - no: Extension.ToThaiNumber((index + 1).toLocaleString()), - fullName: fullName, - position: profile.position, - posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, - reason: null, - }; - }); - - return new HttpSuccess({ - template: "emp2-13", - reportName: "emp2-13", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - agency: agency, - data: formattedData, - }, - }); - } - - /** - * API 17-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง) - * - * @summary 17-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง) - * - */ - @Get("emp2-17/{rootId}/{salaryPeriodId}") - async SalaryReportEmp2_17(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ - where: { - id: salaryPeriodId, - }, - }); - if (!salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - - const salaryProfile = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - isNext: true, - salaryOrg: { - snapshot: "SNAP2", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!salaryProfile) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root; - - const formattedData = salaryProfile.map((profile, index) => { - const fullNameParts = [ - profile.child4, - profile.child3, - profile.child2, - profile.child1, - profile.root, - `${profile.prefix}${profile.firstName} ${profile.lastName}`, - ]; - - const fullName = fullNameParts - .filter((part) => part !== undefined && part !== null) - .join("/"); - - return { - no: Extension.ToThaiNumber((index + 1).toLocaleString()), - fullName: fullName, - position: profile.position, - posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, - reason: null, - }; - }); - - return new HttpSuccess({ - template: "emp2-17", - reportName: "emp2-17", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - agency: agency, - data: formattedData, - }, - }); - } - - /** - * API 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร - * - * @summary 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร - * - */ - @Get("emp2-25/{salaryPeriodId}") - async SalaryReportEmp2_25(@Path() salaryPeriodId: string) { - //งวดปีปัจจุบัน - const salaryPeriodOCT = await this.salaryPeriodRepository.findOne({ - where: { - id: salaryPeriodId, - }, - }); - if (!salaryPeriodOCT) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - - const salaryPeriodAPR = await this.salaryPeriodRepository.findOne({ - where: { - period: "APR", - year: salaryPeriodOCT.year, - }, - }); - if (!salaryPeriodAPR) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - - //งวดปีก่อนหน้า - const perviousYearAPR = await this.salaryPeriodRepository.findOne({ - where:{ - period: "APR", - year: salaryPeriodOCT.year-1, - }, - }); - if (!perviousYearAPR) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า"); - } - - const perviousYearOCT = await this.salaryPeriodRepository.findOne({ - where:{ - period: "OCT", - year: salaryPeriodOCT.year-1, - }, - }); - if (!perviousYearOCT) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า"); - } - - //ปีก่อนหน้า - const salaryProfilePerviousAPR = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP2", - salaryPeriodId: perviousYearAPR.id, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!salaryProfilePerviousAPR) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const salaryProfilePerviousOCT = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP2", - salaryPeriodId: perviousYearOCT.id, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!salaryProfilePerviousOCT) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - //ปีปัจุบัน - const salaryProfileCurrentAPR = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP2", - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!salaryProfileCurrentAPR) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const salaryProfileCurrentOCT = await this.salaryProfileEmployeeRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP2", - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!salaryProfileCurrentOCT) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root; - - const formattedData = salaryProfileCurrentOCT.map((profile, index) => { - //งวดปีก่อนหน้า - const matchedAPRProfileOld = salaryProfilePerviousAPR.find(aprProfile_old => aprProfile_old.citizenId === profile.citizenId); - const matchedOCTProfileOld = salaryProfilePerviousOCT.find(octProfile_old => octProfile_old.citizenId === profile.citizenId); - const amountUseAPR_Old = matchedAPRProfileOld ? matchedAPRProfileOld.amountUse : 0; - const amountUseOCT_Old = matchedOCTProfileOld ? matchedOCTProfileOld.amountUse : 0; - const amountUseOld = amountUseAPR_Old + amountUseOCT_Old; - - //งวดปีปัจจุบัน - const matchedAPRProfile = salaryProfileCurrentAPR.find(aprProfile => aprProfile.citizenId === profile.citizenId); - const matchedOCTProfile = salaryProfileCurrentOCT.find(octProfile => octProfile.citizenId === profile.citizenId); - const amountUseAPR = matchedAPRProfile ? matchedAPRProfile.amountUse : 0; - const amountUseOCT = matchedOCTProfile ? matchedOCTProfile.amountUse : 0; - const amountUse = amountUseAPR + amountUseOCT; - - - const fullNameParts = [ - profile.child4, - profile.child3, - profile.child2, - profile.child1, - profile.root, - `${profile.prefix}${profile.firstName} ${profile.lastName}`, - ]; - - const fullName = fullNameParts - .filter((part) => part !== undefined && part !== null) - .join("/"); - - return { - no: Extension.ToThaiNumber((index + 1).toLocaleString()), - fullName: fullName, - position: profile.position, - posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null, - amountUseOld: amountUseOld ? Extension.ToThaiNumber(amountUseOld.toLocaleString()) : null, - amountUse: amountUse ? Extension.ToThaiNumber(amountUse.toLocaleString()) : null, - reason: null, - }; - }); - - return new HttpSuccess({ - template: "emp2-25", - reportName: "emp2-25", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriodOCT.year))), - agency: agency, - data: formattedData, - }, - }); - } - -} \ No newline at end of file From 0b416e57f435803c925745995a3d25582a734e16 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 29 Mar 2024 17:45:33 +0700 Subject: [PATCH 4/4] no message --- src/controllers/ReportController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 5dfdadb..bf176a8 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -5573,7 +5573,7 @@ export class ReportController extends Controller { } return new HttpSuccess({ - template: "emp2-24", + template: "blank", reportName: "emp2-24", }); }