Fix bugs while fetchHealthCareSheetAmount

This commit is contained in:
Djery-Tom 2022-01-26 09:32:03 +01:00
parent ffe159720b
commit df2d442492
1 changed files with 3 additions and 3 deletions

View File

@ -170,7 +170,7 @@ trait Helper
$insuredAmount = 0; $insuredAmount = 0;
$sum = $sheet->performances()->selectRaw('SUM(moderator_ticket) as moderator_ticket , SUM(insurance_amount) as insurance_amount') $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)) { if (isset($sum)) {
$insurerAmount += $sum->moderator_ticket; $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') $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)) { if (isset($sum)) {
$insurerAmount += $sum->insured_paid_amount; $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') $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)) { if (isset($sum)) {