<?php
	include '../../inc/inc.koneksi.php';
	include '../../inc/fungsi_tanggal.php';
	
	$kode 		= $_GET[kode];
	$tanggal	= $_GET[tgl];	
	$nobank 	= $_GET[nobank];	
	$nabank 	= $_GET[nabank];	
	$total  		= $_GET[total];
	$tbl			= $_GET[tbl];
		
	$sql2		= "SELECT * FROM company";		
	$query2 	= mysql_query($sql2);
		
	while($r2=mysql_fetch_array($query2)){
		$kop1 = $r2[nama1];
		$kop2 = $r2[nama2];
		$kop3 = $r2[alamat];
	}
	
	$content = "<b><h2>$kop1</h2></b>
		<li>$kop2</li>
		<li>$kop3</li>
		<div span='12' align='center'>
			<h2 aligh='center'><b>BUKTI PENGELUARAN BANK</b></h2>
		</div>
	
		<div>
				<li>Nomor Bukti ........... :  $kode</li>
				<li>Rekening Bank ........ :  $nobank - $nabank</li>
				<li>Jumlah pengeluaran : $tbl</li>
				<li>Guna membayar ..... :</li>
		</div>
		
		<table width='500' border='1' style='border-collapse:collapse'>
		<tr>
			<th>No.</th>
			<th>Nama Akun</th>
			<th>Keterangan</th>			
			<th>Jumlah</th>		
		</tr>";
	
		$sql	= "SELECT * FROM jurbk WHERE kode_bk='$kode' ORDER BY kode_bk";
		$query = mysql_query($sql);
		
		$no=1;				
		$tjumlah=0;
		
		while($r_data=mysql_fetch_array($query)){
			
			$content .= "<tr>
				<td align='center'>$no</td>
				<td>$r_data[naakun]</td>
				<td>$r_data[keterangan]</td>				
				<td align='right'>".number_format($r_data[jumlah],0)."</td>
				</tr>";
			$tjumlah=$tjumlah+$r_data[jumlah];
			$no++;
		}
	
		$content .= "</table>";
		
		
		$content .= "<table width='390' border='1' style='border-collapse:collapse'>
				<tr>
				<td></td>
				<td></td>
				<td align='right'>Jumlah</td>
				<td align='right'>".number_format($tjumlah,0)."</td>
			</tr>
			</table>";
		
		$content .= "<table width='390' border='0' style='border-collapse:collapse'>
				<tr><td></td></tr>
				
				<tr>
					<td></td>
					<td></td>
					<td align='right'>Purwokerto, </td>
					<td>".jin_date_str($tanggal)."</td>
				</tr>
				<tr>					
					<td></td>					
					<td align='center'>Manajer</td>					
					<td></td>
					<td align='center'>Bag. Keuangan</td>
				</tr>			
				<tr>
					<td></td>					
				</tr>
				<tr>
					<td></td>					
				</tr>
				<tr>					
					<td></td>
					<td align='center'>_______________</td>
					<td></td>					
					<td align='center'>_______________</td>
				</tr>";
					
		$content .= "</table>";
				
		header("Content-type: application/x-msdownload");
		header("Content-Disposition: attachment; filename=$kode.xls");
		header("Pragma: no-cache");
		header("Expires: 0");
		echo $content;
?>
