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

Sales History

Monitor and manage all your transactions in one place.

Reset
Sales Summary
@php $displayNames = \App\Helpers\PaymentMethods::getDisplayNames(); $totalSalesAmount = collect($summary['payment_methods'] ?? [])->sum('total') ?? 0; $totalTransactions = collect($summary['payment_methods'] ?? [])->sum('count') ?? 0; @endphp
Total Sales

MWK {{ number_format($totalSalesAmount, 0) }}

{{ $totalTransactions }} transactions
@foreach($displayNames as $method => $displayName) @php $data = $summary['payment_methods'][$method] ?? ['count' => 0, 'total' => 0]; @endphp
{{ $displayName }}
{{ $data['count'] }}
MWK {{ number_format($data['total'], 0) }}
@endforeach
Transaction Records
@forelse($sales ?? [] as $s) @empty @endforelse
Invoice # Date & Time Customer Products Items Payment Total Amount Action
#{{ $s->invoice_no ?? 'INV-'.str_pad($s->id, 5, '0', STR_PAD_LEFT) }} {{ $s->created_at->format('d M, Y') }}
{{ $s->created_at->format('H:i') }}
{{ $s->customer_name ?: 'Walk-in Customer' }}
@if($s->items && $s->items->count() > 0) {{ optional($s->items->first()->product)->name ?? 'Deleted Product' }} @if($s->items->count() > 1) +{{ $s->items->count() - 1 }} more @endif @else N/A @endif
{{ $s->total_items }}
{{ ucfirst($s->payment_status) }} {{ str_replace('_', ' ', $s->payment_method) }}
MWK {{ number_format($s->total_amount, 2) }}
No data
No transactions found matching your criteria.
@if($sales->hasPages()) @endif
@endsection @section('scripts') @endsection