var paramCodecEnabled=false; let idleInterval=null; let idleIntervalReactivaSession=null; let sesionIniciada=false; let arrExtensionesComunes= [ ['Documentos de MS Word','doc'], ['Documentos de MS Word','docx'], ['Documentos PDF','pdf'], ['Documentos de MS Excel','xls'], ['Documentos de MS Excel','xlsx'], ['Archivos de imagen','jpg'], ['Archivos de imagen','png'], ['Archivos de imagen','gif'], ['Archivos de imagen','bmp'], ['Archivos de imagen','tif'], ['Archivos de Video','mpg'], ['Archivos de Video','avi'], ['Archivos de Video','mov'], ['Archivos de Video','flv'], ['Archivos de Video','3gp'], ['Archivos de Video','mp4'], ['Archivos de Video','div'], ['Archivos de Video','divx'], ['Archivos de Audio','mp3'], ['Archivos de Audio','wav'], ['Archivos de Audio','midi'], ['Archivos de Audio','wma'] ]; let arrVisores= [ ['pdf','pdf_viewerBusqueda.php'], ['pdf.aes','pdf_viewerBusqueda.php'], ['jpg.aes','images_viewer.php'], ['mp4.aes','video_viewer.php'], ['tif.aes','images_viewer.php'], ['tif','images_viewer.php'], ['doc','pdf_viewer.php'], ['docx','pdf_viewer.php'], ['png','images_viewer.php'], ['gif','images_viewer.php'], ['jpg','images_viewer.php'], ['jpeg','images_viewer.php'], ['mp3','audioViewer_viewer.php'], ['wav','audioViewer_viewer.php'], ['ogg','audioViewer_viewer.php'], ['mp4','video_viewer.php']/*, ['avi','video_viewer.php'], ['3gp','video_viewer.php'], ['flv','video_viewer.php'], ['mov','video_viewer.php'], ['mpg','video_viewer.php'], ['mpeg','video_viewer.php']*/ ]; let msgEspereAux=null; let limpiarValorControl=true; let lblAplicacion='SISTEMA CRÉDITO'; let arrDias=new Array(); arrDias[0]='Domingo'; arrDias[1]='Lunes'; arrDias[2]='Martes'; arrDias[3]='Mi\xE9rcoles'; arrDias[4]='Jueves'; arrDias[5]='Viernes'; arrDias[6]='Sábado'; let matrizDias=new Array(); matrizDias[0]=['0','Domingo']; matrizDias[1]=['1','Lunes']; matrizDias[2]=['2','Martes']; matrizDias[3]=['3','Mi\xE9rcoles']; matrizDias[4]=['4','Jueves']; matrizDias[5]=['5','Viernes']; matrizDias[6]=['6','Sábado']; let arrMeses=[['1','Enero'],['2','Febrero'],['3','Marzo'],['4','Abril'],['5','Mayo'],['6','Junio'],['7','Julio'],['8','Agosto'],['9','Septiembre'],['10','Octubre'],['11','Noviembre'],['12','Diciembre']]; Ext.override(Ext.grid.GroupingView, { doRender : function(cs, rs, ds, startRow, colCount, stripe) { if(rs.length < 1) { return ''; } if(!this.canGroup() || this.isUpdating) { return Ext.grid.GroupingView.superclass.doRender.apply(this, arguments); } let groupField = this.getGroupField(), colIndex = this.cm.findColumnIndex(groupField), g, gstyle = 'width:' + this.getTotalWidth() + ';', cfg = this.cm.config[colIndex], groupRenderer = cfg.groupRenderer || cfg.renderer, prefix = this.showGroupName ? (cfg.groupName || cfg.header)+': ' : '', groups = [], curGroup, i, len, gid; for(i = 0, len = rs.length; i < len; i++){ let rowIndex = startRow + i, r = rs[i], gvalue = r.data[groupField]; g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds); if(!curGroup || curGroup.group != g) { let pos=-1; let x; for(x=0;x -1; Ext.ux.IFrameComponent = Ext.extend(Ext.BoxComponent,{ creado:false, objConf:null, myMask : null, cerrarMask:function() { this.myMask.hide(); }, mostrarMascara:function() { }, ocultarMascara:function() { }, ocultarMascaraManual:function() { let mascara=document.getElementById('dMask'); if(mascara) { mascara.parentNode.removeChild(mascara); mascara=document.getElementById('dMask2'); mascara.parentNode.removeChild(mascara); } }, onRender: function (ct, position) { let ctrlThis=this; if(this.params==undefined) this.params={}; if(!this.creado) { let objConf={tag:'iframe', id: 'iframe-'+ this.id, name:'iframe-'+ this.id, frameBorder:0, src:'',style:'overflow:scroll !important; -webkit-overflow-scrolling:touch !important;'}; this.el = ct.createChild(objConf); let iFrame=document.getElementById( 'iframe-'+ this.id); asignarEvento(iFrame,'load',function() { ctrlThis.myMask.hide(); } ); if(this.loadFuncion) { let iFrame=document.getElementById( 'iframe-'+ this.id); asignarEvento(iFrame,'load',this.loadFuncion); } let arrParam=[]; let obj; if(this.params!=undefined) { for(campo in this.params) { obj=[campo,this.params[campo]]; arrParam.push(obj); } } enviarFormularioDatos(this.url,arrParam,'POST','iframe-'+this.id); this.myMask={ show:function() { ctrlThis.mostrarMascara('iframe-'+ctrlThis.id); }, hide:function() { ctrlThis.ocultarMascara('iframe-'+ctrlThis.id); } } } this.creado=true; }, onShow:function() { }, getFrameWindow:function() { if(document.getElementById( 'iframe-'+ this.id)) return document.getElementById( 'iframe-'+ this.id).contentWindow; return null; }, getFrameDocument:function() { let iFrame=document.getElementById( 'iframe-'+ this.id); if(iFrame.contentDocument) return iFrame.contentDocument; if(this.getFrameWindow().document) return this.getFrameWindow().document; }, load:function(objParams) { let metodo='POST'; if(objParams.metodo) metodo=objParams.metodo; autoScroll=0; let ctrlThis=this; this.objConf=objParams; let arrParam=[]; let obj; if(objParams.params!=undefined) { for(campo in objParams.params) { obj=[campo,objParams.params[campo]]; arrParam.push(obj); } } //ctrlThis.myMask.show(); enviarFormularioDatos(objParams.url,arrParam,metodo,'iframe-'+this.id); }, reload:function() { this.load(this.objConf); } }); Ext.override(Ext.form.TextField, { // vtype=email validation problem for opera filterKeys : function(e){ let k = e.getKey(); if(e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1)) return; let c = e.getCharCode(), cc = String.fromCharCode(c); if(!Ext.isGecko && e.isSpecialKey() && !cc) return; if(!this.maskRe.test(cc)) e.stopEvent(); } }); if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment) { Range.prototype.createContextualFragment = function(html) { let frag = document.createDocumentFragment(), div = document.createElement("div"); frag.appendChild(div); div.outerHTML = html; return frag; } } Ext.override(Ext.grid.GridView, { afterRenderUI: function() { let grid = this.grid; this.initElements(); Ext.fly(this.innerHd).on('click', this.handleHdDown, this); this.mainHd.on({ scope : this, mouseover: this.handleHdOver, mouseout : this.handleHdOut, mousemove: this.handleHdMove }); this.scroller.on('scroll', this.syncScroll, this); if (grid.enableColumnResize !== false) { this.splitZone = new Ext.grid.GridView.SplitDragZone(grid, this.mainHd.dom); } if (grid.enableColumnMove) { this.columnDrag = new Ext.grid.GridView.ColumnDragZone(grid, this.innerHd); this.columnDrop = new Ext.grid.HeaderDropZone(grid, this.mainHd.dom); } if (grid.enableHdMenu !== false) { this.hmenu = new Ext.menu.Menu({id: grid.id + '-hctx'}); this.hmenu.add( {itemId:'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'}, {itemId:'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'} ); if (grid.enableColumnHide !== false) { this.colMenu = new Ext.menu.Menu({id:grid.id + '-hcols-menu'}); this.colMenu.on({ scope : this, beforeshow: this.beforeColMenuShow, itemclick : this.handleHdMenuClick }); this.hmenu.add('-', { itemId:'columns', hideOnClick: false, text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon' }); } this.hmenu.add( {itemId:'excel', cls:'btnExport', text: 'Exportar a Excel', handler:function(){grid.funcionExportarExcel()}} ) this.hmenu.on('itemclick', this.handleHdMenuClick, this); } if (grid.trackMouseOver) { this.mainBody.on({ scope : this, mouseover: this.onRowOver, mouseout : this.onRowOut }); } if (grid.enableDragDrop || grid.enableDrag) { this.dragZone = new Ext.grid.GridDragZone(grid, { ddGroup : grid.ddGroup || 'GridDD' }); } this.updateHeaderSortState(); } } ) Ext.override(Ext.grid.GridPanel, { funcionExportarExcel:function() { if(typeof(funcExportacionExcel)=='undefined') { this.exportarExcel(); } else funcExportacionExcel(); }, exportarExcel:function(nPlantilla,lineaI,letraI,cargarPlantilla) { let x; let fila; let cadDatos=''; let cadEncabezados=''; let cm=this.getColumnModel(); let col; let arrEncabezado=new Array(); let obj={}; let datosTotal=new Array(); let filaDatos=new Array(); for(x=0;x'); valor=arrDatos[1]; arrDatos=valor.split('= 48 && key <= 57)); } // function msgBox(mensaje,fun,icono,titulo) { if(typeof(msgPersonalizado)!='undefined') { let icono='info'; if((mensaje.indexOf('éxito')!=-1)||(mensaje.indexOf('éxito')!=-1)||(mensaje.indexOf('exitosamente')!=-1)||(mensaje.indexOf('correctamente')!=-1)||(mensaje.indexOf('satisfactoriamente')!=-1)) icono='accept'; if((mensaje.indexOf('?')!=-1)||(mensaje.indexOf('¿')!=-1)) icono='question'; if((mensaje.indexOf('error')!=-1)||(mensaje.indexOf('siguiente problema')!=-1)) icono='error'; msgPersonalizado(mensaje,fun,icono); return; } funcion =fun; if(fun==undefined) funcion=null let ICONO=Ext.MessageBox.WARNING; if(icono) ICONO=icono; Ext.MessageBox.show( { title: !titulo?lblAplicacion:titulo, msg: mensaje, buttons: Ext.MessageBox.OK, icon: ICONO, fn:funcion } ); } function msgBoxWin(mensaje,resp,ancho,alto) { let alt=140; if(alto!=undefined) alt=alto; let anch=420; if(ancho!=undefined) anch=ancho; let ventanaAM = new Ext.Window( { title: lblAplicacion, width: anch, height:alt, layout: 'absolute', plain:true, modal:true, border:false, bodyStyle:'padding:3px;color:blue', buttonAlign:'center', items: { xtype:'label', html:'
'+mensaje+'
', x:10, y:20 }, listeners : { show : { buffer : 10, fn : function() { } } }, buttons: [ { text: 'OK', handler: function() { resp(); ventanaAM.close(); } } ] } ); ventanaAM.show(); } function msgConfirm(mensaje,resp,icono,titulo) { if(typeof(msgPersonalizadoConfirm)!='undefined') { let icono='info'; if((mensaje.indexOf('éxito')!=-1)||(mensaje.indexOf('éxito')!=-1)||(mensaje.indexOf('exitosamente')!=-1)||(mensaje.indexOf('correctamente')!=-1)||(mensaje.indexOf('satisfactoriamente')!=-1)) icono='accept'; if((mensaje.indexOf('?')!=-1)||(mensaje.indexOf('¿')!=-1)) icono='question'; if((mensaje.indexOf('error')!=-1)||(mensaje.indexOf('siguiente problema')!=-1)) icono='error'; msgPersonalizadoConfirm(mensaje,resp,icono); return; } Ext.MessageBox.show( { title: lblAplicacion, msg: mensaje, buttons: Ext.MessageBox.YESNO, icon: Ext.MessageBox.QUESTION, fn:resp } ); } function msgConfirmWin(mensaje,resp,ancho,alto) { let alt=140; if(alto!=undefined) alt=alto; let anch=420; if(ancho!=undefined) anch=ancho; let ventanaAM = new Ext.Window( { title: lblAplicacion, width: anch, height:alt, layout: 'absolute', plain:true, modal:true, border:false, bodyStyle:'padding:3px;color:blue', buttonAlign:'center', items: { xtype:'label', html:'
'+mensaje+'
', x:10, y:20 }, listeners : { show : { buffer : 10, fn : function() { } } }, buttons: [ { text: 'Yes', handler: function() { resp('yes'); ventanaAM.close(); } }, { text: 'No', handler:function() { resp('no'); ventanaAM.close(); } } ] } ); ventanaAM.show(); } //formato a controles function marcarCampo(obj)//fondo de un color { obj.style.background='#FFd2dC'; obj.style.backgroundColor='#FFd2dC'; } function desmarcarCampo(obj)//quitarle el color { obj.style.background='#FFFFFF'; obj.style.backgroundColor='#FFFFFF'; } //funciones de arbol function limpiarNodo(nodo) { while(nodo.hasChildNodes()) { nodo.removeChild(nodo.item(0)); } } function obtenerNodoSel(raiz) { let z=0; let enc=false; let nodoSel=null; while((z 0) combo.remove(0); } function crearRichText(idCtrl,divDestino,ancho,alto,conf,valor) { let div = document.getElementById(divDestino); let vTexto=''; if (valor!=undefined) vTexto=valor; let configuracion="../fckconfig.js"; if((conf!='')&&(conf!=undefined)) configuracion=conf; let confRichText= { Name:idCtrl, Width:ancho, Height:alto, Value:vTexto, config:configuracion } let richText=new Ext.ux.FCKeditor(confRichText); let Panel=new Ext.Panel ( { id:'panel_'+idCtrl, renderTo:divDestino, items:[richText] } ) return richText; } function crearCampoHora(idControlDestino,hiddenValor,horaMinima,horaMaxima,interval,objComp) { hMinima='00:00'; hMaxima='23:59'; if(horaMaxima!=undefined) hMaxima=horaMaxima; if(horaMinima!=undefined) hMinima=horaMinima; intervalo=15; if(interval!=undefined) intervalo=interval; let arrHInicial=hMinima.split(':'); let arrHFinal=hMaxima.split(':'); let horaInicial=new Date(2010,5,10,parseInt(arrHInicial[0]),parseInt(arrHInicial[1])); let horaFinal=new Date(2010,5,10,parseInt(arrHFinal[0]),parseInt(arrHFinal[1])); if(horaInicial>horaFinal) { let temp=horaInicial; horaInicial=horaFinal; horaFinal=temp; } let arrHoras=generarIntervaloHoras(horaInicial,horaFinal,intervalo); function funcHoraCamb(campo,nuevoV,viejoV) { if(hiddenValor) gE(hiddenValor).value=nuevoV; } let hora=crearComboExtFormulario(idControlDestino,hiddenValor,arrHoras,objComp); hora.setWidth(110); if(objComp && objComp.width) { hora.setWidth(objComp.width); } let hHora=gE(hiddenValor); hora.setValue(hHora.value); hora.on('change',funcHoraCamb); return hora; } function crearCampoHoraExt(idControl,horaMinima,horaMaxima,interval,esGrid,objComp,posX,posY,ancho) { hMinima='00:00'; hMaxima='23:59'; if(horaMaxima!=undefined) hMaxima=horaMaxima; if(horaMinima!=undefined) hMinima=horaMinima; intervalo=15; if(interval!=undefined) intervalo=interval; let arrHInicial=hMinima.split(':'); let arrHFinal=hMaxima.split(':'); let horaInicial=new Date(2010,5,10,parseInt(arrHInicial[0]),parseInt(arrHInicial[1])); let horaFinal=new Date(2010,5,10,parseInt(arrHFinal[0]),parseInt(arrHFinal[1])); let arrHoras=generarIntervaloHoras(horaInicial,horaFinal,intervalo); let hora; if(!esGrid) { if(!posX) posX=0; if(!posY) posY=0; if(!ancho) ancho=120; hora=crearComboExt(idControl,arrHoras,posX,posY,ancho,objComp); } else { if(objComp) objComp.transform=false; hora=crearComboExt(idControl,arrHoras,0,0,null,objComp); } return hora; } function crearCampoFecha(idControlDestino,hiddenValor,minimaFecha,maximaFecha,funcChange,objComp) { minFecha=null; maxFecha=null; if(maximaFecha) maxFecha=maximaFecha; if(minimaFecha) minFecha=minimaFecha; function funcFechaCamb(campo,nuevoV,viejoV) { let minFecha=''; let maxFecha=''; if(minimaFecha!='null') { minFecha=Date.parseDate(minimaFecha,'Y-m-d'); if(nuevoVmaxFecha) { function resp2() { campo.setValue(viejoV); campo.focus(); } msgBox('La fecha ingresada '+nuevoV.format('d/m/Y')+' es mayor que la fecha máxima permitida '+maxFecha.format('d/m/Y'),resp2); return; } } let f=new Date(nuevoV); gE(hiddenValor).value=f.format('d/m/Y'); } let objConfiguracion={ id:'f_'+idControlDestino, width:100, format:'d/m/Y', renderTo:idControlDestino, readOnly:true, minValue:minFecha, maxValue:maxFecha, enableKeyEvents:true, height:150, maskRe:/^[0-9\/]$/, listeners: { keypress: function( ctrl, e ) { } } }; if(objComp) { for(campo in objComp) { objConfiguracion[campo]=objComp[campo]; } } let FNac=new Ext.form.DateField ( objConfiguracion ) let FNacimiento=gE(hiddenValor); FNac.setValue(FNacimiento.value); if(!funcChange) { FNac.on('change',funcFechaCamb); } else FNac.on('select',funcChange); let contenedor=FNac.getEl(); let idImg=contenedor.next().id; let img=gE(idImg); if(Ext.isIE) img.removeAttribute('style'); else img.setAttribute('style',''); return FNac; } function crearComboExtFormulario(idControlDestino,hiddenValor,arregloValores,objComp) { let almacen=new Ext.data.SimpleStore ( { fields: [ {name:'id'}, {name:'texto'} ] } ) let comboTmp=document.createElement('select'); let objConfiguracion={ id:'f_'+idControlDestino, mode:'local', name:idControlDestino, emptyText:'Elija una opci\u00f3n', store:almacen, displayField:'texto', valueField:'id', transform:comboTmp, editable:false, typeAhead: true, triggerAction: 'all', lazyRender:true, autoCreate:{tag: "input", type: "text", readOnly:"readOnly", autocomplete: "off"}, renderTo:idControlDestino }; if(objComp) { for(campo in objComp) { objConfiguracion[campo]=objComp[campo]; } } let combo =new Ext.form.ComboBox ( objConfiguracion ) almacen.loadData(arregloValores); function funcValorCambiado(campo,nuevoV,viejoV) { gE(hiddenValor).value=nuevoV; } let hCombo=gE(hiddenValor); combo.setValue(hCombo.value); combo.on('change',funcValorCambiado); return combo; } Ext.form.TriggerField.override({ afterRender: function() { Ext.form.TriggerField.superclass.afterRender.call(this); } }); function cerrarSesion(noRedireccion) { sesionIniciada=false; localStorage.clear(); function procResp() { if(noRedireccion==undefined) { document.location.href="../principalPortal/index.php"; } } obtenerDatosWeb('../paginasFunciones/funciones.php',procResp,'POST','funcion=2',true); } function hK() { if(typeof keyMap!='undefined') keyMap.enable(); } function dK() { if(typeof keyMap!='undefined') keyMap.disable(); } function cv(valor,ignorarRetorno,evitaCodificarURI) { valor=valor+''; valor=valor.replace(/"/gi,'\\"'); if((ignorarRetorno==undefined)||(ignorarRetorno==false)) valor=valor.replace(/\n/gi, '
'); else valor=valor.replace(/\n/gi, ''); valor=valor.replace(/\r/gi, ''); valor=valor.replace(/\t/gi, ' '); if(!evitaCodificarURI) return encodeURIComponent(valor); return (valor); } cV=cv; function dv(valor,urlEncode) { let cadena=valor; if((urlEncode==undefined)||(urlEncode)) cadena=decodeURIComponent(valor); cadena=cadena.replace(/#R
/gi,'\n\r'); return cadena; } function selElemCombo(combo,valor) { let x; let valorAux=valor+''; let valRef; for(x=0;x'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesFormulario.php',funcResp, 'POST','funcion=16&condComp='+condComp+'&valDep='+cadObj+'&idReferencia='+gE('idReferencia').value+'&vCondicion='+valorCondicion+'&condicion='+condicion+'&cDestino='+cDestino+'&idFormulario='+idFormulario,true); } function actualizarListado(combo,cFiltro,condicion,cDestino,tControl) { let tipoControl=tControl; let valorCondicion; if(typeof(combo)!='string') valorCondicion=combo.options[combo.selectedIndex].value; else valorCondicion=combo; let idFormulario=gE('idFormulario').value; let nomNCol; let nColumnas; let anchoCol; let tblDestino; let nomDestino; if((tipoControl>=14)&&(tipoControl<=16)) { nomDestino='_'+cDestino+'vch'; nomNCol='nColumnas_'+cDestino+'vch'; nColumnas=gE(nomNCol).value; anchoCol=gE('ancho_'+cDestino+'vch').value; tblDestino=gE('tbl_'+cDestino+'vch'); gE(nomDestino).value='-1'; } else { if((tipoControl>=17)&&(tipoControl<=19)) { nomDestino='_'+cDestino+'arr'; nomNCol='nColumnas_'+cDestino+'arr'; nColumnas=gE(nomNCol).value; anchoCol=gE('ancho_'+cDestino+'arr').value; tblDestino=gE('tbl_'+cDestino+'arr'); } } function funcResp() { arrResp=peticion_http.responseText.split('|'); if(arrResp[0]=='1') { let arrOpciones=eval(arrResp[1]); let numOpt=arrOpciones.length; let x; let opt; let ct=0; let padre=tblDestino.parentNode; padre.removeChild(tblDestino); let tablaCtrl=crearTabla(nColumnas,arrOpciones,tipoControl,nomDestino,anchoCol); padre.appendChild(tablaCtrl); } else { msgBox('No se ha podido llelet cabo la operación debido al siguiente error:
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesFormulario.php',funcResp, 'POST','funcion=16&vCondicion='+valorCondicion+'&condicion='+condicion+'&cDestino='+cDestino+'&idFormulario='+idFormulario,true); } function crearComboGeneral(id,arrData,msgInicial) { let arrDatos=[]; if((arrData !=undefined)&&(arrData!=null)) arrDatos=arrData; let idCombo='idComboGral'; if(id!=undefined) idCombo=id; let dsDatos= new Ext.data.SimpleStore ( { fields: [ {name:'id'}, {name:'tipo'}, {name:'comp1'}, {name:'comp2'}, {name:'comp3'} ] } ); dsDatos.loadData(arrDatos); let comboEtapas=document.createElement('select'); let cmbGeneral=new Ext.form.ComboBox ( { id:idCombo, mode:'local', emptyText:msgInicial, store:dsDatos, displayField:'tipo', valueField:'id', transform:comboEtapas, editable:false, typeAhead: true, triggerAction: 'all', lazyRender:true, width:120, listWidth:270 } ) return cmbGeneral; } function llenarCombo(combo,arrValores,seleccione) { let x; let opcion; limpiarCombo(combo); if((seleccione!=undefined)&&(combo.getAttribute('multiple')==null)) { option=document.createElement('option'); combo.options[0]=option; option.text="Seleccione"; option.value="-1"; } for(x=0;x='0')&&(valor.substr(x,1)<='9'))||(valor.substr(x,1)=='.')||(valor.substr(x,1)=='-')) cadAux+=valor.substr(x,1); } return cadAux; } function cambiaraFormatoMysqlToEstandar(fecha) { if(typeof(fecha)=='string') { let arrFecha=fecha.split('-'); return arrFecha[2]+'/'+arrFecha[1]+"/"+arrFecha[0]; } else return fecha.format('d/m/Y'); } function bE(valor) { if(typeof(Base64Latis)=='undefined') { msgBox('Módulo Base64 NO cargado, espere unos segundos e intente de nuevo'); return; } return Base64Latis.encode(valor) } function bD(valor) { if(typeof(Base64Latis)=='undefined') { msgBox('Módulo Base64 NO cargado, espere unos segundos e intente de nuevo'); return; } return Base64Latis.decode(valor) } function crearRegistro(campos) { return Ext.data.Record.create ( campos); } function obtenerValorSelect(combo) { let cmb; if(typeof(combo)=='object') cmb=combo; else cmb=gE(combo); return cmb.options[cmb.selectedIndex].value; } function obtenerListadoArregloFilas(arrFilas,columna,separador) { let x; let listado=''; let sep=''; if(separador!=undefined) sep=separador; for(x=0;x0)) return nodo.childNodes; if((typeof(nodo.children)!='undefined')&&(nodo.children.length>0)) return nodo.children; if(nodo.attributes!=undefined) { if((typeof(nodo.attributes.children)!='undefined')&&(nodo.attributes.children.length>0)) return nodo.attributes.children; } return []; } function ucWords(string) { let arrayWords; let returnString = ""; let len; arrayWords = string.split(" "); len = arrayWords.length; for(i=0;i < len ;i++) { if(i != (len-1)) { returnString = returnString+ucFirst(arrayWords[i])+" "; } else { returnString = returnString+ucFirst(arrayWords[i]); } } return returnString; } function ucFirst(string) { return string.substr(0,1).toUpperCase()+string.substr(1,string.length); } function abrirVentanaPOST(URL,arrDatos,nVentana) { let nombreVentana='vAuxiliar'; if(nVentana) nombreVentana=nVentana; window.open('',nombreVentana, "toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes,fullscreen=yes"); enviarFormularioDatos(URL,arrDatos,'POST',nombreVentana); } function ordenarCombo(cmb,orden) //1= por valor asc,-1 por valor desc;2 por titulo asc;-2 por titulo desc { if(typeof(cmb)=='object') cmbDestino=cmb; else cmbDestino=gE(cmb); let x; let arrDestino=new Array(); let objArray; for(x=0;x0) { } arrBotones.push( { id:'btnDel_'+idCampoGrid, text:objConf.etRemover, icon:'../principalPortal/imagesSIUGJ/delete.png', cls:'x-btn-text-icon', hidden:eOculto, width:(ancho-4)/2, height:30, handler:function() {} } ); let dsDatos=[]; let alDatos= new Ext.data.SimpleStore ( { fields: arrCampos } ); alDatos.loadData(dsDatos); let chkRow=new Ext.grid.CheckboxSelectionModel({width:40}); let arrColumnasCompleto=new Array(); arrColumnasCompleto.push(new Ext.grid.RowNumberer({width:60})); arrColumnasCompleto.push(chkRow); let x; for(x=0;x0) { /*arrBotones.push( { xtype:'tbspacer', width:30 } );*/ } arrBotones.push( { id:'btnDel_'+idCampoGrid, text:objConf.etRemover, icon:'../principalPortal/imagesSIUGJ/delete.png', cls:'x-btn-text-icon', hidden:eOculto, height:30, width:(ancho-4)/2, handler:function() { let datosGrid=idCampoGrid.split('_'); let tblGrid=gEx(idCampoGrid); let fila=tblGrid.getSelectionModel().getSelected(); if(fila==null) { msgBox('Primero debe seleccionar el elemento a eliminar'); return; } function resp(btn) { if(btn=='yes') { tblGrid.getStore().remove(fila); } } msgConfirm('Está seguro de querer eliminar el elemento seleccionado?',resp); } } ); let alDatos; if((objConf.agrupado)&&(objConf.agrupado=='1')) { let lector= new Ext.data.ArrayReader({ fields: [ {name:'idPedido'}, {name: 'txtRazonSocial2'}, {name:'folioPedido'}, {name:'fechaRecepcion', type:'date'}, {name: 'diferencia', type:'int'}, {name: 'num_Factura'}, {name: 'fecha_entrada',type:'date'}, {name: 'Nombre'}, {name: 'observaciones'}, {name:'num_entrega'}, {name:'cond_pago'}, {name: 'txtRFC'} ] } ); alDatos= new Ext.data.GroupingStore({ reader: lector, sortInfo: {field: objConf.campoAgrupacion, direction: 'ASC'}, groupField: objConf.campoAgrupacion, remoteGroup:false, remoteSort: false, autoLoad:false }) } else { alDatos= new Ext.data.SimpleStore ( { fields: arrCampos } ); } alDatos.loadData(arrDatosGrid); let chkRow=new Ext.grid.CheckboxSelectionModel(); let arrColumnasCompleto=new Array(); arrColumnasCompleto.push(new Ext.grid.RowNumberer()); arrColumnasCompleto.push(chkRow); let x; for(x=0;x0) objConfGrid.tbar=arrBotones; if(objConf.ctCls) { objConfGrid.ctCls=objConf.ctCls; } let tblGrid= new Ext.grid.EditorGridPanel ( objConfGrid ); tblGrid.nuevoRegistro=false; tblGrid.soloLectura=true; if(permisos.indexOf('M')!=-1) tblGrid.soloLectura=false; tblGrid.on('beforeedit',funcAntesEditCampoGrid) if(!Visible) tblGrid.hide(); else tblGrid.show(); } function funcEditorFilaAfterEditCampoGrid(rowEdit,obj,registro,nFila) { let datosEditor=rowEdit.getId().split('_') let idGrid=datosEditor[1]; let arrFunciones=eval("arrFuncionesAfterEdit.func_"+idGrid); if(arrFunciones.length>0) { arrFunciones[0](obj,registro,0,idGrid); } } function funcAntesEditCampoGrid(e) { if((e.grid.soloLectura)&&(!e.grid.nuevoRegistro)) e.cancel=true; } function funcEditorFilaBeforeEditCampoGrid(rowEdit,fila) { let datosEditor=rowEdit.getId().split('_') eval('if(typeof(beforeEdit_'+datosEditor[1]+')!=\'undefined\')beforeEdit_'+datosEditor[1]+'(rowEdit,fila);'); let idGrid='grid_'+datosEditor[1]; let grid=Ext.getCmp(idGrid); grid.copiaRegistro=grid.getStore().getAt(fila).copy(); grid.registroEdit=grid.getStore().getAt(fila); grid.enEdicion=true; if((grid.soloLectura)&&(!grid.nuevoRegistro)) return false; } function funcEditorValidaCampoGrid(rowEdit,obj,registro,nFila) { let datosEditor=rowEdit.getId().split('_') let idGrid='grid_'+datosEditor[1]; let grid=Ext.getCmp(idGrid); let cm=grid.getColumnModel(); let nColumnas=cm.getColumnCount(false); let x; let editor; let dataIndex; let valor; for(x=0;x '; } if(!habilitarColor) { if(leyenda=='') leyenda=icono+''+matriz[pos][column]+''; else leyenda+=", "+icono+""+matriz[pos][column]+''; } else { if(leyenda=='') leyenda=icono+matriz[pos][column]; else leyenda+=", "+icono+matriz[pos][column]; } } } return leyenda; } else { let pos=existeValorMatriz(matriz,valor,0,cNumerico); if(pos==-1) return ''; else { if(habilitarIcono) { icono=' '; } if(habilitarColor) { color=matriz[pos][2]; return icono+''+ matriz[pos][column]+''; } return icono+matriz[pos][column]; } } } function formatearValorRendererCombo(almacen,valor,columna,columnaProy) { let pos=obtenerPosFila(almacen,columna,valor); if(pos==-1) return ''; else return almacen.getAt(pos).get(columnaProy); } function buscarNodoID(nodoBase,id) { if(nodoBase.id==id) { return nodoBase; } let arregloHijos=obtenerHijosNodoArbol(nodoBase); let x; let nodo=null; for(x=0;x=0;x--) { if((cadena[x]=='.')||(cadena[x]!='0')) { if(cadena[x]!='.') x++; break; } } return cadena.substr(0,x); } function ingresarProceso(iP,c,iR,iF) { let idReferencia=-1; if(iR!=undefined) idReferencia=bD(iR); let idFormulario=-1; if(iF!=undefined) idFormulario=bD(iF); let ciclo=-1; if(c!=undefined) ciclo=bD(c); let arrParam=[['idProceso',bD(iP)],['ciclo',ciclo],['idReferencia',idReferencia],['idFormulario',idFormulario],['sL','0']]; if(document.URL.indexOf('vistaMacroProceso.php')==-1) enviarFormularioDatos('../modeloPerfiles/vistaProcesos.php',arrParam); else { vListadoRegistros=true; let content=Ext.getCmp('content'); content.load({ scripts:true,url:'../modeloProyectos/visorRegistrosProcesos.php',params:{sL:0,ciclo:(ciclo),idProceso:bD(iP),cPagina:'sFrm=true',idReferencia:(idReferencia),idFormulario:(idFormulario)}}); } } function ingresarProcesoPadre(iP) { let arrParam=[['idProceso',bD(iP)]]; window.parent.enviarFormularioDatos('../modeloPerfiles/vistaProcesos.php',arrParam); } function irInscripcion(c) { let arrParam=[['ciclo',bD(c)]]; enviarFormularioDatos('../Usuarios/reinscripcion.php',arrParam); } function vFilaSel(nGrid,msgError) { let grid=nGrid; if(typeof(grid)=='string') grid=gEx(nGrid); let fila=grid.getSelectionModel().getSelected(); if(fila==null) { msgBox(msgError); return null; } return fila; } function vNFilasSel(nGrid,msgError) { let grid=nGrid; if(typeof(grid)=='string') grid=gEx(nGrid); let fila=grid.getSelectionModel().getSelections(); if(fila.length==null) { msgBox(msgError); return null; } return fila; } function detenerEvento(e) { if (!e) e = window.event; if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; } function cancelarEvento(e) { if (!e) e = window.event; if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } function convertirDatSetArray(dataSet) { let x; let fila; let arreglo=new Array(); let row; let y; for(x=0;x','').replace('á','á').replace('é','é').replace('í','í').replace('ó','ó').replace('ú','ú').replace('ñ','ñ').replace('Á','Á').replace('É','É').replace('Í','Í').replace('Ó','Ó').replace('Ú','Ú').replace('Ñ','Ñ'); } function str_pad (input, pad_length, pad_string, pad_type) { let half = '', pad_to_go; let str_pad_repeater = function (s, len) { let collect = '', i; while (collect.length < len) { collect += s; } collect = collect.substr(0, len); return collect; }; input += ''; pad_string = pad_string !== undefined ? pad_string : ' '; if (pad_type != 'STR_PAD_LEFT' && pad_type != 'STR_PAD_RIGHT' && pad_type != 'STR_PAD_BOTH') { pad_type = 'STR_PAD_RIGHT'; } if ((pad_to_go = pad_length - input.length) > 0) { if (pad_type == 'STR_PAD_LEFT') { input = str_pad_repeater(pad_string, pad_to_go) + input; } else if (pad_type == 'STR_PAD_RIGHT') { input = input + str_pad_repeater(pad_string, pad_to_go); } else if (pad_type == 'STR_PAD_BOTH') { half = str_pad_repeater(pad_string, Math.ceil(pad_to_go / 2)); input = half + input + half; input = input.substr(0, pad_length); } } return input; } function colisionaTiempo(tI1,tF1,tI2,tF2,cosiderarLimites,formato) { let f='Y-m-d H:i A'; if(formato!=undefined) f=formato; let tInicio1=Date.parseDate(tI1,f); let tFin1=Date.parseDate(tF1,f); let tInicio2=Date.parseDate(tI2,f); let tFin2=Date.parseDate(tF2,f); if(cosiderarLimites) { if((tInicio1>=tInicio2)&&(tInicio1<=tFin2)) return true; else if((tFin1>=tInicio2)&&(tFin1<=tFin2)) return true; if((tInicio2>=tInicio1)&&(tInicio2<=tFin1)) return true; else if((tFin2>=tInicio1)&&(tFin2<=tFin1)) return true; } else { if((tInicio1>=tInicio2)&&(tInicio1tInicio2)&&(tFin1<=tFin2)) return true; if((tInicio2>=tInicio1)&&(tInicio2tInicio1)&&(tFin2<=tFin1)) return true; } return false; } function hDebugC() { if(typeof(obtenerDatosWeb)!='undefined') { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de cálculos habilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=1&accion=1',true); } else { function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de cálculos habilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=1&accion=1',true); } } function dDebugC() { if(typeof(obtenerDatosWeb)!='undefined') { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de cálculos deshabilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=1&accion=0',true); } else { function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de cálculos deshabilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=1&accion=0',true); } } function hDebugQ() { if(typeof(obtenerDatosWeb)!='undefined') { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas habilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=2&accion=1',true); } else { function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas habilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=2&accion=1',true); } } function dDebugQ() { if(typeof(obtenerDatosWeb)!='undefined') { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas deshabilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=2&accion=0',true); } else { function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas deshabilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=2&accion=0',true); } } function hDebugBloque() { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas habilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=3&accion=1',true); } function dDebugBloque() { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas deshabilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=3&accion=0',true); } function hDebugConsulta() { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas habilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=4&accion=1',true); } function dDebugConsulta() { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { msgBox("Modo debug de consultas deshabilitado"); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=5&tDebug=4&accion=0',true); } function checarNodosHijos(nodo,valor) { let x; for(x=0;xIngrese su nombre: *' }, { x:220, y:10, xtype:'textfield', width:325, cls:'controlSIUGJ', id:'txtNombre' }, { x:10, y:55, html:'E-mail de contacto: *' }, { x:220, y:50, xtype:'textfield', width:325, cls:'controlSIUGJ', id:'txtEmail' }, { x:10, y:95, html:'Teléfono de contacto:' }, { x:220, y:90, xtype:'textfield', allowDecimals:false, allowNegative:false, width:325, cls:'controlSIUGJ', id:'txtTelefono' }, { x:10, y:135, html:'Por favor ingrese su Duda / Comentario: *' }, { x:10, y:175, width:605, height:60, cls:'controlSIUGJ', id:'txtComentario', xtype:'textarea' } ] } ); let ventanaAM = new Ext.Window( { title: 'Buzón de Dudas / Comentarios', width: 650, height:360, layout: 'fit', plain:true, modal:true, closable:false, cls:'msgHistorialSIUGJ', bodyStyle:'padding:5px;', buttonAlign:'center', items: form, listeners : { show : { buffer : 10, fn : function() { gEx('txtNombre').focus(false,500); } } }, buttons: [ { text: 'Aceptar', cls:'btnSIUGJ', width:140, handler: function() { let txtNombre=gEx('txtNombre'); let txtEmail=gEx('txtEmail'); let txtComentario=gEx('txtComentario'); if(txtNombre.getValue().trim()=='') { function resp() { txtNombre.focus(); } msgBox('Debe ingresar su nombre',resp) return; } if(txtEmail.getValue().trim()=='') { function resp2() { txtEmail.focus(); } msgBox('El campo de E-mail de contacto es obligatorio',resp2) return; } if (!filter.test(txtEmail.getValue().trim())) { function resp4() { txtEmail.focus(); } msgBox('El E-mail ingresado no es válido',resp4) return; } if(txtComentario.getValue().trim()=='') { function resp3() { txtComentario.focus(); } msgBox('Debe ingresar la duda o comentario que desea enviar',resp3) return; } let obj='{"telefono":"'+cv(gEx('txtTelefono').getValue())+'","nombre":"'+cv(txtNombre.getValue().trim())+'","email":"'+cv(txtEmail.getValue().trim())+'","comentario":"'+cv(txtComentario.getValue().trim())+'"}'; function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { function resp6() { ventanaAM.close(); } msgBox('Su duda / comentario ha sido enviado exitosamente, en breve recibirá respuesta',resp6); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=6&cadObj='+obj,true); } }, { text: 'Cancelar', cls:'btnSIUGJ', width:140, handler:function() { ventanaAM.close(); } } ] } ); ventanaAM.show(); } function mostrarVentanaDudaUsuario() { let filter=/^[A-Za-z0-9\._\-]+@[A-Za-z0-9_\-]+(\.[A-Za-z]+){1,2}$/; let form = new Ext.form.FormPanel( { baseCls: 'x-plain', layout:'absolute', defaultType: 'label', items: [ { x:10, y:10, html:'Por favor ingrese su Duda / Comentario: *' }, { x:10, y:35, width:445, height:170, id:'txtComentario', xtype:'textarea' } ] } ); let ventanaAM = new Ext.Window( { title: 'Buzón de Dudas / Comentarios', width: 490, height:305, layout: 'fit', plain:true, modal:true, bodyStyle:'padding:5px;', buttonAlign:'center', items: form, listeners : { show : { buffer : 10, fn : function() { gEx('txtNombre').focus(); } } }, buttons: [ { text: 'Aceptar', handler: function() { let txtComentario=gEx('txtComentario'); if(txtComentario.getValue().trim()=='') { function resp3() { txtComentario.focus(); } msgBox('Debe ingresar la duda o comentario que desea enviar',resp3) return; } let obj='{"comentario":"'+cv(txtComentario.getValue().trim())+'"}'; function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { function resp6() { ventanaAM.close(); } msgBox('Su duda / comentario ha sido enviado exitosamente, en breve recibirá respuesta',resp6); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funciones.php',funcAjax, 'POST','funcion=6&cadObj='+obj,true); } }, { text: 'Cancelar', handler:function() { ventanaAM.close(); } } ] } ); ventanaAM.show(); } function getDocumento(u,i) { let arrParam=[['iD',(i)]]; enviarFormularioDatos(bD(u),arrParam); } function showDocumento(t,e,i) { let obj={}; let extension=bD(e); let pos=existeValorMatriz(arrVisores,extension,4); if(pos==-1) { msgBox('No existe visor de documento disponible'); return; } let fila=arrVisores[pos]; obj.titulo=bD(t); obj.url=fila[1]; obj.ancho=parseFloat(fila[2]); obj.alto=parseFloat(fila[3]); obj.params=[['iD',(i)],['cPagina','sFrm=true']]; abrirVentanaFancy(obj); } function mostrarOpcionFancy(url,o) { let obj={}; obj.titulo=''; obj.ancho='95%'; obj.alto='95%'; obj.url=url; if(o!=undefined) { let ob=eval('['+bD(o)+']')[0]; if(ob.titulo!=undefined) obj.titulo=ob.titulo; if(ob.ancho!=undefined) obj.ancho=ob.ancho; if(ob.alto!=undefined) obj.alto=ob.alto; if(ob.params!=undefined) obj.params=ob.params; } abrirVentanaFancy(obj); } function habilitarMantenimientoSesion(minutosReactivacion) { setInterval('llamadaActualizacionSesionAjax()',(minutosReactivacion*60000)); } function llamadaActualizacionSesionAjax() { let motorAjax=crearMotorAjax(); let datos='funcion=0'; if(motorAjax) { motorAjax.onreadystatechange=function() { if(motorAjax.readyState==PETICION_COMPLETO) { if(motorAjax.status==RESPUESTA_OK) { } else { } } } motorAjax.open("POST","../paginasFunciones/funcionesPortal.php",true); motorAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); motorAjax.send(datos); } } function mostrarValorDescripcion(val) { return ''+val+''; } function obtenerPosObjeto(arrObjetos,campo,valor) { let x; for(x=0;xDescargar  Descargar'; else descArch='Sin documento'; return descArch; } function obtenerMunicipio(estado,ctrlDestino,tipo,valSel) //Sin tipo o 0 Ext,1 Control frm { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { let arrDatos=eval(arrResp[1]); if(tipo==1) { llenarCombo(gE(ctrlDestino),arrDatos,true); if(valSel) selElemCombo(gE(ctrlDestino),valSel); } else { gEx(ctrlDestino).getStore().loadData(arrDatos); if(valSel) gEx(ctrlDestino).setValue(valSel); } } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesOrganigrama.php',funcAjax, 'POST','funcion=60&accion=1&codigo='+estado,true); } function obtenerLocalidad(municipio,ctrlDestino,tipo,valSel) //Sin tipo o 0 Ext,1 Control frm { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { let arrDatos=eval(arrResp[1]); if(tipo==1) { llenarCombo(gE(ctrlDestino),arrDatos,true); if(valSel) selElemCombo(gE(ctrlDestino),valSel); } else { gEx(ctrlDestino).getStore().loadData(arrDatos); if(valSel) gEx(ctrlDestino).setValue(valSel); } } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesOrganigrama.php',funcAjax, 'POST','funcion=60&accion=2&codigo='+municipio,true); } function obtenerColonia(localidad,ctrlDestino,tipo,valSel) //Sin tipo o 0 Ext,1 Control frm { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { let arrDatos=eval(arrResp[1]); if(tipo==1) { llenarCombo(gE(ctrlDestino),arrDatos,true); if(valSel) selElemCombo(gE(ctrlDestino),valSel); } else { gEx(ctrlDestino).getStore().loadData(arrDatos); if(valSel) gEx(ctrlDestino).setValue(valSel); } } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesOrganigrama.php',funcAjax, 'POST','funcion=60&accion=3&codigo='+localidad,true); } function ejecutarPV(iP) { let objParam={}; objParam.idCaja=bD(iP); let content=gEx('content'); if(content) { content.load ( { url:'../caja/puntoVenta.php', params:objParam, scripts:true } ) } else { let arrParam=[['idCaja',bD(iP)],['mRegresar','1']]; enviarFormularioDatos('../caja/puntoVenta.php',arrParam); } } function existeValorArregloObjetos(arreglo,campo,valor) { let x; let res; for(x=0;x= 0) && (bytes < kilobyte)) { return bytes + ' B'; } else if ((bytes >= kilobyte) && (bytes < megabyte)) { return (bytes / kilobyte).toFixed(precision) + ' KB'; } else if ((bytes >= megabyte) && (bytes < gigabyte)) { return (bytes / megabyte).toFixed(precision) + ' MB'; } else if ((bytes >= gigabyte) && (bytes < terabyte)) { return (bytes / gigabyte).toFixed(precision) + ' GB'; } else if (bytes >= terabyte) { return (bytes / terabyte).toFixed(precision) + ' TB'; } else { return bytes + ' B'; } } function obtenerMunicipioV2(estado,ctrlDestino,tipo,valSel,funcionEjecucion) //Sin tipo o 0 Ext,1 Control frm { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { let arrDatos=eval(arrResp[1]); if(tipo==1) { llenarCombo(gE(ctrlDestino),arrDatos,true); if(valSel) selElemCombo(gE(ctrlDestino),valSel); } else { gEx(ctrlDestino).getStore().loadData(arrDatos); if(valSel) gEx(ctrlDestino).setValue(valSel); } if(funcionEjecucion) funcionEjecucion(); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesOrganigrama.php',funcAjax, 'POST','funcion=69&accion=1&codigo='+estado,true); } function obtenerLocalidadV2(municipio,ctrlDestino,tipo,valSel,funcionEjecucion) //Sin tipo o 0 Ext,1 Control frm { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { let arrDatos=eval(arrResp[1]); if(tipo==1) { llenarCombo(gE(ctrlDestino),arrDatos,true); if(valSel) selElemCombo(gE(ctrlDestino),valSel); } else { gEx(ctrlDestino).getStore().loadData(arrDatos); if(valSel) gEx(ctrlDestino).setValue(valSel); } if(funcionEjecucion) funcionEjecucion(); } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesOrganigrama.php',funcAjax, 'POST','funcion=69&accion=2&codigo='+municipio,true); } function abrirFormularioProcesoFancy(iF,iR,a,param,param2) { let accion='auto'; if(bD(iR)=='-1') accion="agregar"; let arrDatos=[["idFormulario",bD(iF)],["idRegistro",bD(iR)],["actor",a],['dComp',bE(accion)],['actorInicio',1]]; if(param) { let aParam=eval(bD(param)); let x; let pos; for(x=0;x'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesProyectos.php',funcAjax, 'POST','funcion=338&idConcepto='+iC+'&idFormulario='+iF+'&idRegistro='+iR,true); } function generarDocumentoPagoReferenciado(ref,objetivo) { let arrParam=[['referencia',ref]]; if(!objetivo) enviarFormularioDatos('../reportes/generarPagoReferenciado.php',arrParam); else enviarFormularioDatos('../reportes/generarPagoReferenciado.php',arrParam,'POST',objetivo); } function getAcrobatInfo() { let getBrowserName = function() { return this.name = this.name || function() { let userAgent = navigator ? navigator.userAgent.toLowerCase() : "other"; if(userAgent.indexOf("chrome") > -1) return "chrome"; else if(userAgent.indexOf("safari") > -1) return "safari"; else if(userAgent.indexOf("msie") > -1) return "ie"; else if(userAgent.indexOf("firefox") > -1) return "firefox"; return userAgent; }(); }; let getActiveXObject = function(name) { try { return new ActiveXObject(name); } catch(e) {} }; let getNavigatorPlugin = function(name) { for(key in navigator.plugins) { let plugin = navigator.plugins[key]; if(plugin.name == name) return plugin; } }; let getPDFPlugin = function() { return this.plugin = this.plugin || function() { if(getBrowserName() == 'ie') { // // load the activeX control // AcroPDF.PDF is used by version 7 and later // PDF.PdfCtrl is used by version 6 and earlier return getActiveXObject('AcroPDF.PDF') || getActiveXObject('PDF.PdfCtrl'); } else { return getNavigatorPlugin('Adobe Acrobat') || getNavigatorPlugin('Chrome PDF Viewer') || getNavigatorPlugin('WebKit built-in PDF'); } }(); }; let isAcrobatInstalled = function() { return !!getPDFPlugin(); }; let getAcrobatVersion = function() { try { let plugin = getPDFPlugin(); if(getBrowserName() == 'ie') { let versions = plugin.GetVersions().split(','); let latest = versions[0].split('='); return parseFloat(latest[1]); } if(plugin.version) return parseInt(plugin.version); return plugin.name } catch(e) { return null; } } return { browser: getBrowserName(), acrobat: isAcrobatInstalled() ? 'installed' : false, acrobatVersion: getAcrobatVersion() }; }; function cvTextArea(valor,ignorarRetorno) { //alert(valor); valor=valor+''; valor=valor.replace(/"/gi,'\\"'); if(ignorarRetorno==undefined) valor=valor.replace(/\n/gi, '
'); else valor=valor.replace(/\n/gi, ''); valor=valor.replace(/\r/gi, ''); valor=valor.replace(/\t/gi, ' '); return valor; } function escaparEnter(valor) { if(valor) { if(valor.replace) { valor=valor.replace(/\r/gi, ''); valor=valor.replace(/\n/gi, '
'); } } return valor; } function escaparBR(valor,sEnter) { if(valor.replace) { if(sEnter) { valor=valor.replace(/
/gi, '\n'); valor=valor.replace(/
/gi, '\n'); valor=valor.replace(/
/gi, '\n'); } else { valor=valor.replace(/
/gi, '\n\r'); valor=valor.replace(/
/gi, '\n\r'); valor=valor.replace(/
/gi, '\n\r'); } } return valor; } function cancelarOperacion(url) { function respQuestion(btn) { if(btn=='yes') { if(gE('accionCancelar') && (gE('accionCancelar').value!='')) { eval(bD(gE('accionCancelar').value)); } else { if(url) { location.href=url; } else { regresarPagina(); } } } } msgConfirm('Está seguro de querer cancelar la operación?',respQuestion); } function irRuta(iConf,url) { let params=[['configuracion',bD(iConf)]]; enviarFormularioDatos(bD(url),params); } function ingresarProcesoIframe(iP) { let content=Ext.getCmp('content'); if(!content) content=Ext.getCmp('frameContenido'); content.load({ scripts:true,url:'../modeloProyectos/visorRegistrosProcesos.php',params:{sL:0,idProceso:bD(iP),cPagina:'sFrm=true',idReferencia:-1,idFormulario:-1}}); } function mostrarContacto(iZ) { let obj={}; obj.url='../principal/contacto.php'; obj.ancho=650; obj.alto=460; abrirVentanaFancy(obj); } function registrarBitacoraNotificaciones(cadObj,ref1,ref2,ref3)//{"tipoNotificacion":"","respuesta":"","accionEvento":"","datosEvento":"","observaciones":"","comentarios":""} { let motorAjax=crearMotorAjax(); let datos='funcion=85&cadObj='+cadObj; if(ref1) datos+='&referencia1='+ref1; if(ref2) datos+='&referencia2='+ref2; if(ref3) datos+='&referencia3='+ref3; if(motorAjax) { motorAjax.onreadystatechange=function() { if(motorAjax.readyState==PETICION_COMPLETO) { if(motorAjax.status==RESPUESTA_OK) { } else { } } } motorAjax.open("POST","../paginasFunciones/funcionesPortal.php",true); motorAjax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); motorAjax.send(datos); } } function mostrarMensajeProcesando(msg) { try { ocultarMensajeProcesando(); let lblMesg='Espere por favor...'; if(msg) lblMesg=msg; let form = new Ext.form.FormPanel( { baseCls: 'x-plain', layout:'absolute', defaultType: 'label', items: [ { x:30, y:20, html:'' }, { x:150, y:50, cls:'clsMensajeEspere', html:''+lblMesg+'' } ] } ); msgEspereAux = new Ext.Window( { width: 550, height:140, closable :false, layout: 'fit', plain:true, modal:true, shadow :false, cls:'msgBoxSIUGJ', bodyStyle:'padding:5px;', buttonAlign:'center', items: form, listeners : { show : { buffer : 10, fn : function() { } } } } ); msgEspereAux.show(); } catch(err) { } } function ocultarMensajeProcesando() { try { if(msgEspereAux) msgEspereAux.close(); } catch(err) { } } function abrirPaginaFrameCentral(pUrl,iF,nFrame) { let arrParams={cPagina:'sFrm=true'}; if(iF) arrParams={idFormulario:iF,cPagina:'sFrm=true'}; if(!nFrame) { gEx('frameContenido').load ( { url:pUrl, params:arrParams, scripts:true } ) } else { gEx(nFrame).load ( { url:pUrl, params:arrParams, scripts:true } ) } } function abrirFormatoEvaluacion() { let arrDatos=[["idFormulario",318],['idRegistro',-1],['idReferencia',1],['cPagina','sFrm=true']]; let ventanaAbierta=window.open('',"vAuxiliar2", "toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes,fullscreen=yes"); enviarFormularioDatosV("../modeloPerfiles/registroFormulario.php",arrDatos,'POST','vAuxiliar2'); } function abrirAvisoPrivacidad() { let obj={}; obj.titulo='Aviso de privacidad'; obj.url='../principal/privacidad.php'; obj.ancho=950; obj.alto='90%'; abrirVentanaFancy(obj); } function colisionaIntervalo(tI1,tF1,tI2,tF2,cosiderarLimites) { let tInicio1=parseFloat(tI1); let tFin1=parseFloat(tF1); let tInicio2=parseFloat(tI2); let tFin2=parseFloat(tF2); if(cosiderarLimites) { if((tInicio1>=tInicio2)&&(tInicio1<=tFin2)) return true; else if((tFin1>=tInicio2)&&(tFin1<=tFin2)) return true; if((tInicio2>=tInicio1)&&(tInicio2<=tFin1)) return true; else if((tFin2>=tInicio1)&&(tFin2<=tFin1)) return true; } else { if((tInicio1>=tInicio2)&&(tInicio1tInicio2)&&(tFin1<=tFin2)) return true; if((tInicio2>=tInicio1)&&(tInicio2tInicio1)&&(tFin2<=tFin1)) return true; } return false; } function obtenerTipoControl(control) { let tipo=control.nodeName; switch(tipo.toLowerCase()) { case 'textarea': return 'textarea'; case 'input': return control.type.toLowerCase(); break; case 'select': return 'select'; break; } } function invocarEjecucionFuncionIframe(iFrame,funcion,params) { let p=''; if(params) { p=params; } let resp; eval(" resp=gEx('"+iFrame+"').getFrameWindow()."+funcion+"("+p+");"); return resp; } function obtenerNavegador() { let userAgent = navigator ? navigator.userAgent.toLowerCase() : "other"; if(userAgent.indexOf("chrome") > -1) return "chrome"; else if(userAgent.indexOf("safari") > -1) return "safari"; else if(userAgent.indexOf("msie") > -1) return "ie"; else if(userAgent.indexOf("firefox") > -1) return "firefox"; return userAgent; }; function esChrome() { if(obtenerNavegador() =='chrome') return true; return false; } function esSafari() { if(obtenerNavegador() =='safari') return true; return false; } function esIE() { if(obtenerNavegador() =='msie') return true; return false; } function esFirefox() { if(obtenerNavegador() =='firefox') return true; return false; } function includeScript(archivo) { let nuevo = document.createElement('script'); nuevo.setAttribute('type', 'text/javascript'); nuevo.setAttribute('src', archivo); document.getElementsByTagName('head')[0].appendChild(nuevo); } function abrirPaginaFancyBox(pUrl,iF) { let obj={}; obj.ancho='100%'; obj.alto='100%'; obj.url=pUrl; let arrParams=[['cPagina','sFrm=true']]; abrirVentanaFancy(obj); } function abrirPaginaIframe(pUrl,iF) { let arrParams={}; arrParams.cPagina='sFrm=true'; if(iF) arrParams.idFormulario=iF; gEx('frameContenido').load ( { url:pUrl, params:arrParams, scripts:true } ) } function ingresarProcesoIframeV2(iP) { let content=Ext.getCmp('content'); if(!content) content=Ext.getCmp('frameContenido'); content.load({ scripts:true,url:'../modeloProyectos/visorRegistrosProcesosV2.php',params:{sL:0,idProceso:bD(iP),cPagina:'sFrm=true',idReferencia:-1,idFormulario:-1}}); } function actualizarDatosSesion(nSesion,cadDatos) { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesEspecialesSistema.php',funcAjax, 'POST','funcion=3&nS='+nSesion+'&cadObj='+cadDatos,true); } function obtenerAlturaElemento(id) { let ctrl=gE(id); let divHeight=0; if(ctrl.offsetHeight) { divHeight=ctrl.offsetHeight; } else if(ctrl.style.pixelHeight) { divHeight=ctrl.style.pixelHeight; } return divHeight; } function mostrarGraficoAnalisisOSC() { let obj={}; obj.ancho='100%'; obj.alto='100%'; obj.url='../modulosEspeciales_Censida/gRadarOSC.php'; abrirVentanaFancy(obj); } function crearRichTextV2(idCtrl,divDestino,ancho,alto,conf,valor,habilitado,correccionOrtografica) { let arrDatosDestino=divDestino.split('_'); let spEditor=gE('sp_'+idCtrl); if(spEditor) { spEditor.parentNode.removeChild(spEditor); } let div = document.getElementById(divDestino); gE('div_'+arrDatosDestino[1]).setAttribute('version2','1'); let vTexto=''; if (valor!=undefined) vTexto=valor; let configuracion=""; if((conf!='')&&(conf!=undefined)) configuracion=conf; else { configuracion=correccionOrtografica==1?'../../modeloPerfiles/Scripts/configCKEditorOrtografia.js':'../../modeloPerfiles/Scripts/configCKEditor.js'; } let confRichText= { width:ancho, height:alto, enterMode : CKEDITOR.ENTER_BR, resize_enabled:false, readOnly:(habilitado==0)?true:false, customConfig:configuracion, on: { instanceReady:function(evt) { let resultado=''; idCtrl.replace('[',''); idCtrl.replace(']',''); eval("resultado=typeof(funcion"+idCtrl.replace('[','').replace(']','')+"_ready);"); if(resultado!='undefined') { eval("funcion"+idCtrl+"_ready(evt);"); } } } } let spContenedor=cE('span'); spContenedor.id='sp_'+idCtrl; let textArea=cE('textarea'); textArea.id='txt'+idCtrl; spContenedor.appendChild(textArea); div.appendChild(spContenedor) let richText=CKEDITOR.replace(textArea.id,confRichText); richText.setData((valor)); return richText; } function deshabilitarTextoEnriquecido(idCtrl) { CKEDITOR.instances[idCtrl].setReadOnly(true); } function habilitarTextoEnriquecido(idCtrl) { CKEDITOR.instances[idCtrl].setReadOnly(false); } function obtenerValorTextEnriquecido(idCtrl) { return CKEDITOR.instances[idCtrl].getData(); } function establecerValorTextEnriquecido(idCtrl,valor) { if(CKEDITOR.instances[idCtrl]) CKEDITOR.instances[idCtrl].setData(valor); } function loadScript(url, callback) { let script = document.createElement("script") script.type = "text/javascript"; if (script.readyState) { //IE script.onreadystatechange = function() { if(script.readyState == "loaded" || script.readyState == "complete") { script.onreadystatechange = null; callback(); } }; } else { script.onload = function() { callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); } function loadCSS(url, callback) { let estiloCSS = document.createElement("link") estiloCSS.setAttribute('rel','stylesheet'); estiloCSS.type = "text/css"; if (estiloCSS.readyState) { estiloCSS.onreadystatechange = function() { if(estiloCSS.readyState == "loaded" || estiloCSS.readyState == "complete") { estiloCSS.onreadystatechange = null; callback(); } }; } else { estiloCSS.onload = function() { callback(); }; } estiloCSS.href=url; document.getElementsByTagName("head")[0].appendChild(estiloCSS); } function existeFuncionJS(funcion) { let tipo=''; eval('tipo=typeof('+funcion+');'); if(tipo=='undefined') return false; return true; } function visualizarDocumentoAdjuntoB64(iD,e) { mostrarVisorDocumentoProceso(bD(e),bD(iD)); } function mostrarVisorDocumentoProceso(extension,idDocumento,registro,nombreArchivo) { let obj={}; obj.url='../visoresGaleriaDocumentos/visorDocumentosGeneral.php'; obj.ancho='100%'; obj.alto='100%'; obj.params= [['iD',bE('iD_'+idDocumento)],['cPagina','sFrm=true']]; if(extension!='') obj.params.push(['extension',extension]); if(nombreArchivo) obj.params.push(['nombreArchivo',nombreArchivo]); abrirVentanaFancy(obj); } function obtenerDiferenciaDias(fInicio,fTermino) { let totalDias=0; let fechaInicio=Date.parseDate(fInicio,'Y-m-d'); let fechaTermino=Date.parseDate(fTermino,'Y-m-d'); while(fechaInicio<=fechaTermino) { fechaInicio=fechaInicio.add(Date.DAY,1); totalDias++; } return totalDias; } function mostrarVisorDocumentoProcesoV2(extension,idDocumento,oComp) { let obj={}; obj.url='../visoresGaleriaDocumentos/visorDocumentosGeneral.php'; obj.ancho='100%'; obj.alto='100%'; obj.params= [['iD',bE('iD_'+idDocumento)],['cPagina','sFrm=true']]; if(oComp) { let cadObj=''; let o; for(let propiedad in oComp) { o='"'+propiedad+'":"'+oComp[propiedad]+'"'; if(cadObj=='') cadObj=o; else cadObj+=','+o; } cadObj='{'+cadObj+'}'; obj.params.push(['oComp',bE(cadObj)]); } abrirVentanaFancy(obj); } function AES_Encrypt(val) { let i='82437665'; let f='97066587'; let res=''; retrn(res); let vAux=''; let x; for(x=0;x'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesModulosEspeciales_SGP.php',funcAjax, 'POST','funcion=152&iT='+(iT)+'&iA='+(iA),true); } function colisionaTiempoV2(tI1,tF1,tI2,tF2,cosiderarLimites) { let arrTiempo=tI1.split(' '); let arrFecha=arrTiempo[0].split('-'); let arrHora=arrTiempo[1].split(':'); let tInicio1=Date.UTC(parseInt(arrFecha[0]),parseInt(arrFecha[1])-1,parseInt(arrFecha[2]),parseInt(arrHora[0]),parseInt(arrHora[1]),parseInt(arrHora[2])); arrTiempo=tF1.split(' '); arrFecha=arrTiempo[0].split('-'); arrHora=arrTiempo[1].split(':'); let tFin1=Date.UTC(parseInt(arrFecha[0]),parseInt(arrFecha[1])-1,parseInt(arrFecha[2]),parseInt(arrHora[0]),parseInt(arrHora[1]),parseInt(arrHora[2])); arrTiempo=tI2.split(' '); arrFecha=arrTiempo[0].split('-'); arrHora=arrTiempo[1].split(':'); let tInicio2=Date.UTC(parseInt(arrFecha[0]),parseInt(arrFecha[1])-1,parseInt(arrFecha[2]),parseInt(arrHora[0]),parseInt(arrHora[1]),parseInt(arrHora[2])); arrTiempo=tF2.split(' '); arrFecha=arrTiempo[0].split('-'); arrHora=arrTiempo[1].split(':'); let tFin2=Date.UTC(parseInt(arrFecha[0]),parseInt(arrFecha[1])-1,parseInt(arrFecha[2]),parseInt(arrHora[0]),parseInt(arrHora[1]),parseInt(arrHora[2])); if(cosiderarLimites) { if((tInicio1>=tInicio2)&&(tInicio1<=tFin2)) { return true; } else { if((tFin1>=tInicio2)&&(tFin1<=tFin2)) { return true; } } if((tInicio2>=tInicio1)&&(tInicio2<=tFin1)) { return true; } else { if((tFin2>=tInicio1)&&(tFin2<=tFin1)) return true; } } else { if((tInicio1>=tInicio2)&&(tInicio1tInicio2)&&(tFin1<=tFin2)) { return true; } } if((tInicio2>=tInicio1)&&(tInicio2tInicio1)&&(tFin2<=tFin1)) { return true; } } } return false; } function obtenerPosicionScroll() { let scrollTop = window.pageYOffset || document.documentElement.scrollTop; return scrollTop; } function crearControlUploadHTML5(objConf) { if((typeof(uploadControl)!='undefined') &&(uploadControl) &&(uploadControl.destroy)) { //uploadControl.destroy(); } let llavePropiedad; let arrExtencionesAgrupadas={}; let extension; let x=0; let arrExtensionesPermitidas=[]; if(objConf.file_types!='*.*') { let objExtension=''; let aExtensiones=objConf.file_types.split(';'); for(x=0;x'+mensaje+''; let form = new Ext.form.FormPanel( { baseCls: 'x-plain', layout:'absolute', defaultType: 'label', items: [ { x:260, y:30, html:'' }, { x:0, y:140, html:tabla } ] } ); let objVentana={}; objVentana={ title: !titulo?'':titulo, width: 600, closable :false, height:400-(mBotones?0:150), layout: 'fit', plain:true, shadow :false, cls:'msgBoxSIUGJ', modal:true, bodyStyle:'padding:5px;', buttonAlign:'center', items: form, listeners : { show : { buffer : 10, fn : function() { } } } } if(mBotones) { objVentana.buttons= [ { text: 'Aceptar', height:30, width: 120, cls:'btnSIUGJ cls'+icono, handler: function() { msgEspereAux.close(); if(funcionBoton) funcionBoton('YES'); } } ] } msgEspereAux = new Ext.Window( objVentana ); msgEspereAux.show(); } function msgPersonalizadoConfirm(mensaje,funcionBoton,icono,titulo) { let imgIcono='../principalPortal/imagesSIUGJ/question.png'; if(!icono || icono=='') { icono='question'; } let lblColor=''; switch(icono) { case 'info': imgIcono='../principalPortal/imagesSIUGJ/info.png'; lblColor='f3af3d'; break; case 'error': imgIcono='../principalPortal/imagesSIUGJ/error.png'; lblColor='9b2027'; break; case 'question': imgIcono='../principalPortal/imagesSIUGJ/question.png'; lblColor='1a3e9a'; break; case 'accept': imgIcono='../principalPortal/imagesSIUGJ/accept.png'; lblColor='1b6e1b'; break; } let tabla='
'+(titulo?titulo:'')+'
'+mensaje+'
'; let form = new Ext.form.FormPanel( { baseCls: 'x-plain', layout:'absolute', defaultType: 'label', items: [ { x:260, y:30, html:'' }, { x:0, y:140, html:tabla } ] } ); let ventanaAM = new Ext.Window( { title: !titulo?'':titulo, width: 600, height:350, closable :false, layout: 'fit', plain:true, modal:true, shadow :false, cls:'msgBoxSIUGJ', bodyStyle:'padding:5px;', buttonAlign:'center', items: form, listeners : { show : { buffer : 10, fn : function() { } } }, buttons: [ { text: 'No', height:30, width: 120, cls:'btnSIUGJCancel cls'+icono+'Cancel', handler:function() { ventanaAM.close(); if(funcionBoton) funcionBoton('no'); } }, { text: 'Sí', height:30, width: 120, cls:'btnSIUGJ cls'+icono, handler:function() { ventanaAM.close(); if(funcionBoton) funcionBoton('yes'); } } ] } ); ventanaAM.show(); } function irPaginaLogin() { location.href='../principalPortal/inicio.php'; } function encryptString(psSource, psKey) { psSource = bE(psSource); let sDestination = ''; let iSourceLen = psSource.length; let iKeyLen = psKey.length; for (let iSource=0; iSource= 535.2) { Ext.override(Ext.grid.ColumnModel, { getTotalWidth: function (includeHidden) { if (!this.totalWidth) { let boxsizeadj = 2; this.totalWidth = 0; for (let i = 0, len = this.config.length; i < len; i++) { if (includeHidden || !this.isHidden(i)) { this.totalWidth += (this.getColumnWidth(i) + boxsizeadj); } } } return this.totalWidth; } } ); }*/ Ext.onReady( function() { Ext.get(document.body).addClass('ext-chrome-fixes'); Ext.util.CSS.createStyleSheet('@media screen and (-webkit-min-device-pixel-ratio:0) {.x-grid3-cell{box-sizing: border-box !important;}}', 'chrome-fixes-box-sizing'); if(!sesionIniciada) retomarSesion(); } ); function validarNoExistenciaRegistro(objConf) { function funcAjax() { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { if(arrResp[1]=='1') { if(objConf.functionExisteRegistro) objConf.functionExisteRegistro(); } else { if(objConf.functionNoExisteRegistro) objConf.functionNoExisteRegistro(); } } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWeb('../paginasFunciones/funcionesEspecialesSistema.php',funcAjax, 'POST','funcion=8&tabla='+objConf.tabla+'&campoBusqueda='+objConf.campoBusqueda+'&valor='+objConf.valor+'&campoIRegistro='+objConf.campoIRegistro+'&iRegistroIgnorar='+objConf.iRegistroIgnorar,true); } function inicializarSesion() { let tiempoVerificacion=1; tiempoVerificacion=tiempoVerificacion*(1000*60); let minutosReviveSesion=5; if(!localStorage.getItem('fechaCierreSesion')|| (localStorage.getItem('fechaCierreSesion')=='0') || (localStorage.getItem('fechaCierreSesion')=='')) { let horaCierreSesion=new Date().add(Date.MINUTE,0).format('Y-m-d H:i:s'); localStorage.setItem('fechaCierreSesion',horaCierreSesion); localStorage.setItem('tiempoInactividad',0); } idleInterval = setInterval(timerVerificaSesion,tiempoVerificacion ); idleIntervalReactivaSession = setInterval(timerReactivaSesion,(minutosReviveSesion*(1000*60)) ); asignarEvento(document,'mousemove',actualizarSesion); asignarEvento(document,'keypress',actualizarSesion); sesionIniciada=true; } function retomarSesion() { asignarEvento(document,'mousemove',actualizarSesion); asignarEvento(document,'keypress',actualizarSesion); //sesionIniciada=true; } function actualizarSesion() { if(sesionIniciada) { let horaCierreSesion=new Date().add(Date.MINUTE,0).format('Y-m-d H:i:s'); localStorage.setItem('fechaCierreSesion',horaCierreSesion); localStorage.setItem('tiempoInactividad',0); } } function timerVerificaSesion() { return; let tiempoInactividad=parseFloat(localStorage.getItem('tiempoInactividad')); if(tiempoInactividad==null) { localStorage.clear(); sesionIniciada=false; clearInterval(idleInterval); clearInterval(idleIntervalReactivaSession); cerrarVentanaFancy(); function resp() { document.location.href="../principalPortal/index.php"; } msgBox('La sesión ha caducado',resp); return; } tiempoInactividad++; let fechaCierreSesion=Date.parseDate(localStorage.getItem('fechaCierreSesion'),'Y-m-d H:i:s'); let fechaActual=Date.parseDate(new Date().format('Y-m-d H:i:s'),'Y-m-d H:i:s'); localStorage.setItem('tiempoInactividad',tiempoInactividad); //console.log('Cierre sesión a las: '+fechaCierreSesion.format('d/m/Y H:i:s')); if (fechaActual >= fechaCierreSesion) { sesionIniciada=false; cerrarSesion(false); clearInterval(idleInterval); clearInterval(idleIntervalReactivaSession); cerrarVentanaFancy(); function resp() { localStorage.removeItem('fechaCierreSesion'); localStorage.removeItem('tiempoInactividad'); document.location.href="../principalPortal/index.php"; } msgBox('La sesión ha caducado',resp); } } function timerReactivaSesion() { function funcAjax(peticion_http) { let resp=peticion_http.responseText; arrResp=resp.split('|'); if(arrResp[0]=='1') { } else { msgBox('No se ha podido realizar la operación debido al siguiente problema:'+'
'+arrResp[0]); } } obtenerDatosWebV2('../paginasFunciones/funcionesPortal.php',funcAjax, 'POST','funcion=0',false); } Ext.override(Ext.grid.RowNumberer, { renderer : function(v, p, record, rowIndex) { if(this.rowspan) { p.cellAttr = 'rowspan="'+this.rowspan+'"'; } let desplazamientoPaginacion=0; if(this.idGridPaginacion && (this.idGridPaginacion!='') && (!this.gridPadre)) { this.gridPadre=gEx(this.idGridPaginacion); this.tamanoPagina=this.gridPadre.pageSize; } if(this.gridPadre) { desplazamientoPaginacion=this.gridPadre.store.lastOptions.params.start; /*if((this.tamanoPagina==(rowIndex+1))||((rowIndex+1)==this.gridPadre.store.reader.jsonData.registros.length)) { console.log(this.gridPadre); console.log("final"); }*/ } return (rowIndex+1+desplazamientoPaginacion); } } ) Ext.override(Ext.DatePicker, { createMonthPicker : function() { if(!this.monthPicker.dom.firstChild) { let buf = ['']; for(let i = 0; i < 6; i++) { buf.push( '', '', i === 0 ? '' : '' ); } buf.push( '', '
', Date.getShortMonthName(i), '', Date.getShortMonthName(i + 6), '
' ); this.monthPicker.update(buf.join('')); this.mon(this.monthPicker, 'click', this.onMonthClick, this); this.mon(this.monthPicker, 'dblclick', this.onMonthDblClick, this); this.mpMonths = this.monthPicker.select('td.x-date-mp-month'); this.mpYears = this.monthPicker.select('td.x-date-mp-year'); this.mpMonths.each(function(m, a, i) { i += 1; if((i%2) === 0) { m.dom.xmonth = 5 + Math.round(i * 0.5); } else { m.dom.xmonth = Math.round((i-1) * 0.5); } }); } } } ); function isVisible(idCtrl) { let control; if(typeof(idCtrl)=='object') { control=idCtrl; } else { control=gE(idCtrl); } return (typeof(control.style.display)=='undefined' || control.style.display=='')?true:false; } function abrirPaginaVentanaEmergente(pUrl) { let winFeatures = 'screenX=0,screenY=0,top=0,left=0,scrollbars,width=100,height=100'; let winName = 'window'; let win = window.open(pUrl,winName, winFeatures); let extraWidth = win.screen.availWidth - win.outerWidth; let extraHeight = win.screen.availHeight - win.outerHeight; win.resizeBy(extraWidth, extraHeight); let timer = setInterval(function() { if(win.closed) { clearInterval(timer); } }, 1000); return win; } function quitarAcentos(text) { let arrCaracteres=[]; arrCaracteres.push(["á","a"]); arrCaracteres.push(["é","e"]); arrCaracteres.push(["í","i"]); arrCaracteres.push(["ó","o"]); arrCaracteres.push(["ú","u"]); arrCaracteres.push(["ñ","n"]); arrCaracteres.push(["Á","A"]); arrCaracteres.push(["É","E"]); arrCaracteres.push(["Í","I"]); arrCaracteres.push(["Ó","O"]); arrCaracteres.push(["Ú","U"]); arrCaracteres.push(["Ñ","N"]); let expresion; let x; for(x=0;x=ctrl.longitudMaxima) { e.stopEvent(); } } } function setManagerMessajeGrid(g) { g.getStore().on('load',function(proxy) { if((proxy.reader.jsonData)&&(proxy.reader.jsonData.msgErr)&&(proxy.reader.jsonData.msgErr!='')) { msgBox(proxy.reader.jsonData.msgErr); } } ) } function esObjetoVacio(obj) { let totalAtributos=0; for(campo in obj) { totalAtributos++; } return totalAtributos==0; } function setTimerRefreshGrid(g,tiempo,funcionEjecuta) { let defaultTiempo=120000; if(funcionEjecuta) { setInterval(function() { funcionEjecuta(); }, tiempo?tiempo:defaultTiempo ) } else { setInterval(function() { g.getStore().reload(); }, tiempo?tiempo:defaultTiempo ) } } function isSurface() { const isWindows = navigator.userAgent.indexOf('Windows') > -1; const maxTouchPoints = navigator.maxTouchPoints || navigator.msMaxTouchPoints; const isTouchable = 'ontouchstart' in window || maxTouchPoints > 0 || window.matchMedia && matchMedia('(any-pointer: coarse)').matches; return isWindows && isTouchable && maxTouchPoints>1; } function lC(valor) { let x; let arrLetras=[]; arrLetras.push(['#','Ñ']); let exp; for(x=0;x