From 2a524305bfcf9cc928a7fc7ea0fe375a0017bc92 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 24 Jan 2025 10:21:39 +0700 Subject: [PATCH] #1025, #1030, #1031, #1040 --- src/controllers/ReportController.ts | 65 ++++++++++++++++------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 05929bd..100c2d7 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -3261,7 +3261,8 @@ export class ReportController extends Controller { template: "emp1-10", reportName: "emp1-10", data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + yearOld: salaryPeriod.year?Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year - 1))):"", + year: salaryPeriod.year?Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))):"", agency: agency, data: formattedData, }, @@ -3561,14 +3562,14 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, affiliation: affiliation, - position: profile.position, + position: profile.position?? "-", posLevel: profile.posLevel ? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}` - : null, - posNumber: + : "-", + posNumber:profile.orgShortName || profile.posMasterNo ? Extension.ToThaiNumber(profile.orgShortName) + - Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()):"-", + amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-", reason: null, // หมายเหตุ }; }); @@ -3638,24 +3639,24 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, affiliation: affiliation, - position: profile.position, + position: profile.position?? "-", posLevel: profile.posLevel ? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}` - : null, - posNumber: + : "-", + posNumber:profile.orgShortName || profile.posMasterNo ? Extension.ToThaiNumber(profile.orgShortName) + - Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()):"-", amount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) - : null, + : "-", precentTwo: profile.positionSalaryAmountPer == 0.02 - ? profile.positionSalaryAmount * profile.positionSalaryAmountPer - : null, //ร้อยละ 2 + ? Extension.ToThaiNumber((profile.positionSalaryAmount * profile.positionSalaryAmountPer).toLocaleString()) + : "-", //ร้อยละ 2 precentFour: profile.positionSalaryAmountPer == 0.04 - ? profile.positionSalaryAmount * profile.positionSalaryAmountPer - : null, //ร้อยละ 4 + ? Extension.ToThaiNumber((profile.positionSalaryAmount * profile.positionSalaryAmountPer).toLocaleString()) + : "-", //ร้อยละ 4 reason: null, // หมายเหตุ }; }); @@ -4680,29 +4681,35 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) .join("/"); + + const positionParts = [ + profile.position, + profile.child4, + profile.child3, + profile.child2, + profile.child1, + profile.root, + ]; + + const position = positionParts + .filter((part) => part !== undefined && part !== null) + .join("/"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, affiliation: affiliation, - position: - profile.position + - "/" + - (profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") + - (profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") + - (profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") + - (profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") + - (profile.root == undefined && profile.root == null ? "" : profile.root), - posLevel: profile.posLevel, - posNumber: + position: position, + posLevel: profile.posLevel?Extension.ToThaiNumber(profile.posLevel.toLocaleString()) : "-", + posNumber:profile.orgShortName || profile.posMasterNo ? Extension.ToThaiNumber(profile.orgShortName) + - Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()):"-", + amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-", positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) - : null, - score: profile.result, + : "-", + score: profile.result??"-", reason: profile.remark, remark: null, };