{% 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') }}?v=1.0.1" />
</head>
<body>
<h2><strong>{{ page_title }}</strong></h2>
<table class="report-data" width="100%">
    <thead class="header">
    <tr>
        <th>Invoice No.</th>
        <th>Date</th>
        <th>Patient</th>
        <th>Company</th>
        <th>Branch</th>
        <th>Branch Address</th>
        <th>Amount</th>
        <th>Amount Paid</th>
        <th>Amount Refunded</th>
        <th>Balance</th>
        <th>Status</th>
        <th>Note</th>
    </tr>
    </thead>
    <tbody>
    {% set totalCount = 0 %}
    {% set totalAmt = 0 %}
    {% set totalPaid = 0 %}
    {% set totalRefunded = 0 %}
    {% set totalBalance = 0 %}
    {% for record in records %}
        {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
        {% set totalCount = totalCount + 1 %}
        {% set totalAmt = totalAmt + record.amtDue_forTotal %}
        {% set totalPaid = totalPaid + record.amtPaid_forTotal %}
        {% set totalRefunded = totalRefunded + record.amtRefunded_forTotal %}
        {% set totalBalance = totalBalance + record.amtBalance_forTotal %}
        <tr class="{{ trC }}">
            <td>{{ record.invoiceNo }}</td>
            <td>{{ record.billingDate }}</td>
            <td>{{ record.patient }}</td>
            <td>{{ record.companyDesc }}</td>
            <td>{{ record.healthFacility }}</td>
            <td>{{ record.healthFacilityAddress }}</td>
            <td class="text-right">{{ record.amtDue|number_format(2, '.', ',') }}</td>
            <td class="text-right">{{ record.amtPaid|number_format(2, '.', ',') }}</td>
            <td class="text-right">{{ record.amtRefunded|number_format(2, '.', ',') }}</td>
            <td class="text-right">{{ record.amtBalance|number_format(2, '.', ',') }}</td>
            <td>{{ record.billingStatus }}</td>
            <td>{{ record.note|raw }}</td>
        </tr>
    {% endfor %}
    <tr>
        <td><strong>Total:</strong></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td></td>
        <td class="text-right"><strong>{{ totalAmt|number_format(2, '.', ',') }}</strong></td>
        <td class="text-right"><strong>{{ totalPaid|number_format(2, '.', ',') }}</strong></td>
        <td class="text-right"><strong>{{ totalRefunded|number_format(2, '.', ',') }}</strong></td>
        <td class="text-right"><strong>{{ totalBalance|number_format(2, '.', ',') }}</strong></td>
        <td></td>
        <td></td>
    </tr>
</table>
<div style="margin-bottom: 10px;">Total Record(s): {{ totalCount }}</div>
<div style="width: 100%;">
    <div style="width: 49.5%; float: left;">
        <h5 class="report-header">Summary</h5>
        <table class="report-data" width="100%" style="margin-bottom: 10px;">
            <thead class="header">
            <tr>
                <th width="33%">Branch Address</th>
                <th style="text-align: right;" width="33%">Count</th>
                <th style="text-align: right;" width="33%">Invoice</th>
            </tr>
            </thead>
            <tbody>
            {% set summaryTotal = 0 %}
            {% set summaryTotalAmtDue = 0 %}
            {% for record2 in invoiceSummary %}
                {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
                {% set summaryTotal = summaryTotal + record2.totalCount %}
                {% set summaryTotalAmtDue = summaryTotalAmtDue + record2.totalAmtDue %}
                <tr class="{{ trC }}">
                    <td>{{ record2.healthFacility }}</td>
                    <td style="text-align: right;">{{ record2.totalCount }}</td>
                    <td style="text-align: right;">{{ record2.totalAmtDue|number_format(2, '.', ',') }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td></td>
                <td style="text-align: right;"><strong>Total: {{ summaryTotal }}</strong></td>
                <td style="text-align: right;"><strong>Total: {{ summaryTotalAmtDue|number_format(2, '.', ',') }}</strong></td>
            </tr>
            </tbody>
        </table>
    </div>
    <div style="width: 49.5%; float: right;">
        <h5 class="report-header">Financing Company Summary</h5>
        <table class="report-data" width="100%" style="margin-bottom: 10px;">
            <thead class="header">
            <tr>
                <th width="33%">Financing Company</th>
                <th style="text-align: right;" width="33%">Count</th>
                <th style="text-align: right;" width="33%">Invoice</th>
            </tr>
            </thead>
            <tbody>
            {% set summaryFinancingTotal = 0 %}
            {% set summaryFinancingTotalAmtDue = 0 %}
            {% for financingSummary in financingSummary %}
                {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
                {% set summaryFinancingTotal = summaryFinancingTotal + financingSummary.totalCount %}
                {% set summaryFinancingTotalAmtDue = summaryFinancingTotalAmtDue + financingSummary.totalAmtDue %}
                <tr class="{{ trC }}">
                    <td>{{ financingSummary.healthFacility }}</td>
                    <td style="text-align: right;">{{ financingSummary.totalCount }}</td>
                    <td style="text-align: right;">{{ financingSummary.totalAmtDue|number_format(2, '.', ',') }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td></td>
                <td style="text-align: right;"><strong>Total: {{ summaryFinancingTotal }}</strong></td>
                <td style="text-align: right;"><strong>Total: {{ summaryFinancingTotalAmtDue|number_format(2, '.', ',') }}</strong></td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<div style="width: 100%; float: left;">
    <div style="width: 49.5%; float: left;">
        <h5 class="report-header">Payment Summary</h5>
        <table class="report-data" width="100%" style="margin-bottom: 10px;">
            <thead class="header">
            <tr>
                <th>Billing Branch</th>
                <th class="text-right">Transaction Count</th>
                <th class="text-right">Total Amount</th>
            </tr>
            </thead>
            <tbody>
            {% set totalCount = 0 %}
            {% set totalPaymentAmount = 0 %}
            {% for ps in paymentSummary %}
                {% set totalCount = totalCount + ps.count %}
                {% set totalPaymentAmount = totalPaymentAmount + ps.totalPaymentAmount %}
                <tr>
                    <td>{{ ps.healthFacilityAddress }} {#{{ ps.invoice_nos|join(' , ') }}#}</td>
                    <td class="text-right">{{ ps.count }}</td>
                    <td class="text-right">{{ ps.totalPaymentAmount|number_format(2, '.', ',') }}</td>
                </tr>
            {% endfor %}
            </tbody>
            <tfoot>
            <tr>
                <td>Total:</td>
                <td class="text-right">{{ totalCount }}</td>
                <td class="text-right">{{ totalPaymentAmount|number_format(2, '.', ',') }}</td>
            </tr>
            </tfoot>
        </table>
    </div>
    <div style="width: 49.5%; float: right;">
        <h5 class="report-header">Payment Type Breakdown</h5>
        <table class="report-data" data-floathead="false" width="100%">
            <tr class="header">
                <th>Payment Type</th>
                <th class="text-right">Transaction Count</th>
                <th class="text-right">Total Amount</th>
            </tr>
            {% set breakdown_totalCount = 0 %}
            {% set breakdown_totalAmt = 0 %}
            {% set breakdown_totalTranCount = 0 %}
            {% for record in paymentBreakdown %}
                {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
                {% set breakdown_totalCount = breakdown_totalCount + 1 %}
                {% set breakdown_totalAmt = breakdown_totalAmt + record.totalAmt %}
                {% set breakdown_totalTranCount = breakdown_totalTranCount + record.transactionCount %}
                <tr class="{{ trC }}">
                    <td>{{ record.paymentType }} {#{{ record.invoices|join(' , ') }}#}</td>
                    <td class="text-right">{{ record.transactionCount }}</td>
                    <td class="text-right">{{ record.totalAmt|number_format(2, '.', ',') }}</td>
                </tr>
            {% endfor %}
            <tr>
                <td><strong>Total:</strong></td>
                <td class="text-right"><strong>{{ breakdown_totalTranCount }}</strong></td>
                <td class="text-right"><strong>{{ breakdown_totalAmt|number_format(2, '.', ',') }}</strong></td>
            </tr>
        </table>
    </div>
</div>

<div style="width: 59.5%; float: left;">
    <h5 class="report-header">Long Term Summary</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set longTermTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record3 in longTermSummary %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set longTermTotalCount = longTermTotalCount + record3.longTermCount %}
            {% set totalPrice = totalPrice + record3.price %}
            <tr class="{{ trC }}">
                <td>{{ record3.billingBranch }}</td>
                <td style="text-align: right;">{{ record3.longTermCount }}</td>
                <td style="text-align: right;">{{ record3.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ longTermTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div style="width: 39.5%; float: right;">
    <h5 class="report-header">Long Term Summary (Void / Returned)</h5>
    <table class="report-data" width="100%">
        <thead class="header void">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set longTermTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record3 in longTermSummary_void %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set longTermTotalCount = longTermTotalCount + record3.longTermCount %}
            {% set totalPrice = totalPrice + record3.price %}
            <tr class="{{ trC }}">
                <td>{{ record3.billingBranch }}</td>
                <td style="text-align: right;">{{ record3.longTermCount }}</td>
                <td style="text-align: right;">{{ record3.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ longTermTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>

<div style="width: 59.5%; float: left;">
    <h5 class="report-header">Rent to Own Summary</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set rentToTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record4 in rentToOwnSummary %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set rentToTotalCount = rentToTotalCount + record4.rentToCount %}
            {% set totalPrice = totalPrice + record4.price %}
            <tr class="{{ trC }}">
                <td>{{ record4.billingBranch }}</td>
                <td style="text-align: right;">{{ record4.rentToCount }}</td>
                <td style="text-align: right;">{{ record4.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ rentToTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div style="width: 39.5%; float: right;">
    <h5 class="report-header">Rent to Own Summary (Void / Returned)</h5>
    <table class="report-data" width="100%">
        <thead class="header void">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set rentToTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record4 in rentToOwnSummary_void %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set rentToTotalCount = rentToTotalCount + record4.rentToCount %}
            {% set totalPrice = totalPrice + record4.price %}
            <tr class="{{ trC }}">
                <td>{{ record4.billingBranch }}</td>
                <td style="text-align: right;">{{ record4.rentToCount }}</td>
                <td style="text-align: right;">{{ record4.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ rentToTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>

<div style="width: 59.5%; float: left;">
    <h5 class="report-header">Accessory Summary</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set accessoryTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record5 in accessorySummary %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set accessoryTotalCount = accessoryTotalCount + record5.accessoryCount %}
            {% set totalPrice = totalPrice + record5.price %}
            <tr class="{{ trC }}">
                <td>{{ record5.billingBranch }}</td>
                <td style="text-align: right;">{{ record5.accessoryCount }}</td>
                <td style="text-align: right;">{{ record5.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ accessoryTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div style="width: 39.5%; float: right;">
    <h5 class="report-header">Accessory Summary (Void / Returned)</h5>
    <table class="report-data" width="100%">
        <thead class="header void">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set accessoryTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record5 in accessorySummary_void %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set accessoryTotalCount = accessoryTotalCount + record5.accessoryCount %}
            {% set totalPrice = totalPrice + record5.price %}
            <tr class="{{ trC }}">
                <td>{{ record5.billingBranch }}</td>
                <td style="text-align: right;">{{ record5.accessoryCount }}</td>
                <td style="text-align: right;">{{ record5.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ accessoryTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>

<div style="width: 59.5%; float: left;">
    <h5 class="report-header">CPAP Package Summary</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set cpapPackageTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record6 in cpapPackageSummary %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set cpapPackageTotalCount = cpapPackageTotalCount + record6.cpapPackageCount %}
            {% set totalPrice = totalPrice + record6.price %}
            <tr class="{{ trC }}">
                <td>{{ record6.billingBranch }}</td>
                <td style="text-align: right;">{{ record6.cpapPackageCount }}</td>
                <td style="text-align: right;">{{ record6.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ cpapPackageTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div style="width: 39.5%; float: right;">
    <h5 class="report-header">CPAP Package Summary (Void / Returned)</h5>
    <table class="report-data" width="100%">
        <thead class="header void">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set cpapPackageTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record6 in cpapPackageSummary_void %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set cpapPackageTotalCount = cpapPackageTotalCount + record6.cpapPackageCount %}
            {% set totalPrice = totalPrice + record6.price %}
            <tr class="{{ trC }}">
                <td>{{ record6.billingBranch }}</td>
                <td style="text-align: right;">{{ record6.cpapPackageCount }}</td>
                <td style="text-align: right;">{{ record6.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ cpapPackageTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>

<div style="width: 59.5%; float: left;">
    <h5 class="report-header">Medical Supplies Summary</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set medicalSuppliesTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record7 in medicalSuppliesSummary %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set medicalSuppliesTotalCount = medicalSuppliesTotalCount + record7.medicalSuppliesCount %}
            {% set totalPrice = totalPrice + record7.price %}
            <tr class="{{ trC }}">
                <td>{{ record7.billingBranch }}</td>
                <td style="text-align: right;">{{ record7.medicalSuppliesCount }}</td>
                <td style="text-align: right;">{{ record7.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ medicalSuppliesTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div style="width: 39.5%; float: right;">
    <h5 class="report-header">Medical Supplies Summary (Void / Returned)</h5>
    <table class="report-data" width="100%">
        <thead class="header void">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set medicalSuppliesTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record7 in medicalSuppliesSummary_void %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set medicalSuppliesTotalCount = medicalSuppliesTotalCount + record7.medicalSuppliesCount %}
            {% set totalPrice = totalPrice + record7.price %}
            <tr class="{{ trC }}">
                <td>{{ record7.billingBranch }}</td>
                <td style="text-align: right;">{{ record7.medicalSuppliesCount }}</td>
                <td style="text-align: right;">{{ record7.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ medicalSuppliesTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>

<div style="width: 59.5%; float: left;">
    <h5 class="report-header">Part of CPAP Package Summary</h5>
    <table class="report-data" width="100%">
        <thead class="header">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set partOfCpapPackageTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record7 in partOfCpapPackageSummary %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set partOfCpapPackageTotalCount = partOfCpapPackageTotalCount + record7.partOfCpapPackageCount %}
            {% set totalPrice = totalPrice + record7.price %}
            <tr class="{{ trC }}">
                <td>{{ record7.billingBranch }}</td>
                <td style="text-align: right;"><a href="{{ path('report_invoice_itemised_preview', {date_from: dateFrom, date_to: dateTo, patient: 'null', company: 'null', branch: 'null', branchAddress: record7.billingBranchId, term: 'null',  item_type : 'Part of CPAP Package' }) }}" target="_blank">{{ record7.partOfCpapPackageCount }}</a></td>
                <td style="text-align: right;">{{ record7.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ partOfCpapPackageTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div style="width: 39.5%; float: right;">
    <h5 class="report-header">Part of CPAP Package Summary (Void / Returned)</h5>
    <table class="report-data" width="100%">
        <thead class="header void">
        <tr>
            <th width="33%">Branch Address</th>
            <th style="text-align: right;" width="33%">Count</th>
            <th style="text-align: right;" width="33%">Total Amount</th>
        </tr>
        </thead>
        <tbody>
        {% set partOfCpapPackageTotalCount = 0 %}
        {% set totalPrice = 0 %}
        {% for record7 in partOfCpapPackageSummary_void %}
            {% set trC = loop.index > 1 and loop.index % 2 == 0 ? 'even' : 'odd' %}
            {% set partOfCpapPackageTotalCount = partOfCpapPackageTotalCount + record7.partOfCpapPackageCount %}
            {% set totalPrice = totalPrice + record7.price %}
            <tr class="{{ trC }}">
                <td>{{ record7.billingBranch }}</td>
                <td style="text-align: right;">{{ record7.partOfCpapPackageCount }}</td>
                <td style="text-align: right;">{{ record7.price|number_format(2, '.', ',') }}</td>
            </tr>
        {% endfor %}
        <tr>
            <td></td>
            <td style="text-align: right;"><strong>Total: {{ partOfCpapPackageTotalCount }}</strong></td>
            <td style="text-align: right;"><strong>Total: {{ totalPrice|number_format(2, '.', ',') }}</strong></td>
        </tr>
        </tbody>
    </table>
</div>
<div></div>
<div></div>
</body>
</html>