function l_kaspmb() { var nopmbx, cmbpengujix = ''; var prodiall; var ds_thnakademik2 = store_thnakademik2(); var ds_setbiayapmb = store_setbiayapmb(); var ds_jmlbiaya = store_jmlbiaya(); var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'laporan/c_lkaspmb/grid', method: 'POST' }), params: { start: 0, limit: 5 }, root: 'data', totalProperty: 'results', autoLoad: false, fields: [ /* { name: "nopmb", mapping: "nopmb" }, */ { name: "nokuitansipmb", mapping: "nokuitansipmb" }, { name: "tglkuitansipmb", mapping: "tglkuitansipmb" }, { name: "nama", mapping: "nama" }, { name: "kdjk", mapping: "kdjk" }, { name: "nmstmskmhs", mapping: "nmstmskmhs" }, { name: "nmfakultas", mapping: "nmfakultas" }, { name: "nmprodi", mapping: "nmprodi" }, { name: "nominal", mapping: "nominal" }, { name: "nmcarabyr", mapping: "nmcarabyr" }, { name: "namapembayar", mapping: "namapembayar" }], listeners: { load: function(store, records, options) { var jumlahkaspmb = 0; ds_grid.each(function (rec) { jumlahkaspmb += parseFloat(rec.get('nominal')); }); Ext.getCmp('totdata').setValue(ds_grid.getCount()); Ext.getCmp('totkaspmb').setValue(jumlahkaspmb); } } }); var cm = new Ext.grid.ColumnModel({ // specify any defaults for each column defaults: { sortable: true // columns are not sortable by default }, columns: [new Ext.grid.RowNumberer({width: 40}), /* { header: 'No. PMB', width: 100, dataIndex: 'nopmb', sortable: true }, */ { header: 'No. Kuitansi PMB', width: 150, dataIndex: 'nokuitansipmb', sortable: true },{ header: 'Tanggal Daftar', width: 100, dataIndex: 'tglkuitansipmb', sortable: true },{ header: 'Nama Pendaftar', width: 170, dataIndex: 'nama', sortable: true }, { header: '(L/P)', width: 50, dataIndex: 'kdjk', sortable: true },{ header: 'Status Pendaftar', width: 110, dataIndex: 'nmstmskmhs', sortable: true }, { header: 'Fakultas', width: 150, dataIndex: 'nmfakultas', sortable: true }, { header: 'Program Studi', width: 150, dataIndex: 'nmprodi', sortable: true }, { header: 'Cara Bayar', width: 110, dataIndex: 'nmcarabyr', sortable: true }, { header: 'Nominal', width: 110, dataIndex: 'nominal', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: 'Nama Pembayar', width: 170, dataIndex: 'namapembayar', sortable: true }] }); var vw = new Ext.grid.GridView({ emptyText: '< No Data To Display >' }); var sm_nya = new Ext.grid.CheckboxSelectionModel({ listeners: { // rowselect: select_action, // rowdeselect: deselect_action } }); var cari_data = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'remote', width: 200 })]; var paging = new Ext.PagingToolbar({ pageSize: 1000, store: ds_grid, displayInfo: true, displayMsg: 'Data Kas PMB Dari {0} - {1}', emptyMsg: 'Data Kas PMB Belum Dipilih.' }); var grid_nya = new Ext.grid.EditorGridPanel({ store: ds_grid, frame: true, //width: 1140, height: 500, //plugins: cari_data, id: 'grid_det', // autoWidth:true, // autoSizeColumns:true, // enableColumnResize: true, // enableColumnHide: false, // enableColumnMove: false, // enableHdMenu: false, // columnLines: true, loadMask: true, buttonAlign: 'left', defaults: { anchor: '-10' }, forceFit: true, tbar: [{ xtype: 'buttongroup', title: 'Pencarian', columns: 5, width: 800, defaults: { scale: 'small' }, items: [{ xtype:'checkbox', boxLabel: '', name: 'cbakademik', id: 'cbakademik' },{ text: 'Tahun Akademik - Semester' }, { xtype: 'combo', store: ds_thnakademik2, name: 'thnakademik', id: 'thnakademik', triggerAction: 'all', editable: false, valueField: 'kdstsemester', displayField: 'nmthnakademik', forceSelection: true, submitValue: true, hiddenName: 'h_thnkademik', listeners: {}, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 150, listeners:{ select: function(cb, rec) { Ext.getCmp('jmlbiaya').setValue(); ds_jmlbiaya.reload({ params: { kdstsemester: cb.getValue(), }, callback: function(results){ Ext.getCmp('jmlbiaya').enable(); Ext.getCmp('cbjmlbiaya').enable(); } }); } } }, { xtype: 'label', text: '' }, { xtype: 'label', text: '' }, { xtype:'checkbox', boxLabel: '', disabled: true, name: 'cbjmlbiaya', id: 'cbjmlbiaya' }, { text: 'Jumlah Biaya' }, { xtype: 'combo', store: ds_jmlbiaya, name: 'jmlbiaya', id: 'jmlbiaya', triggerAction: 'all', editable: false, valueField: 'nominal', displayField: 'nominalrender', forceSelection: true, submitValue: true, hiddenName: 'h_thnkademik', listeners: {}, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 150, disabled: true, },{ xtype: 'label', text: '' },{ xtype: 'label', text: '' }, { xtype:'checkbox', boxLabel: '', name: 'cbperiode', id: 'cbperiode' }, { text: 'Periode' }, { xtype: 'datefield', fieldLabel: 'Tanggal Awal', name: 'tglawal', id: 'tglawal', value: new Date().format('d/m/Y'), format: "d/m/Y", width: 150, listeners: {} }, { text: 's/d' }, { xtype: 'datefield', fieldLabel: 'Tanggal Akhir', 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 interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if (!Ext.getCmp('cbjmlbiaya').getValue() && !Ext.getCmp('cbakademik').getValue() && !Ext.getCmp('cbperiode').getValue()){ Ext.MessageBox.alert("Informasi", "Silahkan Pilih Pencarian"); return; } if (Ext.getCmp('cbperiode').getValue()==true) { if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); return false } } ds_grid.setBaseParam('cbjmlbiaya', Ext.getCmp('cbjmlbiaya').getValue()); ds_grid.setBaseParam('cbakademik', Ext.getCmp('cbakademik').getValue()); ds_grid.setBaseParam('cbperiode', Ext.getCmp('cbperiode').getValue()); ds_grid.setBaseParam('jmlbiaya', Ext.getCmp('jmlbiaya').getValue()); ds_grid.setBaseParam('thnakademik', Ext.getCmp('thnakademik').getValue()); ds_grid.setBaseParam('tglawal', Ext.getCmp('tglawal').getValue()); ds_grid.setBaseParam('tglakhir', Ext.getCmp('tglakhir').getValue()); ds_grid.load(); } }] }, { xtype: 'button', text: ' Cetak ', iconCls: 'silk-printer', id: 'btn_cetak', width: 3, handler: function() { var parsing = ''; var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if (!Ext.getCmp('cbjmlbiaya').getValue() && !Ext.getCmp('cbakademik').getValue() && !Ext.getCmp('cbperiode').getValue()){ Ext.MessageBox.alert("Informasi", "Silahkan Pilih Pencarian"); return; } if (Ext.getCmp('cbperiode').getValue()==true) { if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); return false } } parsing = parsing + Ext.getCmp('cbakademik').getValue() + 'istra'; parsing = parsing + Ext.getCmp('cbperiode').getValue() + 'istra'; parsing = parsing + Ext.getCmp('cbjmlbiaya').getValue() + 'istra'; parsing = parsing + Ext.getCmp('thnakademik').getValue() + 'istra'; parsing = parsing + Ext.getCmp('tglawal').getValue().format('Y-m-d') + 'istra'; parsing = parsing + Ext.getCmp('tglakhir').getValue().format('Y-m-d') + 'istra'; parsing = parsing + Ext.getCmp('totkaspmb').getValue() + 'istra'; parsing = parsing + Ext.getCmp('jmlbiaya').getValue() + 'istra'; var win = window.open(); win.location.reload(); win.location = BASE_URL + 'print/print_topdf/plkaspmb/'+parsing; } },'-', { xtype: 'button', id: 'btn_excel_lap_kas_pmb', iconCls: 'silk-save', text: ' Export To Excel', handler: function() { var interval =DateDiff(Ext.getCmp('tglawal').getValue(), Ext.getCmp('tglakhir').getValue()); if (!Ext.getCmp('cbjmlbiaya').getValue() && !Ext.getCmp('cbakademik').getValue() && !Ext.getCmp('cbperiode').getValue()){ Ext.MessageBox.alert("Informasi", "Silahkan Pilih Pencarian"); return; } if (Ext.getCmp('cbperiode').getValue()==true) { if (interval < 0) { Ext.MessageBox.alert('Informasi', 'Format Tanggal Tidak Valid'); return false } } export_lap_kas_pmb(); } }], sm: sm_nya, vw: vw, autoScroll: true, cm: cm, bbar: [{ text: 'Total Data :', },{ xtype: 'textfield', style: 'text-align: right;', fieldLabel: 'Total Data', id: 'totdata', name: 'totdata', width: 80, value: 0, listeners: {} },'->',{ text: 'Total Kas PMB :', },{ xtype: 'numericfield', style: 'text-align: right;', fieldLabel: 'Total Kas PMB', id: 'totkaspmb', name: 'totkaspmb', width: 119, value: 0, readOnly: true, decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.', listeners: {} }], clicksToEdit: 1, listeners: { rowclick: function rowclick(grid, rowIdx) { var rec = ds_grid.getAt(rowIdx); nopmbx = rec.data["nopmb"]; // alert(nopmbx); } } }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_bp_general_id', title: 'Laporan Penerimaan Kas PMB', region: 'center', //autoScroll: true, buttonAlign: 'left', bodyStyle: 'padding: 5px', border: false, waitMsg: 'Waiting...', maskDisabled: false, monitorValid: true, items: [{ layout: 'form', items: [grid_nya] }] }); get_content(form_bp_general); } function DateDiff(date1,date2) { return date2.getTime() - date1.getTime(); } //excel function export_lap_kas_pmb(){ var cbjmlbiaya = Ext.getCmp('cbjmlbiaya').getValue(); var cbakademik = Ext.getCmp('cbakademik').getValue(); var cbperiode = Ext.getCmp('cbperiode').getValue(); var jmlbiaya = (Ext.getCmp('jmlbiaya').getValue()) ? Ext.getCmp('jmlbiaya').getValue():'-'; var thnakademik = Ext.getCmp('thnakademik').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 + 'laporan/c_lkaspmb/export_excel/'+ cbjmlbiaya+'/'+cbakademik+'/'+cbperiode+'/'+jmlbiaya+'/'+thnakademik+'/'+tglawal+'/'+tglakhir; }