	<?php 		
	ini_set("max_execution_time", 0);
	header("Content-Disposition: attachment; filename=\"Rekap Stok Obat ".tgl_id_short(date('Y-m-d')).".xls\"");
	header("Content-type: application/vnd.ms-excel"); 
	?>
	<h3 align="center">REKAP STOK OBAT</h3>
	<h4 align="center"><?php echo $depo;?></h4>
	<h5 align="center">Tanggal :<?php echo tgl_id_short(date('Y-m-d'));?> </h5>
	<table border="1" align="center">
		<thead>
			<tr>
				<th>No</th>
				<th>Kode</th>
				<th>Obat</th>				
				<th>Bangsal</th>	
				<th>Stok</th>
				<th>Harga</th>
				<th>Subtotal</th>
			</tr>
		</thead>
		
		<?php $no=1;$subtotal=0;$total=0;
		foreach($result as $dtk){ 
			$subtotal=$dtk->stok * $dtk->h_beli;
			$total=$total + $subtotal;
		?>
			<tr>
				<td><?php echo $no;?></td>
				<td><?php echo $dtk->kode_brng;?></td>
				<td><?php echo $dtk->nama_brng;?></td>
				<td><?php echo $dtk->nm_bangsal;?></td>
				<td><?php echo $dtk->stok;?></td>
				<td><?php echo number_exc_koma($dtk->h_beli);?></td>
				<td><?php echo number_exc_koma($subtotal);?></td>
			</tr>
		<?php $no++; } ?>
			<tr>
				<th colspan="6" class="center">Total Biaya</th>														
				<th><?php echo number_exc_koma($total);?></th>
			</tr>
		
	</table>