<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>Kode BP</th>
			<th>Nama Akun</th>
			<th>Nama Buku Pembantu</th>			
			<th>No.Faktur</th>
			<th>Cabang</th>
			<th>Keterangan</th>
			<th>Jumlah</th>
			<th>Diskon</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' AND posting='P' GROUP BY kode_kk ");
		
		$tjumlah=0;
		$tdiskon=0;		
		while($r1=mysql_fetch_array($data1)){
			$kodekk = $r1['kode_kk'];
			
			echo "<tr>
				<td></td>
				<td>No.BKM :</td>
				<td>$r1[kode_kk]</td>
				<td>Tanggal : ".jin_date_str($r1['tanggal'])."</td>
				<td>No.VPK : $r1[nobukti]</td>
				<td>Kas : $r1[nokas] - $r1[namakas]</td>
				<td>Penerima :</td>
				<td>$r1[penerima]</td>
			</tr>";

			$query = mysql_query("SELECT * FROM jurkk WHERE kode_kk='$kodekk' ");
		
			$no=1;
			$sjumlah=0;
			$sdiskon=0;
			while($r=mysql_fetch_array($query)){
				$sjumlah=$sjumlah+$r['jumlah'];
				$sdiskon=$sdiskon+$r['diskon'];
				echo "<tr>
					<td align='center'>$no</td>
					<td align='center'>$r[noakun]</td>
					<td align='center'>$r[nobp]</td>
					<td>$r[naakun]</td>
					<td>$r[namabp]</td>					
					<td align='center'>$r[nofak]</td>
					<td>$r[kode_cab]</td>
					<td>$r[keterangan]</td>
					<td align='right'>".number_format($r['jumlah'],2)."</td>
					<td align='right'>".number_format($r['diskon'],2)."</td>
					<td align='center'>$r[posting]</td>
				</tr>";
				$no++;				
			}
			
			echo "<tr>
				<td></td>
				<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>
				<td align='right'>".number_format($sdiskon,2)."</td>
			</tr>";
			$tjumlah=$tjumlah+$sjumlah;
			$tdiskon=$tdiskon+$sdiskon;
		}
		echo "<tr></tr>
		<tr>
			<td></td>
			<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>
			<td align='right'>".number_format($tdiskon,2)."</td>
		</tr>
	</table>";
?>