Fecha de elaboración: {{ \Carbon\Carbon::parse($createdAt)->format("d/m/Y") }}
{{--
DATOS DEL PACIENTE:

Tipo de Documento: {{ $invoice->authorization->patient->dni_type}}
Número de Documento: {{ $invoice->authorization->patient->dni}}
{{ $invoice->authorization->patient->full_name}}
  DATOS DE LA EMPRESA:

{{ $invoice->eps->code }} - {{ $invoice->eps->name }}
NIT: {{ $invoice->eps->nit }}
Dirección: {{ $invoice->eps->address->address }}
Tel: {{ $invoice->eps->phone->phone }}

--}} @php $total = 0; @endphp @foreach ($invoices as $invoice) @if ($invoice->multiple) @php $subTotal = 0; @endphp @foreach (json_decode($invoice->multiple_codes, true) as $k => $authorizationCode) @php $currentAuthorization = \App\Authorization::findByCode($authorizationCode); $services = $currentAuthorization->eps_service_id; $companionService = $currentAuthorization->multiple_services; $flag = false; if ($companionService) { $services .= ",".$companionService; } elseif (count($currentAuthorization->services) > 0) { $services = ''; foreach ($currentAuthorization->services as $servicePrice) { $services .= $servicePrice->eps_service_id.","; } $flag = true; $services = trim($services, ","); } @endphp @if ($flag) @foreach($currentAuthorization->services as $authorizationService) @php $currentTotal = $authorizationService->price * $authorizationService->days; $subTotal += $currentTotal; @endphp @endforeach @else @foreach(explode(",", $services) as $serviceId) @php $service = \App\EpsService::find($serviceId); $currentTotal = json_decode($invoice->multiple_totals, true)[$k] / count(explode(",", $services)); $subTotal += $currentTotal; @endphp @endforeach @endif @endforeach @else @php $subTotal = 0; $services = $invoice->authorization->eps_service_id; $companionService = $invoice->authorization->multiple_services; $flag = false; if ($companionService) { $services .= ",".$companionService; } elseif (count($invoice->authorization->services) > 0) { $services = ''; $flag = true; foreach ($invoice->authorization->services as $servicePrice) { $services .= $servicePrice->eps_service_id.","; } $services = trim($services, ","); } @endphp @if ($flag) @foreach($invoice->authorization->services as $authorizationService) @php $currentTotal = $authorizationService->price * $authorizationService->days; @endphp @endforeach @else @foreach(explode(",", $services) as $serviceId) @php $service = \App\EpsService::find($serviceId); $currentTotal = $invoice->total / count(explode(",", $services)); @endphp @endforeach @endif @php $subTotal += $invoice->total; @endphp @endif @php $total += $subTotal; @endphp @endforeach
No. Factura Datos del afiliado Cant. Valor Facturas
{{ $invoice->format_number }} {!! $currentAuthorization->patient->dni !!} {!! mb_strtoupper($currentAuthorization->patient->full_name) !!}
› {!! $authorizationService->service->code !!} {{ mb_strtoupper($authorizationService->service->name) }} {{ mb_strtoupper($currentAuthorization->codec) }} {!! $authorizationService->days !!} $ {!! number_format($currentTotal, 0, ",", ".") !!}
› {!! $service->code !!} {{ mb_strtoupper($service->name) }} {{ mb_strtoupper($currentAuthorization->codec) }} {!! json_decode($invoice->multiple_days, true)[$k] !!} $ {!! number_format($currentTotal, 0, ",", ".") !!}
{{ $invoice->format_number }} {!! $invoice->authorization->patient->dni !!} {{ mb_strtoupper($invoice->authorization->patient->last_name.' '.$invoice->authorization->patient->first_name) }}
› {!! $authorizationService->service->code !!} {{ mb_strtoupper($authorizationService->service->name) }} {{ mb_strtoupper($invoice->authorization->codec) }} {!! $authorizationService->days !!} $ {!! number_format($currentTotal, 0, ",", ".") !!}
› {{ $service->code }} {{ mb_strtoupper($service->name) }} {!! $invoice->authorization->codec !!} {!! $invoice->days !!} $ {!! number_format($currentTotal, 0, ",", ".") !!}
Subtotal Factura $ {!! number_format($subTotal, 0, ",", ".") !!}
TOTAL: $ {!! number_format($total, 0, ",", ".") !!}



_____________________________________
Firma de la persona autorizada
  Recibido: ___________________________
C.C.: _______________________________
Fecha: ________/__________/__________
              DIA         MES          AÑO


{!! $company->name." - Relación de Facturas ".$eps->alias !!}