From f1c134cb0956585b582a26a868376ee6a2f74f7a Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 4 Jun 2025 15:32:01 +0700 Subject: [PATCH] update --- src/controllers/ReportController.ts | 37 ++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 44dfa0d..aa8b39a 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -4926,8 +4926,8 @@ export class ReportController extends Controller { * @summary 04-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้เลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.1) * */ - @Get("emp2-04/{rootId}/{salaryPeriodId}") - async SalaryReportEmp2_4(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp2-04/{rootId}/{salaryPeriodId}/{type}") + async SalaryReportEmp2_4(@Path() rootId: string, @Path() salaryPeriodId: string, @Path() type: string = 'ALL') { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -4938,16 +4938,32 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } + let condition: any = { + salaryOrg: { + snapshot: "SNAP2", + rootId: rootId, + salaryPeriodId: salaryPeriodId, + }, + }; + condition.type = Not("NONE"); + if(salaryPeriod.period == "APR"){ + if(type == "HAFT"){ + condition.type = "HAFT"; + }else if(type == "FULL"){ + condition.type = "FULL"; + } + }else{ + if(type == "HAFT"){ + condition.type = "HAFT"; + }else if(type == "FULL"){ + condition.type = "FULL"; + }else if(type == "FULLHAFT"){ + condition.type = "FULLHAFT"; + } + } const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP2", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - type: Not("NONE"), - }, + where: condition, order: { rootOrder: "ASC", child1Order: "ASC", @@ -4958,7 +4974,6 @@ export class ReportController extends Controller { posMasterNo: "ASC", }, }); - if (!_salaryProfileEmp) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); }