<script type="text/javascript">	
$(document).ready(function(){
	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);				
			}
		});
	}
	
	$('#form_cari_plg').dialog({
		autoOpen: false,
		modal	: true,
		width: 700,
	});
		
	$('#x_namaplg').keyup(function(){
		$('#form_cari_plg').dialog('open');
		$("#info_pelanggan").load('modul/report/tampil_data_plg.php');
		$("#txt_cariplg").focus();
	});
	
	$("#txt_cariplg").keyup(function(){
		$("#info_pelanggan").show();
		var cari= $("#txt_cariplg").val();
		
		$.ajax({
			type	: "POST",
			url		: "modul/report/tampil_data_plg.php",
			data	: "cari="+cari,
			timeout	: 3000,
			beforeSend	: function(){		
				$("#info_pelanggan").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){
				$("#info_pelanggan").html(data);
			}
		});
	});
	
	$("#cari").click(function(){
		var tgl_awal = $("#t_tgl_awal").val();
		var tgl_akhir= $("#t_tgl_akhir").val();
		var kodeplg  = $("#x_kodeplg").val();
		
		$("#data_pj").show();
		$("#data_pj").load('modul/report/tampil_data_pjimp.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&kodeplg='+kodeplg);
	});
	
	$("#refresh").click(function() {
		window.location.reload();		
	});
	
	$("#cetak").click(function() {
		var tgl_awal = $("#t_tgl_awal").val();
		var tgl_akhir= $("#t_tgl_akhir").val();
		var kodeplg  = $("#x_kodeplg").val();
		var namaplg  = $("#x_namaplg").val();
	
		window.location.href='modul/laporan/daftar_pjimp.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&kodeplg='+kodeplg+'&namaplg='+namaplg;
	});
	
	$("#tutup").click(function(){
		document.location='?module=home';
	});
	
});
</script>
<style type="text/css">
#info {
	font-size:12px;
	font-weight:bold;
	color:#F00;
}
</style>

<?php
include '../../inc/inc.koneksi.php';
	
echo "<div span='12' style='background-color:white'>";
echo "<div id='form' align='center'><h3>DAFTAR IMPORT SOP<h3></div>";
echo "<div id='filter' align='left'>
	<fieldset>
		<legend>Filter Data </legend>
		<table width='100%'>
			<tr>
				<td>Tanggal : <input type='date' id='t_tgl_awal' size='10'> Sampai dengan <input type='date' id='t_tgl_akhir' size='10'></td>
				<td>Pelanggan : <input type='text' id='x_namaplg' size='25' class='input_header'> <input type='text' id='x_kodeplg' size='3' readonly/></td>
				<td>
					<button id='cari'>Cari</button>
					<button id='cetak'>Cetak</button>
					<button id='refresh'>Refresh</button>					
					<button id='tutup'>Tutup</button>	
				</td>
			</tr>
		</table>
	</fieldset>
	</div><br>";
	
echo "<div id='data_pj' align='center' style='overflow-x: auto;height: 400px;scroll-behavior: smooth'></div>";

echo "<div id='form_cari_plg' title='Pencarian Data Pelanggan'>
		<table width='100%'>
			<tr>
				<td>Cari Pelanggan : <input type='text' name='txt_cariplg' id='txt_cariplg' size='30'></td>
			</tr>
		</table>
		<div id='info_pelanggan' align='center'></div>
	</div>";
	
echo "</div>";
?>