function rpt_keu_wisuda(){ /** ========= COMMON STORES ========================== */ 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: 'nokuiwisuda' } , { name: 'tglkuiwisuda' } , { name: 'nim' } , { name: 'nmmhs' } , { name: 'kdprodi' } , { name: 'nmprodi' } , { name: 'kdfakultas' } , { name: 'nmfakultas' } , { name: 'nmsetbiayawisuda' } , { name: 'idcarabyr' } , { name: 'nmcarabyr' } , { name: 'bayar' } , { name: 'usernameinput' } ] }); var ds_rptkeuwisuda = new Ext.data.GroupingStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'rptkeu_controller/get_keuwisuda', method: 'POST', }), reader: reader, autoLoad: false, groupField:'nmfakultas', //sortInfo:{field:'kdfakultas',direction:'ASC'}, remoteSort: true, listeners: { load: function(store, records, options) { var scash=0, stransfer=0, sviabank=0; ds_rptkeuwisuda.each(function (rec) { if (rec.get('idcarabyr')==1) { scash = scash + parseFloat(rec.get('bayar')); } if (rec.get('idcarabyr')==2) { stransfer = stransfer + parseFloat(rec.get('bayar')); } if (rec.get('idcarabyr')==3) { sviabank = sviabank + parseFloat(rec.get('bayar')); } }); Ext.getCmp("cash").setValue(scash); Ext.getCmp("transfer").setValue(stransfer); Ext.getCmp("viabank").setValue(sviabank); Ext.getCmp("total").setValue(scash + stransfer + sviabank); } } }); var cm_rptkeuwisuda = 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: 150, dataIndex: 'nokuiwisuda', sortable: true }, { header: 'Tgl. Kuitansi', width: 125, dataIndex: 'tglkuiwisuda', sortable: true }, { header: 'NPM', width: 150, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 250, dataIndex: 'nmmhs', sortable: true }, { header: 'Pembayaran', width: 250, dataIndex: 'nmsetbiayawisuda', sortable: true }, { header: 'Cara Bayar', width: 100, dataIndex: 'nmcarabyr', sortable: true }, { header: 'Nominal', width: 100, dataIndex: 'bayar', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: 'User Input', width: 100, dataIndex: 'usernameinput', sortable: true }] }); var carikeuwisuda = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'remote', width: 200 })]; var gp_rptkeuwisuda = new Ext.grid.GridPanel({ id: 'gp.rptkeuwisuda-rpt', plugins: carikeuwisuda, //title: 'Laporan Keuangan DPP', height:508, autoWidth: true, ds: ds_rptkeuwisuda, cm: cm_rptkeuwisuda, 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 fakultas = Ext.getCmp('cb.fakultas').getValue(); var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if(fakultas){ if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); } else { fnPrintkeuwisuda(); } } } }, '-', { xtype: 'button', id: 'btn_excel_perjenisbiaya', iconCls: 'silk-save', text: ' Export To Excel', handler: function() { var fakultas = Ext.getCmp('cb.fakultas').getValue(); var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if(fakultas){ if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); } else { exportkeuwisuda(); } } } },'->'], 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 fpRptkeuwisuda = new Ext.Panel({ id: 'fp.Rptkeuwisuda', layout: 'form', forceFit: true, autoScroll: true, margin: '0 0 10', frame: true, items: [{ xtype: 'fieldset', title: 'Laporan Penerimaan Wisuda', items: [{ xtype: 'fieldset', layout: 'form', 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(); } } } },{ 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();} } },{ xtype: 'compositefield', fieldLabel: 'Periode', 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: {} }] },{ xtype: 'button', text: ' Cari ', iconCls: 'silk-find', id: 'btn_data', width: 3, handler: function() { var fakultas = Ext.getCmp('cb.fakultas').getValue(); var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if(fakultas){ if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); } else { setGridkeuwisuda(); } } } }] }, { xtype: 'panel', layout:'fit', items: [gp_rptkeuwisuda], }] }] }); SET_PAGE_CONTENT(fpRptkeuwisuda); function DateDiff(date1,date2) { return date2.getTime() - date1.getTime(); } function setGridkeuwisuda(){ ds_rptkeuwisuda.reload({ params: { kdfakultas: Ext.getCmp('cb.fakultas').getValue(), kdprodi: Ext.getCmp('cb.prodi').getValue(), tglawal: Ext.getCmp('tglawal').getValue(), tglakhir: Ext.getCmp('tglakhir').getValue(), }, scope : this, callback: function(records, operation, success) { } }); } function fnPrintkeuwisuda(){ var fakultas= Ext.getCmp('cb.fakultas').getValue(); var prodi= Ext.getCmp('cb.prodi').getValue(); var tglawal= Ext.getCmp('tglawal').getValue().format('Y-m-d'); var tglakhir= Ext.getCmp('tglakhir').getValue().format('Y-m-d'); var win = window.open(); win.location.reload(); win.location = BASE_URL + 'rpt/rpt_keu_wisuda/get_keu_wisuda/' +fakultas+'/'+prodi+'/'+tglawal+'/'+tglakhir; } function exportkeuwisuda(){ var fakultas= Ext.getCmp('cb.fakultas').getValue(); var prodi= Ext.getCmp('cb.prodi').getValue(); var tglawal= Ext.getCmp('tglawal').getValue().format('Y-m-d'); var tglakhir= Ext.getCmp('tglakhir').getValue().format('Y-m-d'); window.location = BASE_URL + 'rptkeu_controller/exportkeuwisuda/' +fakultas+'/'+prodi+'/'+tglawal+'/'+tglakhir; } }