<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ __('Purchase Report') }}</title>
    <style>
        body { font-family: Arial, sans-serif; font-size: 12px; }
        .header { text-align: center; margin-bottom: 20px; }
        .table { width: 100%; border-collapse: collapse; }
        .table th, .table td { border: 1px solid #ccc; padding: 8px; }
        .table th { background: #f5f5f5; }
        .totals { margin-top: 20px; }
    </style>
</head>
<body>
    <div class="header">
        <h2>{{ __('Purchase Report') }}</h2>
        <p>{{ $from }} - {{ $to }}</p>
    </div>
    <table class="table">
        <thead>
            <tr>
                <th>{{ __('Purchase Number') }}</th>
                <th>{{ __('Date') }}</th>
                <th>{{ __('Vendor') }}</th>
                <th>{{ __('Amount') }}</th>
                <th>{{ __('Status') }}</th>
            </tr>
        </thead>
        <tbody>
            @foreach($purchases as $purchase)
                <tr>
                    <td>{{ $purchase->purchase_number }}</td>
                    <td>{{ $purchase->purchase_date->format('Y-m-d') }}</td>
                    <td>{{ $purchase->vendor }}</td>
                    <td>{{ number_format($purchase->total_amount, 2) }}</td>
                    <td>{{ ucfirst($purchase->status) }}</td>
                </tr>
            @endforeach
        </tbody>
    </table>
    <div class="totals">
        <table>
            <tr>
                <td><strong>{{ __('Total Purchases') }}:</strong></td>
                <td>{{ number_format($purchases->sum('total_amount'), 2) }}</td>
            </tr>
        </table>
    </div>
</body>
</html>
