@extends('layouts.master') @section('title', 'Invoice | Proxima - Medical Management app') @section('title-topbar', 'Invoice') @section('css') @endsection @section('fixedcontent') @if (Session::has('success'))

Sent Successfully

{{ Session::get('success') }}

@endif @endsection @section('content')
{{ __('basic.dashboard') }} | {{ __('basic.invoices') }} | {{ __('patientappo.invoice show') }}
@if (in_array($invoice->status, [1, 2, 3]) && $invoice->refund_id == null && $invoice->type == 0) {{ __('basic.refund') }} @endif @if ($invoice->status == 0) {{ __('patientappo.new items invoice') }} {{ __('basic.new material') }} @endif @if ($invoice->status == 0) {{ __('basic.installment') }} {{ __('basic.pay') }} @endif @if ($invoice->status == 1) {{ __('basic.add payment') }} @endif @if ($invoice->status !== 0) @role('Super-admin|Branch-manager') {{ __('basic.edit') }} @endrole @endif @if ($invoice->status !== 0) {{ __('basic.print') }} @endif
@role('Super-admin|Branch-manager') @endrole
{{ __('basic.invoice') }}
{!! QrCode::color(68, 95, 129)->size(75)->style('round')->eye('circle')->generate($invoice->code) !!}

{{ $invoice->code }}


{{ __('basic.type') }}

@if ($invoice->type == 0) {{ __('patientappo.income') }} @else {{ __('patientappo.expenses') }} @endif

{{ __('basic.specialty') }}

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

{{ __('basic.branch') }}

{{ $invoice->branch->name }} @if ($invoice->worker) | {{ $invoice->worker->name }} @endif

{{ __('basic.created') }}

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

@role('Super-admin|Branch-manager') @endrole {{ __('basic.attached') }}
@role('Super-admin|Branch-manager') @endrole @if (!empty($invoice->attached_pic)) {{ __('basic.download') }} @else

No attached

@endif
@if ($invoice->payment_method == 1) @php $payment_method_txt = __('basic.cash'); @endphp @elseif ($invoice->payment_method == 2) @php $payment_method_txt = __('basic.visa'); @endphp @elseif ($invoice->payment_method == 3) @php $payment_method_txt = __('basic.online'); @endphp @elseif ($invoice->payment_method == 4) @php $payment_method_txt = __('basic.bank transfer'); @endphp @elseif ($invoice->payment_method == 5) @php $payment_method_txt = __('basic.mobile transfer'); @endphp @else @php $payment_method_txt = ''; @endphp @endif @if ($invoice->status == 0)
{{ __('basic.status') }}
{{ __('basic.not paid') }}
@elseif ($invoice->status == 1)
{{ __('basic.status') }}
{{ __('basic.pending') }}
@elseif ($invoice->status == 2)
{{ __('basic.status') }}
{{ __('basic.installment') }}
@elseif ($invoice->status == 3)
{{ __('basic.paid') }}

{{ date('d M Y', strtotime($invoice->paid_date)) }} | {{ $payment_method_txt }}

@else @endif

@foreach ($invoice->invoice_items as $item)
@role('Super-admin|Branch-manager') @endrole {{ $item->categorizable->name }}
{{ $item->price }} {{ __('basic.egp') }}
@role('Super-admin|Branch-manager') @endrole @endforeach
{{ __('basic.subtotal') }}
{{ $invoice->invoice_items->sum('price') }} {{ __('basic.egp') }}
{{ __('basic.discount') }}
@if (!empty($invoice->discount)) {{ $invoice->discount }} {{ __('basic.egp') }} @else 0 {{ __('basic.egp') }} @endif
{{ __('basic.total price') }}
{{ $invoice->final_price }} {{ __('basic.egp') }}

@role('Super-admin|Accountant')

All Costs

Doctors commission
{{ $invoice->invoice_items->sum('doctor_comm') }} {{ __('basic.egp') }}
@if (count($invoice->costs) > 0)

Basic Costs

@foreach ($invoice->costs as $item)
@role('Super-admin|Branch-manager') @endrole {{ $item->cost_cat->name }}
{{ $item->price }} {{ __('basic.egp') }}
@role('Super-admin|Branch-manager') @endrole @endforeach @endif @if (count($invoice->materials) > 0)

Materials

@foreach ($invoice->materials as $item)
@role('Super-admin|Branch-manager') @endrole {{ $item->inventory->name }} (Qty: {{ $item->qty }})
@php $material_item_cost = $item->qty * $item->price; @endphp
{{ $material_item_cost }} {{ __('basic.egp') }}
@role('Super-admin|Branch-manager') @endrole @endforeach @endif
{{ __('basic.total cost') }}
{{ $invoice->total_cost }}
{{ __('basic.egp') }}
@endrole {{-- for payments --}} @if (count($invoice->payment) > 0)

Payments

@foreach ($invoice->payment as $item_p) @php if ($item_p->method == 1) { $method_payment = 'Cash'; } else { $method_payment = 'Visa'; } @endphp
@if ($invoice->status == 1) @role('Super-admin|Branch-manager') @endrole @endif @if ($item_p->type == 2) @endif @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') }}
@role('Super-admin|Branch-manager') @endrole @role('Super-admin|Branch-manager') @endrole @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
{{ $invoice->note }}
{{ __('patientappo.invoice final msg') }}
@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
@endsection @section('js') @endsection