@extends('garage.layouts.app') @section('title', 'Thermal Invoice') @section('content') @php $garageName = trim((string) (($garage->name ?? '') ?: 'Garage')); $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; $garageAddressLine1 = '408-Nasheman-e-Iqbal Phase-1,'; $garageAddressLine2 = 'Main Khayaban-e-Jinnah Lahore'; $garagePhoneLine = '0304-4509063 / 0333-8003811'; $customerName = trim((string) ($sale->customer_name ?? 'Walk-in Customer')); $cashier = trim((string) ($sale->cashier_name ?? '')); $disc = (float) ($sale->discount_amount ?? 0); $dt = trim((string) ($sale->sale_date ?? '') . ' ' . substr((string) ($sale->sale_time ?? ''), 0, 5)); $subTotal = (float) ($sale->subtotal ?? 0); $netTotal = (float) ($sale->grand_total ?? 0); $orderAdvance = (float) ($sale->order_advance_amount ?? 0); $orderBalance = (float) ($sale->order_balance_amount ?? $netTotal); $orderNumber = trim((string) ($sale->order_repair_number ?? '')); $packageAmount = (float) ($sale->package_amount_total ?? 0); $lineItems = []; foreach ($items as $row) { $lineItems[] = (object) [ 'name' => $row->product_name ?: ($row->description ?: 'Item'), 'qty' => (int) ($row->quantity ?? 0), 'rate' => (float) ($row->unit_price ?? 0), 'disc' => (float) ($row->discount_amount ?? 0), 'amount' => (float) ($row->line_total ?? 0), ]; } foreach ($services as $svc) { $lineItems[] = (object) [ 'name' => $svc->service_name ?: ($svc->title ?: 'Service'), 'qty' => (int) round((float) ($svc->hours ?? 0)), 'rate' => (float) ($svc->rate ?? 0), 'disc' => 0, 'amount' => (float) ($svc->line_total ?? 0), ]; } if ($packageAmount > 0) { $lineItems[] = (object) [ 'name' => 'Package Services', 'qty' => 1, 'rate' => $packageAmount, 'disc' => 0, 'amount' => $packageAmount, ]; } $warrantyLines = [ '1) ANY TYPE OF LUBRICANT ITEM CAN NOT BE RETURN OR REPLACEABLE.', '2) NOT RESPONSIBLE FOR FILTER FACTORY FAULT OR LEAKAGE.', '3) NO WARRANTY OR GUARANTEE ON TYRE ITEMS.', ]; $softwareFooterUrl = trim((string) ($garage->website ?? '')); if ($softwareFooterUrl === '') { $softwareFooterUrl = 'www.cloudsolutions.com.pk'; } $softwareFooterUrl = preg_replace('#^https?://#i', '', $softwareFooterUrl); @endphp
Back
@if($fareedMotorsLogoUrl) @else
{{ $garageName }}
@endif
One Stop Shop
{{ $garageAddressLine1 }}
{{ $garageAddressLine2 }}
{{ $garagePhoneLine }}
CUSTOMER: {{ $customerName }}
@if($cashier !== '')
CASHIER: {{ $cashier }}
@endif
DATE: {{ $dt }}
INVOICE: {{ $sale->sale_number }}
@if(!empty($sale->meter_reading))
METER: {{ \App\Support\GarageMeterReading::format($sale->meter_reading) }} km
@endif @if(!empty($sale->customer_phone))
MOBILE: {{ $sale->customer_phone }}
@endif
Particulars Qty Rate Disc Amount
@forelse($lineItems as $idx => $line)
{{ $idx + 1 }} {{ $line->name }} {{ $line->qty }} {{ number_format($line->rate, 0) }} {{ number_format($line->disc, 0) }} {{ number_format($line->amount, 0) }}
@empty
No lines
@endforelse
CASH:0
RETURN:0
SUB TOTAL:{{ number_format($subTotal, 0) }}
DISCOUNT:{{ number_format($disc, 0) }}
@if($orderAdvance > 0)
ADVANCE{{ $orderNumber !== '' ? ' ('.$orderNumber.')' : '' }}: {{ number_format($orderAdvance, 0) }}
BALANCE: {{ number_format($orderBalance, 0) }}
@endif
NET TOTAL:{{ number_format($netTotal, 0) }}
@if(!empty($sale->comments))
{{ $sale->comments }}
@endif
@foreach($warrantyLines as $line)
{{ $line }}
@endforeach
@endsection @push('scripts') @endpush