diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index b06c8f3..a4b3296 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -1760,10 +1760,10 @@ export class ReportController extends Controller { // (profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + " ") + // (profile.root == undefined && profile.root == null ? "" : profile.root), position: - (profile.position ? profile.position : "-") + - (profile.posExecutive != null && profile.posExecutive != "" - ? "\n" + profile.posExecutive - : ""), + (profile.position ? profile.position : "-") + + (profile.posExecutive + ? `\n${profile.positionExecutiveField ? `${profile.posExecutive}(${profile.positionExecutiveField})` : profile.posExecutive}` + : ""), affiliation: (profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "\n") + (profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "\n") + @@ -1874,10 +1874,10 @@ export class ReportController extends Controller { log_type: profile.type, log_isNext: profile.isNext, position: - (profile.position ? profile.position : "-") + - (profile.posExecutive != null && profile.posExecutive != "" - ? "\n" + profile.posExecutive - : ""), + (profile.position ? profile.position : "-") + + (profile.posExecutive + ? `\n${profile.positionExecutiveField ? `${profile.posExecutive}(${profile.positionExecutiveField})` : profile.posExecutive}` + : ""), affiliation: (profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "\n") + (profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "\n") + @@ -1995,10 +1995,10 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullname: profile.prefix + profile.firstName + " " + profile.lastName, position: - (profile.position ? profile.position : "-") + - (profile.posExecutive != null && profile.posExecutive != "" - ? "\n" + profile.posExecutive - : ""), + (profile.position ? profile.position : "-") + + (profile.posExecutive + ? `\n${profile.positionExecutiveField ? `${profile.posExecutive}(${profile.positionExecutiveField})` : profile.posExecutive}` + : ""), affiliation: affiliation, posLevel: profile.posLevel, posNumber: @@ -2094,10 +2094,10 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullname: profile.prefix + profile.firstName + " " + profile.lastName, position: - (profile.position ? profile.position : "-") + - (profile.posExecutive != null && profile.posExecutive != "" - ? "\n" + profile.posExecutive - : ""), + (profile.position ? profile.position : "-") + + (profile.posExecutive + ? `\n${profile.positionExecutiveField ? `${profile.posExecutive}(${profile.positionExecutiveField})` : profile.posExecutive}` + : ""), affiliation: affiliation, posLevel: profile.posLevel, posNumber: @@ -2196,8 +2196,10 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, position: - (item.position ? item.position : "-") + - (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), + (item.position ? item.position : "-") + + (item.posExecutive + ? `\n${item.positionExecutiveField ? `${item.posExecutive}(${item.positionExecutiveField})` : item.posExecutive}` + : ""), affiliation: (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + @@ -2314,8 +2316,10 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, position: - (item.position ? item.position : "-") + - (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), + (item.position ? item.position : "-") + + (item.posExecutive + ? `\n${item.positionExecutiveField ? `${item.posExecutive}(${item.positionExecutiveField})` : item.posExecutive}` + : ""), affiliation: (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + @@ -2468,8 +2472,10 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, position: - (item.position ? item.position : "-") + - (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), + (item.position ? item.position : "-") + + (item.posExecutive + ? `\n${item.positionExecutiveField ? `${item.posExecutive}(${item.positionExecutiveField})` : item.posExecutive}` + : ""), affiliation: (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + @@ -2497,8 +2503,10 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber(String(index + 1)), fullname: item.prefix + item.firstName + " " + item.lastName, position: - (item.position ? item.position : "-") + - (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), + (item.position ? item.position : "-") + + (item.posExecutive + ? `\n${item.positionExecutiveField ? `${item.posExecutive}(${item.positionExecutiveField})` : item.posExecutive}` + : ""), affiliation: (item.child4 == undefined && item.child4 == null ? "" : item.child4 + "\n") + (item.child3 == undefined && item.child3 == null ? "" : item.child3 + "\n") + @@ -2627,8 +2635,10 @@ export class ReportController extends Controller { fullname: item.prefix + item.firstName + " " + item.lastName, root: item.root ?? "-", position: - (item.position ? item.position : "-") + - (item.posExecutive != null && item.posExecutive != "" ? "\n" + item.posExecutive : ""), + (item.position ? item.position : "-") + + (item.posExecutive + ? `\n${item.positionExecutiveField ? `${item.posExecutive} (${item.positionExecutiveField})` : item.posExecutive}` + : ""), posMasterNo: Extension.ToThaiNumber(item.orgShortName) + " " + @@ -9058,6 +9068,8 @@ export class ReportController extends Controller { posNoAbb: salary.orgShortName, positionName: salary.position, positionExecutive: salary.posExecutive, + positionExecutiveField: salary.positionExecutiveField, + positionArea: salary.positionArea, positionType: salary.posType, positionLevel: salary.posLevel, commandId: v.commandId, @@ -9139,6 +9151,8 @@ export class ReportController extends Controller { posNoAbb: salary.orgShortName, positionName: salary.position, positionExecutive: salary.posExecutive, + positionExecutiveField: salary.positionExecutiveField, + positionArea: salary.positionArea, positionType: salary.posType, positionLevel: salary.posLevel, commandId: v.commandId, @@ -9220,6 +9234,8 @@ export class ReportController extends Controller { posNoAbb: salary.orgShortName, positionName: salary.position, positionExecutive: salary.posExecutive, + positionExecutiveField: salary.positionExecutiveField, + positionArea: salary.positionArea, positionType: salary.posType, positionLevel: salary.posLevel, commandId: v.commandId, diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 2b8c96d..09a6e27 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -1618,7 +1618,7 @@ export class SalaryPeriodController extends Controller { .orWhere("profile.position LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.posType LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.posLevel LIKE :keyword", { keyword: `%${body.keyword}%` }) - // .orWhere("profile.posExecutive LIKE :keyword", { keyword: `%${body.keyword}%` }) + .orWhere("profile.posExecutive LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.amount LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.amountSpecial LIKE :keyword", { keyword: `%${body.keyword}%` }) .orWhere("profile.amountUse LIKE :keyword", { keyword: `%${body.keyword}%` }) @@ -1694,7 +1694,15 @@ export class SalaryPeriodController extends Controller { .take(body.pageSize) .getManyAndCount(); - return new HttpSuccess({ data: salaryProfile, total }); + const result = salaryProfile.map((profile) => ({ + ...profile, + posExecutive: + profile.positionExecutiveField + ? `${profile.posExecutive} (${profile.positionExecutiveField})` + : profile.posExecutive ?? null, + })); + + return new HttpSuccess({ data: result, total }); } /**