<script type="text/javascript">	
$(document).ready(function() {	
	$("#tabs").tabs({selected:0});	
	$("#info_bbm").hide();
	$("#form").load('modul/setor_bbm/form.php');	
	
	cari_tgl();
	
	function cari_tgl(){
		var no = 1;
		$.ajax({
			type	: "POST",
			url		: "modul/report/cari_tanggal.php",
			data	: "no="+no,
			dataType: "json",
			success	: function(data){				
				$("#t_tgl_awal").val(data.tanggal);
				$("#t_tgl_akhir").val(data.tanggal);
				$("#t_tglaw_kd").val(data.tanggal);
				$("#t_tglak_kd").val(data.tanggal);
			}
		});
	}
	
	$("#cari_tgl").click(function(){
		var tgl_awal = $("#t_tgl_awal").val();
		var tgl_akhir = $("#t_tgl_akhir").val();
		var cari	= $("#txt_caribbm").val();
		
		if(tgl_awal.length==''){
			alert('Maaf, Tanggal awal pencarian belum terisi.');
			$("#t_tgl_awal").focus();
			return false;
		}
		if(tgl_akhir.length==''){
			alert('Maaf, Tanggal akhir pencarian belum terisi.');
			$("#t_tgl_akhir").focus();
			return false;
		}
		$("#tampil_data").show();
		$("#tampil_data").load('modul/setor_bbm/tampil_data.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&cari='+cari);
	});
	
	$("#txt_caribbm").keyup(function(){
		var tgl_awal = $("#t_tgl_awal").val();
		var tgl_akhir = $("#t_tgl_akhir").val();
		var cari	= $("#txt_caribbm").val();
		
		if(tgl_awal.length==''){
			alert('Maaf, Tanggal awal pencarian belum terisi.');
			$("#t_tgl_awal").focus();
			return false;
		}
		if(tgl_akhir.length==''){
			alert('Maaf, Tanggal akhir pencarian belum terisi.');
			$("#t_tgl_akhir").focus();
			return false;
		}
		$("#tampil_data").show();
		$("#tampil_data").load('modul/setor_bbm/tampil_data.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&cari='+cari);
	});
	
	$("#tutup_bbm").click(function(){
		document.location='?module=home';
	});
	
	$("#tutup_detail").click(function(){
		$("#pencarian").show();
		$("#info_bbm").hide();
		$("#tampil_detail").hide();
		$("#tampil_data").show();		
	});
	
	$("#cari_kd").click(function(){
		var tgl_awal = $("#t_tglaw_kd").val();
		var tgl_akhir = $("#t_tglak_kd").val();
		var cari	= $("#caribbm_pl").val();
		
		if(tgl_awal.length==''){
			alert('Maaf, Tanggal awal pencarian belum terisi.');
			$("#t_tglaw_kd").focus();
			return false;
		}
		if(tgl_akhir.length==''){
			alert('Maaf, Tanggal akhir pencarian belum terisi.');
			$("#t_tglak_kd").focus();
			return false;
		}
		$("#tampil_data_kd").show();
		$("#tampil_data_kd").load('modul/setor_bbm/tampil_data_kd.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&cari='+cari);
	});
	
	$("#caribbm_pl").keyup(function(){
		var tgl_awal = $("#t_tglaw_kd").val();
		var tgl_akhir = $("#t_tglak_kd").val();
		var cari	= $("#caribbm_pl").val();
		
		if(tgl_awal.length==''){
			alert('Maaf, Tanggal awal pencarian belum terisi.');
			$("#t_tglaw_kd").focus();
			return false;
		}
		if(tgl_akhir.length==''){
			alert('Maaf, Tanggal akhir pencarian belum terisi.');
			$("#t_tglak_kd").focus();
			return false;
		}
		$("#tampil_data_kd").show();
		$("#tampil_data_kd").load('modul/setor_bbm/tampil_data_kd.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&cari='+cari);
	});
	
	$("#tutup_kd").click(function(){
		document.location='?module=home';
	});
});
</script>

<style type="text/css">
#info {
	font-size:12px;
	font-weight:bold;
	color:#F00;
}
</style>

<?php
echo "<div id='tabs'>";
echo "<ul >
	       <li><a href='#form'>INPUT SETORAN BBM</a></li>
	       <li><a href='#data'>DAFTAR SETORAN BBM</a></li>
		   <li><a href='#data_kd'>DAFTAR PENJUALAN KREDIT BBM</a></li>
      </ul>";
	  
echo "<div id='form'></div>";
	
echo "<div id='data'>
		<div id='pencarian'>
			<fieldset>
			<legend>Pencarian data setoran BBM</legend>
			<table width='100%'>
			<tr>
				<td>Setoran tanggal : <input type='date' name='t_tgl_awal' id='t_tgl_awal' size='10'> sampai dengan <input type='date' name='t_tgl_akhir' id='t_tgl_akhir' size='10'></td>
				<td>
					<button name='cari_tgl' id='cari_tgl'>Cari</button>
					<button name='tutup_bbm' id='tutup_bbm'>Tutup</button>
				</td>
				<td>Cari BBM : <input type='text' name='txt_caribbm' id='txt_caribbm' size='30'></td>
			</tr>				
			</table>
			</fieldset>
		</div>
			
		<div id='tampil_data' align='center'></div>
		
		<div id='info_bbm'>
			<table>
			<tr>
				<td>Kode Setoran</td>
				<td>:</td>
				<td><input type='text' name='t_kodesb' id='t_kodesb' size='10' readonly></td>
				<td>Tanggal</td>
				<td>:</td>
				<td><input type='date' name='t_tanggal' id='t_tanggal' size='10' readonly></td>
				<td>Shift</td>
				<td>:</td>
				<td><input type='text' name='t_shift' id='t_shift' size='2' readonly></td>
				<td>No. Teller</td>
				<td>:</td>
				<td><input type='text' name='t_kodetl' id='t_kodetl' size='2' readonly></td>
			</tr>
			
			<tr>
				<td>Jenis BBM</td>
				<td>:</td>
				<td><input type='text' name='t_jenis' id='t_jenis' size='15' readonly></td>
				<td>Petugas</td>
				<td>:</td>
				<td><input type='text' name='t_petugas' id='t_petugas' size='10' readonly></td>
				<td>Teller Awal</td>
				<td>:</td>
				<td><input type='text' name='t_telleraw' id='t_telleraw' size='9' readonly></td>
				<td>Teller Akhir</td>
				<td>:</td>
				<td><input type='text' name='t_tellerak' id='t_tellerak' size='9' readonly></td>
			</tr>
				
			<tr>
				<td>Jumlah Tera</td>
				<td>:</td>
				<td><input type='text' name='t_jmltera' id='t_jmltera' size='3' readonly></td>
				<td>Jumlah Bon</td>
				<td>:</td>
				<td><input type='text' name='t_jmlbon' id='t_jmlbon' size='6' readonly></td>
				<td>Jumlah Tunai</td>
				<td>:</td>
				<td><input type='text' name='t_jmltunai' id='t_jmltunai' size='9' readonly></td>
				<td>Setoran Tunai</td>
				<td>:</td>
				<td><input type='text' name='t_niltunai' id='t_niltunai' size='9' readonly></td>
				<td colspan='12' align='center'>						
					<button name='tutup_detail' id='tutup_detail'>Tutup Detail</button>
				</td>					
			</tr>
			</table>						
		</div>
			
		<div id='tampil_detail' align='center'></div>
	</div>";
	
echo "<div id='data_kd'>
		<div id='pencarian_kd'>
		<fieldset>
			<legend>Pencarian data penjualan kredit BBM</legend>
			<table width='100%'>
			<tr>
				<td>Setoran tanggal : <input type='date' name='t_tglaw_kd' id='t_tglaw_kd' size='10'> sampai dengan <input type='date' name='t_tglak_kd' id='t_tglak_kd' size='10'></td>				
				<td align='right'>
					<button name='cari_kd' id='cari_kd'>Cari</button>					
					<button name='tutup_kd' id='tutup_kd'>Tutup</button>
				</td>
				<td>Cari Pelanggan : <input type='text' name='caribbm_pl' id='caribbm_pl' size='30'></td>
			</tr>				
			</table>
		</fieldset>
		</div>
			
		<div id='tampil_data_kd' align='center'></div>
	</div>";
		
echo "<div id='info' align='center'></div>";

echo "</div>";
?>
