<script type="text/javascript">  
theight=$( document ).height()-50; 
function setdg(){
	$('#dg').datagrid({  	
		height:250,
		toolbar:"#toolbar",
		fitColumns:true,
		rownumbers:true,		
		pagination:false,
		columns:[[  
			{field:'c_name',title:'Nama Kawasan<br>Berikat dan Gudang<br>Berikat',rowspan:4,width:70,align:"center"},  			
			{title:'JUMLAH DOKUMEN',colspan:19,width:1000,align:"center"},
			{title:'NILAI DEVISA / USD ',rowspan:2,colspan:2,width:55,align:"center"},
			{title:'TONAGE / KG',rowspan:2,colspan:2,width:40,align:"center"}, 
			{field:'jml24',title:'Nilai BM<br>( Rp )<br>Jual Ke DPIL',rowspan:4,width:25,align:"center"}
		],[						
			{title:'Pemasukan',colspan:9,width:20,align:"center"},
			{title:'Pengeluaran',colspan:9,width:25,align:'center'},
			{field:'BAP',title:'Berita<br>Acara<br>Pemusnahan',rowspan:3,width:30,align:"center"}	
		],[						
			{title:'BC 2.3',width:20,align:"center"},
			{title:'BC 2.7',colspan:2,width:20,align:"center"},
			{title:'BC 2.6.2',colspan:2,width:20,align:"center"},
			{title:'BC 2.7',colspan:2,width:20,align:"center"},
			{title:'BC 2.4',width:20,align:"center"},
			{title:'BC 4.0',width:20,align:"center"},
			{title:'BC 3.0',colspan:2,width:20,align:"center"},
			{title:'BC 2.7',width:20,align:"center"},
			{title:'BC 2.6.1',colspan:2,width:20,align:"center"},
			{title:'BC 2.7',colspan:2,width:20,align:"center"},
			{title:'BC 2.5',width:20,align:"center"},
			{title:'BC 4.1',width:20,align:"center"},
			{field:'i1',title:'Impor',rowspan:2,width:30,align:"center"},
			{field:'e1',title:'Ekspor',rowspan:2,width:30,align:"center"},
			{field:'i2',title:'Impor',rowspan:2,width:30,align:"center"},
			{field:'e2',title:'Ekspor',rowspan:2,width:30,align:"center"}
		],[						
			{field:'jml1',title:'1',width:20,align:"center"},
			{field:'jml2',title:'2',width:20,align:'center'},
			{field:'jml3',title:'3',width:20,align:"center"},
			{field:'jml4',title:'4',width:20,align:'center'},
			{field:'jml5',title:'5',width:20,align:"center"},
			{field:'jml6',title:'6',width:20,align:'center'},
			{field:'jml7',title:'7',width:20,align:"center"},
			{field:'jml8',title:'8',width:20,align:'center'},
			{field:'jml9',title:'9',width:20,align:"center"},
			{field:'jml10',title:'10',width:20,align:'center'},
			{field:'jml11',title:'11',width:20,align:"center"},
			{field:'jml12',title:'12',width:20,align:'center'},
			{field:'jml13',title:'13',width:20,align:"center"},
			{field:'jml14',title:'14',width:20,align:'center'},
			{field:'jml15',title:'15',width:20,align:"center"},
			{field:'jml16',title:'16',width:20,align:'center'},
			{field:'jml17',title:'17',width:20,align:"center"},
			{field:'jml18',title:'18',width:20,align:'center'}			
		]],
		url: '<?=site_url($this->module.'/grid'); ?>',
		queryParams:{			
			dtdari:$('#dtdari').datebox('getValue'),
			dtsampai:$('#dtsampai').datebox('getValue')
		},
		onBeforeLoad: function (data) {
		  var panel = $(this).datagrid("getPanel");
		  // here is to add the css style
		  panel.css("border","0");
		},
	});
}

function cari(q){
	$('#dg').datagrid({
		url: '<?=site_url($this->module.'/grid'); ?>',
		queryParams:{			
			dtdari:$('#dtdari').datebox('getValue'),
			dtsampai:$('#dtsampai').datebox('getValue')
		}		
	});
}

function toprint(){
	dtdari=$('#dtdari').datebox('getValue');
	dtsampai=$('#dtsampai').datebox('getValue');
	
	var win = window.open("<?=site_url($this->module)?>/cetak?dtdari="+dtdari+"&dtsampai="+dtsampai,"Popup","toolbar=no, location=no,status=no,menubar=no,scrollbars=yes,resizable=no");
	win.print();
}

function toxls(){
	dtdari=$('#dtdari').datebox('getValue');
	dtsampai=$('#dtsampai').datebox('getValue');
	
	openurl("<?=site_url($this->module);?>/excel?dtdari="+dtdari+"&dtsampai="+dtsampai);
}
</script>	