diff --git a/src/controllers/ProfileSalaryController.ts b/src/controllers/ProfileSalaryController.ts index 18da63cd..6ce0efbf 100644 --- a/src/controllers/ProfileSalaryController.ts +++ b/src/controllers/ProfileSalaryController.ts @@ -632,6 +632,11 @@ export class ProfileSalaryController extends Controller { lastUpdatedAt: new Date(), }; const _null: any = null; + if (body.commandCode && !body.commandName) { + if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ" + else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ" + else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ" + } Object.assign(data, { ...body, ...meta }); const history = new ProfileSalaryHistory(); Object.assign(history, { ...data, id: undefined }); @@ -706,7 +711,11 @@ export class ProfileSalaryController extends Controller { await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", record.profileId); const before = structuredClone(record); const history = new ProfileSalaryHistory(); - + if (body.commandCode && !body.commandName) { + if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ" + else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ" + else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ" + } Object.assign(record, body); Object.assign(history, { ...record, id: undefined }); diff --git a/src/controllers/ProfileSalaryEmployeeController.ts b/src/controllers/ProfileSalaryEmployeeController.ts index 6b5681c2..ce06f015 100644 --- a/src/controllers/ProfileSalaryEmployeeController.ts +++ b/src/controllers/ProfileSalaryEmployeeController.ts @@ -311,7 +311,11 @@ export class ProfileSalaryEmployeeController extends Controller { createdAt: new Date(), lastUpdatedAt: new Date(), }; - + if (body.commandCode && !body.commandName) { + if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ" + else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ" + else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ" + } Object.assign(data, { ...body, ...meta }); const history = new ProfileSalaryHistory(); Object.assign(history, { ...data, id: undefined }); @@ -395,7 +399,11 @@ export class ProfileSalaryEmployeeController extends Controller { ); const before = structuredClone(record); const history = new ProfileSalaryHistory(); - + if (body.commandCode && !body.commandName) { + if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ" + else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ" + else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ" + } Object.assign(record, body); Object.assign(history, { ...record, id: undefined }); diff --git a/src/controllers/ProfileSalaryEmployeeTempController.ts b/src/controllers/ProfileSalaryEmployeeTempController.ts index f4be602a..8d6ff717 100644 --- a/src/controllers/ProfileSalaryEmployeeTempController.ts +++ b/src/controllers/ProfileSalaryEmployeeTempController.ts @@ -125,7 +125,11 @@ export class ProfileSalaryEmployeeTempController extends Controller { createdAt: new Date(), lastUpdatedAt: new Date(), }; - + if (body.commandCode && !body.commandName) { + if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ" + else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ" + else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ" + } Object.assign(data, { ...body, ...meta }); const history = new ProfileSalaryHistory(); Object.assign(history, { ...data, id: undefined }); @@ -150,7 +154,11 @@ export class ProfileSalaryEmployeeTempController extends Controller { if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); const before = structuredClone(record); const history = new ProfileSalaryHistory(); - + if (body.commandCode && !body.commandName) { + if (body.commandCode == "7") body.commandName = "เงินพิเศษอื่น ๆ" + else if (body.commandCode == "6") body.commandName = "เลื่อนเงินเดือนกรณีอื่น ๆ" + else if (body.commandCode == "5") body.commandName = "เลื่อนเงินเดือนตามปกติ" + } Object.assign(record, body); Object.assign(history, { ...record, id: undefined });