From 23ed9319fa7e9ba2c5d104a07adaacdcd4e330d3 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 4 Apr 2025 13:45:33 +0700 Subject: [PATCH] org \n Salary Report --- src/controllers/ReportController.ts | 166 ++++++++++++++-------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 3c6460e..4071da8 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -370,7 +370,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -1236,10 +1236,10 @@ export class ReportController extends Controller { ? salaryProfileGroup1.map((item: any, index: any) => ({ no: Extension.ToThaiNumber(String(index + 1)), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), // สังกัด fullName: item.prefix + item.firstName + " " + item.lastName, @@ -1287,10 +1287,10 @@ export class ReportController extends Controller { ? salaryProfileGroup2.map((item: any, index: any) => ({ no: Extension.ToThaiNumber(String(index + 1)), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), // สังกัด/ชื่อ-นามสกุล fullName: item.prefix + item.firstName + " " + item.lastName, @@ -1516,10 +1516,10 @@ export class ReportController extends Controller { .map((item: any, index: any) => ({ no: Extension.ToThaiNumber(String(index + 1)), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), fullName: item.prefix + item.firstName + " " + item.lastName, posLevel: item.posLevel, @@ -1596,10 +1596,10 @@ export class ReportController extends Controller { .map((item: any, index: any) => ({ no: Extension.ToThaiNumber(String(index + 1)), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), fullName: item.prefix + item.firstName + " " + item.lastName, posLevel: item.posLevel, @@ -1742,12 +1742,12 @@ export class ReportController extends Controller { // (profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + " ") + // (profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + " ") + // (profile.root == undefined && profile.root == null ? "" : profile.root), - position: profile.position, + position: (profile.position?profile.position : "-") + (profile.posExecutive != null && profile.posExecutive != "" ? "\n" + profile.posExecutive : ""), affiliation: - (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.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "\n") + + (profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "\n") + + (profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "\n") + + (profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "\n") + (profile.root == undefined && profile.root == null ? "" : profile.root), posLevel: profile.posLevel, orgShortName: @@ -1851,12 +1851,12 @@ export class ReportController extends Controller { log_group: profile.salaryOrg.group, log_type: profile.type, log_isNext: profile.isNext, - position: profile.position, + position: (profile.position?profile.position : "-") + (profile.posExecutive != null && profile.posExecutive != "" ? "\n" + profile.posExecutive : ""), affiliation: - (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.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "\n") + + (profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "\n") + + (profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "\n") + + (profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "\n") + (profile.root == undefined && profile.root == null ? "" : profile.root), posLevel: profile.posLevel, orgShortName: @@ -1963,11 +1963,11 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullname: profile.prefix + profile.firstName + " " + profile.lastName, - position: profile.position, + position: (profile.position?profile.position : "-") + (profile.posExecutive != null && profile.posExecutive != "" ? "\n" + profile.posExecutive : ""), affiliation: affiliation, posLevel: profile.posLevel, posNumber: @@ -2057,11 +2057,11 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullname: profile.prefix + profile.firstName + " " + profile.lastName, - position: profile.position ?? "-", + position: (profile.position?profile.position : "-") + (profile.posExecutive != null && profile.posExecutive != "" ? "\n" + profile.posExecutive : ""), affiliation: affiliation, posLevel: profile.posLevel, posNumber: @@ -2158,12 +2158,12 @@ export class ReportController extends Controller { const formattedData = salaryProfile.map((item, index) => ({ no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, - position: item.position ?? "-", + position: (item.position?item.position : "-") + (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), posType: item.posType, posLevel: item.posLevel, @@ -2273,12 +2273,12 @@ export class ReportController extends Controller { const formattedData = salaryProfile.map((item, index) => ({ no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, - position: item.position, + position: (item.position?item.position : "-") + (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), posType: item.posType, posLevel: item.posLevel, @@ -2424,12 +2424,12 @@ export class ReportController extends Controller { const profileSpecial = salaryProfileSpecial.map((item, index) => ({ no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, - position: item.position, + position: (item.position?item.position : "-") + (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), posType: item.posType, posLevel: item.posLevel, @@ -2450,12 +2450,12 @@ export class ReportController extends Controller { const profileNoAmount = salaryProfileNoAmount.map((item, index) => ({ no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, - position: item.position, + position: (item.position?item.position : "-") + (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), affiliation: - (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.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + + (item.child2 == undefined && item.child2 == null ? "" : item.child2 + "\n") + + (item.child1 == undefined && item.child1 == null ? "" : item.child1 + "\n") + (item.root == undefined && item.root == null ? "" : item.root), posType: item.posType, posLevel: item.posLevel, @@ -2577,7 +2577,7 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, root: item.root ?? "-", - position: item.position ?? "-", + position: (item.position?item.position : "-") + (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), posMasterNo: Extension.ToThaiNumber(item.orgShortName) + Extension.ToThaiNumber(String(item.posMasterNo)), @@ -2744,7 +2744,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -2838,11 +2838,11 @@ export class ReportController extends Controller { const affiliation = affiliationParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName_aff = fullNameParts .filter((part) => part !== undefined && part !== null && part !== "") - .join(" "); + .join("\n"); return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), @@ -2928,7 +2928,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3013,7 +3013,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3103,7 +3103,7 @@ export class ReportController extends Controller { ]; const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3187,7 +3187,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3328,7 +3328,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3469,7 +3469,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3621,7 +3621,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3708,7 +3708,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3789,7 +3789,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -3868,7 +3868,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -4362,7 +4362,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -4615,7 +4615,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -4778,7 +4778,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -4882,7 +4882,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -4973,7 +4973,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; @@ -5065,7 +5065,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5151,7 +5151,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5276,7 +5276,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5430,7 +5430,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5528,7 +5528,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5639,7 +5639,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5722,7 +5722,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5811,7 +5811,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -5926,7 +5926,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -6021,7 +6021,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; @@ -6121,7 +6121,7 @@ export class ReportController extends Controller { const position = positionParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; @@ -6217,7 +6217,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return { @@ -6553,7 +6553,7 @@ export class ReportController extends Controller { const affiliation = fullNameParts .filter((part) => part !== undefined && part !== null) - .join(" "); + .join("\n"); const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`; return {