From a0881beaff62e4f51a53d4a56666d739ae2eda42 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 18 Jul 2025 09:32:48 +0700 Subject: [PATCH] #136 --- src/controllers/CommandController.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/controllers/CommandController.ts b/src/controllers/CommandController.ts index edc670dc..82467001 100644 --- a/src/controllers/CommandController.ts +++ b/src/controllers/CommandController.ts @@ -3420,7 +3420,7 @@ export class CommandController extends Controller { const data = new ProfileSalary(); data.posNumCodeSit = _posNumCodeSit; data.posNumCodeSitAbb = _posNumCodeSitAbb; - data.dateGovernment = new Date(); + data.dateGovernment = item.commandDateAffect ?? new Date(); data.order = dest_item == null ? 1 : dest_item.order + 1; const meta = { createdUserId: req.user.sub, @@ -3735,7 +3735,7 @@ export class CommandController extends Controller { }); const history = new ProfileSalaryHistory(); Object.assign(history, { ...data, id: undefined }); - data.dateGovernment = meta.createdAt; + data.dateGovernment = item.commandDateAffect ?? meta.createdAt; await this.salaryRepo.save(data, { data: req }); setLogDataDiff(req, { before, after: data }); history.profileSalaryId = data.id; @@ -4286,7 +4286,7 @@ export class CommandController extends Controller { lastUpdateFullName: req.user.name, createdAt: new Date(), lastUpdatedAt: new Date(), - dateGovernment: new Date(), + dateGovernment: item.commandDateAffect ?? new Date(), isGovernment: item.isGovernment, commandNo: item.commandNo, commandYear: item.commandYear, @@ -4480,7 +4480,7 @@ export class CommandController extends Controller { lastUpdateFullName: req.user.name, createdAt: new Date(), lastUpdatedAt: new Date(), - dateGovernment: new Date(), + dateGovernment: item.commandDateAffect ?? new Date(), isGovernment: item.isGovernment, commandNo: item.commandNo, commandYear: item.commandYear, @@ -4769,7 +4769,7 @@ export class CommandController extends Controller { lastUpdateFullName: req.user.name, createdAt: new Date(), lastUpdatedAt: new Date(), - dateGovernment: new Date(), + dateGovernment: item.commandDateAffect ?? new Date(), isGovernment: item.isGovernment, commandNo: item.commandNo, commandYear: item.commandYear, @@ -5264,7 +5264,7 @@ export class CommandController extends Controller { lastUpdateFullName: req.user.name, createdAt: new Date(), lastUpdatedAt: new Date(), - dateGovernment: new Date(), + dateGovernment: item.commandDateAffect ?? new Date(), isGovernment: item.isGovernment, commandNo: item.commandNo, commandYear: item.commandYear, @@ -5542,7 +5542,7 @@ export class CommandController extends Controller { }); const history = new ProfileSalaryHistory(); Object.assign(history, { ...profileEmpSalary, id: undefined }); - profileEmpSalary.dateGovernment = meta.createdAt; + profileEmpSalary.dateGovernment = item.bodySalarys?.commandDateAffect ?? meta.createdAt; (profileEmpSalary.profileId = _null), await this.salaryRepo.save(profileEmpSalary, { data: req }); setLogDataDiff(req, { before, after: profileEmpSalary }); @@ -5872,7 +5872,7 @@ export class CommandController extends Controller { Object.assign(salaryHistory, { ...profileSal, id: undefined }); profileSal.order = dest_item == null ? 1 : dest_item.order + 1; profileSal.profileId = profile.id; - profileSal.dateGovernment = meta.createdAt; + profileSal.dateGovernment = item.bodySalarys.commandDateAffect ?? meta.createdAt; profileSal.amount = item.bodySalarys.amount ?? null; profileSal.amountSpecial = item.bodySalarys.amountSpecial ?? null; profileSal.positionSalaryAmount = item.bodySalarys.positionSalaryAmount ?? null;