แก้ api ที่ดึง amount จาก profile salary เป็นจาก profile
This commit is contained in:
parent
04c200027f
commit
6f4d6d14b7
6 changed files with 37 additions and 22 deletions
|
|
@ -163,10 +163,11 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
: item.positions?.find((position) => position.positionIsSelected == true)?.posExecutive
|
||||
.posExecutiveName;
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
// const amount =
|
||||
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
// ? null
|
||||
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
const amount = item.current_holder?item.current_holder.amount:null;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
@ -380,10 +381,11 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
orgShortName = item.orgChild4?.orgChild4ShortName;
|
||||
}
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
// const amount =
|
||||
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
// ? null
|
||||
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
const amount = item.current_holder?item.current_holder.amount:null;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7247,10 +7247,11 @@ export class ProfileController extends Controller {
|
|||
: item.positions?.find((position) => position.positionIsSelected == true)?.posExecutive
|
||||
.posExecutiveName;
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
// const amount =
|
||||
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
// ? null
|
||||
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
const amount = item.current_holder?item.current_holder.amount:null;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2950,10 +2950,11 @@ export class ProfileEmployeeController extends Controller {
|
|||
orgShortName = item.orgChild4?.orgChild4ShortName;
|
||||
}
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
// const amount =
|
||||
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
// ? null
|
||||
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
const amount = item.current_holder?item.current_holder.amount:null;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2699,10 +2699,11 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
orgShortName = item.orgChild4?.orgChild4ShortName;
|
||||
}
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
// const amount =
|
||||
// item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
// ? null
|
||||
// : item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
const amount = item.current_holder?item.current_holder.amount:null;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export class ProfileSalaryController extends Controller {
|
|||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
||||
const _null:any = null;
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
|
@ -131,6 +131,11 @@ export class ProfileSalaryController extends Controller {
|
|||
history.profileSalaryId = data.id;
|
||||
await this.salaryHistoryRepo.save(history, { data: req });
|
||||
|
||||
profile.amount = body?.amount??_null;
|
||||
profile.positionSalaryAmount = body?.positionSalaryAmount??_null;
|
||||
profile.mouthSalaryAmount = body.mouthSalaryAmount??_null;
|
||||
await this.profileRepo.save(profile, { data: req });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,12 +137,17 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
Object.assign(data, { ...body, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
|
||||
const _null:any = null;
|
||||
await this.salaryRepo.save(data, { data: req });
|
||||
setLogDataDiff(req, { before, after: data });
|
||||
history.profileSalaryId = data.id;
|
||||
await this.salaryHistoryRepo.save(history, { data: req });
|
||||
|
||||
profile.amount = body?.amount??_null;
|
||||
profile.positionSalaryAmount = body?.positionSalaryAmount??_null;
|
||||
profile.mouthSalaryAmount = body.mouthSalaryAmount??_null;
|
||||
await this.profileRepo.save(profile, { data: req });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue