<table>
	<thead>
		<tr>
			<th>Description</th>
			<th>Amount</th>
		</tr>
	</thead>

	<tbody>

		<?php foreach ($details_keys as $title => $key) { ?>
			<?php if (empty($data->get('totals')[$key])) { continue; } ?>
			<tr class="<?php echo (end($details_keys) === $key ? 'last' : '') ?>">
				<td><?php echo ucfirst($title); ?></td>
				<td><?php echo $this->currencySymbol() . number_format($data->get('totals')[$key]['before_vat'], 2); ?></td>
			</tr>
		<?php } ?>

		<tr class="total">
			<td >SUBTOTAL</td>
			<td><strong><?php echo $this->currencySymbol() . number_format($data->get('totals')['before_vat'], 2); ?></strong></td>
		</tr>
		<?php echo $this->render($this->tax_template,array('data' => $data->get('totals'),'col_count'=>2))	?>
		
		<?php if (!empty($invoice_display_options['past_balance']) && $data->get('totals')['past_balance']['after_vat'] < -0.005) { ?>
			<tr class="total">
				<td colspan="1">PAST BALANCE / REIMBURSEMENTS</td>
				<td><?php echo $this->currencySymbol() . number_format($data->get('totals')['past_balance']['after_vat'], 2); ?></td>
			</tr>
		<?php } ?>

		<tr class="grand-total">
			<td colspan="1">GRAND TOTAL</td>
			<td><?php echo $this->currencySymbol() . number_format($data->get('totals')['after_vat']  + (!empty($invoice_display_options['past_balance']) ? $data->get('totals')['past_balance']['after_vat'] : 0 ), 2); ?></td>
		</tr>
	</tbody>
</table>
