diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 69711fb..15ccd51 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -486,37 +486,44 @@ export class ReportController extends Controller { "amount", "amountSpecial", ], + order: { + "posMasterNo": "ASC", + } + }); + + return new HttpSuccess({ + template: "gov1-04", + reportName: "gov1-04", + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod?.year))), + 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, + orgShortName: item.orgShortName + Extension.ToThaiNumber(String(item.posMasterNo)), + amount: + item.amount == undefined || item.amount == null + ? "๐" + : Extension.ToThaiNumber(String(item.amount)), + amountSpecial: + item.amountSpecial == undefined || item.amountSpecial == null + ? "๐" + : Extension.ToThaiNumber(String(item.amountSpecial)), + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน + remark: null, //หมายเหตุ + })), + }, }); - - 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, - orgShortName: item.orgShortName + Extension.ToThaiNumber(String(item.posMasterNo)), - amount: - item.amount == undefined || item.amount == null - ? "๐" - : Extension.ToThaiNumber(String(item.amount)), - amountSpecial: - item.amountSpecial == undefined || item.amountSpecial == null - ? "๐" - : Extension.ToThaiNumber(String(item.amountSpecial)), - score: null, //สรุปผลการประเมินฯ ระดับและคะแนน - remark: null, //หมายเหตุ - })), - }; - return mapData; } /**