<?php
	include '../../inc/inc.koneksi.php';
	include '../../inc/fungsi_tanggal.php';
	
	$kode 		= $_GET['kode'];
	$tanggal	= $_GET['tgl'];
	$pemby  	= $_GET['pemby'];	
	$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 PENERIMAAN KAS</b></h2>
		</div>
	
		<div>
			<li>Nomor Bukti ...... :  $kode</li>
			<li>Telah terima dari 	:  $pemby</li>
			<li>Uang sejumlah	... : $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>Nama BP</th>
			<th>No.Faktur</th>
			<th>Keterangan</th>			
			<th>Jumlah</th>		
		</tr>";
	
		$sql	= "SELECT * FROM jurkm WHERE kode_km='$kode' ORDER BY kode_km";
		$query = mysql_query($sql);
		
		$no=1;				
		$tjumlah=0;
		
		while($r=mysql_fetch_array($query)){
			
			$content .= "<tr>
				<td align='center'>$no</td>
				<td>$r[naakun]</td>
				<td>$r[namabp]</td>
				<td>$r[nofak]</td>
				<td>$r[keterangan]</td>				
				<td align='right'>".number_format($r['jumlah'],0)."</td>
				</tr>";
			$tjumlah=$tjumlah+$r['jumlah'];
			$no++;
		}
	
		$content .= "</table>";
		
		
		$content .= "<table width='390' border='1' style='border-collapse:collapse'>
				<tr>
				<td></td>
				<td></td>
				<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></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></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></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;
?>