<!DOCTYPE html>
<html>
<head>
    <title>Fee Generated Report</title>
    <style>
        body { font-family: DejaVu Sans, sans-serif; font-size: 10px; }
        table { width: 100%; border-collapse: collapse; }
        th, td { border: 1px solid #000; padding: 4px; text-align: center; }
        th { background-color: #f2f2f2; }
    </style>
</head>
<body>
    <h2 style="text-align: center;">Fee Generated Report</h2>

    <table>
        <thead>
            <tr>
                <th>Student</th>
                <th>Reg No</th>
                <th>Narration</th>
                <th>Status</th>
                <th>Class</th>
                <th>Month</th>
                <th>Date</th>
                <th>Adm</th>
                <th>Prom</th>
                <th>Sch</th>
                <th>Sport</th>
                <th>Tuition</th>
                <th>Lab</th>
                <th>Exam</th>
                <th>Board</th>
                <th>Ent</th>
                <th>Other</th>
                <th>Book</th>
                <th>Annual</th>
                <th>2nd Fee</th>
                <th>Total</th>
            </tr>
        </thead>
        <tbody>
            @forelse ($fees as $f)
                <tr>
                    <td>{{ $f->student->student_name ?? 'N/A' }}</td>
                    <td>{{ $f->reg_no ?? 'N/A' }}</td>
                    <td>Fee Generated</td>
                    <td>{{ $f->student->status ?? 'N/A' }}</td>
                    <td>{{ $f->class->name ?? 'N/A' }}</td>
                    <td>{{ $f->billing_month ?? 'N/A' }}</td>
                    <td>{{ $f->date ?? 'N/A' }}</td>

                    <!-- Fees -->
                    <td>{{ $f->Student_fee_detail->admission_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->promotion_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->scholarship_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->sport_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->tuition_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->lab_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->exam_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->board_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->entertainment_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->other_fee ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->books_charges ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->annual_charges ?? 0 }}</td>
                    <td>{{ $f->Student_fee_detail->second_time_fee ?? 0 }}</td>
                    <td>{{ $f->total_amount ?? 0 }}</td>
                </tr>
            @empty
                <tr><td colspan="21">No data found</td></tr>
            @endforelse
        </tbody>
    </table>
</body>
</html>
