@extends('garage.layouts.app') @section('title', 'A4 Invoice') @section('content') @php $garageName = trim((string) (($garage->name ?? '') ?: 'Garage')); $garageAddress = collect([ $garage->address ?? null, $garage->address_1 ?? null, $garage->address_2 ?? null, $garage->address_line1 ?? null, $garage->address_line2 ?? null, $garage->location ?? null, $garage->branch_name ?? null, $garage->city ?? null, $garage->state ?? null, $garage->country ?? null, ])->map(fn ($v) => trim((string) $v)) ->filter(fn ($v) => $v !== '') ->unique() ->implode(', '); $garagePhones = collect([ $garage->phone ?? null, $garage->phone_2 ?? null, $garage->phone_no ?? null, $garage->contact_no ?? null, $garage->mobile ?? null, $garage->mobile_no ?? null, $garage->landline ?? null, $garage->whatsapp ?? null, $garage->whatsapp_no ?? null, ])->map(fn ($p) => trim((string) $p)) ->filter(fn ($p) => $p !== '') ->unique() ->values(); $garagePhoneLine = $garagePhones->implode(' / '); $customer = trim((($sale->customer_code ?? '') ? ($sale->customer_code.' · ') : '').($sale->customer_name ?? 'Walk-in Customer')); // Static print header block (matches thermal invoice). $printAddressLine1 = '408-Nasheman-e-Iqbal Phase-1,'; $printAddressLine2 = 'Main Khayaban-e-Jinnah Lahore'; $printPhoneLine = '0304-4509063 / 0333-8003811'; $printTagline = 'One Stop Shop'; $fareedMotorsLogoPath = public_path('images/fareed-motors-logo.png'); $useFareedMotorsInvoiceLogo = is_file($fareedMotorsLogoPath) && stripos($garageName, 'fareed') !== false; $fareedMotorsLogoUrl = $useFareedMotorsInvoiceLogo ? asset('images/fareed-motors-logo.png') : null; @endphp
Back
@if($fareedMotorsLogoUrl) @else

{{ $garageName }}

@endif
{{ $printTagline }}
{{ $printAddressLine1 }} {{ $printAddressLine2 }}
{{ $printPhoneLine }}
Invoice · {{ $sale->sale_number }}
Invoice #
{{ $sale->sale_number }}
Customer
{{ $customer }}
Date
{{ $sale->sale_date }}
Vehicle
{{ $sale->vehicle_registration ?: '—' }}
Meter reading
@if(!empty($sale->meter_reading)){{ \App\Support\GarageMeterReading::format($sale->meter_reading) }} km@else—@endif
Cashier
{{ $sale->cashier_name ?: '—' }}
Customer Mobile
{{ $sale->customer_phone ?: '—' }}
@php $sr = 1; @endphp @if(count($items) > 0) @endif @foreach($items as $row) @endforeach @if(count($services) > 0) @endif @foreach($services as $svc) @php $svcLine = (float) ($svc->line_total ?? 0); @endphp @endforeach @if((float)($sale->package_amount_total ?? 0) > 0) @endif
# Particular Qty Rate Amount
Parts
{{ $sr++ }} {{ $row->product_name ?: ($row->description ?: 'Item') }} {{ (float)($row->quantity ?? 0) }} {{ number_format((float)($row->unit_price ?? 0), 2) }} {{ number_format((float)($row->line_total ?? 0), 2) }}
Services
{{ $sr++ }} {{ $svc->service_name ?: ($svc->title ?: 'Service') }} {{ number_format((float)($svc->hours ?? 0), 2) }} {{ number_format((float)($svc->rate ?? 0), 2) }} {{ number_format($svcLine, 2) }}
Package
{{ $sr++ }} Package Services 1 {{ number_format((float)($sale->package_amount_total ?? 0), 2) }} {{ number_format((float)($sale->package_amount_total ?? 0), 2) }}
@if((float)($sale->order_advance_amount ?? 0) > 0) @endif
Subtotal{{ number_format((float)($sale->subtotal ?? 0), 2) }}
Discount{{ number_format((float)($sale->discount_amount ?? 0), 2) }}
Tax{{ number_format((float)($sale->tax_amount ?? 0), 2) }}
Freight{{ number_format((float)($sale->freight_amount ?? 0), 2) }}
Advance{{ !empty($sale->order_repair_number) ? ' (Order '.$sale->order_repair_number.')' : '' }} {{ number_format((float)$sale->order_advance_amount, 2) }}
Balance on this invoice {{ number_format((float)($sale->order_balance_amount ?? 0), 2) }}
Net Total{{ number_format((float)($sale->grand_total ?? 0), 2) }}
@endsection @push('scripts') @endpush