@extends('garage.layouts.app') @section('title', 'Sales') @section('content')

Sales

Counter and customer sales

@include('garage.partials.trash-link', ['trashType' => 'sales']) New sale
@forelse($sales as $s) @php $subBefore = (float) ($s->subtotal_calc ?? 0); $after = (float) ($s->grand_total ?? 0) - (float) ($s->tax_amount ?? 0) - (float) ($s->freight_amount ?? 0); if ($after < 0) $after = (float) ($s->subtotal ?? 0); // Always derive applied header discount from the totals we show. $discApplied = max(0, $subBefore - $after); @endphp @include('garage.partials.index-meter-reading-cell', ['meter' => $s->meter_reading ?? null]) @empty @endforelse
Sale no. Date Customer Vehicle Meter (km) Served by Subtotal Discount After discount Grand total Status Receipt Actions
{{ $s->sale_number }} {{ $s->sale_date }} @if(!empty($s->customer_ledger_id)) {{ $s->customer_name ?? '—' }} @else {{ $s->customer_name ?? '—' }} @endif @if(!empty($s->vehicle_registration)) {{ $s->vehicle_registration }} @if($s->vehicle_make || $s->vehicle_model) ({{ trim(($s->vehicle_make ?? '').' '.($s->vehicle_model ?? '')) }}) @endif @else — @endif {{ $s->served_by_name ?? '—' }} PKR {{ number_format((float) $subBefore, 2) }} PKR {{ number_format((float) $discApplied, 2) }}
{{ $s->discount_type ?? 'fixed' }}
PKR {{ number_format((float) $after, 2) }} PKR {{ number_format((float) $s->grand_total, 2) }} {{ $s->status }} @if(($s->sale_kind ?? null) !== 'customer_sale' || ($s->status ?? null) !== 'completed') @elseif(!empty($s->receipt_voucher_id) || (($s->payment_status ?? 'unpaid') === 'paid')) Done @else Pending @endif View Print Thermal Print A4 @if(!empty($s->journal_voucher_id) || !empty($s->receipt_voucher_id)) @endif @if(in_array($s->status, ['draft','held'])) Edit @else @endif @if(($s->sale_kind ?? null) === 'customer_sale' && ($s->payment_status ?? 'unpaid') !== 'paid') @if(in_array(($s->status ?? null), ['held','completed'], true)) @else @endif @endif
@csrf @method('DELETE')
No sales yet. Create a sale.
@if($sales->hasPages())
{{ $sales->withQueryString()->links() }}
@endif @push('styles') @endpush
@endsection @push('scripts') @endpush