From 8b81afe00d775f4a5afe71a7c4e13b4ee74a8477 Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Thu, 29 Feb 2024 15:33:17 +0700 Subject: [PATCH] fix bug --- src/controllers/SalaryPeriodController.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 67883db..c749880 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -150,7 +150,7 @@ export class SalaryPeriodController extends Controller { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขอเงินเดือนผู้ใช้งานนี้ในระบบ"); } - await this.salaryProfileRepository.remove(salaryProfile); + // await this.salaryProfileRepository.remove(salaryProfile); // หาจำนวน Quota คงเหลือ if (salaryProfile.salaryOrg.snapshot == "SNAP1") { @@ -175,7 +175,7 @@ export class SalaryPeriodController extends Controller { }) .getRawOne(); const calRemainAmount = salaryProfile?.salaryOrg.sixPercentAmount - sumAmountUse.totalAmount; - salaryProfile.salaryOrg.useAmount = sumAmountUse; + salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount; salaryProfile.salaryOrg.remainingAmount = calRemainAmount; await this.salaryOrgRepository.save(salaryProfile?.salaryOrg); } @@ -309,7 +309,7 @@ export class SalaryPeriodController extends Controller { }) .getRawOne(); const calRemainAmount = salaryProfile?.salaryOrg.sixPercentAmount - sumAmountUse.totalAmount; - salaryProfile.salaryOrg.useAmount = sumAmountUse; + salaryProfile.salaryOrg.useAmount = sumAmountUse.totalAmount; salaryProfile.salaryOrg.remainingAmount = calRemainAmount; await this.salaryOrgRepository.save(salaryProfile?.salaryOrg); } @@ -366,7 +366,7 @@ export class SalaryPeriodController extends Controller { }) .getRawOne(); const calRemainAmount = salaryOrg.sixPercentAmount - sumAmountUse.totalAmount; - salaryOrg.useAmount = sumAmountUse; + salaryOrg.useAmount = sumAmountUse.totalAmount; salaryOrg.remainingAmount = calRemainAmount; await this.salaryOrgRepository.save(salaryOrg); } @@ -711,7 +711,7 @@ export class SalaryPeriodController extends Controller { }) .getRawOne(); const calRemainAmount = salaryOrg.sixPercentAmount - sumAmountUse.totalAmount; - salaryOrg.useAmount = sumAmountUse; + salaryOrg.useAmount = sumAmountUse.totalAmount; salaryOrg.remainingAmount = calRemainAmount; await this.salaryOrgRepository.save(salaryOrg); }