<?php

// header("Content-type: application/vnd-ms-excel");

// header("Content-Disposition: attachment; filename=Laporan_Unit_Misioner_All_".$periode_thn.".xls");

?>

<!DOCTYPE html>

<html>

<head>

	<title></title>

		<style type="text/css">

	body{

		font-family: sans-serif;

	}

	table{

		margin: 20px auto;

		border-collapse: collapse;

		width: 100%;

	}

	table th,

	table td{

		border: 1px solid #3c3c3c;

		

	}

	table td{

		vertical-align: top;

	}

	a{

		background: blue;

		color: #fff;

		padding: 8px 10px;

		text-decoration: none;

		border-radius: 2px;

	}

	table tfoot tr td{

		background-color: yellow;

	}

	.text{

		padding: 3px 3px 3px 3px;

	}

	.number{

		padding: 3px 3px 3px 3px;

	}

	.no_ppg td{

		background-color: #9dcafa;

	}

	</style>

</head>

<body>

<table border="1">

	<thead>

		<tr>

			<th colspan="4">Rekap Data Sementara PKA <?=$periode_thn?></th>

			

		</tr>

		<tr>

			<th>No</th>

			<th class="text">Unit Misioner</th>

			<th class="number">Penerimaan</th>

			<th class="number">Pengeluaran</th>

		</tr>	

	</thead>

	<tbody>

		<?php

		$no =1;

		for($i=0; $i<count($result);$i++){

			$penerimaan = $result[$i]['penerimaan'] == 0? "-" : "".number_format($result[$i]['penerimaan'],2,",","."); 

			$pengeluaran = $result[$i]['pengeluaran'] == 0? "-" : "".number_format($result[$i]['pengeluaran'],2,",","."); 

		?>

		<tr><td style="text-align: center;">

				<?=$no++?>

			</td>

			<td class="text">

				<?=$result[$i]['nama_um']?>

			</td>

			<td style="text-align: right;">

				 <?=$penerimaan?>

			</td>

			<td style="text-align: right;">

				<?=$pengeluaran?>

			</td>

		</tr>

		<?php

		}

		?>

	</tbody>

	<tfoot>

		<tr>

			<td colspan="2"><strong>Total</strong></td>

			<td style="text-align: right;"><strong><?=number_format($total_penerimaan,2,",",".")?></strong></td>

			<td style="text-align: right;"><strong><?=number_format($total_pengeluaran,2,",",".")?></strong></td>

		</tr>

		<tr class="saldo">

			<td colspan="2"><strong>Saldo</strong></td>

			<td colspan="2" style="text-align: right;"><strong><?=number_format($saldo,2,",",".")?></strong></td>

		</tr>

		<tr class="no_ppg">

			<td colspan="2" style="background-color: #9dcafa;"><strong>Total Tanpa PPG</strong></td>

			<td style="text-align: right;background-color: #9dcafa;"><strong><?=number_format($total_penerimaan_no_ppg,2,",",".")?></strong></td>

			<td style="text-align: right;background-color: #9dcafa;"><strong><?=number_format($total_pengeluaran_no_ppg,2,",",".")?></strong></td>

		</tr>

		<tr class="no_ppg">

			<td colspan="2" style="background-color: #9dcafa;"><strong>Saldo Tanpa PPG</strong></td>

			<td colspan="2" style="text-align: right;background-color: #9dcafa;"><strong><?=number_format($saldo_no_ppg,2,",",".")?></strong></td>

		</tr>

	</tfoot>

</table>

</body>

</html>