แก้ไขผังบัญชีเงินเดือน
This commit is contained in:
parent
f67db862be
commit
15cf60d19d
1 changed files with 9 additions and 7 deletions
|
|
@ -137,9 +137,8 @@ export class Salary extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
const chk_3fields = await this.salaryRepository.findOne({
|
||||
const chk_3fields = await this.salaryRepository.find({
|
||||
where: {
|
||||
name: requestBody.name,
|
||||
posTypeId: requestBody.posTypeId,
|
||||
posLevelId: requestBody.posLevelId,
|
||||
isActive: true,
|
||||
|
|
@ -147,11 +146,14 @@ export class Salary extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
if (chk_3fields != null && requestBody.isActive) {
|
||||
chk_3fields.isActive = false;
|
||||
chk_3fields.lastUpdateUserId = request.user.sub;
|
||||
chk_3fields.lastUpdateFullName = request.user.name;
|
||||
chk_3fields.lastUpdatedAt = new Date();
|
||||
if (chk_3fields.length > 0 && requestBody.isActive) {
|
||||
chk_3fields.forEach(async (item) => {
|
||||
item.isActive = false;
|
||||
item.lastUpdateUserId = request.user.sub;
|
||||
item.lastUpdateFullName = request.user.name;
|
||||
item.lastUpdatedAt = new Date();
|
||||
await this.salaryRepository.save(chk_3fields);
|
||||
});
|
||||
await this.salaryRepository.save(chk_3fields);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue