<?php
	foreach ($data as $key => $value) {
?>
<h4>DPT <?php echo $value['payment'];?></h4>
<table class="table table-condensed table-bordered">
	<tr>
		<th style="text-align:center;" width="10px">No</th>
		<th style="text-align:center;">Tanggal Transaksi</th>
		<th style="text-align:center;">Outlet</th>
		<th style="text-align:center;">Bill</th>
		<th style="text-align:center;">Nama Pelanggan</th>
		<th style="text-align:center;">Jumlah</th>
	</tr>
	<?php
		$total = 0;
		foreach ((array) $value['list'] as $list_key => $list_value) {
			$total += $list_value['total'];
	?>
	<tr>
		<td align="center"><?php echo ($list_key + 1);?></td>
		<td><?php echo Date('d-m-Y H:i', strtotime($list_value['date']));?></td>
		<td><?php echo $list_value['outlet_name'];?></td>
		<td><?php echo $list_value['nobill'];?></td>
		<td><?php echo $list_value['customer'];?></td>
		<td align="right"><?php echo az_thousand_separator($list_value['total']);?></td>
	</tr>
	<?php
		}
	?>
	<tr>
		<td align="right" colspan="5">TOTAL</td>
		<td align="right"><?php echo az_thousand_separator($total);?></td>
	</tr>
</table>
<br>
<?php
	}
?>

<div class="row">
	<div class="col-md-6">
		<table class="table table-bordered table-condensed">
			<tr>
				<th style="text-align:center;" width="10px">No</th>
				<th style="text-align:center;" width="170px">Cara Pembayaran</th>
				<th style="text-align:center;">Total</th>
				<th style="text-align:center;" width="110px">Persentase (%)</th>
			</tr>
			<?php
				foreach ($data as $key => $value) {
					$perc = 0;
					if ($value['total'] > 0 && $grand_total > 0) {
						$perc = $value['total'] / $grand_total * 100;
						$perc = round($perc);
					}
			?>
			<tr>
				<td align="center"><?php echo ($key + 1);?></td>
				<td><?php echo $value['payment'];?></td>
				<td align="right"><?php echo az_thousand_separator($value['total']);?></td>
				<td align="center"><?php echo $perc;?>%</td>
			</tr>
			<?php
				}
			?>
			<tr>
				<td align="right" colspan="2">TOTAL DPT</td>
				<td align="right"><?php echo az_thousand_separator($grand_total);?></td>
				<td align="center">100%</td>
			</tr>
		</table>
	</div>
</div>