<script type="text/javascript">	
	window.print();
</script>

<?php
	include '../../inc/inc.koneksi.php';	
	include '../../inc/fungsi_tanggal.php';

	$tgl_awal	= $_GET['tgl_awal'];
	$tgl_akhir= $_GET['tgl_akhir'];

	$query2 = mysql_query("SELECT * FROM company");
		
	while($r2=mysql_fetch_array($query2)){
		$kop1 = $r2[nama1];
		$kop2 = $r2[nama2];
		$kop3 = $r2[alamat];
	}
	
	echo "<table width='100%' style='font:13px arial'>
		<tr>
			<td><b>$kop1</b></td>
		</tr>
		<tr>
			<td>$kop2</td>
		</tr>
		<tr>
			<td>$kop3</td>
		</tr>
	</table>
	<br>
		
	<table width='100%'>
		<tr>
			<td align='center' style='font:16px arial'><b>JURNAL PENGELUARAN KAS</b></td>
		</tr>
		<tr>
			<td align='center' style='font:16px arial'><b>TANGGAL : ".jin_date_str($tgl_awal)." S/D ".jin_date_str($tgl_akhir)."</b></td>
		</tr>
	</table>
	<br>
	
	<table width='800' border='1' style='border-collapse:collapse;font:13px arial'>
		<tr>
			<th>No.</th>
			<th>Kode Akun</th>
			<th>Nama Akun</th>
			<th>Kode BP</th>
			<th>Nama Buku Pembantu</th>
			<th>No.Polisi</th>
			<th>Keterangan</th>
			<th>Jumlah</th>
			<th>Posting</th>
		</tr>";
		
		$data1	= mysql_query("SELECT kode_kk,tanggal,nokas,namakas,penerima FROM jurkk WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' GROUP BY kode_kk ");
		
		$tjumlah=0;
		$jdata=0;
		while($r_data1=mysql_fetch_array($data1)){
			$kodekk = $r_data1[kode_kk];
			
			echo "<tr>
				<td></td>
				<td>No.Bkk :</td>
				<td>$r_data1[kode_kk]</td>
				<td>".jin_date_str($r_data1[tanggal])."</td>
				<td>Kas : $r_data1[nokas] - $r_data1[namakas]</td>				
				<td>Penerima :</td>
				<td>$r_data1[penerima]</td>
			</tr>";
				
			$sql = "SELECT * FROM jurkk WHERE kode_kk='$kodekk' ORDER BY no_urut";
			$query = mysql_query($sql);
		
			$no=1;
			$sjumlah=0;
			while($r_data=mysql_fetch_array($query)){
				$sjumlah=$sjumlah+$r_data[jumlah];
				echo "<tr>					
					<td align='center'>$no</td>
					<td align='center'>$r_data[noakun]</td>
					<td>$r_data[naakun]</td>
					<td align='center'>$r_data[nobp]</td>
					<td>$r_data[namabp]</td>
					<td>$r_data[nopol]</td>
					<td>$r_data[keterangan]</td>
					<td align='right'>".number_format($r_data[jumlah],2)."</td>
					<td align='center'>$r_data[posting]</td>
				</tr>";
				$no++;
				$jdata++;				
			}
			
			echo "<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td align='right'>Jumlah</td>
				<td align='right'>".number_format($sjumlah,2)."</td>
			</tr>";
			$tjumlah=$tjumlah+$sjumlah;
		}
		echo "<tr></tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td align='right'>Total</td>
			<td align='right'>".number_format($tjumlah,2)."</td>
		</tr>
	</table>
	<table width='100%'>
		<tr>
			<td>Jumlah Data : $jdata</td>
		</tr>
	</table>";
?>
<script type="text/javascript">	
	history.back();
</script>