รายชื่อตามกลุ่มในโครงสร้าง
This commit is contained in:
parent
8786468761
commit
289b447b33
8 changed files with 269 additions and 42 deletions
|
|
@ -2747,6 +2747,62 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
await Promise.all(
|
||||
body.refIds.map(async (item) => {
|
||||
const profile = await this.profileEmployeeRepository.findOne({
|
||||
where: { id: item.refId },
|
||||
relations: ["posType", "posLevel"],
|
||||
});
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
|
||||
const dest_item = await this.salaryRepo.findOne({
|
||||
where: { profileEmployeeId: item.refId },
|
||||
order: { order: "DESC" },
|
||||
});
|
||||
const before = null;
|
||||
const data = new ProfileSalary();
|
||||
|
||||
const meta = {
|
||||
profileId: profile.id,
|
||||
date: new Date(),
|
||||
amount: item.amount,
|
||||
positionSalaryAmount: item.positionSalaryAmount,
|
||||
mouthSalaryAmount: item.mouthSalaryAmount,
|
||||
posNo: "",
|
||||
position: profile.position,
|
||||
positionType: profile.posType?.posTypeName || null,
|
||||
positionLevel: profile.posLevel?.posLevelName || null,
|
||||
refCommandNo: `${item.commandNo}/${Extension.ToThaiYear(item.commandYear)}`,
|
||||
templateDoc: item.templateDoc,
|
||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||
createdUserId: req.user.sub,
|
||||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
||||
Object.assign(data, meta);
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
||||
await this.salaryRepo.save(data, { data: req });
|
||||
setLogDataDiff(req, { before, after: data });
|
||||
history.profileSalaryId = data.id;
|
||||
await this.salaryHistoryRepo.save(history, { data: req });
|
||||
}),
|
||||
);
|
||||
const posMasters = await this.posMasterRepository.find({
|
||||
where: { id: In(body.refIds.map((x) => x.refId)) },
|
||||
});
|
||||
const data = posMasters.map((_data) => ({
|
||||
..._data,
|
||||
statusReport: "PENDING",
|
||||
}));
|
||||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
@Post("command38/officer/report")
|
||||
|
|
@ -2757,6 +2813,12 @@ export class CommandController extends Controller {
|
|||
refIds: string[];
|
||||
},
|
||||
) {
|
||||
const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds) } });
|
||||
const data = posMasters.map((_data) => ({
|
||||
..._data,
|
||||
statusReport: "REPORT",
|
||||
}));
|
||||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
@Post("command38/officer/report/delete")
|
||||
|
|
@ -2776,6 +2838,12 @@ export class CommandController extends Controller {
|
|||
}[];
|
||||
},
|
||||
) {
|
||||
const posMasters = await this.posMasterRepository.find({ where: { id: In(body.refIds) } });
|
||||
const data = posMasters.map((_data) => ({
|
||||
..._data,
|
||||
statusReport: "PENDING",
|
||||
}));
|
||||
await this.posMasterRepository.save(data);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue