{% 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="100%">
    <thead class="header">
    <tr>
        <th>Patient</th>
        <th>Company</th>
        <th>Billing Branch</th>
        <th>Billing Address</th>
        <th>Insurance</th>
        <th>Frequency</th>
        <th>Benefit Period</th>
        <th>Product Name</th>
        <th>Amount</th>
        <th>Ceiling Amount</th>
        <th>% of Coverage</th>
        <th>Net Coverage</th>
    </tr>
    </thead>
    <tbody>
    {% set totalCount = 0 %}
    {% set percentageOfCoverge = 0 %}
    {% for record in records %}
        {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
        {% set totalCount = totalCount + 1 %}
        {% if record.amtCovered != 0 %}
            {% set percentageOfCoverge = (record.amtCovered / record.amt) * 100 %}
        {% endif %}
        <tr class="{{ trC }}">
            <td><a href="{{ path('patient_detail', {patient_id : record.patientId|base64Encode}) }}" target="_blank">{{ record.patientName }}</a></td>
            <td>{{ record.companyDesc }}</td>
            <td>{{ record.branch }}</td>
            <td>{{ record.branchAddress }}</td>
            <td>{{ record.insuranceDesc }}</td>
            <td>{{ record.frequency }}</td>
            <td>{{ record.benefitPeriod }}</td>
            <td>{{ record.itemDesc }}</td>
            <td style="text-align: right;">{{ record.amt }}</td>
            <td style="text-align: right;">{{ record.amtCovered }}</td>
            <td style="text-align: right;">{{ percentageOfCoverge|number_format(2, '.', ',')~' %' }}</td>
            <td>--</td>
        </tr>
    {% endfor %}
</table>
<div>Total Records: {{ totalCount }}</div>
</body>
</html>