<div class="row">
	<div class="col-md-6">
		<table class="table table-bordered table-condensed">
			<thead>
				<tr>
					<th style="text-align:center;">Pembayaran melalui</th>
					<th style="text-align:center;">Keterangan</th>
					<th style="text-align:center;">Total</th>
				</tr>
			</thead>
			<tbody>
				<?php 
					$grand_total = 0;
					$total_cash = 0;
					foreach ($data->result() as $key => $value) {
						$total_pay = $value->grand_total_final;
						if ($value->payment_status == 'PANJAR') {
							$total_pay = $value->total_panjar;
						}
						$grand_total += $total_pay;

						if ($value->idpayment_type == '1') {
							$total_cash += $total_pay;
						}
				?>
				<tr>
					<td><?php echo $value->payment_type_name;?></td>
					<td><?php echo $value->code.' '.$value->customer_name;?></td>
					<td align="right"><?php echo az_thousand_separator($total_pay);?></td>
				</tr>
				<?php
					}
				?>		
			</tbody>
			<tfoot>
				<tr>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td colspan="2" align="right"><b>TOTAL</b></td>
					<td align="right"><b><?php echo az_thousand_separator($grand_total);?></b></td>
				</tr>
			</tfoot>
		</table>
	</div>
	<div class="col-md-6">
		<table class="table table-bordered table-condensed">
			<tr>
				<td>TOTAL KAS</td>
				<td></td>
				<td align="right"><?php echo az_thousand_separator($total_cash);?></td>
			</tr>
			<tr>
				<td>Pengeluaran</td>
				<td></td>
				<td></td>
			</tr>
			<?php 
				$balance_in = $total_cash;
				$balance_out = 0;
				foreach ($outlay->result() as $key => $value) {
					$balance_out += $value->total;
			?>
			<tr>
				<td><?php echo $value->outlay_type_name;?></td>
				<td align="right"><?php echo az_thousand_separator($value->total);?></td>
				<td></td>
			</tr>
			<?php
				}
			?>
			<tr>
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<tr>
				<td align="right"><b>BALANCE<b></td>
				<td align="right"><b><?php echo az_thousand_separator($balance_out);?></b></td>
				<td align="right"><b><?php echo az_thousand_separator($balance_in);?></b></td>
			</tr>
		</table>
	</div>
</div>