@extends('layouts.app') @section('title', 'Print Invoice') @section('navigation') @endsection @section('content')
Phone: {{ $booking->bookingBranch->contacts ?? '+966XXX-XXXXXXX' }}
{{ $booking->bookingBranch->name ?? 'BMT-Dak' }}
| Booking Date : | {{ $booking->booking_date ?? ($booking->created_at ? $booking->created_at->format('d M Y') : '-') }} | Passenger Mobile (BD) : | {{ $passengerMobileBd }} |
| Customer Name : | {{ $booking->customer->name ?? '-' }} | Passenger Address : | {{ $passengerAddress }} |
| Iqama Number : | {{ $booking->customer->iqama_no ?? '-' }} | Fingerprint Deadline : | {{ $fingerprintDeadline ?? '-' }} |
| Customer Mobile : | {{ $booking->customer->mobile_no ?? '-' }} | Fingerprint Location : | {{ $fpLocation ?? '-' }} |
| Address (KSA) : | {{ $addressKsa }} | ||
| Invoice Date : | {{ $invoiceDate ?? '-' }} |
| Booking Date : | {{ $booking->created_at ? $booking->created_at->format('d M Y') : '-' }} |
| Booking Branch : | {{ $booking->bookingBranch->name ?? '-' }} |
| Fingerprint Branch : | {{ $booking->fingerprintBranch->name ?? '-' }} |
| Sale Representative : | {{ $booking->user->name ?? '-' }} |
| Remarks : | {{ $booking->remarks ?? '-' }} |
| Pax No. | Name of passengers | Gender | Passport number | Package | Duration (Days) | Package Value | Trip | Airline | Route | Est.Flight Date | Baggage | Cabin | Meal | Flight Type | Remarks | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| In | Out | |||||||||||||||||||
| {{ $index + 1 }} | {{ $passenger->first_name ?? '' }} {{ $passenger->last_name ?? '' }} | {{ $passenger->gender ?? '-' }} | {{ $passenger->passport_no ?? '-' }} | {{ $booking->package?->package_name ?? 'Package' }} | {{ $passenger->stay_duration ?? '-' }} | @currency($passenger->package_value ?? 0, 2, $rate) |
In Bound
Out Bound
|
@php
$_alCode = $passenger->ticketFare?->airline?->code ?? null;
$_rt = $passenger->ticketFare?->route?->route_type?->value;
$_airIn = 'N/A';
$_airOut = 'N/A';
if ($_alCode) {
if ($_rt === 'oneway_inbound') {
$_airIn = $_alCode;
} elseif ($_rt === 'oneway_outbound') {
$_airOut = $_alCode;
} else {
$_airIn = $_alCode;
$_airOut = $_alCode;
}
}
@endphp
{{ $_airIn }}
{{ $_airOut }}
|
@php
$_routeType = $passenger->ticketFare?->route?->route_type?->value;
$_routeTop = 'N/A';
$_routeBottom = 'N/A';
$_isSplit = false;
if ($_routeType === 'oneway_inbound') {
$_routeTop = $passenger->route_display;
$_isSplit = true;
} elseif ($_routeType === 'oneway_outbound') {
$_routeBottom = $passenger->route_display;
$_isSplit = true;
} elseif ($_routeType === 'multi_city') {
$_segments = $passenger->ticketFare?->route?->multiSegments ?? collect();
$_inSegment = $_segments->first(fn($s) => $s->segment_direction?->value === 'inbound');
$_outSegment = $_segments->first(fn($s) => $s->segment_direction?->value === 'outbound');
if ($_inSegment && $_inSegment->fromCity && $_inSegment->toCity) {
$_routeTop = $_inSegment->fromCity->code . ' → ' . $_inSegment->toCity->code;
}
if ($_outSegment && $_outSegment->fromCity && $_outSegment->toCity) {
$_routeBottom = $_outSegment->fromCity->code . ' → ' . $_outSegment->toCity->code;
}
$_isSplit = true;
}
@endphp
@if($_isSplit)
{{ $_routeTop }}
{{ $_routeBottom }}
|
@else
{{ $passenger->route_display }} | @endif
{{ $passenger->flight_date_display }}
After {{ $passenger->stay_duration ?? '-' }} Days
|
@php
$_bd = $passenger->baggage_display;
$_in = 'N/A';
$_out = 'N/A';
if ($_bd !== '-' && $_bd !== '') {
foreach (explode("\n", $_bd) as $_line) {
if (str_starts_with($_line, 'In:')) {
$_raw = trim(substr($_line, 3));
$_in = preg_replace('/[^0-9]/', '', $_raw) ?: 'N/A';
} elseif (str_starts_with($_line, 'Out:')) {
$_raw = trim(substr($_line, 4));
$_out = preg_replace('/[^0-9]/', '', $_raw) ?: 'N/A';
}
}
}
@endphp
{{ $_in }} | {{ $_out }} | @php $_cabinVal = $passenger->ticketFare?->airlineClass?->travelClass?->name ?? '-'; $_cabinRt = $passenger->ticketFare?->route?->route_type?->value; $_cabinTop = $_cabinVal; $_cabinBottom = $_cabinVal; $_cabinSplit = false; if ($_cabinRt === 'oneway_inbound') { $_cabinBottom = 'N/A'; $_cabinSplit = true; } elseif ($_cabinRt === 'oneway_outbound') { $_cabinTop = 'N/A'; $_cabinSplit = true; } @endphp @if($_cabinSplit)
{{ $_cabinTop }}
{{ $_cabinBottom }}
|
@else
{{ $_cabinVal }} | @endif @php $_mealVal = $passenger->meal_display; $_mealRt = $passenger->ticketFare?->route?->route_type?->value; $_mealTop = $_mealVal; $_mealBottom = $_mealVal; $_mealSplit = false; if ($_mealRt === 'oneway_inbound') { $_mealBottom = 'N/A'; $_mealSplit = true; } elseif ($_mealRt === 'oneway_outbound') { $_mealTop = 'N/A'; $_mealSplit = true; } @endphp @if($_mealSplit)
{{ $_mealTop }}
{{ $_mealBottom }}
|
@else
{{ $_mealVal }} | @endif @php $_ftRt = $passenger->ticketFare?->route?->route_type?->value; $_ftType = $passenger->ticketFare?->route?->flight_type?->value; $_transits = $passenger->ticketFare?->route?->transits ?? collect(); $_inMins = $_transits->filter(fn($t) => $t->route_direction?->value === 'inbound')->sum('transit_time'); $_outMins = $_transits->filter(fn($t) => $t->route_direction?->value === 'outbound')->sum('transit_time'); $_fmt = function($mins) { if (!$mins || $mins <= 0) return 'Direct'; $h = intdiv($mins, 60); $m = $mins % 60; return sprintf('Transit: %02d hr %02d min', $h, $m); }; $_ftTop = 'N/A'; $_ftBottom = 'N/A'; $_ftSplit = false; if ($_ftRt === 'oneway_inbound') { $_ftTop = $_ftType === 'transit' ? $_fmt($_inMins) : 'Direct'; $_ftSplit = true; } elseif ($_ftRt === 'oneway_outbound') { $_ftBottom = $_ftType === 'transit' ? $_fmt($_outMins) : 'Direct'; $_ftSplit = true; } elseif (in_array($_ftRt, ['round', 'multi_city'])) { if ($_ftType === 'transit') { $_ftTop = $_fmt($_inMins); $_ftBottom = $_fmt($_outMins); $_ftSplit = true; } else { $_ftTop = 'Direct'; } } @endphp @if($_ftSplit)
{{ $_ftTop }}
{{ $_ftBottom }}
|
@else
{{ $_ftTop }} | @endif{{ $booking->remarks ?? '-' }} |
| No passenger data | ||||||||||||||||||||
| Sub Total: | @currency($subTotal, 2, $rate) |
| Total Pax: | {{ $totalPackages ?? 0 }} |
| Fingerprint Charge: | @currency($fingerprintCharge, 2, $rate) |
| Discount: | @currency($discount, 2, $rate) |
| Grand Total: | @currency($grandTotal, 2, $rate) |
Exchange Rate: 1 SAR = {{ number_format($displayRate, 4) }} BDT
@endif| Total Amount: | @currency($grandTotal, 2, $rate) |
| Previous Paid Amount: | @currency($totalPaid - $currentPaid, 2, $rate) |
| Current Paid Amount: | @currency($currentPaid, 2, $rate) |
| Total Paid Amount: | @currency($totalPaid, 2, $rate) |
| Due Amount: | @currency($dueAmount, 2, $rate) |
Representative Signature
Customer Signature
This is a computer-generated invoice. No signature is required.