@if($appointment->patient)

{{ $appointment->patient->full_name }}

{{ $appointment->patient->phone_number }}

@else

{{ $appointment->sell_debtor->full_name }}

{{ $appointment->sell_debtor->phone_number }}

@endif

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

{{ $appointment->creator->full_name }}

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

{{ $appointment->branch->name }}

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

{{-- for invoice payment for client and supplier--}} @if(in_array($appointment->payment_method, [1,2])) @if ($appointment->status == 0) @php $msg_invoice_debtor = __('basic.not paid'); $text_color_invoice_debtor = 'cancel-color-btn'; @endphp @elseif ($appointment->status == 1) @php $text_color_invoice_debtor = 'pend-color-btn'; $msg_invoice_debtor = __('basic.pending'); @endphp @elseif ($appointment->status == 2) @php $text_color_invoice_debtor = 'prog-color-btn'; $msg_invoice_debtor = __('basic.installment'); @endphp @elseif ($appointment->status == 3) @php $text_color_invoice_debtor = 'done-color-btn'; $msg_invoice_debtor = __('basic.paid'); @endphp @elseif ($appointment->status == 4) @php $msg_invoice_debtor = __('basic.refund'); $text_color_invoice_debtor = 'cancel-color-btn'; @endphp @endif @if($appointment->invoice)

@endif @else {{ __('basic.no invoice') }} @endif

{{-- @if($appointment->created_at)

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

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

@endif --}}

@php $total_buy = 0; $total_sell = 0; @endphp {{-- Hotels --}} @if(count($appointment->hotel) > 0)
{{ __('basic.hotels') }}
@foreach ($appointment->hotel as $item)
@if($item->offer_room) @else @endif
{{ $item->hotel->name }}

{{ __('basic.room type') . ':'}} {{ $item->room_type->name }}

{{ __('basic.room meal') . ':'}} {{ $item->room_meal->name }}

{{ __('basic.room view') . ':'}} {{ $item->room_view->name }}

{{ __('basic.check in') }}
{{ date('d M Y', strtotime($item->start_at)) }}
{{ __('basic.check out') }}
{{ date('d M Y', strtotime($item->end_at)) }}
{{ __('basic.nights') }}
{{ $item->nights . ' ' . __('basic.nights') }}
{{ __('basic.quantity') }}
{{ $item->quantity . ' ' . __('basic.rooms') }}
{{-- for invoice payment for client and supplier--}} @if(in_array($item->payment_method, [1,2]) && $item->invoice_item->invoice_id !== 0) {{-- for cost wallet --}} @if($item->cost) {{-- for cost invoice --}} @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp {{-- for no invoice --}} @else {{-- for cost wallet --}} @if($item->cost) @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->subtotal; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp @endif
{{ __('basic.selling price') }}
{{ $selling_price }}
{{ __('basic.hotel booking code') }}
{{ $item->code }}
@if($item->customer_name)

{{ __('basic.traveler name') . ':'}} {{ $item->customer_name }}

{{ __('basic.traveler phone') . ':'}} {{ $item->customer_phone }}

@endif
@endforeach
@endif {{-- transporation --}} @if(count($appointment->transportation) > 0)
{{ __('basic.transportations') }}
@foreach ($appointment->transportation as $item)
@if($item->bus_trip) {{ $item->bus_trip->name }} @else {{ $item->vehicle->name }} @endif @if($item->fromable) @php $from_transp = $item->fromable->name; @endphp

{{ __('basic.from') . ':'}} {{ $item->fromable->name }}

@else @php $from_transp = ""; @endphp @endif @if($item->toable) @php $to_transp = $item->toable->name; @endphp

{{ __('basic.to') . ':'}} {{ $item->toable->name }}

@else @php $to_transp = ""; @endphp @endif

{{ __('basic.vehicle') . ':'}} {{ $item->vehicle->name }}

{{ __('basic.check in') }}
{{ date('d M Y h:i A', strtotime($item->start_at)) }}
{{ __('basic.check out') }}
{{ date('d M Y h:i A', strtotime($item->end_at)) }}
@if($item->cat == 1)
{{ __('basic.days') }}
{{ $item->days . ' ' . __('basic.days') }}
@else
{{ __('basic.tickets') }}
{{ $item->qty . ' ' . __('basic.tickets') }}
{{ __('basic.seat numbers') }}
@foreach ($item->seats as $item_seat) {{ $item_seat->seat }} @endforeach {{ __('basic.numbers') }}
@endif
{{-- accept client and supplier invoice --}} @if(in_array($item->payment_method, [1,2]) && $item->invoice_item->invoice_id !== 0) {{-- for cost wallet --}} @if($item->cost) {{-- for cost invoice --}} @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += $item->buy; $buying_price = $item->buy; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp {{-- for no invoice --}} @else {{-- for cost wallet --}} @if($item->cost) @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += $item->buy; $buying_price = $item->buy; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp @endif
{{ __('basic.selling price') }}
{{ $selling_price }}
{{ __('basic.transport booking code') }}
{{ $item->code }}
@if($item->customer_name)

{{ __('basic.traveler name') . ':'}} {{ $item->customer_name }}

{{ __('basic.traveler phone') . ':'}} {{ $item->customer_phone }}

@endif
@endforeach
@endif {{-- visa --}} @if(count($appointment->visa) > 0)
{{ __('basic.visas') }}
@foreach ($appointment->visa as $item)
{{ $item->visa->name }}

{{ __('basic.type') . ':'}} {{ $item->visa_type->name }}

{{ __('basic.arrival date') }}
{{ date('d M Y h:i A', strtotime($item->start_at)) }}
{{ __('basic.duration') }}
{{ $item->duration . ' ' . __('basic.days') }}
{{-- accept client and supplier invoice --}} @if(in_array($item->payment_method, [1,2]) && $item->invoice_item->invoice_id !== 0) {{-- for cost wallet --}} @if($item->cost) {{-- for cost invoice --}} @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp {{-- for no invoice --}} @else {{-- for cost wallet --}} @if($item->cost) @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp @endif
{{ __('basic.selling price') }}
{{ $selling_price }}
{{ __('basic.transport booking code') }}
{{ $item->code }}
@if($item->first_name)

{{ __('basic.traveler name') . ':'}} {{ $item->first_name }}

{{ __('basic.traveler phone') . ':'}} {{ $item->second_name }}

@endif

@endforeach
@endif {{-- trip --}} @if(count($appointment->trip) > 0)
{{ __('basic.trips') }}
@foreach ($appointment->trip as $item)
{{ $item->trip->name }}

{{ __('basic.destination') . ':'}} {{ $item->destination->name }}

{{ __('basic.start date') }}
{{ date('d M Y h:i A', strtotime($item->start_at)) }}
{{ __('basic.quantity') }}
{{ $item->qty . ' ' . __('basic.people') }}
{{-- accept client and supplier invoice --}} @if(in_array($item->payment_method, [1,2]) && $item->invoice_item->invoice_id !== 0) {{-- for cost wallet --}} @if($item->cost) {{-- for cost invoice --}} @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp {{-- for no invoice --}} @else {{-- for cost wallet --}} @if($item->cost) @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp @endif
{{ __('basic.selling price') }}
{{ $selling_price }}
{{ __('basic.transport booking code') }}
{{ $item->code }}
@if($item->customer_name)

{{ __('basic.traveler name') . ':'}} {{ $item->customer_name }}

{{ __('basic.traveler phone') . ':'}} {{ $item->customer_phone }}

@endif
@endforeach
@endif {{-- airline --}} @if(count($appointment->airline) > 0)
{{ __('basic.airline') }}
@foreach ($appointment->airline as $item)

{{ $item->name }}

{{ __('basic.from') . ':'}} {{ $item->from->name }}

{{ __('basic.to') . ':'}} {{ $item->to->name }}

{{ __('basic.start date') }}
{{ date('d M Y h:i A', strtotime($item->start_at)) }}
{{ __('basic.end date') }}
{{ date('d M Y h:i A', strtotime($item->end_at)) }}
{{ __('basic.quantity') }}
{{ $item->qty . ' ' . __('basic.people') }}
{{-- accept client and supplier invoice --}} @if(in_array($item->payment_method, [1,2]) && $item->invoice_item->invoice_id !== 0) {{-- for cost wallet --}} @if($item->cost) {{-- for cost invoice --}} @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp {{-- for no invoice --}} @else {{-- for cost wallet --}} @if($item->cost) @php $total_buy += $item->cost->final_price; $buying_price = $item->cost->final_price; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->wallet_serviceable->amount; $selling_price = $item->wallet_serviceable->amount; @endphp @endif
{{ __('basic.selling price') }}
{{ $selling_price }}
{{ __('basic.transport booking code') }}
{{ $item->code }}
@if($item->customer_name)

{{ __('basic.traveler name') . ':'}} {{ $item->customer_name }}

{{ __('basic.traveler phone') . ':'}} {{ $item->customer_phone }}

@endif
@endforeach
@endif {{-- package --}} @if(count($appointment->package) > 0)
{{ __('basic.package') }}
@foreach ($appointment->package as $item)
{{ $item->package->name }}

{{ __('basic.type') . ':'}} {{ $item->type_qty . " " . __('basic.trip') }}

{{ __('basic.type') . ':'}} @if($item->type == 1) @php $package_type = __('basic.customized'); @endphp @elseif ($item->type == 2) @php $package_type = __('basic.commission'); @endphp @endif {{ $package_type }}

{{ __('basic.start date') }}
{{ date('d M Y h:i A', strtotime($item->start_at)) }}
{{ __('basic.end date') }}
{{ date('d M Y h:i A', strtotime($item->end_at)) }}
{{ __('basic.capacity') }}
{{ $item->qty . ' ' . __('basic.people') }}
{{-- accept client and supplier invoice --}} @if(in_array($item->payment_method, [1,2]) && $item->invoice_item->invoice_id !== 0) {{-- for cost wallet --}} @if($item->cost) {{-- for cost invoice --}} @php $total_buy += $item->buy; $buying_price = $item->buy_pp; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->invoice_item->final_price; $selling_price = $item->invoice_item->subtotal; @endphp {{-- for no invoice --}} @else {{-- for cost wallet --}} @if($item->buy) @php $total_buy += $item->buy; $buying_price = $item->buy_pp; @endphp @else @php $total_buy += 0; $buying_price = 0; @endphp @endif @php $total_sell += $item->sell; $selling_price = $item->sell_pp; @endphp @endif
{{ __('basic.selling price pp') }}
{{ $selling_price }}
{{ __('basic.selling price') }}
{{ $item->sell }}
{{ __('basic.transport booking code') }}
{{ $item->code }}
@if($item->customer_name)

{{ __('basic.traveler name') . ':'}} {{ $item->customer_name }}

{{ __('basic.traveler phone') . ':'}} {{ $item->customer_phone }}

@endif
@endforeach
@endif
{{ __('basic.subtotal') }}
{{ $appointment->total_sell_price }} {{ $appointment->invoice->currency->code }}
{{ __('basic.discount') }}
@if ($appointment->invoice_item) @if (!empty($appointment->invoice_item->invoice->discount)) {{ $appointment->invoice_item->invoice->discount }} {{ $appointment->invoice->currency->code }} @else 0 @endif @else No Discount @endif
{{ __('basic.final price') }}
{{ $appointment->final_sell_price }} {{ $appointment->invoice->currency->code }}
{{--
{{ __('basic.final price') }}
{{ $appointment->total_sell_price }} {{ __('basic.egp') }}
--}}
{{ __('basic.final price') }}

{{ $appointment->final_sell_price }} {{ $appointment->invoice->currency->code }}

{{ $invoice_rule }}