From b17a55da72619bb29076126a9f40542ba1759aaf Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 25 Mar 2024 16:28:48 +0700 Subject: [PATCH] isNext --- src/controllers/ReportController.ts | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 47afc2d..6dfea32 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -2479,7 +2479,7 @@ export class ReportController extends Controller { /** * API 09-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับเลื่อนขั้นค่าจ้างในวันที่ 1 เมษา ย้อนหลัง 3 ครั้ง * - * @summary 09-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับเลื่อนขั้นค่าจ้างในวันที่ 1 เมษา ย้อนหลัง 3 ครั้ง + * @summary 09-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับเลื่อนขั้นค่าจ้างในวันที่ 1 เมษา ย้อนหลัง 3 ครั้ง bright * */ @Get("emp1-09/{rootId}/{salaryPeriodId}") @@ -2576,23 +2576,29 @@ export class ReportController extends Controller { amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "๐", type1: _salaryProfileEmpAPR.length > 0 ? (() => { - const type = _salaryProfileEmpAPR + const _profile = _salaryProfileEmpAPR .filter((profileAPR) => profileAPR.citizenId === profile.citizenId) - .map((profile) => profile.type); - const Type = type[0]; - return Type === "HALF" ? "0.5 ขั้น" : Type === "FULL" ? "1 ขั้น" : "ไม่ได้เลื่อนขั้นฯ"; + .map((profile) => ({ type: profile.type, isNext: profile.isNext, positionSalaryAmountPer: profile.positionSalaryAmountPer })); + if(_profile[0].isNext){ + return _profile[0].positionSalaryAmountPer === 0.02 ? "2%" : _profile[0].positionSalaryAmountPer === 0.04 ? "4%": "6%" + } + return _profile[0].type === "HALF" ? "0.5 ขั้น" : _profile[0].type === "FULL" ? "1 ขั้น" : "ไม่ได้เลื่อนขั้นฯ"; })() : null, //เมษา ปีก่อนหน้า type2: _salaryProfileEmpOCT.length > 0 ? (() => { - const type = _salaryProfileEmpOCT + const _profile = _salaryProfileEmpOCT .filter((profileOCT) => profileOCT.citizenId === profile.citizenId) - .map((profile) => profile.type); - const Type = type[0]; - return Type === "HALF" ? "0.5 ขั้น" : Type === "FULL" ? "1 ขั้น" : "ไม่ได้เลื่อนขั้นฯ"; + .map((profile) => ({ type: profile.type, isNext: profile.isNext, positionSalaryAmountPer: profile.positionSalaryAmountPer })); + if(_profile[0].isNext){ + return _profile[0].positionSalaryAmountPer === 0.02 ? "2%" : _profile[0].positionSalaryAmountPer === 0.04 ? "4%": "6%" + } + return _profile[0].type === "HALF" ? "0.5 ขั้น" : _profile[0].type === "FULL" ? "1 ขั้น" : "ไม่ได้เลื่อนขั้นฯ"; })() : null, //ตุลา ปีก่อนหน้า - type: profile.type === "HALF" ? "0.5 ขั้น" : profile.type === "FULL" ? "1 ขั้น" : "ไม่ได้เลื่อนขั้นฯ", + type: profile.isNext === true + ? profile.positionSalaryAmountPer === 0.02 ? "2%" : profile.positionSalaryAmountPer === 0.04 ? "4%" : "6%" + : profile.type === "HALF" ? "0.5 ขั้น" : profile.type === "FULL" ? "1 ขั้น" : "ไม่ได้เลื่อนขั้นฯ", score: null, //ผลการประเมิน remark: null, //หมายเหตุ };