function cetak_daftar_usm() { var ds_jadwalusm = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_daftar_usm/get_jadwalusm', method: 'POST' }), totalProperty: 'results', root: 'data', autoLoad: true, fields: [{ name: 'idjadwalusm', mapping: 'idjadwalusm' },{ name: 'nmjadwalusm', mapping: 'nmjadwalusm' },{ name: 'idstmskmhs', mapping: 'idstmskmhs' },{ name: 'kdstsemester', mapping: 'kdstsemester' }] }); var idstmskmhs, kdstsemester; var ds_tempat = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_daftar_usm/get_tempat_combo', method: 'POST' }), totalProperty: 'results', root: 'data', autoLoad: false, fields: [{ name: 'idtempat', mapping: 'idtempat' },{ name: 'nmtempat', mapping: 'nmtempat' }] }); var ds_grid = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_daftar_usm/get_peserta_usm', method: 'POST', }), baseParams: { }, totalProperty: 'results', autoLoad : false, root: 'data', fields: [ { name: 'nopmb' } , { name: 'nama' } , { name: 'kdjk' } , { name: 'tmpttgllhr' } , { name: 'nmstmskmhs' } , { name: 'prodi1' } , { name: 'nmjadwalusm' } , { name: 'idjadwalusm' } , { name: 'tglusm' } , { name: "jamusm" } , { name: "tempat" } ] }); var cm = new Ext.grid.ColumnModel({ columns: [ new Ext.grid.RowNumberer({width: 35}), { header: RH.h3('No.PMB'), width: 100, dataIndex: 'nopmb', align: 'center', sortable: true }, { header: RH.h3('Nama'), width: 200, dataIndex: 'nama', sortable: true }, { header: RH.h3('(L/P)'), width: 50, dataIndex: 'kdjk', align: 'center', sortable: true }, { header: RH.h3('Tempat, Tgl.Lahir'), width: 150, dataIndex: 'tmpttgllhr', sortable: true }, { header: RH.h3('Status Pendaftar'), width: 150, dataIndex: 'nmstmskmhs', sortable: true }, { header: RH.h3('Prodi Pilihan 1'), width: 200, dataIndex: 'prodi1', sortable: true }, { header: RH.h3('Tgl.USM'), width: 100, dataIndex: 'tglusm', align: 'center', sortable: true }, { header: RH.h3('Jam USM'), width: 150, dataIndex: 'jamusm', align: 'center', sortable: true }, { header: RH.h3('Tempat / Ruangan'), width: 300, dataIndex: 'tempat', align: 'left', sortable: true }] }); var cari_data_nya = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 150 })]; var grid_nya = new Ext.grid.GridPanel({ id: 'gp.dftrusm', plugins: cari_data_nya, ds: ds_grid, cm: cm, sm: new Ext.grid.RowSelectionModel({ singleSelect: true}), view: new Ext.grid.GridView({ emptyText: '< Belum ada Data >'}), forceFit: true, //autoHeight: true, width: 720, tbar: [{ xtype: 'button', id: 'btn_peserta', iconCls: 'silk-printer', text: ' Cetak Daftar Peserta', handler: function() { GetReport('daftarpeserta'); } },{ xtype: 'button', id: 'btn_peserta_excel', iconCls: 'silk-save', text: ' Excel Daftar Peserta', handler: function() { GetExcel('daftarpeserta'); } },'-',{ xtype: 'button', id: 'btn_hadir', iconCls: 'silk-printer', text: ' Cetak Daftar Hadir', handler: function() { GetReport('daftarhadir'); } },{ xtype: 'button', id: 'btn_hadir_excel', iconCls: 'silk-save', text: ' Excel Daftar Hadir', handler: function() { GetExcel('daftarhadir'); } },{ xtype: 'combo', store: ds_tempat, name: 'cbtempat', id: 'cbtempat', triggerAction: 'all', editable: true, valueField: 'idtempat', displayField: 'nmtempat', forceSelection: true, submitValue: true, hiddenName: 'h_cbtempat', listeners: { select: function() { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih Tempat / Ruangan...', selectOnFocus: true, width: 250, disabled: true },'->','-',{ xtype: 'button', id: 'btn_add_susulan', iconCls: 'silk-add', text: 'Tambah Peserta Susulan', handler: function() { var cbjadwalusm = Ext.getCmp('cbjadwalusm'); if (cbjadwalusm.getValue()) { AddSusulan(grid_nya, cbjadwalusm, kdstsemester, idstmskmhs); } else { Ext.MessageBox.alert("Informasi", "Pilih Jadwal USM"); } } }], //bbar:[], frame:false, autoScroll: true, autoSizeColumns: true, enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, layout: 'anchor', }); var form_bp_general = new Ext.Panel({ autoWidth: true, title: 'Cetak Daftar Peserta USM', id: 'fp.dftrusm', layout: 'form', forceFit: true, autoScroll: true, margin: '0 0 10', frame: true, tbar: [{ text: 'Jadwal USM :', },{ xtype: 'combo', store: ds_jadwalusm, name: 'cbjadwalusm', id: 'cbjadwalusm', triggerAction: 'all', editable: false, valueField: 'idjadwalusm', displayField: 'nmjadwalusm', forceSelection: true, submitValue: true, hiddenName: 'h_cbjadwalusm', listeners: { select: function(combo, records) { idstmskmhs = records.data['idstmskmhs']; kdstsemester = records.data['kdstsemester']; setTempat(idstmskmhs); } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 300 },{ xtype: 'button', text: ' Cari ', iconCls: 'silk-find', id: 'btn_data', width: 3, handler: function() { setGridDftrUsm(); } }], defaults: { labelWidth: 200, labelAlign: 'right'}, items: [ { region: 'center', layout:'form', autoScroll:true, items:[{ xtype: 'panel', layout:'fit', height:510, id:'fp.usm', frame:true, items: [grid_nya] }] } ] }) function setTempat(idstmskmhs){ Ext.getCmp('cbtempat').disable(); Ext.getCmp('cbtempat').setValue(); ds_tempat.setBaseParam('idstmskmhs',idstmskmhs); ds_tempat.reload({ callback: function(results){ Ext.getCmp('cbtempat').enable(); } }); } function setGridDftrUsm(){ var idjadwalusm = RH.getCompValue('cbjadwalusm'); if(!idjadwalusm) return; ds_grid.setBaseParam('idjadwalusm', idjadwalusm); ds_grid.setBaseParam('idstmskmhs', idstmskmhs); ds_grid.reload(); } function GetReport(vtype){ var idjadwalusm = RH.getCompValue('cbjadwalusm'); if(!idjadwalusm) return; if(grid_nya.getStore().getCount()==0) return; if (vtype=='daftarpeserta') { RH.ShowReport(BASE_URL + 'print/pdaftarusm/'+vtype+'/'+idjadwalusm+'/'+idstmskmhs); } else if (vtype=='daftarhadir') { var idtempat = RH.getCompValue('cbtempat'); if(!idtempat) { Ext.MessageBox.alert("Informasi", "Pilih Tempat"); return }; RH.ShowReport(BASE_URL + 'print/pdaftarusm/'+vtype+'/'+idjadwalusm+'/'+idstmskmhs+'/'+idtempat); } } function GetExcel(vtype){ var idjadwalusm = RH.getCompValue('cbjadwalusm'); if(!idjadwalusm) return; if(grid_nya.getStore().getCount()==0) return; if (vtype=='daftarpeserta') { window.location.reload(); window.location = BASE_URL + 'pendaftaran/c_daftar_usm/export_excel_daftarusm/'+idjadwalusm+'/'+idstmskmhs; } else if (vtype=='daftarhadir') { var idtempat = RH.getCompValue('cbtempat'); if(!idtempat) { Ext.MessageBox.alert("Informasi", "Pilih Tempat"); return }; window.location.reload(); window.location = BASE_URL + 'pendaftaran/c_daftar_usm/export_excel_daftarusm/'+idjadwalusm+'/'+idstmskmhs+'/'+idtempat; } } function AddSusulan(gridm, cbjadwalusm, kdstsemester, idstmskmhs){ var idstmskmhs2; var ds_jadwalusm2 = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_daftar_usm/get_jadwalusm_not', method: 'POST' }), baseParams: { idjadwalusmnow : cbjadwalusm.getValue(), idstmskmhs : idstmskmhs, kdstsemester : kdstsemester }, totalProperty: 'results', root: 'data', autoLoad: true, fields: [{ name: 'idjadwalusm', mapping: 'idjadwalusm' },{ name: 'nmjadwalusm', mapping: 'nmjadwalusm' },{ name: 'idstmskmhs', mapping: 'idstmskmhs' }] }); var ds_ruangan = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_mappingruanganpmb/get_ruanganpriv', method: 'POST' }), totalProperty: 'results', root: 'data', autoLoad: true, fields: [{ name: 'idruangan', mapping: 'idruangan' },{ name: 'nmruangan', mapping: 'nmruangan' }] }); var ds_grid2 = new Ext.data.JsonStore({ proxy: new Ext.data.HttpProxy({ url: BASE_URL + 'pendaftaran/c_daftar_usm/get_peserta_usm_susulan', method: 'POST', }), baseParams: { }, totalProperty: 'results', autoLoad : false, root: 'data', fields: [ { name: 'nopmb' } , { name: 'nama' } , { name: 'kdjk' } , { name: 'tmpttgllhr' } , { name: 'nmstmskmhs' } , { name: 'prodi1' } , { name: 'iscek', type: 'bool' } , { name: "idruangan" } , { name: "tempat" } ] }); function render_ruangan(value) { var fValue = ''; var index = ds_ruangan.find('idruangan', value); if(index != -1)//the record has been found { var record = ds_ruangan.getAt(index); fValue = record.data['nmruangan'];// } return fValue; } var cm2 = new Ext.grid.ColumnModel({ columns: [ new Ext.grid.RowNumberer({width: 35}), { header: RH.h3('No.PMB'), width: 100, dataIndex: 'nopmb', align: 'center', sortable: true }, { header: RH.h3('Nama'), width: 200, dataIndex: 'nama', sortable: true }, { header: RH.h3('(L/P)'), width: 50, dataIndex: 'kdjk', align: 'center', sortable: true }, { header: RH.h3('Tempat, Tgl.Lahir'), width: 150, dataIndex: 'tmpttgllhr', sortable: true }, { header: RH.h3('Status Pendaftar'), width: 150, dataIndex: 'nmstmskmhs', sortable: true }, { header: RH.h3('Prodi Pilihan 1'), width: 200, dataIndex: 'prodi1', sortable: true }, { header: RH.h3('Ruangan'), width: 300, dataIndex: 'idruangan', align: 'left', sortable: true, hidden: (idstmskmhs==2) ? true:false, renderer: render_ruangan, editor: { xtype: 'combo', allowBlank: true, store: ds_ruangan, name: 'cmbruangan', triggerAction: 'all', id: 'cmbruangan', valueField: 'idruangan', displayField: 'nmruangan', forceSelection: true, submitValue: true, hiddenName: 'h_cmbruangan', listeners: { select: function(cb, record) { } }, typeAhead: true, mode: 'local', emptyText: 'Pilih Ruangan...', selectOnFocus: true } }, { header: RH.h3('Tempat'), width: 300, dataIndex: 'tempat', align: 'left', sortable: true, hidden: (idstmskmhs==2) ? false:true },{ xtype: 'checkcolumn', header: RH.h3('Pilih'), width: 50, dataIndex: 'iscek', sortable: true, processEvent : function(name, e, grid, rowIndex, colIndex){ if (name == 'mousedown') { var record = grid.store.getAt(rowIndex); if (idstmskmhs==2){ record.set(this.dataIndex, !record.data[this.dataIndex]); } else { if (!record.data['idruangan']) { return; } record.set(this.dataIndex, !record.data[this.dataIndex]); } } } }] }); var cari_data_nya2 = [new Ext.ux.grid.Search({ iconCls: 'btn_search', minChars: 1, autoFocus: true, autoHeight: true, position: 'top', mode: 'local', width: 200 })]; var grid_nya2 = new Ext.grid.EditorGridPanel({ id: 'gp.dftrusm2', plugins: cari_data_nya2, ds: ds_grid2, cm: cm2, //sm: new Ext.grid.RowSelectionModel({ singleSelect: true}), view: new Ext.grid.GridView({ emptyText: '< Belum ada Data >'}), forceFit: true, //autoHeight: true, width: 720, tbar: [{ text: 'Jadwal USM Sekarang: ' + cbjadwalusm.getRawValue() + '', },'->',{ text: 'Pilih Jadwal USM :', },{ xtype: 'combo', store: ds_jadwalusm2, name: 'cbjadwalusm2', id: 'cbjadwalusm2', triggerAction: 'all', editable: false, valueField: 'idjadwalusm', displayField: 'nmjadwalusm', forceSelection: true, submitValue: true, hiddenName: 'h_cbjadwalusm', listeners: { select: function(combo, records) { idstmskmhs2 = records.data['idstmskmhs']; } }, typeAhead: true, mode: 'local', emptyText: 'Pilih...', selectOnFocus: true, width: 300 },{ xtype: 'button', text: ' Cari ', iconCls: 'silk-find', id: 'btn_data', width: 3, handler: function() { var idjadwalusm2 = RH.getCompValue('cbjadwalusm2'); if(!idjadwalusm2) return; ds_grid2.setBaseParam('idjadwalusmselect', cbjadwalusm.getValue()); ds_grid2.setBaseParam('idjadwalusm', idjadwalusm2); ds_grid2.setBaseParam('idstmskmhs', idstmskmhs2); ds_grid2.reload(); } },{ xtype: 'button', id: 'save_susulan', iconCls: 'silk-save', text: 'Simpan', handler: function() { if (grid_nya2.getStore().getCount()>0) { save_susulan(); } else { Ext.MessageBox.alert("Informasi", "Data Belum Dipilih"); } } }], //bbar:[], autoSizeColumns: true, enableColumnResize: true, enableColumnHide: false, enableColumnMove: false, enableHdaccess: false, columnLines: true, loadMask: true, layout: 'anchor', }); var win = new Ext.Window({ title: 'Daftar Peserta Susulan', modal: true, height: 400, width: 1300, layout: 'fit', items: [grid_nya2] }).show(); function save_susulan() { var par=''; var a= 1; var endpar = ';'; grid_nya2.getStore().each(function(rec){ var rowData = rec.data; // get record var idruangan = (rowData['idruangan']) ? rowData['idruangan'] : 0; var iselect = (rowData['iscek']) ? 1 : 0; if (a == grid_nya2.getStore().getCount()) { endpar = '' } par += rowData['nopmb'] + 'x' + cbjadwalusm.getValue() + 'x' + idruangan + 'x' + iselect + 'x' + endpar; a= a+1; }); var waitmsgload = Ext.MessageBox.wait('Menyimpan Data...', 'Info'); Ext.Ajax.request({ url: BASE_URL + 'pendaftaran/c_daftar_usm/save_susulan', params: { idstmskmhs: idstmskmhs, par_susulan: par }, success: function() { waitmsgload.hide(); Ext.MessageBox.alert("Informasi", "Simpan Data Berhasil"); grid_nya2.getStore().reload(); gridm.getStore().reload(); }, failure: function() { waitmsgload.hide(); Ext.MessageBox.alert("Informasi", "Simpan Data Gagal"); } }); } } get_content(form_bp_general); }