From 38e1f62ca59a240df8d784a0659b40926cbe9fac Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 24 Apr 2025 16:50:46 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B8=84=E0=B8=B3=E0=B8=AA=E0=B8=B1?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B9=81=E0=B8=95=E0=B9=88=E0=B8=87=E0=B8=95?= =?UTF-8?q?=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88?= =?UTF-8?q?=E0=B9=89=E0=B8=B2=E0=B8=87=E0=B8=8A=E0=B8=B1=E0=B9=88=E0=B8=A7?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=B2=E0=B8=A7=E0=B9=80=E0=B8=9B=E0=B9=87?= =?UTF-8?q?=E0=B8=99=E0=B8=A5=E0=B8=B9=E0=B8=81=E0=B8=88=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=87=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=88=E0=B8=B3=20(?= =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B9=80=E0=B8=A5=E0=B8=82=E0=B8=97=E0=B8=B5?= =?UTF-8?q?=E0=B9=88=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=81=E0=B8=AA=E0=B8=94?= =?UTF-8?q?=E0=B8=87)=20#1442?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 41 ++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 1bbb67ba..72e8e6a8 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1741,12 +1741,17 @@ export class CommandController extends Controller { return { no: Extension.ToThaiNumber((idx + 1).toString()), - org: - (_child4 == null ? "" : _child4 + "\n") + - (_child3 == null ? "" : _child3 + "\n") + - (_child2 == null ? "" : _child2 + "\n") + - (_child1 == null ? "" : _child1 + "\n") + - (_root == null ? "" : _root), + org: commandCode != "C-PM-21" + ? (_child4 == null ? "" : _child4 + "\n") + + (_child3 == null ? "" : _child3 + "\n") + + (_child2 == null ? "" : _child2 + "\n") + + (_child1 == null ? "" : _child1 + "\n") + + (_root == null ? "" : _root) + : (profile?.child4Temp == null ? "" : profile?.child4Temp + "\n") + + (profile?.child3Temp == null ? "" : profile?.child3Temp + "\n") + + (profile?.child2Temp == null ? "" : profile?.child2Temp + "\n") + + (profile?.child1Temp == null ? "" : profile?.child1Temp + "\n") + + (profile?.rootTemp == null ? "" : profile?.rootTemp), fullName: `${x.prefix}${x.firstName} ${x.lastName}`, citizenId: Extension.ToThaiNumber(x.citizenId), position: profile?.position ? profile?.position : "-", @@ -1756,11 +1761,25 @@ export class CommandController extends Controller { `${profile?.posType.posTypeShortName} ${profile?.posLevel.posLevelName}`, ) : "-", - posNo: shortName ? Extension.ToThaiNumber(shortName) : "-", - amount: x.amount ? Extension.ToThaiNumber(x.amount.toString()) : "-", - dateRetire: profile?.dateRetire - ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile?.dateRetire)) - : "-", + posNo: commandCode != "C-PM-21" + ? shortName + ? Extension.ToThaiNumber(shortName) + : "-" + : Extension.ToThaiNumber(`${profile?.rootShortNameTemp}${profile?.posMasterNoTemp}`) , + amount: x.amount ? Extension.ToThaiNumber(x.amount.toLocaleString()) : "-", + dateRetire: profile?.dateRetire + ? Extension.ToThaiNumber( + Extension.ToThaiShortDate_monthYear(profile?.dateRetire) + ) + : profile?.birthDate && commandCode == "C-PM-21" + ? Extension.ToThaiNumber( + Extension.ToThaiShortDate_monthYear( + new Date( + profile.birthDate.getFullYear() + 60, profile.birthDate.getMonth(), profile.birthDate.getDate() + ) + ) + ) + : "-", dateExecute: command.commandExcecuteDate ? Extension.ToThaiNumber( Extension.ToThaiShortDate_monthYear(command.commandExcecuteDate),