From 8d4378013589efc13f751ca40e28319028a5817c Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 20 Mar 2024 10:56:15 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=20report?= =?UTF-8?q?=20gov1-03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 53 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 71b59cc..735ac84 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -369,31 +369,34 @@ export class ReportController extends Controller { ], }); - const mapData = { - effectiveDate: salaryPeriod?.effectiveDate, - // root: salaryProfile[0]?.root, - profile: salaryProfile.map((item, index) => ({ - no: Extension.ToThaiNumber(String(index + 1)), - fullname: item.prefix + item.firstName + " " + item.lastName, - position: - item.position + - "/" + - (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") + - (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") + - (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") + - (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") + - (item.root == undefined && item.root == null ? "" : item.root), - posLevel: item.posLevel, - posMasterNo: Extension.ToThaiNumber(String(item.posMasterNo)), - amount: - item.amount == undefined || item.amount == null - ? "๐" - : Extension.ToThaiNumber(String(item.amount)), - score: null, //สรุปผลการประเมินฯ ระดับและคะแนน - remark: null, //หมายเหตุ - })), - }; - return mapData; + return new HttpSuccess({ + template: "gov1-03", + reportName: "gov1-03", + data: { + year: Extension.ToThaiNumber(String(salaryPeriod.year)), + root: salaryProfile[0]?.root, + profile: salaryProfile.map((item, index) => ({ + no: Extension.ToThaiNumber(String(index + 1)), + fullname: + (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") + + (item.root == undefined && item.root == null ? "" : item.root)+ + "/" + item.prefix + item.firstName + " " + item.lastName, // สังกัด/ชื่อ-นามสกุล + posLevel: item.posLevel, + posMasterNo: Extension.ToThaiNumber(String(item.posMasterNo)), + amount: + item.amount == undefined || item.amount == null + ? "๐" + : Extension.ToThaiNumber(String(item.amount.toLocaleString())), + salaryIncrease1: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า + salaryIncrease2: null, //การเลื่อนเงินเดือนปีก่อนหน้า + score: null, //ผลการประเมินฯ + remark: null, //หมายเหตุ + })) + } + }); } /**