<script type="text/javascript">
	$(document).ready(function(){
	$("#detail_posting").load("spv/pengel_bank/tampil_data_post.php");
	$("#form_cari_kode").hide();
		
	$('#form_cari_kode').dialog({
		autoOpen: false,
		modal	: true,
		width: 600,
	});
	
	$('#form_cari_kode').dialog({
		autoOpen: false,
		modal	: true,
		width: 600,
	});
		
	$('#cari_kodeaw').click(function(){
		$('#form_cari_kode').dialog('open');
		no=1;
		
		$.ajax({
			type	: "POST",
			url		: "spv/pengel_bank/tampil_data_aw.php",
			data	: "no="+no,
			timeout	: 3000,
			beforeSend	: function(){
				$("#info_kode").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){				
				$("#info_kode").html(data);
			}
		});
	});
	
	$('#cari_kodeak').click(function(){
		$('#form_cari_kode').dialog('open');
		no=1;
		
		$.ajax({
			type	: "POST",
			url		: "spv/pengel_bank/tampil_data_ak.php",
			data	: "no="+no,
			timeout	: 3000,
			beforeSend	: function(){
				$("#info_kode").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){				
				$("#info_kode").html(data);
			}
		});
	});
	
	$("#postjbk").click(function(){
		posting_bk();
	});
		
	function posting_bk(){
		var	kodeaw = $("#txt_kodeaw").val();
		var	kodeak	= $("#txt_kodeak").val();
		
		var 	error = false;
		if(kodeaw.length == 0){
           var error = true;
			alert("Maaf, Kode BKK awal masih kosong, klik icon di samping Kode BKK awal untuk mencari.");
		   return (false);
        }
		
		if(kodeak.length == 0){
           var error = true;
			alert("Maaf, Kode BKK akhir masih kosong, klik icon di samping Kode BKK akhir untuk mencari.");
		   return (false);
        }
			
		if(error == false){		
		$.ajax({
			type	: "POST",
			url		: "spv/pengel_bank/postbk.php",
			data	: "kodeaw="+kodeaw+
				"&kodeak="+kodeak,
								
			timeout	: 3000,
			beforeSend	: function(){		
				$("#info").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){
				$("#info").html(data);
				$("#txt_kodeaw").val('');
				$("#txt_kodeak").val('');
				$("#detail_posting").load("spv/pengel_bank/tampil_data_post.php");				
			}
		});
		}
		return false;
	}
	
	$("#tutup_post").click(function(){
		document.location='?module=home';
	});
});
</script>

<style type="text/css">
#txt_kode {
	background:#CCC;
}
</style>

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

echo "<table width='100%'>	
	<tr>
		<td>Kode BBK : <input type='text' name='txt_kodeaw' id='txt_kodeaw' size='9' class='input_header' readonly />
			<img src='images/view.png' width='18' height='18' title='Cari Nomor BBK' id='cari_kodeaw'> sampai dengan 
			<input type='text' name='txt_kodeak' id='txt_kodeak' size='9' class='input_header' readonly />
			<img src='images/view.png' width='18' height='18' title='Cari Nomor BBK' id='cari_kodeak'>
		</td>
		<td>
			<button name='postjbk' id='postjbk'>Posting</button>
			<button name='tutup_post' id='tutup_post'>Tutup</button>
		</td>
	</tr>
	</table>
	<div id='detail_posting'></div>";

echo "<div id='form_cari_kode' title='Pencarian Nomor BBK'>		
		<div id='info_kode' align='center'></div>
	</div>";
?>
