diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index 2e18f0d1..5eec5fcf 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3002,8 +3002,8 @@ export class CommandController extends Controller { refCommandNo: item.refCommandNo, templateDoc: item.salaryRef, position: profile.position, - positionType: profile.posType.posTypeName, - positionLevel: profile.posLevel.posLevelName, + positionType: profile?.posType?.posTypeName ?? null, + positionLevel: profile?.posLevel?.posLevelName ?? null, posNo: shortName ? shortName : null, positionLine: position?.positionField ?? null, positionPathSide: position?.positionArea ?? null, @@ -3187,8 +3187,8 @@ export class CommandController extends Controller { refCommandNo: item.refCommandNo, templateDoc: item.salaryRef, position: profile.position, - positionType: profile.posType.posTypeName, - positionLevel: profile.posLevel.posLevelName, + positionType: profile?.posType?.posTypeName ?? null, + positionLevel: profile?.posLevel?.posLevelName ?? null, posNo: shortName ? shortName : null, // positionLine: position?.positionField ?? "-", // positionPathSide: position?.positionArea ?? "-", @@ -3411,8 +3411,8 @@ export class CommandController extends Controller { refCommandNo: item.refCommandNo, templateDoc: item.salaryRef, position: profile.position, - positionType: profile.posType.posTypeName, - positionLevel: profile.posLevel.posLevelName, + positionType: profile?.posType?.posTypeName ?? null, + positionLevel: profile?.posLevel?.posLevelName ?? null, posNo: shortName ? shortName : null, // positionLine: position?.positionField ?? "-", // positionPathSide: position?.positionArea ?? "-", @@ -3629,8 +3629,8 @@ export class CommandController extends Controller { templateDoc: item.salaryRef, commandId: item.commandId, position: profile.position, - positionType: profile.posType.posTypeName, - positionLevel: profile.posLevel.posLevelName, + positionType: profile?.posType?.posTypeName ?? null, + positionLevel: profile?.posLevel?.posLevelName ?? null, posNo: shortName ? shortName : null, positionLine: position?.positionField ?? null, positionPathSide: position?.positionArea ?? null, @@ -3800,8 +3800,8 @@ export class CommandController extends Controller { templateDoc: item.salaryRef, commandId: item.commandId, position: profile.position, - positionType: profile.posType.posTypeName, - positionLevel: profile.posLevel.posLevelName, + positionType: profile?.posType?.posTypeName ?? null, + positionLevel: profile?.posLevel?.posLevelName ?? null, posNo: shortName, positionLine: position?.positionField ?? null, positionPathSide: position?.positionArea ?? null, @@ -4511,8 +4511,8 @@ export class CommandController extends Controller { /*(posMasterAct.posMasterChild?.current_holder?.position ?? "-") + "/" +*/ _organization ?? "-", - postype: posMasterAct.posMasterChild?.current_holder?.posType?.posTypeName ?? "-", - poslevel: posMasterAct.posMasterChild?.current_holder?.posLevel?.posLevelName ?? "-", + postype: posMasterAct?.posMasterChild?.current_holder?.posType?.posTypeName ?? "-", + poslevel: posMasterAct?.posMasterChild?.current_holder?.posLevel?.posLevelName ?? "-", organizationNew: /*(posMasterAct.posMaster?.current_holder?.position ?? "-") + "/" +*/ @@ -4620,8 +4620,8 @@ export class CommandController extends Controller { mouthSalaryAmount: item.mouthSalaryAmount, posNo: shortName ?? null, position: position?.positionName ?? null, - positionType: position?.posType.posTypeName ?? null, - positionLevel: position?.posLevel.posLevelName ?? null, + positionType: position?.posType?.posTypeName ?? null, + positionLevel: position?.posLevel?.posLevelName ?? null, refCommandNo: `${item.commandNo}/${Extension.ToThaiYear(item.commandYear)}`, templateDoc: item.templateDoc, order: dest_item == null ? 1 : dest_item.order + 1,