<script type="text/javascript">
$(document).ready(function(){
	$(':input:not([type="submit"])').each(function() {
		$(this).focus(function() {
			$(this).addClass('hilite');
		}).blur(function() {
			$(this).removeClass('hilite');});
	});	
	$("#kode_brg").keyup(function(e){
		var isi = $(e.target).val();
		$(e.target).val(isi.toUpperCase());
	});
	$("#tgl_1").datepicker({
			dateFormat:"dd-mm-yy"
    });
	$("#tgl_2").datepicker({
			dateFormat:"dd-mm-yy"
    });
	$("#cari").click(function(){
		var tgl1 		= $("#tgl_1").val();
		var tgl2 		= $("#tgl_2").val();
		
		var string ="&tgl1="+tgl1+"&tgl2="+tgl2;
		
		if(tgl1.length == 0){
           var error = true;
           alert("Maaf, Anda belum memilih tgl mulai ");
		   return (false);
         }
		 if(tgl2.length == 0){
           var error = true;
           alert("Maaf, Anda belum memilih tgl akhir ");
		   return (false);
         }
		 $("#tampil_data").html('');
		 $.ajax({
			type	: 'POST',
			url		: "<?php echo site_url(); ?>/lap_penjualan_terlaris/lihat",
			data	: string,
			cache	: false,
			success	: function(data){
				var win = $.messager.progress({
				title:'Please waiting',
				msg:'Loading data...'
				});
				setTimeout(function(){
					$.messager.progress('close');
					$("#tampil_data").html(data);
				},2800)
			}		
		});
		return false();	
	});
	
	$("#cetak").click(function(){
		var tgl1 		= $("#tgl_1").val();
		var tgl2 		= $("#tgl_2").val();
		var kunjungan 	= $("#kunjungan").val();
		var instalasi 	= $("#instalasi").val();
		
		var string = tgl1+"/"+tgl2;
		window.open('<?php echo site_url();?>/lap_penjualan_terlaris/cetak/'+string);
		return false();	
	});
	
});	
</script>
<fieldset class="atas">
<table width="100%">
<tr>    
  <td width="141">Tanggal.</td>
  <td width="10">:</td>
  <td width="896"><input type="text" name="tgl_1" id="tgl_1" size="12" maxlength="12" />
    s.d <input type="text" name="tgl_2" id="tgl_2" size="12" maxlength="12" /></td>
</tr>
</table>
</fieldset>
<fieldset class="bawah">
<table width="100%">
<tr>
	<td colspan="3" align="center">
    <button type="button" name="cari" id="cari" class="easyui-linkbutton" data-options="iconCls:'icon-search'">CARI</button>
    <button type="button" name="cetak" id="cetak" class="easyui-linkbutton" data-options="iconCls:'icon-print'">CETAK</button>
    <a href="<?php echo base_url();?>index.php/lap_beli/">
    <button type="button" name="kembali" id="kembali" class="easyui-linkbutton" data-options="iconCls:'icon-back'">KEMBALI</button>
    </a>
    </td>
</tr>
</table>  
</fieldset>
<fieldset>
<div id="tampil_data"></div>
</fieldset>   