<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){				
				$("#txt_tglawal").val(data.tanggal);
				$("#txt_tglakhir").val(data.tanggal);
			}
		});
	}

	$("#cari_data").click(function(){
		var tglawal = $("#txt_tglawal").val();
		var tglakhir= $("#txt_tglakhir").val();
		var kodecab = $("#t_kodecab").val();
		$("#data_detail").load('modul/report/tampil_cashflow.php?tglawal='+tglawal+'&tglakhir='+tglakhir+'&kodecab='+kodecab);
	});

	$("#cetak").click(function(){
		var tglawal = $("#txt_tglawal").val();
		var tglakhir= $("#txt_tglakhir").val();
		var kodecab = $("#t_kodecab").val();
		window.location.href='modul/laporan/cash_flow.php?tglawal='+tglawal+'&tglakhir='+tglakhir+'&kodecab='+kodecab;
	});
	
	$("#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'>";
echo "<div id='form' align='center' style='background-color:white'>
	<table align='center'>
		<tr>
			<td style='font-size:16px'><b>LAPORAN ARUS KAS</b></td>
		</tr>
	</table>

	<fieldset>
		<legend style='font-size:14px'>Filter Data </legend>
		<table width='100%'>
			<tr>
			    <td style='font-size:15px'>Cabang : <select id='t_kodecab'>";
				        $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 style='font-size:15px'>Periode : <input type='date' id='txt_tglawal' size='10'> sampai dengan <input type='date' id='txt_tglakhir' size='10'></td>
				<td align='right'>
					<button name='cari_data' id='cari_data'>Cari Data</button>	
					<button name='cetak' id='cetak'>Cetak</button>
					<button name='tutup' id='tutup'>Tutup</button>
				</td>
			</tr>
		</table>
	</fieldset>
	<div id='data_detail' align='center'></div>
</div>";
	
echo "</div>";
?>