function feederAktmhs() { var ds_stsmt = store_stsmt(); var ds_prodi = store_prodireg(); var ds_years = store_tahun(); var arr_caraexport = [ ['1', 'Dari SIAk'], ['2', 'Upload Excel'], ]; var ds_caraexport = new Ext.data.ArrayStore({ fields: ['id', 'nama'], data : arr_caraexport }); var ds_idsemester = new Ext.data.JsonStore({ //from database proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'data_controller/get_semester_ganjilgenap', method: 'POST' }), autoLoad: true, root: 'data', fields: [ { name: "kode", mapping: "kode" }, { name: "tingsem", mapping: "tingsem" } ] }); var fields_stmhssmt = RH.storeFields('idstmhssemester', 'kdstsemester', 'nim', 'kdstaktivitasmhs', 'nmkodtbkod', 'jmasuk', 'catnonaktif', 'idsemester', 'nmmhs', 'thnmasuk', 'ips', 'sks_smt', 'ipk', 'sks_total'); var ds_stmhssmt = RH.JsonStore({ url : BASE_URL + 'feeder/feeder_aktmhs_controller/get_stmhssemester', fields : fields_stmhssmt, params: [ {key:'kdprodi', id: 'cb.prodi_aktivmhs-stru'}, {key:'kdstsemester', id: 'cb.smt-stru'}, ], }); var cm_aktmhs = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer(), { header: 'NIM', width: 110, dataIndex: 'nim', sortable: true }, { header: 'Nama Mahasiswa', width: 200, dataIndex: 'nmmhs', sortable: true }, { header: 'Cara Daftar', width: 100, dataIndex: 'jmasuk', sortable: true }, { header: 'Tahun Masuk', width: 100, dataIndex: 'thnmasuk', sortable: true }, { header: 'Semester', width: 90, dataIndex: 'idsemester', sortable: true }, { header: 'Status', width: 80, dataIndex: 'nmkodtbkod', sortable: true }, { header: 'SKS Semester', width: 100, dataIndex: 'sks_smt', sortable: true, align:'right' , renderer: renderBlue, editor: RH.getNumEditor('sks_smt', 'INTEGER', 0, 900, false, function(){}), }, { header: 'SKS Total', width: 80, dataIndex: 'sks_total', sortable: true, align:'right' , renderer: renderBlue, editor: RH.getNumEditor('sks_total', 'INTEGER', 0, 900, false, function(){}), }, { header: 'IPS', width: 80, dataIndex: 'ips', sortable: true, align:'right' , xtype: 'numbercolumn', format:'0,000.00', align:'right', editor: RH.getNumEditor('ips', 'DECIMALS', 0, 50, false, function(){}), }, { header: 'IPK', width: 80, dataIndex: 'ipk', sortable: true, align:'right', xtype: 'numbercolumn', format:'0,000.00', align:'right', editor: RH.getNumEditor('ipk', 'DECIMALS', 0, 50, false, function(){}), }, ]); // Selection Model var sm_mhs = new Ext.grid.RowSelectionModel({singleSelect: true}); // Grid View var gv_mhs = new Ext.grid.GridView({emptyText: '< Belum ada Data >'}); //GRID PANEL var gp_feeder_aktmhs = new Ext.grid.EditorGridPanel({ id: 'gp.feeder_aktmhs', ds: ds_stmhssmt, cm: cm_aktmhs, sm: sm_mhs, view: gv_mhs, clicksToEdit: 1, //for cell editing (single click =1, dblclick=2) height: 450, columnLines: true, loadMask: true, layout: 'anchor', tbar:[{ text: 'Export To Feeder', id: 'id_eks_feeder', iconCls: 'silk-book', handler: function() { if (gp_feeder_aktmhs.getStore().getCount() == 0) { Ext.MessageBox.alert("Informasi", "Data Kosong"); }else{ insert(); } } }], }); var form_bp_general = new Ext.form.FormPanel({ id: 'form_export_feeder_kurikulum', title: 'Export Data Aktivitas Mahasiswa', fileUpload: true, width: 900, Height: 1000, layout: { type: 'form', pack: 'center', align: 'center'}, autoScroll: true, items: [ { xtype: 'fieldset', flex: 1, region:'north', layout:'form', autoHeight:true, labelWidth: 160, labelAlign: 'right', items: [{ xtype: 'combo', fieldLabel: 'Cara Export ', id: 'cb.cara_export', store: ds_caraexport, width: 250, valueField: 'id', displayField: 'nama', editable: false, triggerAction: 'all', allowBlank: false, forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', listeners:{ select: function(){ var cara_export = Ext.getCmp('cb.cara_export').getValue(); if(cara_export == 1){ //dari siak Ext.getCmp('cb.prodi_aktivmhs').enable(); Ext.getCmp('cb.stsmt_aktivmhs').enable(); Ext.getCmp('excelaktmhs').disable(); Ext.getCmp('uploadbtn').disable(); }else if(cara_export == 2){ Ext.getCmp('cb.prodi_aktivmhs').disable(); Ext.getCmp('cb.stsmt_aktivmhs').disable(); Ext.getCmp('excelaktmhs').enable(); Ext.getCmp('uploadbtn').enable(); } ds_stmhssmt.removeAll(); } } }] },{ xtype: 'fieldset', flex: 1, region:'south', layout:'form', autoHeight:true, labelWidth: 160, labelAlign: 'right', items: [{ xtype:'compositefield', items:[{ xtype: 'combo', fieldLabel: 'Program Studi ', id: 'cb.prodi_aktivmhs', store: ds_prodi, width: 250, valueField: 'kdprodi', displayField: 'nmprodi', editable: false, triggerAction: 'all', allowBlank: false, forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', disabled:true, listeners:{ select: function(){ reloadGridAktvmhs(); } } },{ xtype: 'label', text: ' Upload File Excel : ', margins:'4 10 0 60', //top right bottom left },{ xtype: 'fileuploadfield', id: 'excelaktmhs', name: 'excelaktmhs', emptyText: 'Upload data mahasiswa (excel)', width:250, buttonText: ' Browse ', disabled:true, },{ xtype:'button', text:'Upload', iconCls: 'silk-accept', margins:'0 0 0 5', disabled:true, id: 'uploadbtn', handler: function(){ form_action=1; form_bp_general.getForm().submit({ url: BASE_URL + 'feeder/feeder_aktmhs_controller/upload_excel', waitMsg: 'Mengupload data ', success: function(form,action){ //add data to grid obj = Ext.util.JSON.decode(action.response.responseText); var dt_aktfmahasiswa = obj.data; var mapAktMahasiswa = new Ext.data.Record.create([{ name : 'idstmhssemester', name : 'kdstsemester', name : 'nim', name : 'kdstaktivitasmhs', name : 'nmkodtbkod', name : 'jmasuk', name : 'catnonaktif', name : 'idsemester', name : 'nmmhs', name : 'thnmasuk', name : 'ips', name : 'sks_smt', name : 'ipk', name : 'sks_total' }]); //loop data mahasiswa for (i = 0; i < dt_aktfmahasiswa.length; i++) { curr_aktfmhs = dt_aktfmahasiswa[i]; ds_stmhssmt.add([ new mapAktMahasiswa({ 'idstmhssemester' : curr_aktfmhs.idstmhssemester, 'kdstsemester' : curr_aktfmhs.kdstsemester, 'nim' : curr_aktfmhs.nim, 'kdstaktivitasmhs' : curr_aktfmhs.kdstaktivitasmhs, 'nmkodtbkod' : curr_aktfmhs.nmkodtbkod, 'jmasuk' : curr_aktfmhs.jmasuk, 'catnonaktif' : curr_aktfmhs.catnonaktif, 'idsemester' : curr_aktfmhs.idsemester, 'nmmhs' : curr_aktfmhs.nmmhs, 'thnmasuk' : curr_aktfmhs.thnmasuk, 'ips' : curr_aktfmhs.ips, 'sks_smt' : curr_aktfmhs.sks_smt, 'ipk' : curr_aktfmhs.ipk, 'sks_total' : curr_aktfmhs.sks_total, }) ]); } }, failure:function(form, action){ obj = Ext.util.JSON.decode(action.response.responseText); if(obj.message){ Ext.MessageBox.alert('Informasi',obj.message); }else{ Ext.MessageBox.alert('Informasi','Data gagal di export'); } } }); } }] },{ xtype: 'compositefield', items: [{ xtype: 'combo', fieldLabel: 'Tahun Akademik - Semester ', id: 'cb.stsmt_aktivmhs', store: ds_stsmt, width: 250, valueField: 'kdstsemester', displayField: 'nmsmt', editable: false, triggerAction: 'all', allowBlank: false, forceSelection: true, submitValue: true, mode: 'local', emptyText:'Pilih...', disabled:true, listeners:{ select: function(){ reloadGridAktvmhs(); } } },{ xtype: 'tbtext', style:'font-size:12px;', id: 'info', margins:'4 10 0 60', //top right bottom left text: 'Silahkan download format data aktifitas mahasiswa disini
'+ 'Status Mahasiswa diisi huruf A/C/D/L/K (A : Aktif, C : Cuti, D : Drop Out, L : Lulus, K : Mengundurkan Diri)', }] }] },gp_feeder_aktmhs ] }); SET_PAGE_CONTENT(form_bp_general); function reloadGridAktvmhs(){ if(RH.isEmpty('cb.prodi_aktivmhs')) return; if(RH.isEmpty('cb.stsmt_aktivmhs')) return; //reload master-grid ds_stmhssmt.reload({ params: { kdprodi: RH.getCompValue('cb.prodi_aktivmhs', true), kdstsemester: RH.getCompValue('cb.stsmt_aktivmhs', true), }, }); } function set_semester() { Ext.getCmp('cb.idsemester').enable(); Ext.getCmp('cb.idsemester').allowBlank=true; Ext.getCmp('cb.idsemester').setValue(null); Ext.getCmp('cb.idsemester').allowBlank=false; ds_idsemester.reload({ params: { jsemester: RH.getCompValue('cb.stsmt_aktivmhs', true).substr(-1) } }); } function insert() { Ext.Msg.show({ title: 'Confirm', msg: 'Ekspor data?', buttons: Ext.Msg.YESNO, fn: function(btn) { if (btn == 'yes') { var waitmsg_getotokui = Ext.MessageBox.wait('Sedang Mengekspor Data...', 'Info'); var par = get_par(); var idsemester = RH.getCompValue('cb.stsmt_aktivmhs', true); Ext.Ajax.request({ url: BASE_URL + 'feeder/feeder_aktmhs_controller/insert', method: 'POST', timeout: 1000000, params: { postdata: par, semester: idsemester, }, success: function(response) { waitmsg_getotokui.hide(); obj = Ext.util.JSON.decode(response.responseText); if(obj.success){ Ext.Msg.alert("Info:", msgSaveSuccess); ds_stmhssmt.removeAll(); }else{ if(obj.message){ Ext.MessageBox.alert('Informasi',obj.message); }else{ Ext.MessageBox.alert('Informasi','Simpan data gagal'); } } }, }); } } }); } function get_par() { var par=''; var a= 1; var c = '||'; var GridStore = Ext.getCmp('gp.feeder_aktmhs').store; GridStore.each(function(rec){ // ambil seluruh grid her var rowData = rec.data; if (a == GridStore.getCount()) { c = '' } par += rowData['nim'] + ';' + rowData['sks_smt'] + ';' + rowData['sks_total'] + ';' + rowData['ips'] + ';' + rowData['ipk'] + ';' + rowData['kdstaktivitasmhs'] + ';' + rowData['kdstsemester'] + ';' + rowData['nmmhs'] + c; a= a+1; }); return par; } function renderBlue(value){ if(value == 0) return ''+value+''; else return ''+value+''; } };