
<div style="padding:5px;min-width:800px;">
<div style="padding:20px;"></div>
<button class="btn btnExcel" style="width:150px;text-align:center;">Export Excel</button></div>
<table id="view_laporan" class="cetakExcel" border="0" cellpadding="2" cellspacing="0" style="margin:10px;min-width:800px;">
	<tbody>
		<tr>
			<td align="center" colspan="12" style="text-align: center;border:0px;border-top:0;font-size:14px;border-right:0px;">LAPORAN KEUANGAN PERKARA</td>

		</tr>
		<tr>
			<td align="center" colspan="12" style="text-align: center;border:0px;font-size:14px;border-right:0px;"><?php echo $nama_pn;?></td>

		</tr>
		<tr>
			<td align="center" colspan="12" style="text-align: center;border:0px;font-size:14px;border-bottom:1px solid #000000;border-right:0px;">Bulan <?php echo fetch_montd($bulan);?> <?php echo $tahun;?></td>

		</tr>
	</tbody>
	<tbody>
		<tr>
			<th rowspan="1" colspan="1">NO</th>
			<th rowspan="1" colspan="1">URAIAN</th>
			<th rowspan="1" colspan="1">PENERIMAAN</th>
			<th rowspan="1" colspan="1">PENGELUARAN</th>
		</tr>
		<tr>
			<th>1</th>
			<th>2</th>
			<th>3</th>
			<th>4</th>
		</tr>
		<tr>
		<?php
		$a = 0;
		$totalPenerimaan = 0;
		$totalPengeluaran = 0;
		foreach ($listKeuangan->result() as $row) {$a++;
			$totalPenerimaan += $row->jml_penerimaan;
			$totalPengeluaran += $row->jml_pengeluaran;
			echo "<tr>";
				echo "<td style='text-align:center;'>".$a."</td>";
				echo "<td>".$row->uraian."</td>";
				echo "<td style='text-align:right;'>".number_format($row->jml_penerimaan, 0, ',', '.')."</td>";
				echo "<td style='text-align:right;'>".number_format($row->jml_pengeluaran, 0, ',', '.')."</td>";
			echo "</tr>";
		}
		echo "<tr>";			
			echo "<td colspan='2' style='text-align:center;'>Jumlah</td>";
			echo "<td style='text-align:right;'>".number_format($totalPenerimaan, 0, ',', '.')."</td>";
			echo "<td style='text-align:right;'>".number_format($totalPengeluaran, 0, ',', '.')."</td>";
		echo "</tr>";
		$saldo = $totalPenerimaan-$totalPengeluaran;
		echo "<tr>";			
			echo "<td colspan='2' style='text-align:center;'>Saldo Akhir</td>";
			echo "<td colspan='2' style='text-align:right;'>".number_format($saldo, 0, ',', '.')."</td>";
		echo "</tr>";
		?>	
	</tbody>
</table>
</div>
<div style="padding:15px;"></div>
<script src="resources/js/jquery.table2excel.js"></script>
<script>
$(function() {
	$(".btnExcel").click(function(){
		$(".cetakExcel").table2excel({
			exclude: ".noExl",
			name: "Excel Document Name",
			filename: "Cetak Excel"
		});
	});
});
</script>