<?php 
		if($_POST['followup']=='ralan'){
			$foll="Rawat Jalan";
		}else if($_POST['followup']=='ranap'){
			$foll="Rawat Inap";
		}else{
			$foll="Rawat Jalan Dan Rawat Inap";
		}
		
		if($_POST['statusx']==''){ 
			$stat="Semua";		
		}else{
			$stat=$_POST['statusx'];
		}
	ini_set("max_execution_time", 0);
	header("Content-Disposition: attachment; filename=\"Rekap Jumlah Pasien ".$foll." ".tgl_id_short($_POST['tglawal'])."-".tgl_id_short($_POST['tglakhir']).".xls\"");
	header("Content-type: application/vnd.ms-excel"); 
	?>
<h3 align="center">Rekap Jumlah Pasien <?php echo $foll;?><br>
Status Pasien <?php echo $stat;?></h3>
<h4 align="center">Periode <?php echo tgl_id_short($_POST['tglawal']);?> s/d <?php echo tgl_id_short($_POST['tglakhir']);?></h4>

<table border="1" align="center">
												
	<tr>
		<th>No</th>
		<th>Poliklinik</th>
		<th>BPJS</th>
		<th>Umum</th>
		<th>Lainnya</th>
		<th>Total</th>														
	</tr>

<?php $no=1;
$totbpjs=0;$totumum=0;$totlain=0;$totall=0;
foreach($result as $dtk){ 
	$totbpjs=$totbpjs+$dtk->BPJS;
	$totumum=$totumum+$dtk->Umum;
	$totlain=$totlain+$dtk->Lainnya;
	$totall=$totall+$dtk->Total;
	
	/* if($dtk->PintuMasuk=='VK'){
		$poli="KIA";
	}else{
		$poli=$dtk->PintuMasuk;
	} */
?>
	<tr>
		<td><?php echo $no;?></td>
		<td class="hidden-480"><?php echo $dtk->nm_poli;?></td>
		<td class="hidden-480"><?php echo $dtk->BPJS;?></td>
		<td class="hidden-480"><?php echo $dtk->Umum;?></td>
		<td class="hidden-480"><?php echo $dtk->Lainnya;?></td>
		<td class="hidden-480"><?php echo $dtk->Total;?></td>

	</tr>
<?php $no++; } ?>
	<tr style="color:#b30000;font-size:1.1em">
		<td colspan="2" class="text-center"><strong>Total</strong></td>
		<td><strong><?php echo $totbpjs;?></strong></td>
		<td><strong><?php echo $totumum;?></strong></td>
		<td><strong><?php echo $totlain;?></strong></td>
		<td><strong><?php echo $totall;?></strong></td>
	</tr>

</table>