<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);
				$("#t_user").val(data.user);
			}
		});
	}
	
	$("#cari").click(function(){
		var tgl_awal  = $("#t_tgl_awal").val();
		var tgl_akhir = $("#t_tgl_akhir").val();
		var user      = $("#t_user").val();
		
		$("#data_pj").show();
		$("#data_pj").load('modul/report/tampil_rekap_pjst.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&user='+user);
	});
	
	$("#refresh").click(function() {
		window.location.reload();		
	});
	
	$("#cetak").click(function() {
		var tgl_awal  = $("#t_tgl_awal").val();
		var tgl_akhir = $("#t_tgl_akhir").val();
		var user      = $("#t_user").val();
		
		window.location.href='modul/laporan/rekap_pjst.php?tgl_awal='+tgl_awal+'&tgl_akhir='+tgl_akhir+'&user='+user;
	});
	
	$("#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 span='12' style='background-color:white'>";
echo "<div id='form' align='center'><h2>REKAP PENJUALAN BARANG DAGANGAN<h2></div>";
echo "<div id='filter' align='left'>
	<fieldset>
		<legend>Filter Data </legend>
		<table width='100%' style='font:14px Verdana'>
			<tr>
				<input type='text' id='t_user' class='input_header' hidden/>
				<td>Tanggal : <input type='date' id='t_tgl_awal' size='10'> sampai dengan <input type='date' id='t_tgl_akhir' size='10'></td>				
			</tr>
		</table>
		<table width='100%' style='font:14px Verdana'>
			<tr>
				<td align='center'>
					<button name='cari' id='cari'>Cari</button>
					<button name='cetak' id='cetak'>Cetak</button>
					<button name='refresh' id='refresh'>Refresh</button>
					<button name='tutup' 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>";
?>
