{% 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 class="report-header"><strong>{{ page_title }}</strong></h2>
<table class="report-data" width="100%">
    <thead class="header">
    <tr>
        <th>Patient</th>
        <th>Address</th>
        <th>Phone No(s)</th>
        <th>Email(s)</th>
        <th>Invoice No.</th>
        <th>Company</th>
        <th>Branch</th>
        <th>Branch Address</th>
        <th>Category</th>
        <th>Term</th>
        <th>Item Type</th>
        <th>Description</th>
        <th style="text-align: right;">Quantity</th>
        <th style="text-align: right;">Price</th>
    </tr>
    </thead>
    <tbody>
    {% set totalCount = 0 %}
    {% set totalAmount = 0 %}
    {% set totalQty = 0 %}
    {% for record in records %}
        {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
        {% set totalCount = totalCount + 1 %}
        {% set totalQty = totalQty + record.qty %}
        {% set totalAmount = totalAmount + record.price %}
        <tr>
            <td>{{ record.patientName }}</td>
            <td>{{ record.address }}</td>
            <td>{{ record.phoneNo }}</td>
            <td>{{ record.email }}</td>
            <td>{{ record.invoiceNo }}</td>
            <td>{{ record.companyDesc }}</td>
            <td>{{ record.branch }}</td>
            <td>{{ record.branchAddress }}</td>
            <td>{{ record.itemCategory }}</td>
            <td>{{ record.term }}</td>
            <td>{{ record.itemType }}</td>
            <td>{{ record.itemDesc }}</td>
            <td style="text-align: right;">{{ record.qty }}</td>
            <td style="text-align: right;">{{ record.price|number_format(2, '.', ',') }}</td>
        </tr>
    {% endfor %}
    <tr>
        <td><strong>Total:</strong></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td style="text-align: right;"><strong>{{ totalQty }}</strong></td>
        <td style="text-align: right;"><strong>{{ totalAmount|number_format(2, '.', ',') }}</strong></td>
    </tr>
</table>
<div>Total Records: {{ totalCount }}</div>
</body>
</html>