// COMMON //////////////////// //GLOBAL VARIABLES //MESSAGES var msgSaveSuccess = 'Simpan data berhasil'; var msgSaveFail = 'Simpan data gagal'; var msgSaveInvalid = 'Data belum valid (data primer belum terisi)!'; //TIMER /* var rhVar=setInterval(function(){rhTimer()},1000); //for Timer setInterval(function(){ var d=new Date(); var t=d.toLocaleTimeString(); Ext.getCmp('tf.timekwi-byr').setValue(t); },1000) function rhStopTimer(){ //clearInterval(rhVar); //STOP TIMER ACTION } */ RH={version:"1.0.0",versionDetail:{major:1,minor:1,patch:0}}; RH.getVersion = function(){ return 'RH.version: 1.0.0 [Developed by RH]'; } RH.h3 = function(text, align){ var hAlign = 'center'; if(align =='c') hAlign = 'center'; if(align =='l') hAlign = 'left'; if(align =='r') hAlign = 'right'; //return "
PHOTO
', bodyStyle: 'background:#ffc; padding:0px;', /* listeners: { render: function(panel) { panel.body.on('mouseover', function() { RH.warning('get foto'); }); } } *//* listeners: { render: function () { this.getEl().dom.title = 'my custom tool tip'; } }*/ }); var tip = new Ext.ToolTip({ target: arg.id, html: 'A very simple tooltip' }); Ext.QuickTips.init(); return fpn; } RH.ShowReport = function(rpt_url){ var win = window.open(); win.location.reload(); win.location = rpt_url; } /** =======================================================================*/ RH.combo = function(cId, cLabel, cDS, cVal, cDisp, cWidth, cEditable, cAllowBlank) { var c = { xtype: 'combo', id: cId, fieldLabel: cLabel, store: cDS, triggerAction: 'all', valueField: cVal, displayField: cDisp, forceSelection: true, submitValue: true, mode: 'local',//'remote', emptyText:'Pilih...', selectOnFocus:false, width: cWidth, editable: cEditable, allowBlank: cAllowBlank, } return c; } /* //CONTOH ACTION COLUMN var AspActionColumn = Ext.extend(Ext.grid.Column, { header: 'Remove', menuDisabled: true, editable: false, sortable: false, constructor: function(cfg){ AspActionColumn.superclass.constructor.call(this, cfg); this.width = 60; this.renderer = function(value, metaData, record, rowIndex, colIndex, store) { var id = Ext.id(); var html; html = ''; this.setupOnClick.defer(1, this, [id, store, rowIndex]); return html; } }, setupOnClick: function(id, store, rowIndex) { var grid = Asp.invite.grid; var rowIndex = rowIndex; var store = store; var rowElement = grid.getView().getRow(rowIndex); Ext.fly(id).on('click', function(ev) { ev.stopEvent(); var currentIndex = grid.getView().findRowIndex(rowElement); if (confirm('Are you sure you want to delete this mentee?')) { store.removeAt(currentIndex); } }, this); } }); */ /** ========= UTILITY ======================================================= */ function terbilang(bilangan) { bilangan = String(bilangan); var angka = new Array('0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'); var kata = new Array('','Satu','Dua','Tiga','Empat','Lima','Enam','Tujuh','Delapan','Sembilan'); var tingkat = new Array('','Ribu','Juta','Milyar','Triliun'); var panjang_bilangan = bilangan.length; /* pengujian panjang bilangan */ if (panjang_bilangan > 15) { kaLimat = "Diluar Batas"; return kaLimat; } /* mengambil angka-angka yang ada dalam bilangan, dimasukkan ke dalam array */ for (i = 1; i <= panjang_bilangan; i++) { angka[i] = bilangan.substr(-(i),1); } i = 1; j = 0; kaLimat = ""; /* mulai proses iterasi terhadap array angka */ while (i <= panjang_bilangan) { subkaLimat = ""; kata1 = ""; kata2 = ""; kata3 = ""; /* untuk Ratusan */ if (angka[i+2] != "0") { if (angka[i+2] == "1") { kata1 = "Seratus"; } else { kata1 = kata[angka[i+2]] + " Ratus"; } } /* untuk Puluhan atau Belasan */ if (angka[i+1] != "0") { if (angka[i+1] == "1") { if (angka[i] == "0") { kata2 = "Sepuluh"; } else if (angka[i] == "1") { kata2 = "Sebelas"; } else { kata2 = kata[angka[i]] + " Belas"; } } else { kata2 = kata[angka[i+1]] + " Puluh"; } } /* untuk Satuan */ if (angka[i] != "0") { if (angka[i+1] != "1") { kata3 = kata[angka[i]]; } } /* pengujian angka apakah tidak nol semua, lalu ditambahkan tingkat */ if ((angka[i] != "0") || (angka[i+1] != "0") || (angka[i+2] != "0")) { subkaLimat = kata1+" "+kata2+" "+kata3+" "+tingkat[j]+" "; } /* gabungkan variabe sub kaLimat (untuk Satu blok 3 angka) ke variabel kaLimat */ kaLimat = subkaLimat + kaLimat; i = i + 3; j = j + 1; } /* mengganti Satu Ribu jadi Seribu jika diperlukan */ if ((angka[5] == "0") && (angka[6] == "0")) { kaLimat = kaLimat.replace("Satu Ribu","Seribu"); } return kaLimat + "Rupiah"; } //RH DEDEN// RH.renderBlue = function(val) { return '' + val + ''; } RH.renderGreen = function(val) { return '' + val + ''; } RH.renderBrown = function(val) { return '' + val + ''; } RH.renderRed = function(val) { return '' + val + ''; } RH.renderYellow = function(val) { return '' + val + ''; } RH.renderPurple = function(val) { return '' + val + ''; } RH.renderOrange = function(val) { return '' + val + ''; } //////////////////////// END COMMON FUNCTIONS /////////////// //////////////////////// END COMMON FUNCTIONS ///////////////