function pRptKeuPerJbiaya(){ /** ========= COMMON STORES ========================== */ var ds_jbiaya = store_jbiaya(); var ds_fakultas_jbiaya = store_fakultas_jbiaya(); var ds_prodi_jbiaya = store_prodi_jbiaya(); var reader = new Ext.data.JsonReader({ root:'data', idProperty: '', totalProperty: 'results', remoteGroup: true, fields: [ { name: 'nokuitansi' } , { name: 'tglkuitansi' } , { name: 'nim' } , { name: 'nmmhs' } , { name: 'kdprodi' } , { name: 'nmprodi' } , { name: 'kdfakultas' } , { name: 'nmfakultas' } , { name: 'kdjnsbiaya' } , { name: 'nmcarabyr' } , { name: 'jmlbayar' } , { name: 'catatan' } , { name: 'useridinput' } ] }); var ds_rptKeuPerJbiaya = new Ext.data.GroupingStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'rptkeu_controller/get_KeuPerJbiaya', method: 'POST', }), reader: reader, groupField:'nmfakultas', //sortInfo:{field:'kdfakultas',direction:'ASC'}, remoteSort: true, }); var cm_rptKeuPerJbiaya = new Ext.grid.ColumnModel({ columns: [new Ext.grid.RowNumberer({width: 35}), { header: 'Fakultas', width: 200, dataIndex: 'nmfakultas', hidden:true },{ header: 'Fakultas/Program Studi', width: 270, dataIndex: 'nmprodi', hidden:false, sortable: true }, { header: 'No. Kuitansi', width: 140, dataIndex: 'nokuitansi', sortable: true }, { header: 'Tgl. Kuitansi', width: 125, dataIndex: 'tglkuitansi', sortable: true }, { header: 'NPM', width: 150, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 200, dataIndex: 'nmmhs', sortable: true }, { header: 'Jenis Biaya', width: 100, dataIndex: 'kdjnsbiaya', sortable: true }, { header: 'Cara Bayar', width: 100, dataIndex: 'nmcarabyr', sortable: true }, { header: 'Nominal', width: 100, dataIndex: 'jmlbayar', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: 'Keterangan', width: 150, dataIndex: 'catatan', sortable: true }, { header: 'User Input', width: 100, dataIndex: 'useridinput', sortable: true }] }); var cari_data_nya1 = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var gp_rptKeuPerJbiaya = new Ext.grid.GridPanel({ id: 'gp.keuperjbiaya-rpt', plugins: cari_data_nya1, //title: 'Laporan Keuangan DPP', height:508, autoWidth: true, ds: ds_rptKeuPerJbiaya, cm: cm_rptKeuPerJbiaya, sm: new Ext.grid.RowSelectionModel({ singleSelect: true}), view: new Ext.grid.GroupingView({ forceFit:true, groupTextTpl: '{text} ({[values.rs.length]})',// {["Prodi"]})', enableGroupingMenu: false, // don't show a grouping menu enableNoGroups: false, // don't let the user ungroup hideGroupedColumn: false, // don't show the column that is being used to create the heading showGroupName: false, // don't show the field name with the group heading startCollapsed: false // the groups start closed/no }), forceFit: true, //autoHeight: true, //250, //width: 720, tbar: [{hidden:false, text: 'Print', iconCls: 'silk-printer', handler: function(){ var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); return false } fnPrintKeuPerJbiaya(); } }, '-', { xtype: 'button', id: 'btn_excel_perjenisbiaya', iconCls: 'silk-save', text: ' Export To Excel', handler: function() { exportperjenisbiaya(); } },'->'], bbar:[{ xtype: 'fieldset', title: 'Summary', items: [{ xtype: 'fieldset', title: 'Cara Bayar', width: 300, defaults: { xtype: 'numericfield', decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.' }, items: [{ fieldLabel: 'Cash/Tunai', id: 'cash', readOnly: true, width: 150 }, { fieldLabel: 'Transfer', id: 'transfer', readOnly: true, width: 150 }, { fieldLabel: 'Via Bank', id: 'viabank', readOnly: true, width: 150 }, { fieldLabel: 'Total', labelStyle: 'font-weight: bold;', style: 'font-weight: bold;text-align: right;', id: 'total', readOnly: true, width: 150 }] }] }], forceFit: true, //autoHeight: true, autoScroll: true, autoSizeColumns: true, enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, layout: 'anchor', }); //THE FORM PANEL var fpRptKeuPerJbiaya = new Ext.Panel({ id: 'fp.RptKeuPerJbiaya', //title:'Laporan Keuangan DPP', layout: 'form', forceFit: true, autoScroll: true, //width:500, height:400, margin: '0 0 10', frame: true, items: [{ xtype: 'fieldset', title: 'Laporan Keuangan Per Jenis Biaya', //flex: 1, items: [{ //////////////////// xtype: 'fieldset', layout: 'column', items: [ { layout: 'form', columnWidth: 5, defaults: { labelWidth: 50, labelAlign: 'left'}, items: [{ xtype: 'combo', emptyText:'Pilih...', id: 'cb.jbiaya', fieldLabel: 'Jenis Biaya', store: ds_jbiaya, valueField: 'idjnsbiaya', displayField: 'kdjnsbiaya', triggerAction: 'all',editable: false, hidden:false, //width:120, forceSelection: true, submitValue: true, mode: 'local', listeners:{ scope: this, 'select': function(){ }//setGridDPKdet();} } }] }, { layout: 'form', columnWidth: 5, defaults: { labelWidth: 50, labelAlign: 'left'}, items: [{ xtype: 'combo', emptyText:'Pilih...', id: 'cb.fakultas', fieldLabel: 'Fakultas', store: ds_fakultas_jbiaya, valueField: 'kdfakultas', displayField: 'nmfakultas', triggerAction: 'all',editable: false, hidden:false, width:300, forceSelection: true, submitValue: true, mode: 'local', listeners:{ select: function(){ var kdfak = Ext.getCmp('cb.fakultas').getValue(); if(kdfak){ if(kdfak == 99){ Ext.getCmp('cb.prodi').disable(); Ext.getCmp('cb.prodi').setValue(''); }else{ Ext.getCmp('cb.prodi').enable(); Ext.getCmp('cb.prodi').setValue(9999); } ds_prodi_jbiaya.reload({ params: { kdfakultas: kdfak } }); }else{ Ext.getCmp('cb.prodi').disable(); } } } }] }, { layout: 'form', columnWidth: 5, defaults: { labelWidth: 50, labelAlign: 'left'}, items: [{ xtype: 'combo', emptyText:'Pilih...', id: 'cb.prodi', fieldLabel: 'Prodi', store: ds_prodi_jbiaya, valueField: 'kdprodi', displayField: 'nmprodi', triggerAction: 'all',editable: false, disabled:true, width:300, forceSelection: true, submitValue: true, mode: 'local', listeners:{ scope: this, 'select': function(){ }//setGridDPKdet();} } }] }, { layout: 'form', columnWidth: 0.30, defaults: { labelWidth: 50, labelAlign: 'left'}, items: [{ xtype: 'datefield', fieldLabel: 'Periode', name: 'tglawal', id: 'tglawal', value: new Date().format('d/m/Y'), format: "d/m/Y", width: 150, listeners: {} }] }, { xtype: 'label', text: ' s/d ', id: 'sd', width: 30 }, { xtype: 'datefield', fieldLabel: '', name: 'tglakhir', id: 'tglakhir', value: new Date().format('d/m/Y'), format: "d/m/Y", width: 150, listeners: {} }, { layout: 'form', columnWidth: 3, defaults: { labelWidth: 50, labelAlign: 'left'}, items: [{ xtype: 'button', text: ' Cari ', iconCls: 'silk-find', id: 'btn_data', width: 3, handler: function() { var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); var jbiaya = Ext.getCmp('cb.jbiaya').getValue(); var fakultas = Ext.getCmp('cb.fakultas').getValue(); var prodi = Ext.getCmp('cb.prodi').getValue(); var tglawal = Ext.getCmp('tglawal').getValue(); var tglakhir = Ext.getCmp('tglakhir').getValue(); if(jbiaya=='' || fakultas=='' || tglawal=='' || tglakhir==''){ Ext.Msg.alert("Info", "Isi parameter"); return false }else if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); return false }else if(jbiaya !='' && fakultas !='' && tglawal !='' && tglakhir !='' && interval >= 0){ setGridKeuPerJbiaya(); } } }] } ] ///////////////////// }, { xtype: 'panel', layout:'fit', items: [gp_rptKeuPerJbiaya], }] }] }); SET_PAGE_CONTENT(fpRptKeuPerJbiaya); function fnPrintKeuPerJbiaya(){ var tgl1 = Ext.getCmp('tglawal').getValue().format('Y-m-d'); var tgl2 = Ext.getCmp('tglakhir').getValue().format('Y-m-d'); var jbiaya = Ext.getCmp('cb.jbiaya').getValue(); var fakultas = Ext.getCmp('cb.fakultas').getValue(); var prodi = Ext.getCmp('cb.prodi').getValue(); var parsing = ''; parsing = parsing + '1' + 'istra' ; parsing = parsing + '2' + 'istra' ; parsing = parsing + '3' + 'istra' ; parsing = parsing + tgl1 + 'istra' ; parsing = parsing + tgl2 + 'istra' ; parsing = parsing + jbiaya + 'istra' ; parsing = parsing + fakultas + 'istra' ; parsing = parsing + prodi + 'istra' ; var win = window.open(); win.location.reload(); win.location = BASE_URL + 'rpt/rpt_keu_per_jbiaya/get_keu_per_jbiaya/'+parsing; } function setGridKeuPerJbiaya(){ //debug//RH.warning(RH.getCompValue('cb.stsmt-dpp'));return; ds_rptKeuPerJbiaya.reload({ params: { jbiaya: Ext.getCmp('cb.jbiaya').getValue(), fakultas: Ext.getCmp('cb.fakultas').getValue(), prodi: Ext.getCmp('cb.prodi').getValue(), tglawal: Ext.getCmp('tglawal').getValue(), tglakhir: Ext.getCmp('tglakhir').getValue(), } }); Ext.Ajax.request({ url: BASE_URL + 'rptkeu_controller/get_sum_KeuPerJbiaya', method: 'POST', params:{ carabayar1:'1', carabayar2:'2', carabayar3:'3', tglawal: Ext.getCmp('tglawal').getValue(), tglakhir: Ext.getCmp('tglakhir').getValue(), jbiaya: Ext.getCmp('cb.jbiaya').getValue(), fakultas: Ext.getCmp('cb.fakultas').getValue(), prodi: Ext.getCmp('cb.prodi').getValue() }, success: function(response) { var arrjson = Ext.decode(response.responseText); Ext.getCmp("cash").setValue(arrjson.sum1); Ext.getCmp("transfer").setValue(arrjson.sum2); Ext.getCmp("viabank").setValue(arrjson.sum3); Ext.getCmp("total").setValue(arrjson.sumall); } }); } function DateDiff(date1,date2) { return date2.getTime() - date1.getTime(); } //excel function exportperjenisbiaya(){ var tablename = 'excel_keu_perjenis_biaya'; var waitmsgexport = Ext.MessageBox.wait('Exporting Data...', 'Info'); var jbiaya= Ext.getCmp('cb.jbiaya').getValue(); var fakultas= Ext.getCmp('cb.fakultas').getValue(); if(jbiaya && fakultas){ Ext.Ajax.request({ url: BASE_URL + 'rptkeu_controller/get_KeuPerJbiayaExcel', params: { jbiaya: Ext.getCmp('cb.jbiaya').getValue(), fakultas: Ext.getCmp('cb.fakultas').getValue(), prodi: Ext.getCmp('cb.prodi').getValue(), tglawal: Ext.getCmp('tglawal').getValue(), tglakhir: Ext.getCmp('tglakhir').getValue(), }, success: function() { waitmsgexport.hide(); window.location = BASE_URL + 'rptkeu_controller/export_excel/'+tablename; }, failure: function() { waitmsgexport.hide(); Ext.MessageBox.alert("Info", "Export Data Gagal"); } }); }else{ Ext.MessageBox.alert("Info", "Jenis Biaya atau Fakultas kosong"); } } }