<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");
            }
        );
    });
});	

	function pilih(ID){
		var kode = ID;	
		$.ajax({
			type	: "POST",
			url	: "spv/outstan_do/edit.php",
			data	: "kode="+kode,
			dataType: "json",
			success	: function(data){
				$("#txt_kodedo").val(kode);
				$("#txt_jenis").val(data.jenis);
				$("#txt_jmlliter").val(data.jmlliter);
				$("#txt_hgbeli").val(data.hgbeli);
				$("#txt_jumlah").val(data.jumlah);
				$("#form_cari_do").dialog('close');				
				$("#txt_jmlliter").focus();
			}
		});		
	}
</script>

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

echo "<table id='theList' width='100%'>
		<tr>			
			<th>Kode Penebusan</th>
			<th>Tanggal</th>
			<th>Nomor Bukti</th>
			<th>Jenis BBM</th>
			<th>Jumlah Liter</th>
			<th>Harga Beli</th>
			<th>Jumlah Harga</th>
			<th>Pilih</th>
		</tr>";
		
		$query = "SELECT * FROM stock_do WHERE !(jml_liter='0') ORDER BY tanggal";
		
		$sql= mysql_query($query);
						
		while($r_data=mysql_fetch_array($sql)){
			echo "<tr>					
					<td>$r_data[kode_do]</td>
					<td align='center'>".jin_date_str($r_data[tanggal])."</td>
					<td>$r_data[nobukti]</td>
					<td>$r_data[jenis]</td>
					<td align='right'>$r_data[jml_liter]</td>
					<td align='right'>".number_format($r_data[hg_beli],2)."</td>
					<td align='right'>".number_format($r_data[jumlah],0)."</td>
					<td align='center'>
						<a href='javascript:void(0)' onClick=\"pilih('$r_data[kode_do]')\">
						<img src='icon/thumb_up.png' border='0' id='edit' title='Pilih DO' width='12' height='12' ></a>					
					</td>
				</tr>";			
		}

	echo "</table>";
?>
