function pDiskon() { var kodex =''; var ds_jbiaya = store_jbiaya(); var ds_stsmt = store_stsmt(); var ds_jdiskon = store_jdiskon(); var isUpdate = false; var formx = new Ext.form.FormPanel({ xtype:'form', border: false, id: 'formx', labelAlign: 'left', buttonAlign: 'left', bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri monitorValid: true, // height: 510, //width: 470, items: [{ layout: 'column', border: false, items: [{ columnWidth: 1, border: false, layout: 'form', items: [{ xtype: 'fieldset', title: 'Form Entry/Edit', defaults: { labelWidth: 130, labelAlign: 'right' }, items: [{ columnWidth: 1, border: false, layout: 'form', items: [{ xtype: 'compositefield', name: 'comp_biaya', id: 'comp_biaya', items: [{ xtype: 'combo', id: 'idjnsbiaya', fieldLabel: 'Jenis Biaya', store: ds_jbiaya, valueField: 'idjnsbiaya', displayField: 'kdjnsbiaya', forceSelection: true, submitValue: true, triggerAction: 'all', mode: 'local', emptyText:'Pilih...', selectOnFocus:false, //false spy ga fokus setelah dipilih width: 125, allowBlank: false, editable: false, listeners: { select : function(){ if (Ext.getCmp('idjnsbiaya').getValue() == '2' || Ext.getCmp('idjnsbiaya').getValue() == '5') { Ext.getCmp('statussmt').setValue(''); Ext.getCmp('statussmt').hide(); } else { Ext.getCmp('statussmt').show(); } setDataBiaya(); } } }, { xtype: 'label', text: '', id: 'alertbiaya', style: 'color: red;font-size:12px;', }] }, { xtype: 'combo', id: 'statussmt', fieldLabel: 'Tahun Akademik - Semester', store: ds_stsmt, valueField: 'kdstsemester', displayField: 'nmsmt', triggerAction: 'all', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:false, //false spy ga fokus setelah dipilih width: 175, editable: false, listeners: { select: function(combo, record){ setDataBiaya(); } } }, { xtype: 'compositefield', name: 'comp_submenu', fieldLabel: 'NPM', id: 'comp_submenu', items: [{ xtype: 'textfield', id: 'tf.nim', readOnly: true, width: 200, emptyText:'Pilih...', allowBlank: false, listeners: { 'render': function(c) { c.getEl().on('keypress', function(e) { if (e.getKey() == 13) Ext.getCmp('btn_simpan_product').focus(); }, c); } } }, { xtype: 'button', //text: ' ... ', iconCls: 'silk-find', id: 'btn_data_submenu', width: 3, handler: function() { var jnsbiaya = Ext.getCmp('idjnsbiaya').getValue(); //pemberian_diskon_popup(jnsbiaya); wLookupMhsDiskon(); } }] },{ xtype: 'textfield', id: 'hidealertdiskonx', width: 90, hidden: true },{ xtype: 'label', text: '', id: 'alertdiskonx', style: 'color: red;font-size:12px;', }, { xtype: 'textfield', fieldLabel: 'Nama Mahasiswa', id: 'namamhs', readOnly: true, width: 250 }, { xtype: 'textfield', fieldLabel: 'Tahun Masuk', id: 'thnmsk', readOnly: true, width: 250 }, { xtype: 'textfield', fieldLabel: 'Program Studi', id: 'prodi', readOnly: true, width: 250 }, { xtype: 'textfield', fieldLabel: 'Jenis Kelas', id: 'jnskls', readOnly: true, width: 250 }, { xtype: 'numericfield', fieldLabel: 'Biaya', id: 'biaya', readOnly: true, width: 250 }, { xtype: 'textfield', id: 'idsetbiaya', hidden: true, width: 250 }, { xtype: 'textfield', id: 'hf.kdprodi', hidden: true, width: 250 }, { xtype: 'textfield', id: 'kdkls', hidden: true, width: 250 }, { xtype: 'combo', id: 'idjnsdiskon', fieldLabel: 'Jenis Diskon', store: ds_jdiskon, valueField: 'idjnsdiskon', displayField: 'nmdiskon', triggerAction: 'all', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', selectOnFocus:false, width: 175, allowBlank: false,editable: false, listeners: { select: function(){ setNominalDiskon();} } }, { xtype: 'numericfield', fieldLabel: 'Nominal Diskon', id: 'nominaldiskon', readOnly: false, width: 250, value:0, listeners: { 'change': function(){ var nominaldiskon = (RH.getCompValue('nominaldiskon', nominaldiskon) > 0)? RH.getCompValue('nominaldiskon', nominaldiskon): 0; var biaya = (RH.getCompValue('biaya')!='')? RH.getCompValue('biaya') : 0; var persendiskon = (biaya!=0)? (nominaldiskon/biaya)*100 : 0; var setelahdiskon = (biaya!=0)? (biaya - nominaldiskon) : 0; RH.setCompValue('persendiskon', persendiskon); RH.setCompValue('setelahdiskon', setelahdiskon); } } }, { xtype: 'numericfield', fieldLabel: 'Persentase Diskon', id: 'persendiskon', readOnly: true, width: 250 }, { xtype: 'numericfield', fieldLabel: 'Biaya Setelah Diskon', id: 'setelahdiskon', readOnly: true, width: 250 }, { columnWidth: 1, xtype: 'panel', border: false, buttonAlign: 'left', buttons: [ { text: 'Baru', id: 'btn_baru_product', iconCls: 'silk-add', handler: function() { var labelalertbiaya = Ext.getCmp('alertbiaya'); var labelalertdiskonx = Ext.getCmp('alertdiskonx'); labelalertbiaya.setText(''); labelalertdiskonx.setText(''); RH.setCompValue('hidealertdiskonx', ''); formx.getForm().reset(); Ext.getCmp('formx').enable(); Ext.getCmp('btn_simpan').enable(); Ext.getCmp('btn_hapus').disable(); Ext.getCmp('btn_ubah').disable(); Ext.getCmp('btn_data_submenu').enable(); isUpdate = false; } },'->', { text: 'Simpan', id: 'btn_simpan', iconCls: 'silk-save', handler: function() { simpan_grid("formx"); } }, { text: 'Hapus', id: 'btn_hapus', iconCls: 'silk-delete', handler: function() { hapus_grid("formx"); } }, { text: 'Ubah', id: 'btn_ubah', iconCls: 'silk-edit', handler: function() { ubah_grid("formx"); } }] },{ columnWidth: 1, xtype: 'panel', border: false, buttonAlign: 'left', buttons: [ '->',{ text: 'Salin diskon dari data sebelumnya', id: 'btn_salin', width:235, iconCls: 'silk-page-copy', handler: function() { salin_diskon(); } }] }] }] }] }] }] }); var pageSize = 50; var ds_grid = RH.JsonStore({ url : BASE_URL + 'diskon_controller/get_data', fields : data_source_diskon(), limit: pageSize, params: { start: 0, limit: 5 }, root: 'data', totalProperty: 'results', autoLoad: true, }); /* var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'diskon_controller/get_data', method: 'POST' }), params: { start: 0, limit: 5 }, root: 'data', totalProperty: 'results', autoLoad: true, fields: data_source_diskon() }); */ var cm_grid = new Ext.grid.ColumnModel([ { header: 'NIM', width: 130, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 150, dataIndex: 'nmmhs', sortable: true }, { header: 'Tahun Masuk', width: 80, dataIndex: 'thnmasuk', sortable: true }, { header: 'Tahun Akademik - Semester', width: 150, dataIndex: 'nmthnakademik', sortable: true, }, { header: 'Program Studi', width: 150, dataIndex: 'nmprodi', sortable: true }, { header: 'Jenis Kelas', width: 120, dataIndex: 'nmjnskls', sortable: true }, { header: 'Jenis Biaya', width: 100, dataIndex: 'kdjnsbiaya', sortable: true }, { header: 'Biaya', width: 100, dataIndex: 'biaya', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }, { header: 'Jenis Diskon', width: 100, dataIndex: 'nmdiskon', sortable: true }, { header: 'Nominal Diskon', width: 100, dataIndex: 'nominal', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }, { header: 'Persentase Diskon', width: 100, dataIndex: 'persentase', sortable: true, xtype: 'numbercolumn', format:'0.00', align:'right' }, { header: 'Biaya Setelah Diskon', width: 100, dataIndex: 'jml', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }] ); var sm_nya = new Ext.grid.RowSelectionModel({ singleSelect: true, listeners: {} }); 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: 50, store: ds_grid, displayInfo: true, displayMsg: 'Data Menu Dari {0} - {1} of {2}', emptyMsg: 'No data to display' }); var grid_nya = new Ext.grid.GridPanel({ store: ds_grid, frame: true, //width: 630, cm: cm_grid,//dtm_pemberian_diskon, sm: sm_mhs, view: gv_mhs, height: 500, plugins: cari_data, id: 'grid_det_product', forceFit: true, tbar: ['->'], autoScroll: true, autoSizeColumns: true, enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, bbar: paging, listeners: { rowclick: function rowClick(grid, rowIdx) { var rec = ds_grid.getAt(rowIdx); Ext.getCmp("idjnsbiaya").setValue(rec.data["idjnsbiaya"]); if (rec.data["idjnsbiaya"] == '2' || rec.data["idjnsbiaya"] == '5') { Ext.getCmp('statussmt').hide(); } else { Ext.getCmp('statussmt').show(); } Ext.getCmp("statussmt").setValue(rec.data["kdstsemester"]); Ext.getCmp("tf.nim").setValue(rec.data["nim"]); Ext.getCmp("namamhs").setValue(rec.data["nmmhs"]); Ext.getCmp("hf.kdprodi").setValue(rec.data["kdprodi"]); Ext.getCmp("prodi").setValue(rec.data["nmprodi"]); Ext.getCmp("kdkls").setValue(rec.data["idjnskls"]); Ext.getCmp("jnskls").setValue(rec.data["nmjnskls"]); Ext.getCmp("biaya").setValue(rec.data["biaya"]); Ext.getCmp('idsetbiaya').setValue(rec.data["idsetbiaya"]); Ext.getCmp("idjnsdiskon").setValue(rec.data["idjnsdiskon"]); Ext.getCmp("persendiskon").setValue(rec.data["persentase"]); Ext.getCmp("setelahdiskon").setValue(rec.data["jml"]); Ext.getCmp("thnmsk").setValue(rec.data["thnmasuk"]); Ext.getCmp("nominaldiskon").setValue(rec.data["nominal"]); Ext.getCmp('btn_simpan').disable(); Ext.getCmp('btn_ubah').enable(); Ext.getCmp('btn_hapus').enable(); Ext.getCmp('formx').enable(); Ext.getCmp('idjnsbiaya').disable(); Ext.getCmp('statussmt').disable(); Ext.getCmp('btn_data_submenu').disable(); isUpdate = true; } } }); function awal() { formx.getForm().reset(); Ext.getCmp('formx').enable(); Ext.getCmp('btn_simpan').disable(); Ext.getCmp('btn_hapus').disable(); Ext.getCmp('btn_ubah').disable(); } var formUtama = new Ext.Panel({ id: 'f.Utama', forceFit: true, title: 'Pemberian Diskon Biaya Kuliah', layout: 'column', items: [{ columnWidth: .42, xtype: 'panel', border: false, bodyStyle: 'padding:3px 3px 3px 3px', items: [formx] } , { columnWidth: .58, xtype: 'panel', border: false, bodyStyle: 'padding:3px 3px 3px 3px', items:[{ layout: 'form', bodyStyle: 'padding:10px 3px 3px 5px', border: false, items: [grid_nya] } ] } ], listeners: { afterrender: awal } }); function wLookupMhsDiskon(){ var grid_mhs = gridLookupMhsKeu(); var winMhskeu = new Ext.Window({ title: 'Daftar Mahasiswa', modal: true, layout: 'fit', width:720, height:400, items: [grid_mhs] }); grid_mhs.on('rowdblclick', function(grid, rowIdx){ var rec = grid_mhs.store.getAt(rowIdx); // SET VALUES OF FIELDSET MAHASISWA RH.setCompValue('tf.nim', rec.data['nim']), RH.setCompValue('namamhs', rec.data['nmmhs']), RH.setCompValue('hf.kdprodi', rec.data['kdprodi']), RH.setCompValue('prodi', rec.data['nmprodi']), RH.setCompValue('thnmsk', rec.data['thnmasuk']), RH.setCompValue('kdkls', rec.data['idjnskls']), RH.setCompValue('jnskls', rec.data['nmjnskls']), setDataBiaya(); winMhskeu.close(); }, this ); winMhskeu.show(); } /**GET DATA BIAYA==*/ function setDataBiaya(){ var kdprodi = RH.getCompValue('hf.kdprodi', true); var thmasuk = RH.getCompValue('thnmsk', true); var idjnskls = RH.getCompValue('kdkls', true); var idjnsbiaya = RH.getCompValue('idjnsbiaya', true); var kdstsemester = RH.getCompValue('statussmt', true); var labelalertbiaya = Ext.getCmp('alertbiaya'); //initialize RH.setCompValue('persendiskon', 0); RH.setCompValue('setelahdiskon', 0); if (idjnsbiaya=='2' || idjnsbiaya=='5') { if(kdprodi=='' || thmasuk=='' || idjnskls=='' || idjnsbiaya=='') return; } else { if(kdprodi=='' || thmasuk=='' || idjnskls=='' || idjnsbiaya=='' || kdstsemester=='') return; } RH.setCompValue('biaya', 0); Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/get_data_setbiaya', method: 'POST', params :{ kdprodix: kdprodi, idjnsbiayax: idjnsbiaya, idjnsklsx: idjnskls, tahunmskx: thmasuk, kdstsemesterx : kdstsemester }, //waitMsg: "sedang diproses...", success: function(result){ //alert(Ext.decode(result.responseText)); var jsonData = Ext.decode(result.responseText); //bisa utk Ext3 dan Ext4 var dataArray = jsonData.data; if (jsonData.msg=='0') { labelalertbiaya.setText('Biaya Kuliah Belum Di Setting'); kodex = 'Biaya Kuliah Belum Di Setting'; } else { labelalertbiaya.setText(''); kodex = ''; var data = dataArray[0]; var biaya = data.biaya; RH.setCompValue('biaya', biaya); RH.setCompValue('idsetbiaya', data.idsetbiaya); if(RH.getCompValue('nominaldiskon',true)!=''){ var nominaldiskon = RH.getCompValue('nominaldiskon',true); var persendiskon = (nominaldiskon/biaya)*100; var setelahdiskon = (biaya - nominaldiskon); RH.setCompValue('persendiskon', persendiskon); RH.setCompValue('setelahdiskon', setelahdiskon); } cek_diskon(); } } }); } function setNominalDiskon(){ var jnsdiskon = Ext.getCmp('idjnsdiskon').getValue(); if (jnsdiskon) { Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/get_nominal_diskon', method: 'POST', params :{ idjnsdiskonx: Ext.getCmp('idjnsdiskon').getValue() }, //waitMsg: "sedang diproses...", success: function(result){ //alert(Ext.decode(result.responseText)); var jsonData = Ext.decode(result.responseText); //bisa utk Ext3 dan Ext4 var dataArray = jsonData.data; if(dataArray == null || dataArray =='') return; var data = dataArray[0]; nominalx = data.nominal; var nominaldiskon = (data.nominal > 0)? data.nominal: 0; var biaya = (RH.getCompValue('biaya')!='')? RH.getCompValue('biaya') : 0; var persendiskon = (biaya!=0)? (nominaldiskon/biaya)*100 : 0; var setelahdiskon = (biaya!=0)? (biaya - nominaldiskon) : 0; RH.setCompValue('nominaldiskon', nominaldiskon); RH.setCompValue('persendiskon', persendiskon); RH.setCompValue('setelahdiskon', setelahdiskon); } }); } } function perhitungan_diskon() { alert(Ext.getCmp('biaya').getValue()); } function cek_diskon() { var nim = RH.getCompValue('tf.nim'); var idsetbiaya = RH.getCompValue('idsetbiaya'); var kdstsemester = RH.getCompValue('statussmt'); var idjnsdiskon = RH.getCompValue('idjnsdiskon'); var idjnsbiaya = RH.getCompValue('idjnsbiaya'); var kdjnsbiaya = RH.getFieldValue('idjnsbiaya', 'idjnsbiaya', 'kdjnsbiaya'); //utk mudah bedakan DPP & DPK var labelalertdiskonx = Ext.getCmp('alertdiskonx'); if (isUpdate) { return; } /* if (kdjnsbiaya == 'DPK' || kdjnsbiaya == 'KON') { if(nim=='' || idsetbiaya=='' || idjnsdiskon=='') return; } else if (kdjnsbiaya != 'DPK' || kdjnsbiaya != 'KON') { if(nim=='' || idsetbiaya=='' || idjnsdiskon=='' || kdstsemester=='') return; } */ if (kdjnsbiaya == 'DPK' || kdjnsbiaya == 'KON') { if(nim=='' || idsetbiaya=='') return; } else if (kdjnsbiaya != 'DPK' || kdjnsbiaya != 'KON') { if(nim=='' || idsetbiaya=='' || kdstsemester=='') return; } Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/get_count_diskon', method: 'POST', params :{ nim: nim, idsetbiaya: idsetbiaya, kdstsemester: kdstsemester, idjnsdiskon: idjnsdiskon, idjnsbiaya: idjnsbiaya, kdjnsbiaya: kdjnsbiaya }, scope: this, async:false, //waitMsg: "Biaya sedang diproses...", success: function(result){ var jsonData = Ext.decode(result.responseText); //bisa utk Ext3 dan Ext4 if (jsonData.result!='0') { labelalertdiskonx.setText('Mahasiswa Sudah Mendapat Diskon Biaya Kuliah'); RH.setCompValue('hidealertdiskonx', 'Mahasiswa Sudah Mendapat Diskon Biaya Kuliah'); } else { labelalertdiskonx.setText(''); RH.setCompValue('hidealertdiskonx', ''); } } }); } function simpan_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); var alertx = RH.getCompValue('hidealertdiskonx'); if(alertx != ''){ return; }; if(RH.isEmpty('idjnsbiaya')){ RH.warning('Jenis Biaya harus diisi'); return; }; if(kodex != ''){ return; }; if((RH.getCompValue('idjnsbiaya', true) != '2' && RH.getCompValue('idjnsbiaya', true) != '5') && (RH.isEmpty('statussmt'))){ RH.warning('Tahun Akademik - Semester harus diisi'); return; }; if(RH.isEmpty('tf.nim')){ RH.warning('NPM harus diisi'); return; }; if(RH.isEmpty('idjnsdiskon')){ RH.warning('Jenis Diskon harus diisi'); return; }; if(RH.isEmpty('nominaldiskon') || Ext.getCmp('nominaldiskon').getValue() <= 0){ RH.warning('Nominal Diskon harus diisi'); return; }; Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/insert', params: { kdstsemesterx: Ext.getCmp('statussmt').getValue(), idsetbiayax: Ext.getCmp('idsetbiaya').getValue(), nimx : Ext.getCmp('tf.nim').getValue(), idjnsdiskonx : Ext.getCmp('idjnsdiskon').getValue(), nominalx: Ext.getCmp('nominaldiskon').getValue() }, method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); ds_grid.load(); formx.getForm().reset(); Ext.getCmp('formx').enable(); Ext.getCmp('btn_simpan').enable(); Ext.getCmp('btn_hapus').disable(); Ext.getCmp('btn_ubah').disable(); isUpdate = false; }, failure: function() { Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } function hapus_grid(namaForm) { var form_nya = Ext.getCmp(namaForm); Ext.MessageBox.show({ title: "Konfirmasi", msg: "
Anda Yakin Untuk menghapus Data ini?
", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/delete', params: { nimx : Ext.getCmp('tf.nim').getValue(), idsetbiayax: Ext.getCmp('idsetbiaya').getValue(), kdstsemesterx: Ext.getCmp('statussmt').getValue(), idjnsdiskonx : Ext.getCmp('idjnsdiskon').getValue(), idjnsbiayax: Ext.getCmp('idjnsbiaya').getValue() }, method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Hapus Data Berhasil"); ds_grid.load(); formx.getForm().reset(); Ext.getCmp('formx').enable(); Ext.getCmp('btn_simpan').enable(); Ext.getCmp('btn_hapus').disable(); Ext.getCmp('btn_ubah').disable(); isUpdate = false; }, failure: function() { Ext.MessageBox.alert("Informasi", "Hapus Data Gagal"); } }); } } }) } function ubah_grid(namaForm) { if(RH.isEmpty('idjnsbiaya')){ RH.warning('Jenis Biaya harus diisi'); return; }; if(kodex != ''){ return; }; if((RH.getCompValue('idjnsbiaya', true) != '2') && (RH.getCompValue('idjnsbiaya', true) != '5') && (RH.isEmpty('statussmt'))){ RH.warning('Tahun Akademik - Semester harus diisi'); return; }; if(RH.isEmpty('tf.nim')){ RH.warning('NPM harus diisi'); return; }; if(RH.isEmpty('idjnsdiskon')){ RH.warning('Jenis Diskon harus diisi'); return; }; if(RH.isEmpty('nominaldiskon') || Ext.getCmp('nominaldiskon').getValue() <= 0){ RH.warning('Nominal Diskon harus diisi'); return; }; Ext.MessageBox.show({ title: "Konfirmasi", width: 350, msg: "Anda Yakin Untuk Mengubah Data ini?", buttons: Ext.MessageBox.YESNO, fn: function(btn) { if (btn == 'yes') { Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/update', params: { kdstsemesterx: Ext.getCmp('statussmt').getValue(), idsetbiayax: Ext.getCmp('idsetbiaya').getValue(), nimx : Ext.getCmp('tf.nim').getValue(), idjnsdiskonx : Ext.getCmp('idjnsdiskon').getValue(), nominalx: Ext.getCmp('nominaldiskon').getValue() }, method: 'POST', success: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Berhasil"); ds_grid.load(); formx.getForm().reset(); Ext.getCmp('formx').enable(); Ext.getCmp('btn_simpan').enable(); Ext.getCmp('btn_hapus').disable(); Ext.getCmp('btn_ubah').disable(); isUpdate = false; }, failure: function() { Ext.MessageBox.alert("Informasi", "Ubah Data Gagal"); } }); } } }); } SET_PAGE_CONTENT(formUtama); function salin_diskon(){ var ds_stsmt_copy1 = store_stsmt(); var ds_stsmt_copy2 = store_stsmt(); var copy_form = new Ext.form.FormPanel({ xtype:'form', id: 'frm.copy', buttonAlign: 'left', labelWidth: 220, labelAlign: 'right', bodyStyle: 'padding:10px 3px 3px 5px', // atas, kanan, bawah, kiri monitorValid: true, height: 160, width: 500, layout: 'form', frame: false, defaultType:'combo', items: [{ xtype: 'combo', id: 'cb.stsmtbaru-copy', fieldLabel: 'Tahun Akademik - Semester (Baru) ', store: ds_stsmt_copy1, triggerAction: 'all', allowBlank: false, valueField: 'kdstsemester', displayField: 'nmsmt', forceSelection: true, submitValue: true, mode: 'local', width: 150, },{ xtype: 'combo', id: 'cb.stsmtlama-copy', fieldLabel: 'Tahun Akademik - Semester (Lama) ', store: ds_stsmt_copy2, triggerAction: 'all', editable: true, valueField: 'kdstsemester', displayField: 'nmsmt', forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', width:150, }], buttons: [{ text: 'Simpan', iconCls:'silk-save', handler: function() { fnSaveCopy(); } }, { text: 'Kembali', iconCls:'', handler: function() { wCopyDiskon.close(); } }] }); /**SET THE FORM */ setForm(); var wCopyDiskon = new Ext.Window({ title: 'Salin Kurikulum dari Tahun Masuk/Angkatan Sebelumnya', modal: true, closable:false, items: [copy_form] }).show(); function setForm(){ //get active kurikulum, set to Tahun Akademik - Semester (Baru) Ext.getCmp('cb.stsmtbaru-copy').disable(); Ext.Ajax.request({ url: BASE_URL + 'diskon_controller/get_semester_active', params: { getdata : true, }, success: function(response){ obj = Ext.util.JSON.decode(response.responseText); Ext.getCmp('cb.stsmtbaru-copy').setValue(obj.kdstsemester); } }); } function fnSaveCopy(){ var smtbaru = RH.getCompValue('cb.stsmtbaru-copy',true); var smtlama = RH.getCompValue('cb.stsmtlama-copy',true); if(smtbaru == '' || smtlama =='') { RH.warning('Tahun Masuk/Angkatan harus diisi'); return; }; var idForm = 'frm.copy'; var sUrl = BASE_URL +'diskon_controller/copy_diskon'; var sParams = new Object({ smtbaru : smtbaru, smtlama : smtlama, }); var grid = grid_nya; var msgWait = 'Tunggu, sedang proses menyimpan...'; var msgSuccess = 'Salin data berhasil'; var msgFail = 'Salin data gagal'; var msgInvalid = 'Data belum valid (data primer belum terisi)!'; //call form grid submit function (common function by RH) RH.submitGridForm(idForm, sUrl, sParams, grid, wCopyDiskon, msgWait, msgSuccess, msgFail, msgInvalid); } } } function data_source_diskon() { return new Object( [{ name: "nim", mapping: "nim" }, { name: "kdstsemester", mapping: "kdstsemester" }, { name: "idjnsbiaya", mapping: "idjnsbiaya" }, { name: "kdjnsbiaya", mapping: "kdjnsbiaya", }, { name: "idsetbiaya", mapping: "idsetbiaya" }, { name: "nmmhs", mapping: "nmmhs" },{ name: "thnmasuk", mapping: "thnmasuk" },{ name: "kdprodi", mapping: "kdprodi" },{ name: "nmprodi", mapping: "nmprodi" },{ name: "idjnskls", mapping: "idjnskls" }, { name: "nmjnskls", mapping: "nmjnskls" },{ name: "biaya", mapping: "biaya" },{ name: "nmdiskon", mapping: "nmdiskon" }, { name: "idjnsdiskon", mapping: "idjnsdiskon" }, { name: "nominal", mapping: "nominal" },// { name: "persentase", mapping: "persentase" }, { name: "jml", mapping: "jml" }, { name: "nmthnakademik", mapping: "nmthnakademik" }, { name: "nmjnssemester", mapping: "nmjnssemester", }, { name: "thnmasuk", mapping: "thnmasuk", }] ); } /** * DEFAULT TABLE MODEL *//* var dtm_pemberian_diskon = new Ext.grid.ColumnModel([ { header: 'NIM', width: 130, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 150, dataIndex: 'nmmhs', sortable: true }, { header: 'Tahun Masuk', width: 80, dataIndex: 'thnmasuk', sortable: true }, { header: 'Program Studi', width: 150, dataIndex: 'nmprodi', sortable: true }, { header: 'Jenis Kelas', width: 120, dataIndex: 'nmjnskls', sortable: true }, { header: 'Biaya', width: 100, dataIndex: 'biaya', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }, { header: 'Jenis Diskon', width: 100, dataIndex: 'nmdiskon', sortable: true }, { header: 'Nominal Diskon', width: 100, dataIndex: 'nominal', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }, { header: 'Persentase Diskon', width: 100, dataIndex: 'biaya', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }, { header: 'Biaya Setelah Diskon', width: 100, dataIndex: 'jml', sortable: true, xtype: 'numbercolumn', format:'0,000', align:'right', }] ); */ // Selection Model var sm_mhs = new Ext.grid.RowSelectionModel({ singleSelect: true }); // Grid View var gv_mhs = new Ext.grid.GridView({ emptyText: '< Belum ada Data >' });