<h5 style="margin-top: 0px;">{{ __("Opening Invoices Summary") }}</h5>
{% $.each(data, (company, summary) => { %}
<h6 style="margin: 15px 0px -10px 0px;"><a class="company-link"> {{ company }}</a></h6>

<table class="table table-bordered small">
	<thead>
		<tr>
			<td style="width: 33%">{{ __("Invoice Type") }}</td>
			<td style="width: 33%" class="text-right">{{ __("Opening Invoices") }}</td>
			<td style="width: 33%" class="text-right">{{ __("Total Outstanding") }}</td>
		</tr>
	</thead>
	<tbody>
		{% $.each(["Sales Invoice", "Purchase Invoice"], (idx, doctype) => { %}
		{% if summary[doctype] %}
		<tr>
			<td>
				<a class="invoice-link" data-type="{{ doctype }}" data-company="{{ company }}">
					{{ __(doctype) }}</a>
			</td>
			<td class="text-right">
				{{ summary[doctype].total_invoices }}
			</td>
			<td class="text-right">
				{{ format_currency(summary[doctype].outstanding_amount, summary.currency, 2) }}
			</td>
		</div>
		{% endif %}
		{% }); %}
	</tbody>
</table>
{% }); %}
