<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>Keterangan</th>
			<th>Jumlah</th>
			<th>Posting</th>
		</tr>";
		
		$data1	= mysql_query( "SELECT kode_km,tanggal,nokas,namakas FROM jurkm WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND posting='P' GROUP BY kode_km ");
		
		$tjumlah=0;
		$jdata=1;
		while($r1=mysql_fetch_array($data1)){
			$kodekm = $r1[kode_km];
			
			echo "<tr>
				<td></td>
				<td>Nomor BKM :</td>
				<td>$r1[kode_km]</td>
				<td>Tanggal : ".jin_date_str($r1[tanggal])."</td>
				<td>Akun Kas : $r1[nokas] - $r1[namakas]</td>				
			</tr>";
				
			$query = mysql_query("SELECT * FROM jurkm WHERE kode_km='$kodekm' AND posting='P' ");
		
			$no=1;
			$sjumlah=0;
			while($r=mysql_fetch_array($query)){
				$sjumlah=$sjumlah+$r[jumlah];
				echo "<tr>
					<td align='center'>$no</td>
					<td align='center'>$r[noakun]</td>
					<td>$r[naakun]</td>
					<td align='center'>$r[nobp]</td>
					<td>$r[namabp]</td>
					<td>$r[nofak]</td>
					<td>$r[keterangan]</td>
					<td align='right'>".number_format($r[jumlah],2)."</td>
					<td align='center'>$r[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>";
?>