@extends('layouts.app') @section('title', 'Customer Details - Sales Report') @section('content')

Customer Details - {{ $summary['customer_name'] }}

Invoice details for {{ $summary['customer_name'] }}

Customer Information
{{ $summary['customer_name'] }}
Customer Name
{{ $summary['customer_email'] }}
Email Address
{{ $summary['customer_phone'] ?? 'N/A' }}
Phone Number
{{ $summary['total_invoices'] }}
Total Invoices
${{ number_format($summary['total_amount'], 2) }}
Total Amount
${{ number_format($summary['total_paid'], 2) }}
Total Paid
${{ number_format($summary['total_due'], 2) }}
Total Due
Invoice Details
@if($invoices->count() > 0)
@foreach($invoices as $invoice) @php $paid = $invoice->transections()->where('transaction_type', 'payment')->sum('amount'); $due = $invoice->invoice_amount - $paid; $status = $due <= 0 ? 'paid' : ($due < $invoice->invoice_amount ? 'partial' : 'unpaid'); @endphp @endforeach
Invoice No Invoice Date Due Date Amount Paid Due Status Actions
{{ $invoice->invoice_no }}
{{ \Carbon\Carbon::parse($invoice->invoice_date)->format('M d, Y') }}
{{ \Carbon\Carbon::parse($invoice->invoice_date)->format('h:i A') }}
@if($invoice->due_date)
{{ \Carbon\Carbon::parse($invoice->due_date)->format('M d, Y') }}
{{ \Carbon\Carbon::parse($invoice->due_date)->format('h:i A') }}
@else N/A @endif
${{ number_format($invoice->invoice_amount, 2) }} ${{ number_format($paid, 2) }} ${{ number_format($due, 2) }} @if($status === 'paid') Paid @elseif($status === 'partial') Partial @else Unpaid @endif
@else
No Invoices Found

No invoices found for this customer in the selected date range.

@endif
@endsection @section('styles') @endsection