function pRptTGK(){ /** ========= COMMON STORES */ //var ds_stsmt = store_stsmt(); var ds_jkls = store_klsmhsplusall(); /** ======================================*/ var reader = new Ext.data.JsonReader({ root:'data', idProperty: '', totalProperty: 'results', remoteGroup: true, fields: [ { name: 'kdfakultas' } , { name: 'nmfakultas' } , { name: 'fakultas' } , { name: 'kdprodi' } , { name: 'nmprodi' } , { name: 'lnmprodi' } , { name: 'biaya' } , { name: 'jmlbayar' } , { name: 'persenbayar' } , { name: 'sisa' } , { name: 'persensisa' } ] }); var ds_rptTGK = new Ext.data.GroupingStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'rptkeu_controller/get_TgkAllProdi', method: 'POST', }), reader: reader, groupField:'fakultas', //sortInfo:{field:'kdfakultas',direction:'ASC'}, remoteSort: true, }); var cm_rptTGK = new Ext.grid.ColumnModel({ columns: [{ header: 'Fakultas/Program Studi', width: 300, dataIndex: 'fakultas', //sortable: true }, { header: 'Fakultas/Program Studi', width: 300, dataIndex: 'lnmprodi', //sortable: true }, { header: 'Total Tagihan', width: 150, dataIndex: 'biaya', xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: 'Total Bayar', width: 150, dataIndex: 'jmlbayar', xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: '% Tot. Bayar', width: 100, dataIndex: 'persenbayar', xtype: 'numbercolumn', format:'0.00', align:'right' }, { header: 'Tunggakan', width: 150, dataIndex: 'sisa', xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: '% Tunggakan', width: 100, dataIndex: 'persensisa', xtype: 'numbercolumn', format:'0.00' }] }); var gp_rptTGK = new Ext.grid.GridPanel({ id: 'gp.tgk-rpt', //title: 'Laporan Tunggakan', ds: ds_rptTGK, cm: cm_rptTGK, 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: true, // 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: 'Cetak', iconCls: 'silk-printer', handler: function(){ fnPrintTgk(); } },'->'], frame: false, autoScroll: true, autoSizeColumns: true, autoExpandColumn: 'lnmprodi', enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, layout: 'anchor', listeners: { rowclick: onRowTgkClick } }); var ds_rptTGKdet = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'rptkeu_controller/get_TgkDet', method: 'POST' }), //baseParams: { nim:npm, kdprodi:kdprodi, thmasuk:thmasuk, idjnskls:idjnskls, persen:persen }, totalProperty: 'results', autoLoad : true, root: 'data', fields: [ { name: "kdprodi" } , { name: "nim" } , { name: "nmmhs" } , { name: "thnmasuk" } , { name: "biaya" } , { name: "jmlbayar" } , { name: "persenbayar" } , { name: "sisa" } , { name: "persensisa" } , { name: "stlunas" } ] }); var cm_rptTGKdet = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer({width: 45}), { header: 'NPM', width: 120, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 200, dataIndex: 'nmmhs', sortable: true }, { header: 'Tahun Masuk', width: 80, dataIndex: 'thnmasuk', sortable: true }, { header: 'Total Tagihan', width: 110, dataIndex: 'biaya', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: 'Total Bayar', width: 110, dataIndex: 'jmlbayar', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: '% Tot. Bayar', width: 80, dataIndex: 'persenbayar', sortable: true, xtype: 'numbercolumn', format:'0.', align:'right' }, { header: 'Tunggakan', width: 110, dataIndex: 'sisa', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right' }, { header: '% Tunggakan', width: 80, dataIndex: 'persensisa', sortable: true, xtype: 'numbercolumn', format:'0.', align:'right' }, { header: 'Status', width: 100, dataIndex: 'stlunas', sortable: true, }] ); var gp_rptTGKdet = new Ext.grid.GridPanel({ id: 'gp.tgkdet-rpt', //title: 'Laporan per Mahasiswa', ds: ds_rptTGKdet, cm: cm_rptTGKdet, sm: new Ext.grid.RowSelectionModel({ singleSelect: true}), view: new Ext.grid.GridView({ emptyText: '< Belum ada Data >'}), forceFit: true, autoHeight: true, //width: 720, tbar: [{hidden:false, text: 'Cetak', iconCls: 'silk-printer', handler: function(){ fnPrintDetailTgk(); } },'->'], frame:false, autoScroll: true, autoSizeColumns: true, enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, layout: 'anchor', bbar: [{ xtype: 'form', border: false, items:[{ xtype: 'textfield', fieldLabel: 'Total Sudah Bayar', id:'tf.to-mhs-bayar', readOnly: true, disabled: false, width:100, }] },{ xtype:'form', border: false, items:[{ xtype: 'numericfield', fieldLabel: 'Total Tagihan', id:'nf.to-biaya-tgkdet', readOnly: true, disabled: false, width:100, decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.', }] }, { xtype: 'form', border: false, items:[{ xtype: 'numericfield', fieldLabel: 'Total Bayar', id:'nf.to-bayar-tgkdet', readOnly: true, disabled: false, width:100, decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.', }] }, { xtype: 'form', border: false, items:[{ xtype: 'numericfield', fieldLabel: 'Tunggakan', id:'nf.to-sisa-tgkdet', readOnly: true, disabled: false, width:100, decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.', }] }, { xtype: 'form', border: false, items:[{ xtype: 'numericfield', fieldLabel: 'Diskon', id:'nf.to-diskon-tgkdet', readOnly: true, disabled: false, width:100, decimalSeparator: ',', decimalPrecision: 0, alwaysDisplayDecimals: true, useThousandSeparator: true, thousandSeparator: '.', }] }], }); //THE FORM PANEL var fpRptTGK = new Ext.form.FormPanel({ id: 'fp.RptTGK', //title:'Laporan Keuangan TUNGGAKAN', layout: 'form', forceFit: true, autoScroll: true, //width:500, height:400, margin: '0 0 10', frame: true, defaults: { labelWidth: 100, labelAlign: 'right'}, items: [{ xtype: 'fieldset', title: 'Laporan Tunggakan Mahasiswa', //flex: 1, items: [{ xtype: 'combo', id: 'cb.jkelas-tgk', fieldLabel: 'Jenis Kelas', store: ds_jkls, valueField: 'idklsmhs', displayField: 'kdnm', triggerAction: 'all',editable: false, forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', //selectOnFocus:true, listeners:{ scope: this, 'select': function(){ setGridTGK(); setGridTGKdet();} } }, { xtype: 'panel', layout:'fit', items: [gp_rptTGK], }] }, { xtype: 'fieldset', title: 'Laporan per Mahasiswa', //flex: 1, items: [{ xtype: 'textfield', width:250, disabled:true, readOnly:true, id: 'tf.prodi-tgkdet', fieldLabel: 'Program Studi', }, { xtype: 'hidden', id: 'hf.kdprodi-tgkdet', //FOR STORING kdprodi }, { xtype: 'panel', layout:'fit', items: [gp_rptTGKdet], }] }] }); SET_PAGE_CONTENT(fpRptTGK); /* var wRptTgk = new Ext.Window({ title: 'Laporan Tunggakan Mahasiswa', modal: false, layout: 'fit', minimizable:true, width:1000, height:570, items: [fpRptTGK], bbar: [{xtype:'tbfill'}, { text: 'Close', iconCls: 'silk-cancel', handler: function(){ wRptTgk.close();} }] }).show(); */ function setGridTGK(){ if(RH.isEmpty('cb.jkelas-tgk')) return; var idjnskls = RH.getCompValue('cb.jkelas-tgk'); ds_rptTGK.reload({ params: { idjnskls: idjnskls } }); } function onRowTgkClick(grid, rowIdx){ var record = ds_rptTGK.getAt(rowIdx); RH.setCompValue('tf.prodi-tgkdet',record.data['lnmprodi']); RH.setCompValue('hf.kdprodi-tgkdet',record.data['kdprodi']); setGridTGKdet(); } function fnPrintTgk(){ var jenis_kelas = RH.getCompValue('cb.jkelas-tgk'); if(jenis_kelas){ RH.ShowReport(BASE_URL + 'rpt/rpt_tgk/get_tgk/'+jenis_kelas); } else {} } function fnPrintDetailTgk(){ var jenis_kelas = RH.getCompValue('cb.jkelas-tgk'); var kdprodi = RH.getCompValue('hf.kdprodi-tgkdet'); if(jenis_kelas && kdprodi) { RH.ShowReport(BASE_URL + 'rpt/rpt_det_tgk/get_det_tgk/'+jenis_kelas+'/'+kdprodi); } else {} } function setGridTGKdet(){ if(RH.isEmpty('cb.jkelas-tgk')) return; if(RH.isEmpty('hf.kdprodi-tgkdet')) return; //the key var kdprodi = RH.getCompValue('hf.kdprodi-tgkdet'); //initialize RH.setCompValue('tf.to-mhs-bayar', 0); RH.setCompValue('nf.to-biaya-tgkdet', 0); RH.setCompValue('nf.to-bayar-tgkdet', 0); RH.setCompValue('nf.to-sisa-tgkdet', 0); RH.setCompValue('nf.to-diskon-tgkdet', 0); /* var record = RH.getRecAtVal(gp_rptTGK.getStore(), 'kdprodi', kdprodi); if (record != null) { RH.setCompValue('nf.to-biaya-tgkdet', record.data['biaya']); RH.setCompValue('nf.to-bayar-tgkdet', record.data['jmlbayar']); RH.setCompValue('nf.to-sisa-tgkdet', record.data['sisa']); } */ //Reload the Store of Grid TGK-det ds_rptTGKdet.reload({ params: { idjnskls: RH.getCompValue('cb.jkelas-tgk'), kdprodi: RH.getCompValue('hf.kdprodi-tgkdet'), start: 0, limit: 20, }, callback: function(results){ if(results == 0) return; var count = 0; ds_rptTGKdet.each(function (rec) { if (rec.data['jmlbayar'] > 0) { count = count + 1; } }); RH.setCompValue('tf.to-mhs-bayar', count); RH.setCompValue('nf.to-biaya-tgkdet', RH.sumRecVal(ds_rptTGKdet, 'biaya')); RH.setCompValue('nf.to-bayar-tgkdet', RH.sumRecVal(ds_rptTGKdet, 'jmlbayar')); RH.setCompValue('nf.to-sisa-tgkdet', RH.sumRecVal(ds_rptTGKdet, 'sisa')); RH.setCompValue('nf.to-diskon-dppdet', RH.sumRecVal(ds_rptDPPdet, 'diskon')); } }); } }