function feederNilai() { /** COMMON STORES */ /* ket : idkelas = idkelas perkuliahan di SIAK nmkelas = nama kelas perkuliahan di SIAK id_kls = id uniq kelas di feeder nm_kls = nama kelas di feeder idkelas (id kelas siak) == nm_kls (nama kelas feeder) */ var ds_nilai = new Ext.data.JsonStore({ //static data fields: [ 'id_kls', 'id_mk', 'id_reg_pd', 'id_sms', 'id_smt', 'is_update', 'kd_mk', 'nilai_angka', 'nilai_huruf', 'nilai_indeks', 'nim', 'nm_kelas', 'nm_mhs', 'nm_mk' ], data: [] }); var uploadexcelform = new Ext.FormPanel({ fileUpload: true, width: 800, autoHeight: true, layout: 'form', bodyStyle: 'padding: 10px 10px 10px 10px;', labelWidth: 60, defaults: { allowBlank: false, msgTarget: 'side' }, items:[ { xtype:'compositefield', items:[ { xtype: 'fileuploadfield', id: 'excelnilai', name: 'excelnilai', emptyText: 'Upload nilai mahasiswa (excel)', width:300, fieldLabel: 'File ', buttonText: ' Browse ', },{ xtype:'button', text:'Upload', iconCls: 'silk-accept', margins:'0 0 0 15', handler: function(){ if(uploadexcelform.getForm().isValid()){ ds_nilai.clearData(); Ext.getCmp('btn_export_to_feeder').disable(); form_action=1; uploadexcelform.getForm().submit({ url: BASE_URL + 'feeder/feedernilai_controller/upload_excel', waitMsg: 'Mengupload data ', success: function(form,action){ //add data to grid obj = Ext.util.JSON.decode(action.response.responseText); if(obj.success){ var dt_nilai = obj.data; var mapNilai = new Ext.data.Record.create([ { name: 'id_kls', name: 'id_mk', name: 'id_reg_pd', name: 'id_sms', name: 'id_smt', name: 'is_update', name: 'kd_mk', name: 'nilai_angka', name: 'nilai_huruf', name: 'nilai_indeks', name: 'nim', name: 'nm_kelas', name: 'nm_mhs', name: 'nm_mk' } ]); //loop data nilai for (i = 0; i < dt_nilai.length; i++) { var cur_nilai = dt_nilai[i]; ds_nilai.add([ new mapNilai({ 'id_kls' : cur_nilai.id_kls, 'id_mk' : cur_nilai.id_mk, 'id_reg_pd' : cur_nilai.id_reg_pd, 'id_sms' : cur_nilai.id_sms, 'id_smt' : cur_nilai.id_smt, 'is_update' : cur_nilai.is_update, 'kd_mk' : cur_nilai.kd_mk, 'nilai_angka' : cur_nilai.nilai_angka, 'nilai_huruf' : cur_nilai.nilai_huruf, 'nilai_indeks': cur_nilai.nilai_indeks, 'nim' : cur_nilai.nim, 'nm_kelas' : cur_nilai.nm_kelas, 'nm_mhs' : cur_nilai.nm_mhs, 'nm_mk' : cur_nilai.nm_mk, }) ]); } check = ds_nilai.getCount(); if(check > 0){ Ext.getCmp('btn_export_to_feeder').enable(); }else{ Ext.getCmp('btn_export_to_feeder').disable(); } //show error if any var dt_error = obj.errors; var errmsg = ''; if(dt_error.length > 0){ for (i = 0; i < dt_error.length; i++) { curr_error = dt_error[i]; errmsg += curr_error+"
"; } Ext.MessageBox.alert('Informasi',errmsg); } }else{ if(obj.message){ Ext.MessageBox.alert('Informasi',obj.message); }else{ Ext.MessageBox.alert('Informasi','Data gagal di export'); } } } }); } } },{ xtype: 'button', id: 'btn_export_to_feeder', margins:'0 0 0 15', iconCls: 'silk-save', text: ' Export To Feeder', disabled: true, handler: function() { export_to_feeder(); } }] }], }); /** FUNCTION for GRID COLUMN EDITOR */ /** GRID COLUMN MODEL */ var cm_nilai = new Ext.grid.ColumnModel([ new Ext.grid.RowNumberer({width: 30}), //for rows numbering { header: headerGerid('NIM'), width: 100, dataIndex: 'nim', sortable: true, },{ header: headerGerid('Nama Mahasiswa'), width: 100, dataIndex: 'nm_mhs', sortable: true, },{ header: headerGerid('Kode Mata Kuliah'), width: 100, dataIndex: 'kd_mk', sortable: true, },{ header: headerGerid('Nama Mata Kuliah'), width: 100, dataIndex: 'nm_mk', sortable: true, },{ header: headerGerid('Nama Kelas Perkuliahan'), width: 100, dataIndex: 'nm_kelas', sortable: true, },{ header: headerGerid('Semester'), width: 100, dataIndex: 'id_smt', sortable: true, },{ header: headerGerid('Nilai Angka'), width: 100, dataIndex: 'nilai_angka', sortable: true, },{ header: headerGerid('Nilai Huruf'), width: 100, dataIndex: 'nilai_huruf', sortable: true, },{ header: headerGerid('Nilai Indeks'), width: 100, dataIndex: 'nilai_indeks', sortable: true, },] ); var grid_nilai = new Ext.grid.EditorGridPanel({ id: 'grid_nilai', store: ds_nilai, autoSizeColumns: true, enableColumnResize: true, view: new Ext.grid.GridView({emptyText: '< Belum ada Data >'}), cm: cm_nilai, frame: true, loadMask: true, height: 400, layout: 'anchor', style: 'padding-bottom:5px', }); var fp_nilai_mahasiswa = RH.GPContainer1_wHeaders({ title: 'Export Nilai Mahasiswa', iconCls:'silk-book', gridPanel: grid_nilai, headerLabelWidth: 60, headers: [{ xtype: 'container', layout: 'hbox', items:[{ layout:'form', labelWidth:60, labelAlign:'right', items: [ uploadexcelform, { xtype: 'tbtext', style:'font-size:12px;padding:10px;', id: 'info', text: 'Keterangan :
'+ 'Semester diisi dengan ID Semester. Lihat ID semester disini.
'+ 'Silahkan download format data nilai disini ' } ] }] }], }); SET_PAGE_CONTENT(fp_nilai_mahasiswa); function export_to_feeder(){ var waitmsg = Ext.MessageBox.wait('Mengirim data ke aplikasi Feeder...', 'Info'); var dt_nilai = []; for(var zx = 0; zx < ds_nilai.data.items.length; zx++){ var record = ds_nilai.data.items[zx].data; dt_nilai[zx] = record; } Ext.Ajax.request({ url: BASE_URL + 'feeder/feedernilai_controller/export_to_feeder', params: { json_nilai : Ext.encode(dt_nilai) }, success: function(response){ waitmsg.hide(); obj = Ext.util.JSON.decode(response.responseText); if(obj.success === true){ Ext.MessageBox.alert('Informasi','Berhasil mengekspor data nilai ke aplikasi feeder.'); //ds_nilai.clearData(); ds_nilai.removeAll(); Ext.getCmp('btn_export_to_feeder').disable(); }else{ Ext.MessageBox.alert('Informasi',obj.message); } } }); } } function headerGerid(text, align){ var hAlign = 'center'; if(align =='c') hAlign = 'center'; if(align =='l') hAlign = 'left'; if(align =='r') hAlign = 'right'; return "

"+text+"

"; } function show_list_semester(){ var ds_semester = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'feeder/feedermahasiswa_controller/get_semester', method: 'POST' }), root: 'result', totalProperty: 'total', autoLoad: true, fields:[ { name: 'id_smt', mapping: 'id_smt'}, { name: 'id_thn_ajaran', mapping: 'id_thn_ajaran'}, { name: 'nm_smt', mapping: 'nm_smt'}, { name: 'smt', mapping: 'smt' }, { name: 'a_periode_aktif', mapping: 'a_periode_aktif'}, { name: 'tgl_mulai', mapping: 'tgl_mulai'}, { name: 'tgl_selesai', mapping: 'tgl_selesai'}] }); var grid_semester = new Ext.grid.GridPanel({ id: 'grid_semester', store: ds_semester, autoScroll: true, frame: true, height:480, loadMask: true, columnLines: true, columns: [ { header: headerGerid('ID Semester'), width: 100, dataIndex: 'id_smt', sortable: true, },{ header: headerGerid('Tahun Ajaran'), width: 150, dataIndex: 'id_thn_ajaran', sortable: true, },{ header: headerGerid('Nama Semester'), width: 200, dataIndex: 'nm_smt', sortable: true, }] }); var semester_form = new Ext.form.FormPanel({ xtype:'form', id: 'frm.semester', buttonAlign: 'left', labelWidth: 165, labelAlign: 'right', monitorValid: true, height: 500, width: 500, layout: { type: 'form', pack: 'center', align: 'center' }, frame: true, items: [grid_semester] }); var wSemester = new Ext.Window({ title: 'Daftar Semester', modal: true, closable:true, items: [semester_form] }); wSemester.show(); }