From 2ec55789a7fec9ae3158527f5f0ebe222f71ec15 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 24 Jul 2025 14:23:50 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B8=AB=E0=B8=A5?= =?UTF-8?q?=E0=B8=B1=E0=B8=87=E0=B8=88=E0=B8=B2=E0=B8=81=E0=B8=9E=E0=B9=89?= =?UTF-8?q?=E0=B8=99=E0=B8=A3=E0=B8=B2=E0=B8=8A=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=AA=E0=B8=B1=E0=B8=87=E0=B8=81=E0=B8=B1=E0=B8=94=E0=B9=84?= =?UTF-8?q?=E0=B8=A1=E0=B9=88=E0=B9=81=E0=B8=AA=E0=B8=94=E0=B8=87=E0=B9=83?= =?UTF-8?q?=E0=B8=99=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/CommandController.ts | 33 +++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index cf6d1ac5..4f836a15 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -1671,7 +1671,14 @@ export class CommandController extends Controller { "current_holders.orgChild2", "current_holders.orgChild3", "current_holders.orgChild4", + "profileSalary" ], + order: { + profileSalary: { + order: "DESC", + createdAt: "DESC" + } + } }); const shortName = profile?.current_holders.length == 0 @@ -1753,16 +1760,30 @@ export class CommandController extends Controller { let _child2 = child2?.orgChild2Name; let _child3 = child3?.orgChild3Name; let _child4 = child4?.orgChild4Name; - + let _OrgLeave:any = [] + if (profile?.isLeave && profile?.profileSalary.length > 0) { + _OrgLeave = [ + profile?.profileSalary[0].orgChild4 ? profile?.profileSalary[0].orgChild4 : null, + profile?.profileSalary[0].orgChild3 ? profile?.profileSalary[0].orgChild3 : null, + profile?.profileSalary[0].orgChild2 ? profile?.profileSalary[0].orgChild2 : null, + profile?.profileSalary[0].orgChild1 ? profile?.profileSalary[0].orgChild1 : null, + profile?.profileSalary[0].orgRoot ? profile?.profileSalary[0].orgRoot : null, + ]; + } + const orgLeave = _OrgLeave.filter((x:any) => x !== undefined && x !== null).join("\n"); return { no: Extension.ToThaiNumber((idx + 1).toString()), 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?.isLeave == false + ? + (_child4 == null ? "" : _child4 + "\n") + + (_child3 == null ? "" : _child3 + "\n") + + (_child2 == null ? "" : _child2 + "\n") + + (_child1 == null ? "" : _child1 + "\n") + + (_root == null ? "" : _root) + : + orgLeave : (profile?.child4Temp == null ? "" : profile?.child4Temp + "\n") + (profile?.child3Temp == null ? "" : profile?.child3Temp + "\n") + (profile?.child2Temp == null ? "" : profile?.child2Temp + "\n") +