<?php
	include '../../inc/inc.koneksi.php';	
		
	$tgllap =date('d-m-Y');
		
	$content = "<b><li>DAFTAR AKUN BUKU BESAR</li>		
		<li>PER TANGGAL $tgllap</li></b>
		<br>
	
		<table width='390' border='1' style='border-collapse:collapse'>
		<tr>			
			<th>Kode</th>
			<th>Nama Akun</th>
			<th>Level</th>
			<th>D/K</th>			
		</tr>";
		
		$query1= "SELECT * FROM gol_akun ORDER BY nogol";
	
		$data1	= mysql_query($query1);
		$jml=1;		
		while($r1=mysql_fetch_array($data1)){
			$nogol=$r1[nogol];
			
			$content .= "<tr>				
				<td><b>$r1[nogol]</b></td>			
				<td><b>$r1[nagol]</b></td>
			</tr>";
		
			$sql	= "SELECT * FROM akun_bb WHERE nogol='$nogol' ORDER BY noakun";
			$query = mysql_query($sql);
					
			while($r_data=mysql_fetch_array($query)){
				$content .= "<tr>
					<td>$r_data[noakun]</td>
					<td>$r_data[naakun]</td>
					<td align='center'>$r_data[level]</td>
					<td align='center'>$r_data[kode]</td>
				</tr>";				
				$jml++;
			}	
		}
		
		$content .= "</table>";
		
		$content .= "<table>
			<tr>
				<td>Jumlah Data : $jml</td>
			</tr>
			</table>";
				
		header("Content-type: application/x-msdownload");
		header("Content-Disposition: attachment; filename=daftar_akunbb.xls");
		header("Pragma: no-cache");
		header("Expires: 0");
		echo $content;
?>
