<!DOCTYPE html>
<html>
<head>
    <title>Invoice Summary Report</title>
    <style>
        body { font-family: Arial, sans-serif; }
        table { width: 100%; border-collapse: collapse; }
        th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
        th { background-color: #f2f2f2; }
        .total-row { font-weight: bold; }
    </style>
</head>
<body>
    <h2>Invoice Summary Report</h2>
    <p>Date Range: {{ \Carbon\Carbon::parse($fromDate)->format('d/m/Y') }} - {{ \Carbon\Carbon::parse($toDate)->format('d/m/Y') }}</p>
    
    <table>
        <thead>
            <tr>
                <th>Date</th>
                <th>Customer Code</th>
                <th>Name</th>
                <th>Amount (USD)</th>
            </tr>
        </thead>
        <tbody>
            @foreach($invoices as $invoice)
                <tr>
                    <td>{{ \Carbon\Carbon::parse($invoice->document_date)->format('d/m/Y') }}</td>
                    <td>{{ $invoice->customer->customer_code }}</td>
                    <td>{{ $invoice->customer->customer_account }}</td>
                    <td>{{ number_format($invoice->inclusive_total, 2) }}</td>
                </tr>
            @endforeach
        </tbody>
        <tfoot>
            <tr class="total-row">
                <td colspan="3" style="text-align: right;">Total Amount:</td>
                <td>USD {{ number_format($invoices->sum('inclusive_total'), 2) }}</td>
            </tr>
        </tfoot>
    </table>
</body>
</html>