From df2d44249230a5bf3598822d556af12e3ec05f81 Mon Sep 17 00:00:00 2001 From: Djery-Tom Date: Wed, 26 Jan 2022 09:32:03 +0100 Subject: [PATCH] Fix bugs while fetchHealthCareSheetAmount --- app/Traits/Helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Traits/Helper.php b/app/Traits/Helper.php index 342ccf5..77ae44b 100644 --- a/app/Traits/Helper.php +++ b/app/Traits/Helper.php @@ -170,7 +170,7 @@ trait Helper $insuredAmount = 0; $sum = $sheet->performances()->selectRaw('SUM(moderator_ticket) as moderator_ticket , SUM(insurance_amount) as insurance_amount') - ->groupBy('nh_health_care_sheets_performances.id')->first(); + ->groupBy('nh_health_care_sheets_performances.id')->groupBy('nh_health_care_sheets_performances.sheet_id')->first(); if (isset($sum)) { $insurerAmount += $sum->moderator_ticket; @@ -179,7 +179,7 @@ trait Helper $sum = $sheet->prescriptions()->selectRaw('SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount') - ->groupBy('nh_health_care_sheets_prescriptions.id')->first(); + ->groupBy('nh_health_care_sheets_prescriptions.id')->groupBy('nh_health_care_sheets_prescriptions.sheet_id')->first(); if (isset($sum)) { $insurerAmount += $sum->insured_paid_amount; @@ -187,7 +187,7 @@ trait Helper } $sum = $sheet->exams()->selectRaw('SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount') - ->groupBy('nh_health_care_sheets_exams.id')->first(); + ->groupBy('nh_health_care_sheets_exams.id')->groupBy('nh_health_care_sheets_exams.sheet_id')->first(); if (isset($sum)) {