<script type="text/javascript">   
function setdg(){
theight=window.parent.$('#content_title').height()-30;	
	
	$('#dg').datagrid({  	
		title:"",
		style:{borderWidth:10},	
		toolbar:"#toolbar",
		fit:true,
		fitColumns:true,
		singleSelect:true,
		rownumbers:true,
		pagination:true,
		columns:[[
			{field:'trans_no',title:'No. Transaksi',width:80},
			{field:'dmy',title:'Tanggal',width:60,align:'center'},
			{field:'tipe',title:'Tipe',width:60},
			{field:'buspart',title:'Pengirim/Penerima',width:60,align:'center'},
			{field:'line',title:'Line',width:60,align:'center'},
			{field:'fdebit',title:'Pemasukan',width:70,align:'right'},
			{field:'fcredit',title:'Pengeluaran',width:70,align:'right'},
			{field:'saldo',title:'Saldo',width:70,align:'right'}
		]],
		onBeforeLoad: function (data) {
		  var panel = $(this).datagrid("getPanel");
		  // here is to add the css style
		  panel.css("border","0");
		}
	});
}

function aksi(cmd){
	dtdari=$('#dtdari').datebox('getValue');
	dtsampai=$('#dtsampai').datebox('getValue');
	kd_cmpy=$('#kd_cmpy').combobox('getValue');
	q=$('#KdBarang').combogrid('getValue');
	NmBarang=$('#KdBarang').combogrid('getText');
	line=$('#line').textbox('getValue');
	
	if (q!="" && dtdari!="" && dtsampai!="" && kd_cmpy!=""){
		if (cmd=='cari'){
			$('#dg').datagrid({
				url: '<?=site_url($this->modul)?>/grid',
				queryParams:{			
					dtdari:dtdari,
					dtsampai:dtsampai,
					kd_cmpy:kd_cmpy,
					q:q,
					NmBarang:NmBarang,
					line:line
				}		
			});		
		} else if (cmd=='print'){
			var win = window.open("<?=site_url($this->modul)?>/aksi/cetak?dtdari="+dtdari+"&dtsampai="+dtsampai+"&kd_cmpy="+kd_cmpy+"&q="+q+"&NmBarang="+NmBarang+"&line="+line);
			win.print();
		} else if (cmd=='xls'){
			openurl("<?=site_url($this->modul)?>/aksi/excel?dtdari="+dtdari+"&dtsampai="+dtsampai+"&kd_cmpy="+kd_cmpy+"&q="+q+"&NmBarang="+NmBarang+"&line="+line);
		}
			
	}
	
	
}

</script>