diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index ec04e0ec..c6aee17c 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -2674,6 +2674,7 @@ export class ProfileEmployeeController extends Controller { @Path() id: string, @Body() requestBody: { isLeave: boolean; leaveReason: string; dateLeave: Date }, + @Request() request: { user: Record }, ) { const profile = await this.profileRepo.findOne({ where: { id: id }, @@ -2684,6 +2685,27 @@ export class ProfileEmployeeController extends Controller { profile.leaveReason = requestBody.leaveReason; profile.dateLeave = requestBody.dateLeave; 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(); }