diff --git a/app/Http/Controllers/HealthCareSheetController.php b/app/Http/Controllers/HealthCareSheetController.php index c181722..e6b2f30 100755 --- a/app/Http/Controllers/HealthCareSheetController.php +++ b/app/Http/Controllers/HealthCareSheetController.php @@ -1193,7 +1193,7 @@ class HealthCareSheetController extends Controller public function getOneHealthCareSheets($id) { - $sheet = NhInfosHealthCareSheets::with(['performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name'])->where('id', $id)->first(); + $sheet = NhInfosHealthCareSheets::with(['performances.act:id,code,name', 'exams.act:id,code,name', 'prescriptions.drug_or_device:id,name'])->where('id', $id)->firstOrFail(); $this->formalizeHealthCareSheet($sheet); return $this->successResponse($sheet); } @@ -1779,6 +1779,10 @@ class HealthCareSheetController extends Controller $sheet->patient_situation = trans('states.' . $sheet->patient_situation); $sheet->_care_condition = $sheet->care_condition; $sheet->care_condition = trans('states.' . $sheet->care_condition); + $this->fetchHealthCareSheetAmounts($sheet); + $sheet->insurance_amount = $this->toMoneyWithCurrencyCode($sheet->insurer_amount, $sheet->currency_code); + $sheet->insured_amount = $this->toMoneyWithCurrencyCode($sheet->insured_amount, $sheet->currency_code); + unset($sheet->insurer_amount); foreach ($sheet->performances as $p) { $p->amount_formatted = $this->toMoneyWithCurrencyCode($p->amount, $sheet->currency_code); $p->moderator_ticket_formatted = $this->toMoneyWithCurrencyCode($p->moderator_ticket, $sheet->currency_code);