Fix invoices null amounts

This commit is contained in:
Djery-Tom 2022-04-24 19:09:47 +01:00
parent 6f9a015ab1
commit b9a5487f66
3 changed files with 8 additions and 5 deletions

View File

@ -249,7 +249,8 @@ class InvoiceController extends Controller
$network_id = $request->input('network_id');
$network_agent_id = $request->input('network_agent_id');
$query = NhInfosInvoice::with(['health_care_sheets:id,invoice_id,health_care_sheet_id,type,practitioner_lastname,practitioner_firstname,practitioner_provider_class,patient_lastname,patient_firstname,institution_name,institution_code']);
$query = NhInfosInvoice::with(['health_care_sheets:id,invoice_id,health_care_sheet_id,type,practitioner_lastname,practitioner_firstname,practitioner_provider_class,patient_lastname,'
. 'patient_firstname,institution_name,institution_code,insurance_amount,insured_amount']);
if (!empty($network_id)) {
$query = $query->where('network_id', $network_id);
@ -264,13 +265,13 @@ class InvoiceController extends Controller
$i->amount = $this->toMoneyWithCurrencyCode($i->amount, $i->currency_code);
$i->insured_amount = $this->toMoneyWithCurrencyCode($i->insured_amount, $i->currency_code);
$i->insurer_amount = $this->toMoneyWithCurrencyCode($i->insurer_amount, $i->currency_code);
$i->state = trans('states.' . $i->state);
foreach ($i->health_care_sheets as $sheet) {
$sheet->amount = $this->toMoneyWithCurrencyCode($sheet->insured_amount + $sheet->insurance_amount, $i->currency_code);
$sheet->insurerAmount = $this->toMoneyWithCurrencyCode($sheet->insurance_amount, $i->currency_code);
$sheet->insuredAmount = $this->toMoneyWithCurrencyCode($sheet->insured_amount, $i->currency_code);
unset($sheet->insurance_amount, $sheet->insured_amount);
}
}
return $this->successResponse($invoices);

View File

@ -36,5 +36,6 @@ return [
"DAILY" => "DAY",
"MONTHLY" => "MONTH",
"MODIFIED" => "MODIFIED",
'RENEWAL' => 'RENEWAL'
'RENEWAL' => 'RENEWAL',
'ACCEPTED_MODIFIED' => 'ACCEPTED MODIFIED'
];

View File

@ -36,5 +36,6 @@ return [
"DAILY" => "JOUR",
"MONTHLY" => "MOIS",
"MODIFIED" => "MODIFIÉE",
'RENEWAL' => 'RENOUVELLEMENT'
'RENEWAL' => 'RENOUVELLEMENT',
'ACCEPTED_MODIFIED' => 'ACCEPTÉE MODIFIÉE'
];