{% set absUrl = app.request.getSchemeAndHttpHost() ~ app.request.baseUrl|replace({'/app_dev.php': ''}) %}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="{{ absUrl ~ asset('bundles/rxconnexion/admin/css/report/report_wkpdf.css') }}" />
</head>
<body>
<h2><strong>{{ page_title }}</strong></h2>
<table class="report-data" width="200%">
    <thead class="header">
    <tr>
        <th>Patient</th>
        <th>Patient Type</th>
        <th>Referring Branch</th>
        <th>Clinician</th>
        <th>Diagnosis</th>
        <th>Latest Encounter</th>
        <th>Latest Encounter Date</th>
        <th>Latest Encounter Status</th>
        <th>BMI</th>
        <th>O2 Saturation</th>
        <th>Initial AHI</th>
        <th>Current AHI</th>
        <th>Servicing Branch</th>
        <th>Service</th>
        <th>Specialist</th>
        <th>Latest Specialist Encounter</th>
        <th>Latest Specialist Encounter Date</th>
        <th>Latest Specialist Encounter Status</th>
        <th width="15%">Note</th>
    </tr>
    </thead>
    <tbody>
    {% set totalCount = 0 %}
    {% for record in records %}
        {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
        {% set totalCount = totalCount + 1 %}
        <tr class="{{ trC }}">
            <td><a href="{{ path('patient_detail', {patient_id : record.patientId|base64Encode}) }}" target="_blank">{{ record.patientName }}</a></td>
            <td>{{ record.patientType }}</td>
            <td>{{ record.healthFacility }}</td>
            <td>{{ record.providerFullName }}</td>
            <td>{{ record.diagnosisDesc }}</td>
            <td>{{ record.chartType }}</td>
            <td>{{ record.chartDate }}</td>
            <td>{{ record.chartStatus }}</td>
            <td>{{ record.bmi }}</td>
            <td>{{ record.otwo_saturation }}</td>
            <td>{{ record.init_ahi }}</td>
            <td>{{ record.ahi }}</td>
            <td>{{ record.servicingHealthFacility }}</td>
            <td>{{ record.serviceDesc }}</td>
            <td>{{ record.specialistFullName }}</td>
            <td>{{ record.sp_chartType }}</td>
            <td>{{ record.sp_chartDate }}</td>
            <td>{{ record.sp_chartStatus }}</td>
            <td>{{ record.note|raw }}</td>
        </tr>
    {% endfor %}
</table>
<div>Total Records: {{ totalCount }}</div>
</body>
</html>