@section('title', 'Invoices') @section('heading', 'Invoices') @section('top-menu-items') @endsection
@if (isset($invoice->id))

INVOICE

{{-- Logo --}}
{{ $invoice->partner?->organization_name }}
{{ $invoice->partner?->billing_email_address }}
Invoice ID #{{ $invoice->id }}
Status {{ $invoice->status ?? '' }}
Open Date {{ $invoice->created_at->format('d M, Y') }}
Closed Date {{ $invoice->closed_at ? \Carbon\Carbon::parse($invoice->closed_at)->format('d M, Y') : '' }}
Paid Date {{ $invoice->paid_at ? \Carbon\Carbon::parse($invoice->paid_at)->format('d M, Y') : '' }}
Billing Address Unit 1/23 Hastings Road,
Melbourne 3000,
Victoria,
Australia.
Shipping Address Unit 1/23 Hastings Road,
Melbourne 3000,
Victoria,
Australia.
@if ($invoice->status == 'Sent') @endif {{-- --}} @if ($invoice->status == 'Sent') @endif @foreach ($orders as $order) @if ($invoice->status == 'Sent') @endif {{-- --}} @php $tourTypeCounts = []; $tourTypePrices = []; $tourTypeDiscounts = []; $tourTypeTaxes = []; foreach ($order->bookings as $booking) { $tourName = $booking->tour->name ?? 'N/A'; foreach ($booking->passengers as $passenger) { $type = $passenger->type ?? 'N/A'; $price = $passenger->price ?? 0; $discount = (float) $passenger->discountedPrice(); $tax = $passenger->effectiveTaxTotal(); if (!isset($tourTypeCounts[$tourName][$type])) { $tourTypeCounts[$tourName][$type] = 1; $tourTypePrices[$tourName][$type] = $price; $tourTypeDiscounts[$tourName][$type] = $discount; $tourTypeTaxes[$tourName][$type] = $tax; } else { $tourTypeCounts[$tourName][$type]++; $tourTypePrices[$tourName][$type] += $price; $tourTypeDiscounts[$tourName][$type] += $discount; $tourTypeTaxes[$tourName][$type] += $tax; } } } $name = 'name'; $price = 'price'; $qty = 'qty'; $taxes = 'taxes'; $groupedLineItems = $order->lineItems; @endphp {{-- Tour Name Column --}} {{-- Type Column --}} {{-- Price per Single Passenger Type --}} {{-- Quantity Column --}} {{-- Total Price Column --}} @if ($invoice->status == 'Sent') @endif @endforeach

Select All

Order# Reference #Ref#Date Products Rate Price Qty Subtotal Discount Taxes Total Paid DuePayment
#{{ $order->id }} {{ $order->orderable->partner_ref_id ?? 'N/A' }} {{ $order->Partner_ref_id ?? 'N/A' }} {{ optional($order->bookings->first())->booking_date ? \Carbon\Carbon::parse($order->bookings->first()->booking_date)->format('d-m-Y') : '' }}
@foreach ($tourTypeCounts as $tour => $types) @foreach ($types as $type => $count) {{ $tour }}
@endforeach @endforeach @foreach ($groupedLineItems as $groupedLineItem ) {{ $groupedLineItem->$name }}
@endforeach
@foreach ($tourTypeCounts as $tour => $types) @foreach ($types as $type => $count) {{ ucfirst($type) }}
@endforeach @endforeach
@foreach ($tourTypePrices as $tour => $types) @foreach ($types as $type => $total) @php $count = $tourTypeCounts[$tour][$type] ?? 1; $singlePrice = $count > 0 ? $total / $count : 0; @endphp {{ $singlePrice < 0 ? '-$' . number_format(abs($singlePrice), 2) : '$' . number_format($singlePrice, 2) }}
@endforeach @endforeach @foreach ($groupedLineItems as $groupedLineItem ) {{ number_format($groupedLineItem->$price, 2) }}
@endforeach
@foreach ($tourTypeCounts as $tour => $types) @foreach ($types as $type => $count) {{ $count }}
@endforeach @endforeach @foreach ($groupedLineItems as $groupedLineItem ) {{ $groupedLineItem->$qty }}
@endforeach
@foreach ($tourTypePrices as $tour => $types) @foreach ($types as $type => $total) @php $numericTotal = is_numeric($total) ? (float) $total : 0; @endphp {{ $numericTotal < 0 ? '-$' . number_format(abs($numericTotal), 2) : '$' . number_format($numericTotal, 2) }}
@endforeach @endforeach @foreach ($groupedLineItems as $groupedLineItem ) {{ $groupedLineItem->$qty * $groupedLineItem->$price }}
@endforeach
@foreach ($tourTypeDiscounts as $tour => $types) @foreach ($types as $type => $discount) {{ $discount < 0 ? '-$' . number_format(abs($discount), 2) : '$' . number_format($discount, 2) }}
@endforeach @endforeach
@foreach ($tourTypeTaxes as $tour => $types) @foreach ($types as $type => $tax) {{ $tax < 0 ? '-$' . number_format(abs($tax), 2) : '$' . number_format($tax, 2) }}
@endforeach @endforeach @foreach ($groupedLineItems as $groupedLineItem ) @php $calculated = $groupedLineItem->effectiveTaxTotal(); @endphp {{ $calculated < 0 ? '-$' . number_format(abs($calculated), 2) : '$' . number_format($calculated, 2) }}
@endforeach
@php $orderTotal = ($order->total_price + $order->discount) + ($order->taxes ?? 0); @endphp {{ $orderTotal < 0 ? '-$' . number_format(abs($orderTotal), 2) : '$' . number_format($orderTotal, 2) }} @php $orderPaid = (float) $order->paid; @endphp {{ $orderPaid < 0 ? '-$' . number_format(abs($orderPaid), 2) : '$' . number_format($orderPaid, 2) }} @php $due = $orderTotal - ($orderPaid ?? 0); @endphp {{ $due < 0 ? '-$' . number_format(abs($due), 2) : '$' . number_format($due, 2) }}
@php $balance = ($total_val + $total_dis + $total_tax) - $paid; $balance = abs($balance) < 0.5 ? 0 : $balance; @endphp
@if ($invoice->status == 'Sent') @endif
Sub-Total {{ $total_val < 0 ? '-$' . number_format(abs($total_val), 2) : '$' . number_format($total_val, 2) }}
Discount {{ $total_dis < 0 ? '-$' . number_format(abs($total_dis), 2) : '$' . number_format($total_dis, 2) }}
Taxes {{ $total_tax < 0 ? '-$' . number_format(abs($total_tax), 2) : '$' . number_format($total_tax, 2) }}
Total @php $grandTotal = $total_val + $total_dis + $total_tax; @endphp {{ $grandTotal < 0 ? '-$' . number_format(abs($grandTotal), 2) : '$' . number_format($grandTotal, 2) }}
Payments {{ $paid < 0 ? '-$' . number_format(abs($paid), 2) : '$' . number_format($paid, 2) }}
Balance {{ $balance < 0 ? '-$' . number_format(abs($balance), 2) : '$' . number_format($balance, 2) }}
@if ($status === 'Open') @endif @if ($status === 'Closed' || $status === 'Sent')
@if ($invoice->sent_date) Last Sent Date: {{ $invoice->sent_date->format('Y-m-d') }} @else Not sent yet @endif
@endif
@endif
@if (!empty($uploadedFiles))
    @foreach ($uploadedFiles as $file) @if ($file)
  • @if(in_array(pathinfo($file->name, PATHINFO_EXTENSION), ['jpg', 'jpeg', 'png', 'gif'])) @else @endif {{ basename($file->name) }}
  • @endif @endforeach
@else

No files uploaded yet.

@endif
@push('scripts') @endpush