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(); const data = new ProfileSalary();
data.posNumCodeSit = _posNumCodeSit; data.posNumCodeSit = _posNumCodeSit;
data.posNumCodeSitAbb = _posNumCodeSitAbb; data.posNumCodeSitAbb = _posNumCodeSitAbb;
data.dateGovernment = new Date(); data.dateGovernment = item.commandDateAffect ?? new Date();
data.order = dest_item == null ? 1 : dest_item.order + 1; data.order = dest_item == null ? 1 : dest_item.order + 1;
const meta = { const meta = {
createdUserId: req.user.sub, createdUserId: req.user.sub,
@ -3735,7 +3735,7 @@ export class CommandController extends Controller {
}); });
const history = new ProfileSalaryHistory(); const history = new ProfileSalaryHistory();
Object.assign(history, { ...data, id: undefined }); Object.assign(history, { ...data, id: undefined });
data.dateGovernment = meta.createdAt; data.dateGovernment = item.commandDateAffect ?? meta.createdAt;
await this.salaryRepo.save(data, { data: req }); await this.salaryRepo.save(data, { data: req });
setLogDataDiff(req, { before, after: data }); setLogDataDiff(req, { before, after: data });
history.profileSalaryId = data.id; history.profileSalaryId = data.id;
@ -4286,7 +4286,7 @@ export class CommandController extends Controller {
lastUpdateFullName: req.user.name, lastUpdateFullName: req.user.name,
createdAt: new Date(), createdAt: new Date(),
lastUpdatedAt: new Date(), lastUpdatedAt: new Date(),
dateGovernment: new Date(), dateGovernment: item.commandDateAffect ?? new Date(),
isGovernment: item.isGovernment, isGovernment: item.isGovernment,
commandNo: item.commandNo, commandNo: item.commandNo,
commandYear: item.commandYear, commandYear: item.commandYear,
@ -4480,7 +4480,7 @@ export class CommandController extends Controller {
lastUpdateFullName: req.user.name, lastUpdateFullName: req.user.name,
createdAt: new Date(), createdAt: new Date(),
lastUpdatedAt: new Date(), lastUpdatedAt: new Date(),
dateGovernment: new Date(), dateGovernment: item.commandDateAffect ?? new Date(),
isGovernment: item.isGovernment, isGovernment: item.isGovernment,
commandNo: item.commandNo, commandNo: item.commandNo,
commandYear: item.commandYear, commandYear: item.commandYear,
@ -4769,7 +4769,7 @@ export class CommandController extends Controller {
lastUpdateFullName: req.user.name, lastUpdateFullName: req.user.name,
createdAt: new Date(), createdAt: new Date(),
lastUpdatedAt: new Date(), lastUpdatedAt: new Date(),
dateGovernment: new Date(), dateGovernment: item.commandDateAffect ?? new Date(),
isGovernment: item.isGovernment, isGovernment: item.isGovernment,
commandNo: item.commandNo, commandNo: item.commandNo,
commandYear: item.commandYear, commandYear: item.commandYear,
@ -5264,7 +5264,7 @@ export class CommandController extends Controller {
lastUpdateFullName: req.user.name, lastUpdateFullName: req.user.name,
createdAt: new Date(), createdAt: new Date(),
lastUpdatedAt: new Date(), lastUpdatedAt: new Date(),
dateGovernment: new Date(), dateGovernment: item.commandDateAffect ?? new Date(),
isGovernment: item.isGovernment, isGovernment: item.isGovernment,
commandNo: item.commandNo, commandNo: item.commandNo,
commandYear: item.commandYear, commandYear: item.commandYear,
@ -5542,7 +5542,7 @@ export class CommandController extends Controller {
}); });
const history = new ProfileSalaryHistory(); const history = new ProfileSalaryHistory();
Object.assign(history, { ...profileEmpSalary, id: undefined }); Object.assign(history, { ...profileEmpSalary, id: undefined });
profileEmpSalary.dateGovernment = meta.createdAt; profileEmpSalary.dateGovernment = item.bodySalarys?.commandDateAffect ?? meta.createdAt;
(profileEmpSalary.profileId = _null), (profileEmpSalary.profileId = _null),
await this.salaryRepo.save(profileEmpSalary, { data: req }); await this.salaryRepo.save(profileEmpSalary, { data: req });
setLogDataDiff(req, { before, after: profileEmpSalary }); setLogDataDiff(req, { before, after: profileEmpSalary });
@ -5872,7 +5872,7 @@ export class CommandController extends Controller {
Object.assign(salaryHistory, { ...profileSal, id: undefined }); Object.assign(salaryHistory, { ...profileSal, id: undefined });
profileSal.order = dest_item == null ? 1 : dest_item.order + 1; profileSal.order = dest_item == null ? 1 : dest_item.order + 1;
profileSal.profileId = profile.id; profileSal.profileId = profile.id;
profileSal.dateGovernment = meta.createdAt; profileSal.dateGovernment = item.bodySalarys.commandDateAffect ?? meta.createdAt;
profileSal.amount = item.bodySalarys.amount ?? null; profileSal.amount = item.bodySalarys.amount ?? null;
profileSal.amountSpecial = item.bodySalarys.amountSpecial ?? null; profileSal.amountSpecial = item.bodySalarys.amountSpecial ?? null;
profileSal.positionSalaryAmount = item.bodySalarys.positionSalaryAmount ?? null; profileSal.positionSalaryAmount = item.bodySalarys.positionSalaryAmount ?? null;