<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_bm,tanggal,nobank,namabank,pembayar FROM jurbm WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND posting='P' GROUP BY kode_bm ");
		
		$tjumlah=0;
		$tdiskon=0;		
		while($r1=mysql_fetch_array($data1)){
			$kodebm = $r1['kode_bm'];
			
			echo "<tr>
				<td></td>
				<td>No.BBM :</td>
				<td>$r1[kode_bm]</td>
				<td>Tanggal : ".jin_date_str($r1['tanggal'])."</td>
				<td>Bank : $r1[nobank] - $r1[namabank]</td>
				<td>Pembayar :</td>
				<td>$r1[pembayar]</td>
			</tr>";

			$query = mysql_query("SELECT * FROM jurbm WHERE kode_bm='$kodebm' ");
		
			$no=1;
			$sjumlah=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='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>
			</tr>";
			$tjumlah=$tjumlah+$sjumlah;
		}
		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>
		</tr>
	</table>";
?>