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

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

	function pilih(ID){
		var kode = ID;
		$("#p_kodeaw").val(kode);
		$("#form_cari_kode").dialog('close');				
	}
</script>

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

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

echo "<table id='theList' width='100%'>
		<tr>
			<th>No.</th>
			<th>Nomor Bbm</th>
			<th>Tanggal</th>
			<th>Akun Bank</th>
			<th>Nama Bank</th>
			<th>Pembayar</th>
			<th>Jml. Item</th>
			<th>Jml. Nominal</th>
			<th>Posting</th>
			<th>Pilih</th>
		</tr>";
		$sql= mysql_query("SELECT kode_bm,tanggal,nobank,namabank,pembayar,count(noakun) as totitem,sum(jumlah) as tjumlah,posting FROM jurbm WHERE tanggal BETWEEN '$tgl_awal' AND '$tgl_akhir' AND posting='P' GROUP BY kode_bm");
				
		$no=1;
		while($r=mysql_fetch_array($sql)){
			echo "<tr>
				<td align='center'>$no</td>
				<td align='center'>$r[kode_bm]</td>
				<td align='center'>".jin_date_str($r['tanggal'])."</td>
				<td align='center'>$r[nobank]</td>
				<td>$r[namabank]</td>
				<td>$r[pembayar]</td>
				<td align='center'>$r[totitem]</td>
				<td align='right'>".number_format($r['tjumlah'],2)."</td>
				<td align='center'>$r[posting]</td>
				<td align='center'><a href='javascript:void(0)' onClick=\"pilih('$r[kode_bm]')\">
					<img src='images/view.png' border='0' id='edit' title='Pilih Bbm' width='12' height='12' ></a>
				</td>
			</tr>";
			$no++;								
		}
	echo "</table>";
?>