This commit is contained in:
AdisakKanthawilang 2025-07-18 09:32:48 +07:00
parent 9ea012f4d2
commit a0881beaff

View file

@ -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;