@if ($invoice->receivable)

@if ($invoice->receivable_type === 'App\Models\Patient\Patient') Patient @elseif ($invoice->receivable_type === 'App\Models\User') Doctor @elseif ($invoice->receivable_type === 'App\Models\Invoice\Debtor') Debtor @endif

{{ $invoice->receivable->name }}

{{ date('d M Y h:i a', strtotime($invoice->created_at)) }}

@else The invoice is for no receiver @endif

Type

@if ($invoice->type == 0) Client @else Client @endif

Specialty

{{ $invoice->specialty->name }}

Branch

{{ $invoice->branch->name }}

Paid At

{{ date('d M Y h:i a', strtotime($invoice->paid_date)) }}


@foreach ($invoice->invoice_items as $item)
{{ $item->categorizable->name }}
{{ $item->price }} EGP
@endforeach
{{ __('basic.subtotal') }}
{{ $invoice->invoice_items->sum('price') }} {{ __('basic.egp') }}
Discount
@if (!empty($invoice->discount)) {{ $invoice->discount }} EGP @else 0 @endif
{{ __('patientappo.final price') }}
{{ $invoice->final_price }} {{ __('basic.egp') }}
{{-- for payments --}} @if (count($invoice->payment) > 0)
@foreach ($invoice->payment as $item_p) @php if ($item_p->method == 1) { $method_payment = 'Cash'; } else { $method_payment = 'Visa'; } @endphp
@if ($item_p->type == 2) {{ date('d M Y', strtotime($item_p->installment_date)) }} Installment @else {{ date('d M Y', strtotime($item_p->paid_date)) }} via {{ $method_payment }} @endif @if ($item_p->installment_date)

Installment: {{ date('d M Y', strtotime($item_p->installment_date)) }}

@endif @if ($item_p->worker)

Shift: {{ $item_p->worker->name }}

@endif
{{ $item_p->amount }} {{ __('basic.egp') }}
@endforeach
{{ __('basic.total payments') }}
@if ($invoice->sum_payment) {{ $invoice->sum_payment }} @else 0 @endif {{ __('basic.egp') }}
@if ($invoice->status !== 3)
{{ __('basic.remaining amount') }}
{{ $invoice->final_price - $invoice->sum_payment }} {{ __('basic.egp') }}
@endif @endif
Here is the total price that you have paid including tax with discount applied
@if ($invoice->status == 0)

{{ __('basic.not paid') }}

@elseif (in_array($invoice->status, [1, 2]))
{{ __('basic.remaining amount') }}

{{ $invoice->final_price - $invoice->sum_payment }} {{ __('basic.egp') }}

@else
{{ __('patientappo.amount to pay') }}

{{ $invoice->final_price }} {{ __('basic.egp') }}

@endif