@php $W = \App\Support\Words::class; $bnd = fn ($t) => \App\Support\Words::bnDigits((string) $t); $mp = fn ($n) => ($s['bn_digits'] ?? '') === '1' ? $W::bnDigits($W::plain($n)) : $W::plain($n); $cur = ($s['currency_symbol'] ?? '') ?: '৳'; $act = array_values(array_filter($b->items, fn ($i) => $i->status !== 'cancelled')); $travelDates = array_values(array_unique(array_map(fn ($i) => $i->travel_date, $act))); sort($travelDates); $isPaid = $b->isInvoice && $b->due <= 0 && $b->total > 0; $corp = ($b->booking_type ?? '') === 'corporate' && !empty($b->company); $ins = array_values(array_filter(array_map('trim', preg_split('/\r?\n/', $s['invoice_instructions'] ?? '')))); $ver = array_values(array_filter($b->payments, fn ($p) => $p->verified)); $docWord = $b->isInvoice ? 'Invoice' : 'Quotation'; $tel = fn ($n) => 'tel:' . preg_replace('/[^0-9+]/', '', (string) $n); $wa = preg_replace('/\D/', '', $s['whatsapp'] ?? ''); if ($wa && str_starts_with($wa, '01')) $wa = '88' . $wa; $pct = $b->total > 0 ? min(100, round($b->paid * 100 / $b->total)) : 0; $coName = ($s['company_legal_name'] ?? '') ?: ($s['site_name'] ?? ''); $wmOn = ($s['invoice_watermark'] ?? '1') !== '0'; $wmText = trim($s['invoice_watermark_text'] ?? '') ?: (bn((int) ($s['experience_years'] ?? 15)) . ' বছরের অভিজ্ঞতা'); $policy = \App\Support\Docs::policyFor($b); $one = ($s['invoice_onepage'] ?? '1') !== '0' && !request('full'); $hideRates = request()->has('rates') ? request('rates') === '0' : (int) ($b->invoice_hide_rates ?? 0) === 1; $hasBank = !empty($s['bank_name']) || !empty($s['bank_account_no']); $showMobile = ($s['invoice_show_bkash'] ?? '0') === '1' || !$hasBank; $custWa = preg_replace('/\D/', '', (string) ($b->customer->mobile ?? '')); if (str_starts_with($custWa, '01')) $custWa = '88' . $custWa; $shareText = ($b->isInvoice ? 'আপনার ইনভয়েস' : 'আপনার কোটেশন') . ' ' . $invNo . ' (' . ($s['site_name'] ?? '') . '): ' . $publicUrl; // trip details set by the office for each tour date (vehicle / ship, driver, guide, emergency numbers) $trips = []; foreach ($act as $it) { $dp = \Illuminate\Support\Facades\DB::table('departures')->where(['package_id' => $it->package_id, 'travel_date' => $it->travel_date])->first(); if ($dp && ($dp->transport_name || $dp->transport_no || $dp->guide_name || $dp->meeting_point || $dp->emergency || $dp->driver_name)) $trips[] = ['it' => $it, 'd' => $dp]; } $copy = function ($v) { return ''; }; @endphp {{ $docWord }} {{ $invNo }} – {{ $s['site_name'] ?? '' }} @if($public)@endif @if($toolbar)
✏️ Edit invoice 📄 PDF 📊 Excel 📝 Word 🟢 WhatsApp এ পাঠান {{ $b->customer->mobile }} 🔗 কাস্টমার যা দেখবে {{ $hideRates ? '💰 দাম দেখান' : '🙈 দাম লুকান' }} {{ $one ? '📃 Full details' : '📄 One page' }} {{ $showPay ? 'Hide' : 'Show' }} payment info ← Back
@elseif($public)
📞 Call us {{ $s['phone'] ?? '' }}
@endif
@if($wmOn)@endif
{{ $b->isInvoice ? ($isPaid ? 'PAID' : '') : 'QUOTATION' }}
{{ $s['site_name'] ?? '' }}
{{ $coName }}
{{ $s['address'] ?? '' }}
Hotline: {{ $s['phone'] ?? '' }} · WhatsApp: {{ $s['whatsapp'] ?? '' }}
{{ $s['email'] ?? '' }} · {{ preg_replace('~^https?://~', '', $s['site_url'] ?? '') }} @php $tl = ($s['legal_trade_license'] ?? '') ?: ($s['trade_license'] ?? ''); $tb = trim(implode(' / ', array_filter([$s['legal_tin'] ?? '', $s['legal_bin'] ?? '']))) ?: ($s['tin_bin'] ?? ''); @endphp @if($tl)
Trade licence: {{ $tl }}@endif @if($tb) · TIN/BIN: {{ $tb }}@endif @if(!empty($s['vat_reg_no'])) · VAT reg: {{ $s['vat_reg_no'] }}@endif
@if($wmOn)🏆 {{ $wmText }}@endif

{{ strtoupper($b->docTitle) }}

№ {{ $invNo }}
@if($isPaid)@endif
{{ $docWord }} date: {{ dfmt($b->docDate) }}
@if(!$b->isInvoice && !empty($b->quote_valid_until))Valid until: {{ $b->quote_valid_until }}
@endif Booking ID: {{ $b->code }}
Booked on: {{ dfmt($b->created_at) }}
Travel date{{ implode(', ', array_map('dfmt', $travelDates)) ?: '-' }}
Travellers{{ $b->persons }} person(s)
Status@if($isPaid)Paid in full@elseif($b->isInvoice && $b->paid > 0)Partially paid@elseif(!$b->isInvoice)Quotation@else{{ $STATUS[$b->overall]['label'] ?? $b->overall }}@endif
Balance due{{ $cur }} {{ $mp($b->due) }}

{{ $b->isInvoice ? '🧾 Billed to' : '📝 Prepared for' }}

@if($corp){{ $b->company }}
Attn: {{ $b->customer->name }}@else{{ $b->customer->name }}@endif
📞 {{ $b->customer->mobile }}
✉️ {!! $b->customer->email ? e($b->customer->email) : 'email not given' !!}
📍 {!! $b->customer->address ? e($b->customer->address) : 'address not given' !!}

🗓 Reservation

{{ $corp ? 'Corporate booking' : ($b->persons > 1 ? 'Individual / group booking' : 'Individual booking') }}
{{ count($act) }} tour(s) · {{ $b->persons }} traveller(s)
Journey: {{ implode(', ', $travelDates) }}

QRScan to view / print{{ $docWord }} {{ $invNo }}
@unless($one)

Dear {{ $corp ? 'Sir / Madam' : $b->customer->name }},
@if($b->isInvoice)Thank you for choosing {{ $s['site_name'] ?? '' }}. We are pleased to confirm your reservation. Please find below the services booked and the payment status of your account.@else Thank you for your interest in {{ $s['site_name'] ?? '' }}. As requested, here is our quotation for the following tour services. Rates are subject to availability at the time of confirmation.@endif

@endunless @unless($hideRates)@endunless @foreach($act as $i => $it) @unless($hideRates)@endunless @if(!$hideRates && ($it->child_amount || $it->extra_amount || $it->discount)) @endif @endforeach @if($b->lines) @foreach($b->lines as $l)@unless($hideRates)@endunless@endforeach @endif
SLDescription of serviceTravel datePaxRate (BDT)Amount (BDT)
{{ $i + 1 }} {{ $it->title_en }} – {{ $it->title }}
{{ $it->duration }} · {{ $it->route }}
Ref: {{ $it->code }}{{ $it->rooms ? ' · Rooms: ' . $it->rooms : '' }}
@if(!empty($it->days) || !empty($it->nights) || !empty($it->meals) || !empty($it->meal_note))
@if(!empty($it->days) || !empty($it->nights))🗓 {{ $bnd(($it->days ?? 0) . ' দিন') }}{{ !empty($it->nights) ? ' / ' . $bnd($it->nights . ' রাত') : '' }} ({{ (int) $it->days }}D{{ !empty($it->nights) ? '/' . (int) $it->nights . 'N' : '' }})@endif @if(!empty($it->nights))🏨 থাকা: {{ $bnd($it->nights . ' রাত') }}@endif @if(!empty($it->meals) || !empty($it->meal_note))🍽 {{ !empty($it->meals) ? $bnd($it->meals . ' বেলা খাবার') : 'খাবার' }}{{ !empty($it->meal_note) ? ': ' . $it->meal_note : '' }}@endif
@endif @if(!empty($it->room_lines))
    @foreach($it->room_lines as $rl)
  • {{ $rl['qty'] }} × {{ $rl['name'] }} ({{ $rl['persons'] }} জন)@unless($hideRates){{ $cur }} {{ $mp($rl['amount']) }}@endunless
  • @endforeach
@else
{{ $it->rate_name }}@endif
{{ dfmt($it->travel_date) }} {{ $it->adults }} adult @if($it->children)
{{ $it->children }} child @endif
{{ $mp($it->unit_price) }} {{ $mp($it->total) }}
@if($it->children)Children (age {{ implode(', ', $it->child_ages) }}): {{ $mp($it->child_amount) }}@endif @if($it->extra_amount) · Extra: {{ $mp($it->extra_amount) }}@endif @if($it->discount) · Discount: −{{ $mp($it->discount) }}@endif
{{ $l['desc'] }}{{ $l['amount'] < 0 ? '−' : '' }}{{ $mp(abs($l['amount'])) }}
@unless($one) @foreach($act as $it)@php $pk = \App\Support\Pkg::byId((int) $it->package_id); $days = $pk ? array_slice($pk->itineraryDays ?? [], 0, 6) : []; @endphp

🧭 Tour summary · ভ্রমণ সারাংশ{{ count($act) > 1 ? ' – ' . $it->title_en : '' }}

Travellers{{ $it->adults }} adult{{ $it->adults > 1 ? 's' : '' }}{{ $it->children ? ' + ' . $it->children . ' child' : '' }}
Rooms / cabins{{ $it->rooms ?: (!empty($it->room_lines) ? array_sum(array_column($it->room_lines, 'qty')) : '–') }}
Duration{{ !empty($it->days) ? (int) $it->days . 'D' : '' }}{{ !empty($it->nights) ? ' / ' . (int) $it->nights . 'N' : '' }}{{ empty($it->days) && empty($it->nights) ? ($it->duration ?: '–') : '' }}
Meals{{ !empty($it->meals) ? (int) $it->meals . ' meals' : '–' }}
Package ID{{ $pk->sku ?? '–' }}
@if(!empty($it->meal_note))

🍽 Meals: {{ $it->meal_note }}

@endif @if($days)@endif @endforeach @endunless
Amount in words: {{ $W::en($b->total) }}
সর্বমোট (কথায়): {{ $W::bn($b->total) }}
Paid: {{ $W::en($b->paid) }}
Balance due: {{ $W::en($b->due) }} ({{ $W::bn($b->due) }})
@if($b->lines && !$hideRates)
Tours subtotal{{ $cur }} {{ $mp($b->itemsTotal) }}
Other charges{{ $b->linesTotal < 0 ? '−' : '' }}{{ $cur }} {{ $mp(abs($b->linesTotal)) }}
@endif
Grand total{{ $cur }} {{ $mp($b->total) }}
@php $vp = (float) ($s['vat_percent'] ?? 0); @endphp @if(($s['vat_mode'] ?? 'none') === 'included' && $vp > 0)
Incl. VAT {{ rtrim(rtrim(number_format($vp, 2), '0'), '.') }}%{{ $cur }} {{ $mp((int) round($b->total * $vp / (100 + $vp))) }}
@endif @if(!empty($s['tax_note']))
{{ $s['tax_note'] }}
@endif
Advance / paid{{ $cur }} {{ $mp($b->paid) }}
Balance due{{ $cur }} {{ $mp($b->due) }}

{{ $pct }}% paid

@if($b->paid < $b->advanceRequired)
Advance to confirm{{ $cur }} {{ $mp($b->advanceRequired) }}
@endif
@foreach($trips as $tr) @php $d = $tr['d']; $em = array_map(fn ($l) => array_map('trim', explode('|', $l)), \App\Support\Util::lines($d->emergency ?? '')); @endphp @if($one)
🚌 যাত্রার তথ্য{{ count($trips) > 1 ? ' · ' . $tr['it']->title_en : '' }}: @if($d->transport_name || $d->transport_no){{ $d->transport_type ?: 'গাড়ি' }}: {{ $d->transport_name }}{{ $d->transport_no ? ' (' . $d->transport_no . ')' : '' }}@endif @if($d->driver_name || $d->driver_phone)চালক: {{ $d->driver_name }} {{ $d->driver_phone }}@endif @if($d->guide_name || $d->guide_phone)গাইড: {{ $d->guide_name }} {{ $d->guide_phone }}@endif @if($tr['it']->operator_name ?? null)অপারেটর: {{ $tr['it']->operator_name }} {{ $tr['it']->operator_phone ?? '' }}@endif @if($d->operator_vehicle)অপারেটরের গাড়ি: {{ $d->operator_vehicle }}@endif @if($d->meeting_point || $d->meeting_time)রিপোর্টিং: {{ $d->meeting_time }} {{ $d->meeting_point }}@endif @if($em)🆘 জরুরি: @foreach($em as $e){{ isset($e[1]) ? $e[0] . ' ' : '' }}{{ $e[1] ?? $e[0] }}@endforeach@endif
@else

🚌 Travel details · যাত্রার তথ্য{{ count($trips) > 1 ? ' – ' . $tr['it']->title_en : '' }}

@if($d->transport_name || $d->transport_no)
{{ $d->transport_type ?: 'Transport' }} · গাড়ি / জাহাজ{{ $d->transport_name }}@if($d->transport_no)নম্বর: {{ $d->transport_no }}@endif
@endif @if($d->driver_name || $d->driver_phone)
Driver / Captain · চালক{{ $d->driver_name }}@if($d->driver_phone)📞 {{ $d->driver_phone }}@endif
@endif @if($d->guide_name || $d->guide_phone)
Tour guide · গাইড{{ $d->guide_name }}@if($d->guide_phone)📞 {{ $d->guide_phone }}@endif
@endif @if($one && ($tr['it']->operator_name ?? null))
Tour operator · অপারেটর{{ $tr['it']->operator_name }}@if($tr['it']->operator_phone ?? null)📞 {{ $tr['it']->operator_phone }}@endif
@endif @if($d->operator_vehicle)
Operator vehicle · অপারেটরের গাড়ি{{ $d->operator_vehicle }}
@endif @if($d->meeting_point || $d->meeting_time)
Reporting · রিপোর্টিং{{ $d->meeting_time }}{{ $d->meeting_point }}
@endif
@if($em)

🆘 জরুরি নম্বর: @foreach($em as $e){{ isset($e[1]) ? $e[0] . ': ' : '' }}{{ $e[1] ?? $e[0] }}@endforeach

@endif
@endif @endforeach @if($contacts && !($one && $trips))

Your tour contacts

@endif @if($ver && $one)

💳 Payment received · জমা: @foreach($ver as $p){{ dfmt($p->paid_at ?: $p->created_at) }} · {{ $p->method }}{{ !empty($p->txn_ref) ? ' (' . $p->txn_ref . ')' : '' }} · {{ $cur }} {{ $mp($p->amount) }}@endforeach

@elseif($ver)

Payment receipts

@foreach($ver as $p)@endforeach
DateMethodReferenceNoteAmount {{ $s['currency_symbol'] ?? '' ?: '৳' }}
{{ dfmt($p->paid_at ?: $p->created_at) }}{{ $p->method }}{{ $p->txn_ref ?? '' }}{{ $p->note }}{{ $mp($p->amount) }}
@endif @if($showPay && !($one && $b->due <= 0))

How to pay

Please pay the {{ $b->paid < $b->advanceRequired ? 'advance amount' : 'balance due' }} through any channel below, quoting booking reference {{ $b->code }}, and send us the transaction ID.

@if($showMobile)

@foreach($payLogos as $pl)@if(stripos($pl['alt'] ?? '', 'bkash') !== false)bKash@endif @endforeach Mobile banking

@if($qrs) @foreach($qrs as $q)@if(!empty($q['number']))
{{ $q['label'] ?? 'bKash' }}{{ $q['number'] }}{!! $copy($q['number']) !!}
@endif @endforeach @endif @if(!empty($s['mobile_banking']))
{{ $s['mobile_banking'] }}
@endif
Reference{{ $b->code }}{!! $copy($b->code) !!}
@if($qrs)
@foreach($qrs as $q)QR@endforeachScan with bKash or any bank app (Bangla QR)
@endif
@endif @if(!empty($s['bank_name']) || !empty($s['bank_account_no']))

🏦 Bank transfer

Bank{{ $s['bank_name'] ?? '' }}
@if(!empty($s['bank_branch']))
Branch{{ $s['bank_branch'] }}
@endif
A/C name{{ $s['bank_account_name'] ?? '' }}
A/C no{{ $s['bank_account_no'] ?? '' }}{!! $copy($s['bank_account_no'] ?? '') !!}
Reference · রেফারেন্স{{ $b->code }}{!! $copy($b->code) !!}
@if(!empty($s['bank_routing']))
Routing{{ $s['bank_routing'] }}
@endif @if($showMobile)
@foreach($payLogos as $pl){{ $pl['alt'] ?? '' }}@endforeach
@endif
@endif
@endif @unless($one) @foreach($act as $it) @if($it->inclusionsList)

Inclusions – {{ $it->title_en }}

@endif @if($it->exclusionsList)

Exclusions

@endif @if($it->departure)

Departure: {{ $it->departure }}

@endif @endforeach @endunless @if(!empty($b->invoice_extra_note))

Note: {{ $b->invoice_extra_note }}

@endif @if(!$b->isInvoice && !empty($s['quote_note']) && !$one)

Quotation: {{ $s['quote_note'] }}

@endif @unless($one) @if($ins)

Instructions for travellers

@endif @if(!empty($s['invoice_note']))

Terms: {{ $s['invoice_note'] }}

@endif @if(!empty($s['booking_terms_note']))

নীতি: {{ $s['booking_terms_note'] }}

@endif @if($policy)

📜 {{ $policy['title'] ?: 'Billing policy' }}

@if(!empty($policy['text']))
    @foreach(\App\Support\Util::lines($policy['text']) as $x)
  • {{ $x }}
  • @endforeach
@endif @if(!empty($policy['file']))@endif
@endif @endunless @if($one)
⚠️ বাতিল নীতি: বুকিং কনফার্মের পর বাতিল করলে অগ্রিম টাকা ফেরতযোগ্য নয়। · Booking money is non-refundable once confirmed.
@else
⚠️ {{ ($s['invoice_nonref_title'] ?? '') ?: 'Cancellation policy · বাতিল নীতি' }}
{{ ($s['invoice_nonref_text'] ?? '') ?: 'বুকিং কনফার্ম করার পর ট্যুর বাতিল করলে বুকিংয়ের (অগ্রিম) টাকা ফেরতযোগ্য নয়। Booking money is non-refundable once the booking is confirmed. শুক্র, শনি ও সরকারি ছুটির দিনে খালি থাকা সাপেক্ষে দাম পরিবর্তন হতে পারে।' }}
@endif
Accepted by (customer)
@if($members && $one)

Proud member of · আমরা যেসব প্রতিষ্ঠানের সদস্য ও সরকার নিবন্ধিত

@foreach($members as $m)
{{ $m['alt'] ?? '' }}
{{ $m['label'] ?? ($m['alt'] ?? '') }}
@endforeach
@endif
Seal @if($signature)Signature@else
{{ ($s['signatory_name'] ?? '') ?: ($s['site_name'] ?? '') }}
@endif @if(!empty($seal2))Company stamp@endif
{{ $s['signatory_name'] ?? '' }}{{ !empty($s['signatory_name']) ? ' · ' : '' }}{{ ($s['signatory_title'] ?? '') ?: 'Authorised signatory' }}
For and on behalf of {{ $coName }}
@if($members && !$one)

Proud member of · আমরা যেসব প্রতিষ্ঠানের সদস্য ও সরকার নিবন্ধিত

@foreach($members as $m)
{{ $m['alt'] ?? '' }}
{{ $m['label'] ?? ($m['alt'] ?? '') }}
@endforeach
@endif

We appreciate your business and look forward to serving you. For any help please call {{ $s['phone'] ?? '' }}.

{{ $s['site_name'] ?? '' }} – {{ $s['site_tagline'] ?? '' }} · {{ $s['phone'] ?? '' }} · {{ $s['email'] ?? '' }}
This is a computer generated {{ strtolower($docWord) }} and is valid with the seal shown. Printed {{ now()->format('Y-m-d H:i') }} (BD time).
@if($public)
📞 Call@if($wa)WhatsApp@endifSave PDF
@endif @if($public && !empty($s['fb_pixel_id']) && $b->paid > 0) {{-- Meta Pixel: a paid booking counts as a Purchase once per browser (the customer opens their invoice link) --}} @endif