<script type="text/javascript">	
$(document).ready(function() {	
	$("#tabs").tabs({selected:0});	
	
	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_tglawal").val(data.tanggal);
				$("#t_tglakhir").val(data.tanggal);
			}
		});
	}
	
	$("#cari_mbr").click(function(){
		var tgl_awal	= $("#t_tglawal").val();
		var tgl_akhir 	= $("#t_tglakhir").val();
		var gdtjn  		= $("#t_gdtjn").val();
		var cari   		= $("#txt_carist").val();

		$.ajax({
			type	: "GET",
			url		: "md_gdg/mutasi_br/tampil_daftar.php",
			data	: "cari="+cari+
				"&gdtjn="+gdtjn+
				"&tgl_awal="+tgl_awal+
				"&tgl_akhir="+tgl_akhir,
			success	: function(data){
				$("#tampil_data").html(data);
			}
		});
	});
	
	$("#txt_carist").keyup(function(){
		var tgl_awal	= $("#t_tglawal").val();
		var tgl_akhir 	= $("#t_tglakhir").val();
		var gdtjn  		= $("#t_gdtjn").val();
		var cari   		= $("#txt_carist").val();
		
		$.ajax({
			type	: "GET",
			url		: "md_gdg/mutasi_br/tampil_daftar.php",
			data	: "cari="+cari+
				"&gdtjn="+gdtjn+
				"&tgl_awal="+tgl_awal+
				"&tgl_akhir="+tgl_akhir,
			success	: function(data){
				$("#tampil_data").html(data);
			}
		});
	});
	
	$("#cetak_mbr").click(function(){
		var tgl_awal = $("#t_tglawal").val();
		var tgl_akhir= $("#t_tglakhir").val();
		var gdtjn  	 = $("#t_gdtjn").val();
		var cari   	 = $("#txt_carist").val();
		
		window.location.href='modul/laporan/daftar_mbgd.php?gdtjn='+gdtjn+'&tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&cari='+cari;
	});
	
	$("#tutup").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='#data'>DAFTAR PEMINDAHAN BARANG</a></li>
      </ul>";
	  
echo "<div id='form'></div>";

echo "<div id='data'>
        <div id='pencarian'>
			<table width='100%'>
				<tr>
					<td>Pemindahan tanggal : <input type='date' id='t_tglawal' size='10'> Sampai dengan <input type='date' id='t_tglakhir' size='10'></td>
					<td>Gudang Tujuan :  <select id='t_gdtjn'>
					        <option value=''></option>";
							$sql=mysql_query("SELECT * FROM cabang WHERE 1 ORDER BY kode_cab");
				            while($r=mysql_fetch_array($sql)){
				                $kodecab=$r[kode_cab];
				                echo "<option value='$kodecab'>$r[nama_cab]</option>";
				            }
			            echo "</select>
                   	</td>
					<td>Cari barang : <input type='text' id='txt_carist' size='30'></td>
				</tr>
			</table>
			<table width='100%'>
				<tr>
					<td align='center'>
						<button id='cari_mbr'>Cari</button>
						<button id='cetak_mbr'>Cetak</button>
						<button id='tutup'>Tutup</button>
					</td>
				</tr>
			</table>
		</div>
		<div id='tampil_data' align='center'></div>
    </div>";
    
echo "<div id='info' align='center'></div>";
echo "</div>";
?>
