add function emp
This commit is contained in:
parent
2a4c3e745f
commit
7871e18130
1 changed files with 22 additions and 0 deletions
|
|
@ -2674,6 +2674,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
@Path() id: string,
|
@Path() id: string,
|
||||||
@Body()
|
@Body()
|
||||||
requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date },
|
requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date },
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
) {
|
) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
where: { id: id },
|
where: { id: id },
|
||||||
|
|
@ -2684,6 +2685,27 @@ export class ProfileEmployeeController extends Controller {
|
||||||
profile.leaveReason = requestBody.leaveReason;
|
profile.leaveReason = requestBody.leaveReason;
|
||||||
profile.dateLeave = requestBody.dateLeave;
|
profile.dateLeave = requestBody.dateLeave;
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
|
|
||||||
|
const profileSalary = await this.salaryRepository.findOne({
|
||||||
|
where: { profileEmployeeId: id },
|
||||||
|
order: { createdAt: "DESC" },
|
||||||
|
});
|
||||||
|
|
||||||
|
await new CallAPI().PostData(request, "org/profile-employee/salary", {
|
||||||
|
profileEmployeeId: profile.id,
|
||||||
|
date: requestBody.dateLeave,
|
||||||
|
amount: profileSalary?.amount,
|
||||||
|
positionSalaryAmount: profileSalary?.positionSalaryAmount,
|
||||||
|
mouthSalaryAmount: profileSalary?.mouthSalaryAmount,
|
||||||
|
posNo: profileSalary?.posNo,
|
||||||
|
position: profileSalary?.position,
|
||||||
|
positionType: profileSalary?.positionType,
|
||||||
|
positionLevel: profileSalary?.positionLevel,
|
||||||
|
refCommandNo: null,
|
||||||
|
templateDoc: requestBody.leaveReason,
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue