<script type="text/javascript">
$(document).ready(function() {
    $(function() {
        $("#theList tr:even").addClass("stripe1");
        $("#theList tr:odd").addClass("stripe2");

        $("#theList tr").hover(
            function() {
                $(this).toggleClass("highlight");
            },
            function() {
                $(this).toggleClass("highlight");
            }
        );
    });
});	
</script>

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

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

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Akun</th>
			<th>Nama Akun</th>
			<th>Kode BP</th>			
			<th>Nama BP</th>
			<th>No.Faktur</th>
			<th>Kode Stok</th>
			<th>Jml.Unit</th>
			<th>Keterangan</th>
			<th>Debet</th>
			<th>Kredit</th>
			<th>Posting</th>
		</tr>";
		
		$query1 = "SELECT kode_ju,tanggal FROM jurnalum WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' GROUP BY kode_ju ";
		$data1	= mysql_query($query1);
		
		$tdebet=0;
		$tkredit=0;
		$jdata=0;
		while($r_data1=mysql_fetch_array($data1)){
			$kodeju = $r_data1[kode_ju];
			
			echo "<tr>
				<td></td>
				<td>No. Bukti :</td>
				<td>$r_data1[kode_ju]</td>
				<td>Tanggal : ".jin_date_str($r_data1[tanggal])."</td>				
				</tr>";
				
			$sql = "SELECT * FROM jurnalum WHERE kode_ju='$kodeju' ";
			$query = mysql_query($sql);
		
			$no=1;
			$sdebet=0;
			$skredit=0;
			while($r_data=mysql_fetch_array($query)){
				$sdebet=$sdebet+$r_data[debet];
				$skredit=$skredit+$r_data[kredit];
				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 align='center'>$r_data[nofak]</td>
					<td align='center'>$r_data[kode_st]</td>
					<td align='center'>$r_data[jml_unit]</td>
					<td>$r_data[keterangan]</td>
					<td align='right'>".number_format($r_data[debet],2)."</td>
					<td align='right'>".number_format($r_data[kredit],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></td>
				<td></td>
				<td align='right'>Jumlah</td>
				<td align='right'>".number_format($sdebet,2)."</td>
				<td align='right'>".number_format($skredit,2)."</td>
			</tr>";
			$tdebet=$tdebet+$sdebet;
			$tkredit=$tkredit+$skredit;
		}
		echo "<tr></tr>
		<tr>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td></td>
			<td align='right'>Total</td>
			<td align='right'>".number_format($tdebet,2)."</td>
			<td align='right'>".number_format($tkredit,2)."</td>
		</tr>
	</table>
	<table width='100%'>
		<tr>
			<td>Jumlah data : $jdata</td>
		</tr>
	</table>";
?>