<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';

$bulan  = $_POST[bulan];
$tahun  = $_POST[tahun];

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Kode Trans</th>
			<th>Tanggal</th>
			<th>Jurnal</th>
			<th>Debet</th>
			<th>Kredit</th>
		</tr>";
		
		if($bulan=='')
		    $sql= mysql_query("SELECT kode_tr,tanggal,jurnal,sum(debet) as tdebet,sum(kredit) as tkredit FROM rekapjur WHERE 1 GROUP BY kode_tr");
		else
		    $sql= mysql_query("SELECT kode_tr,tanggal,jurnal,sum(debet) as tdebet,sum(kredit) as tkredit FROM rekapjur WHERE month(tanggal)='$bulan' AND year(tanggal)='$tahun' GROUP BY kode_tr");
				
		$no=1;
		while($data=mysql_fetch_array($sql)){
		    $tdebet = $data[tdebet];
		    $tkredit= $data[tkredit];
		    
		    if(!($tdebet==$tkredit)){
			echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$data[kode_tr]</td>
				<td align='center'>".jin_date_str($data[tanggal])."</td>
				<td align='center'>$data[jurnal]</td>
				<td align='right'>".number_format($data[tdebet],2)."</td>
				<td align='right'>".number_format($data[tkredit],2)."</td>
			</tr>";
			$no++;
		    }
		}
	echo "</table>";
?>
