var u_site = '/WEB'; function report(uri,parameters) { do{ uri = uri.replace("/", "%2F"); }while(uri.indexOf("/") > -1); if(parameters) { var href = "executeReport.jsp?uri=" + uri; param = ''; for(var par in parameters) { param += '&' + par + '=' + parameters[par]; } href += param; window.open(href, 'rep', 'tools=n,width=1024,height=768'); } } ca = ac = ""; dk = false; // variable para poder ejecutar eventos key sr = false; // variable para setear requeridos en el ias winF7 = null; winLV = null; winGF = null; winCls = false; //variable para controlar el cierre de la ventana de preview de escaneo var zoomImg = null, origW = null, origH = null; //variables para pre-cargar una imagen en la ventana de zoom. var zoomWid = 640; //ancho de la ventana de zoom. var zoomHei = 480; //alto de la ventana de zoom. kc = 0; // variable que permite saber que tecla de funciones se ejecuta (f1,f2,f3..etc) var qCkMF = null; // variable de timer para la función MostrarForm var qCkf7a = null; // variable de timer para la función f7aWin var qStts = null; // variable de timer para resaltar mensajes en estatus var qFgLV = false; // bandera para que no se ejecute MostrarForm en la función mo() con ListaValores var qFgCV = false; // bandera para que no se ejecute Caducar sesión en la ventana de ConsultaValores // variables para el reloj: var qDate = new Date(); var qClock = null; var ventana = null; var qzColorMDa = "blue"; var qzColorMDi = "gray"; var ventanaPop = null; var as = document.getElementById("estatus") != null ? document.getElementById("ps").value : ""; var at = document.getElementById("estatus") != null ? document.getElementById("pt").value : ""; /* Función para encontrar todos los tags (input, table, div, etc.) de un objeto ( puede ser document.forms["fb"] ) */ function findElementByTagFN(obj, tag) { return (obj.all) ? obj.all.tags(tag) : obj.getElementsByTagName(tag); } /* Función para encontrar el primer elemento que tiene el name */ function findElementFN(name) { return document.getElementById(name) || findElByName(name)[0]; } /* Función para encontrar todos los elementos que tienen el mismo name */ function findElByName(name) { return document.getElementsByName(name); } /* Función para sincronizar todas las filas, de un mismo Tab, definidas con overflow (Tipo de fila: "O,idPropio-idSincronizado1-idSincronizado2-...-idSincronizadoN") */ function sincroScroll(propio, sincronizado) { try { if(propio.scrollLeft) { findElementFN(sincronizado).scrollLeft = propio.scrollLeft; setTimeout("findElementFN('" + sincronizado + "').scrollLeft=findElementFN('" + propio.id + "').scrollLeft;",140); } if(propio.scrollTop) { findElementFN(sincronizado).scrollTop = propio.scrollTop; setTimeout("findElementFN('" + sincronizado + "').scrollTop=findElementFN('" + propio.id + "').scrollTop;",140); } }catch(exc) { } } /* Función para validar y pintar una fila de Maestro - Detalle */ function pintaMD(qzBlq, qzReg, qzColorMD) { var qzCampos = findElByName("qzCampo")[qzBlq].value; qzCampos = qzCampos!="" ? split(qzCampos, ",") : ""; var qzCamp = ""; if(qzCampos.length == 1) qzCamp = qzCampos[0]; else if(qzCampos.length >= qzReg) qzCamp = qzCampos[qzReg - 1]; if(qzColorMD==null || qzColorMD=="") qzColorMD = qzColorMDi; if(qzCamp!="") { if(findElByName(qzCamp).length > 1) { if(qzReg>0 && findElByName(qzCamp)[qzReg - 1].value != "") { findElByName(qzCamp)[qzReg - 1].parentNode.parentNode.style.backgroundColor = qzColorMD; return true; } }else if(findElByName(qzCamp).length == 1) { if(findElByName(qzCamp)[0].value != "") { findElByName(qzCamp)[0].parentNode.parentNode.style.backgroundColor = qzColorMD; return true; } } } return false; } /* Función para despintar una fila de Maestro - Detalle */ function despintaMD(qzBlq) { try { qzReg = parseInt(findElByName("qzRegistro")[qzBlq].value,10); }catch (Exception) { qzReg = -1; } var qzCampos = findElByName("qzCampo")[qzBlq].value; qzCampos = qzCampos!="" ? split(qzCampos, ",") : ""; var qzCamp = ""; if(qzCampos.length==1) qzCamp = qzCampos[0]; else if(qzReg > 0 && qzCampos.length >= qzReg) { qzCamp = qzCampos[qzReg - 1]; qzReg = 1; } if(qzCamp!="" && qzReg>0) findElByName(qzCamp)[qzReg - 1].parentNode.parentNode.style.backgroundColor = "white"; } /* Función para evento onactivate de un registro de Maestro - Detalle */ function activaMD(qzBlq, qzReg, qzPadre) { var qzBlqAnt = document.forms["fb"].qzBloqueActivo.value; document.forms["fb"].qzBloqueActivo.value = qzBlq; if(pintaMD(qzBlq, qzReg, qzColorMDa)) { if(document.forms["fb"].qzRegistro[qzBlq].value != qzReg) { despintaMD(qzBlq); document.forms["fb"].qzRegistro[qzBlq].value = qzReg; if(qzPadre && document.getElementById("estatus") != null) { f7(); st("Procesando Consulta de Maestro - Detalle", false); } }else if(qzBlqAnt!=qzBlq) { st("CAMBIO REALIZADO CORRECTAMENTE", false, findElByName("qzCodMen")[qzBlq].value); }else st("CAMBIO REALIZADO CORRECTAMENTE", false, -1); }else { st("NO EXISTEN MAS REGISTROS", false, 111006); findElByName("qzCodMen")[qzBlq].value = "111006"; } } /* Función para evento ondeactivate de un registro de Maestro - Detalle */ function desactivaMD(qzDiv, qzBlq, qzReg) { if(document.forms["fb"].qzRegistro[qzBlq].value == qzReg) pintaMD(qzBlq, qzReg, qzColorMDi); else qzDiv.style.background = 'white'; } /* Función que realiza un barrido de un objeto form de HTML, setea la página que se solicita en el siguiente envío y recibe el objeto del Servidor a donde se envía el submit del form.*/ function generarRequest(targetForm, setPagina, serverObject) { envio = ""; document.forms[targetForm]["qzPagina"].value = setPagina; for(var a = 0; a < document.forms[targetForm].length; a++) envio += document.forms[targetForm][a].name + "=" + escape(document.forms[targetForm][a].value) + "&"; return serverObject + "?" + envio; } /*Función que obtiene dinámicamente un archivo .js y lo carga a petición en los formularios*/ function getScript(id, url) { qxIni("getScript(id, url)", 1, "funciones.js"); if(document.getElementById(id)) { document.getElementById(id).src = url; }else { var script = document.createElement('script'); script.id = id; script.defer = true; script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } qxEnd(); } // Funciones para reportar lista de seguimiento de instrucciones ejecutadas y el error detectados por window.onerror var qxMaxList = 25; var qxTracking = " "; var qxNivel = 0; var qxShow = false; var qxValores = new Array(); if(document.getElementById("estatus") == null) { window.onerror = reportError; // Si está en la aplicación no se ejecuta. } function reportError(message, url, lineNumber) { qxValores = (" | | | |" + qxTracking).split("|"); qxValores[0] = lineNumber; qxValores[1] = message; qxValores[2] = url; qxValores[3] = qxNivel; qxNivel = 0; if(qxShow) { señalarError(); }else { if(document.getElementById("qxVentanaError") == null) { var vError = document.createElement("img"); vError.id = "qxVentanaError"; vError.src = "imagenes/notif_red.gif"; vError.style.width = "15px"; vError.style.height = "15px"; vError.style.top = "5px"; vError.style.left = "5px"; vError.style.position = "absolute"; vError.onclick = function() { qxShow = false; this.style.display = "none"; señalarError(); } document.getElementById("fb").appendChild(vError); } document.getElementById("qxVentanaError").style.display = "block"; } return true; } function qxIni(nombre, tipo, archivo) { if (document.getElementById("estatus")) return; // Si está en la aplicación no se ejecuta. archivo = archivo==null || archivo=="" ? "HTML" : archivo; tipo = tipo==null ? 0 : tipo; nombre = (tipo==0 ? "Evento:" : tipo==1 ? "Función:" : tipo==2 ? "Enlace:" : tipo==3 ? "JS inicial:" : "Ejecuta:") + " \"" + nombre + "\" en " + archivo; qxTracking += "| " + qxBlank(qxNivel++) + qxNivel + "- " + nombre.replace(/\|/g, '¡'); while (qxTracking.split("|").length > qxMaxList) { qxTracking = qxTracking.substring(qxTracking.indexOf("|") + 1); } } function qxEnd() { if (document.getElementById("estatus")) return; // Si está en la aplicación no se ejecuta. if(qxNivel>0) qxNivel--; } function qxBlank(d) { var s = ""; for(var k=0; k 0) { for (i = 0; i < ptListeners.length; i++) { ptListeners[i](document.getElementById("ps").value, document.getElementById("pt").value); } } cod = 0; recibido = sinXml || d.responseXML.childNodes; for(var iter = 0 ; (sinXml && iter == 0) || iter < recibido.length ; iter++){ e = sinXml || recibido[iter].childNodes; if(sinXml || recibido[iter].nodeName.toLowerCase() == "formulario"){ for(var b = 0 ; b < e.length ; b++) { var valor = e[b].firstChild.nodeValue != null ? e[b].firstChild.nodeValue : ""; if(valor.substring(0, 7) == "[CDATA[") valor = valor.substring(7, valor.length - 2); if(e[b].nodeName.toLowerCase() == "cuerpo" && e[b].nodeType == 1) { document.getElementById("contenido").innerHTML = valor; }else if(e[b].nodeName.toLowerCase() == "calculos" && e[b].nodeType == 1) { var f = valor; h = /¤/; while(h.test(f)) f = f.replace(h,"'"); h = /\r\n?/; while(h.test(f)) f = f.replace(h," "); h = /\n\n?/; while(h.test(f)) f = f.replace(h," "); ca = f; }else if(e[b].nodeName.toLowerCase() == "estatus") { var cod = e[b].lastChild.nodeValue; if(cod.substring(0, 7) == "[CDATA[") cod = cod.substring(7, cod.length - 2); message = valor; cod = cod; } } st(sinXml || message, false, cod); if (!sinXml) { PreF7 = null; PreF12 = null; } MostrarTab(); sr = false; if(!qFgLV) { if(!qFgCV){ document.getElementById("ps").onkeydown = pp; document.getElementById("pt").onkeydown = pp; document.getElementById("ps").onkeydownOld = null; document.getElementById("pt").onkeydownOld = null; } configurador(); if (!sinXml) { try { document.getElementById('ps').focus(); } catch(e) {} try{ eval(ca); }catch(err){ st (" - ERROR EN CALCULOS!", false, 1); } } else { setTimeout(function() { st("FORMULARIO CARGADO CON EXITO", false, 0); }, 100); } f7aWin(); setFocusAfterF12(); // llamar focus de caja qvalMAN = document.forms["fb"]["qCCM"] != null && document.forms["fb"]["qCCM"].value != "0" ? true : false; if(objCampo.length>1) { // para Maestro - Detalle if(qzReg>0 && findElementFN(split(findElByName("qzCampo")[blqAux].value, ",")[qzReg - 1]).value!="") findElementFN(split(findElByName("qzCampo")[blqAux].value, ",")[qzReg - 1]).focus(); } }else if(qFgLV && verificaCalculosLV){ try{ verificaCalculosLV = false; eval(ca); }catch(err) { st(" - ERROR EN CALCULOS DE LV!", false, 1); } } callGclock(true); } } if(!qFgLV) { printReciboLibreta(); if(globalVars["postMAN"]) { globalVars["postMAN"] = null; if(cod == 0) f7("TRUE"); }else if(globalVars['cambio'] && globalVars['cambio']!="") { if(document.getElementById("codEstatus").value=="0") eval(globalVars['cambio']); // ejecuta proceso interrumpido por mantenimiento globalVars['cambio'] = ""; }else if(globalVars["postLIMPIAR"]) { limpiarRegistroF2(); globalVars["postLIMPIAR"] = null; } } } function moLV(originalRequest){ qFgLV = true; mo(originalRequest); qdf = document.forms["fb"]; if(opener.flagLink=="XX") { f2 = function() { st("F2 no aplica - control deshabilitado", false, 1); }; } opener.callGclock(true); if(document.links.length > 0 && document.getElementById('estatus').innerHTML == '') st('Seleccione una Línea de valores o escriba un Criterio de búsqueda + F7     (Cerrar: Alt + F4)', false, 0); if(opener.qdf && opener.qdf.qLV1.value != 'open') { if(document.links.length == 0) { opener.st('NO SE ENCONTRO NINGUN REGISTRO', false, 1); self.close(); } eval(qdf.qLV1.value); } qdf.qLV1.value = ''; if(opener.qdf.qLV1.value != 'close') opener.qdf.qLV1.value = 'open'; document.onkeydown = function(e) { var evento = new Evento(e); if(evento.tecla == evento.BACKSPACE) evento.cancelar(); kb(e); }; window.onfocus = "document.focus();"; window.focus(); try{ eval(ca); }catch(err) { st(" - ERROR EN CALCULOS DE LV!", false, 1); } } // funcion para configurar la presentación de: pestañas de ListaForms, Tablas, ListaMenu y Maestro-Detalle function configurador() { if(!document.getElementById("estatus")) { dk = true; document.onkeydown = function(e) { var eve = (e) ? e : event; ev = eve.which ? eve.which : eve.keyCode ? eve.keyCode : 0; if(ev == 16) snap = 0; // para Generador gráfico var evento = new Evento(e); kb(e); }; } // Se habilita elementos Tabla flagTabla = new Array(); var objTablas = findElementByTagFN(document.forms["fb"], "table"); for(var i=0; i1) { try { blqAux = parseInt(document.forms["fb"].qzBloqueActivo.value, 10); } catch(Exception) { blqAux = 0; } for(var qzBlq=0; qzBlq0 && findElementFN(split(findElByName("qzCampo")[qzBlq].value, ",")[qzReg - 1]).value!="") findElementFN(split(findElByName("qzCampo")[qzBlq].value, ",")[qzReg - 1]).focus(); } } try { qzReg = parseInt(findElByName("qzRegistro")[blqAux].value, 10); } catch (Exception) { qzReg = -1; } if(qzReg>0 && findElementFN(split(findElByName("qzCampo")[blqAux].value, ",")[qzReg - 1]).value!="") findElementFN(split(findElByName("qzCampo")[blqAux].value, ",")[qzReg - 1]).focus(); document.forms["fb"].qzBloqueActivo.value = blqAux; } // Se descarga información enviada (si existe). MostrarForm(); } function getLineaSaldo() { qxIni("getLineaSaldo()", 1, "funciones.js"); var valores = new Array(); valores[0] = qdf.printLinea != null && qdf.printLinea.value != "" ? qdf.printLinea.value : "1"; valores[1] = qdf.printSaldo != null ? qdf.printSaldo.value : ""; valores[2] = qdf.NUMEROLIBRETA != null ? qdf.NUMEROLIBRETA.value : ""; do { newValores = showModalDialog("html/lineaPrint.html", valores, "status:false;dialogWidth:400px;dialogHeight:210px;scroll:no;help:no;status:no;"); }while(newValores == null); if(qdf.printLinea != null) qdf.printLinea.value = newValores.linea; if(qdf.printSaldo != null) qdf.printSaldo.value = newValores.saldo; if(qdf.NUMEROLIBRETA != null) qdf.NUMEROLIBRETA.value = newValores.libreta; qxEnd(); } function printReciboLibreta() { qxIni("printReciboLibreta()", 1, "funciones.js"); if(qdf.printLibreta != null && qdf.printLibreta.value != "") { //Imprime Libreta var numLineas = 32; var valores = document.getElementById("estatus")==null ? showModalDialog("html/lineaPrint.html", window, "status:false;dialogWidth:400px;dialogHeight:210px;scroll:no;help:no;status:no;") : null; var linea = qdf.printLinea != null ? qdf.printLinea.value : valores!=null ? valores.linea : null; if(linea != null) { linea = parseInt(linea,10) - 1; var lineas = split(qdf.printLibreta.value, "|").length; var lineasP = split(qdf.printLibreta.value, "|"); var cont = 2; var reverso = linea>29 ? true : false; var pendiente = ""; qdf.PrnTck1.Text = "L00 | |" + (reverso || linea>0 ? " | | |" : lineasP[0] + "| |" + lineasP[1]) + "| |"; if(reverso) qdf.PrnTck1.Text += " |"; linea = reverso ? linea-32 : linea; for(var i=0; i 31 - linea) break; qdf.PrnTck1.Text += lineasP[i] + "|"; } if(confirm("Por favor ingrese la Libreta")) qdf.PrnTck1.Imprimir(1); qdf.printLibreta.value = qdf.printSaldo.value = ""; lineas -= cont + 1; if(lineas > 0) { qdf.PrnTck1.Text = "L00 | | | | | | | |"; linea = lineas < numLineas ? lineas : numLineas; for(var i=0; i 0 && g[a] != obj) { MostrarTab(tab, g[a]); } } } } // Sección para pintar pestañas de ListaTabs y ListaForms if(obj == document.forms["fb"] && !qFgLV) { if(document.getElementById("estatus")) { // En la Aplicacion: forma = document.getElementById("ps").value + document.getElementById("pt").value; }else { // En el Generador: forma = document.location.href; forma = forma.substring(forma.lastIndexOf("/") + 1, forma.lastIndexOf(".")); if(forma.length > 6) forma = forma.substring(0, 6); } var objTablas = findElementByTagFN(obj, "table"); for(var i=0; i") > 0) { campo[a] = e[a].substring(0, e[a].indexOf(">")); e[a] = e[a].substring(e[a].indexOf(">") + 1); }else campo[a] = e[a]; if(document.getElementById(campo[a]) != null && document.getElementById(campo[a]).src != "") { globalVars["pasaCampos"][e[a]] = new Object(); globalVars["pasaCampos"][e[a]].src = document.getElementById(campo[a]).src; globalVars["pasaCampos"][e[a]].zoomEvent = document.getElementById(campo[a]).zoomEvent; }else if(document.forms["fb"][campo[a]] != null) { globalVars["pasaCampos"][e[a]] = document.forms["fb"][campo[a]].value; if(a == 0 && document.forms["fb"][campo[a]].value != "") flgF7 = true; } } globalVars["pasaCampos"]["f7auto"] = f7a && flgF7; clearTimeout(qCkMF); qCkMF = setTimeout("globalVars['pasaCampos']=null", 30000); if(opn==null || opn==1 || opn==true) { qvalMAN = false; if(d.length>5) pt(d.substring(0,2) + ":" + d.substring(2,6)); qvalMAN = document.getElementById("qCCM")!=null && document.getElementById("qCCM").value!="0" ? true : false; } }else if(globalVars["pasaCampos"]["lleno"]) { // Entra si el iframe está con campos, para pasar valores al formulario d. for(var a in globalVars["pasaCampos"]) { if(globalVars["pasaCampos"][a].src) { document.getElementById(a).src = globalVars["pasaCampos"][a].src; if(globalVars["pasaCampos"][a].zoomEvent) { document.getElementById(a).zoomEvent = globalVars["pasaCampos"][a].zoomEvent; document.getElementById(a).ondblclick = new Function(globalVars["pasaCampos"][a].zoomEvent); } }else if(document.forms["fb"][a]) { document.forms["fb"][a].value = globalVars["pasaCampos"][a]; } } f7a = globalVars["pasaCampos"]["f7auto"]; globalVars["pasaCampos"] = new Object(); clearTimeout(qCkMF); if(f7a) setTimeout("f7()", 140); } }else { // PARA EL GENERADOR winLF = window.open('','qWinForms','left=20,top=2000,heigth=100,width=100'); if(winLF==null) alert("ADVERTENCIA:\nRevise por favor las opciones de su Navegador,\nestá bloqueando abrir ventanas emergentes\ny no permite operar la función MostrarForm()"); if((d && d!=="") && (e && e!="")){ // Entra si no existe la ventana (para copiar los campos a pasar). wt = "...Cargando
"; e = split(e,','); var campo = new Array(); for(var a=0; a") > 0) { campo[a] = e[a].substring(0, e[a].indexOf(">")); e[a] = e[a].substring(e[a].indexOf(">") + 1); }else campo[a] = e[a]; if(document.getElementById(campo[a])!=null && document.getElementById(campo[a]).src!="") wt += ""; else if(document.getElementById(campo[a])!=null) wt += ""; } wt += ""; wt += ""; winLF.document.write(wt); winLF.document.close(); if(opn==null || opn==1 || opn==true) { window.name = "qFitBank"; myWin = window.open(d + ".htm", "qFitBank", "", true); } }else if(dfr = winLF.document.forms[0]) { // Entra si la ventana estaba abierta y con campos, para pasar valores al formulario d. for(var a=0; a=0 || dfr.elements[a].value.indexOf("d:")>=0)) document.getElementById(dfr.elements[a].name).src = dfr.elements[a].value; else if(document.getElementsByName(dfr.elements[a].name) != null) document.forms["fb"][dfr.elements[a].name].value = dfr.elements[a].value; } } if(winLF.document.getElementsByName("f7auto") && dfr.f7auto.value=="true") f7a = true; else f7a = false; winLF.close(); }else winLF.close(); // Cierra la ventana por seguridad, si no cumple lo anterior. } } /* * Función que se encarga de pintar las pestañas siempre que correspondan a */ function pintaPestanias(tab, objTabla) { var objImg = findElementByTagFN(objTabla, "img"); var tuv; for (var i=0; i6) d = d.substring(0, 6); } e = e ? e : document.forms["fb"]; if(e && e.hasChildNodes) { var g = e.childNodes; for(var a=0; a0 && g[a]!=e) clf(g[a]); } } } } function desactivaTabs(lista, juegoImg, desactiva) { if(lista == null || lista == "") return; qxIni("desactivaTabs(lista, juegoImg, desactiva)", 1, "funciones.js"); juegoImg = juegoImg == null || juegoImg == "" ? "tab" : juegoImg; lista = split(lista, ","); desactiva = desactiva == null || desactiva ? true : false; //var cual = split("izq,cen,der,br", ","); var cual = split("izq,cen,der", ","); for(var i=0; i5) lista[i] = lista[i].substring(0, 6); for(var j=0; j= evento.F1 && evento.tecla <= evento.F12) { evento.cancelar(); } break; } } else { switch(evento.tecla) { case evento.F1: evento.cancelar(); f1(); break; case evento.F2: evento.cancelar(); f2(); break; case evento.F3: evento.cancelar(); f3(); break; case evento.F4: evento.cancelar(); f4(); break; case evento.F5: evento.cancelar(); f5(); break; case evento.F6: evento.cancelar(); f6(); break; case evento.F7: evento.cancelar(); f7(true); break; case evento.PGUP: // Se ejecuta lo siguiente: case evento.F8: if(!qFgLV && (as=="" || at=="")) break; evento.cancelar(); f8(); break; case evento.PGDOWN: // Se ejecuta lo siguiente: case evento.F9: if(!qFgLV && (as=="" || at=="")) break; evento.cancelar(); f9(); break; case evento.F10: evento.cancelar(); f10(); break; case evento.F11: evento.cancelar(); f11(); break; case evento.F12: evento.cancelar(); if(!(qFgLV || qFgCV)) { try { document.getElementById("ps").focus(); } catch(e) {} setTimeout("f12()", 140); } break; default: break; } } } else { if(!(evento.ctrl || evento.alt || evento.shift)) { switch(evento.tecla) { case evento.F1: evento.cancelar(); f1(); break; case evento.F3: evento.cancelar(); break; case evento.F5: evento.cancelar(); break; case evento.F11: evento.cancelar(); break; default: break; } } else if(evento.alt) { switch(evento.tecla) { case evento.F4: alert("Precaución: La ventana se cerrará sin caducar la Sesión"); break; default: evento.cancelar(); break; } } else if(evento.shift) { switch(evento.tecla) { case evento.TAB: break; default: evento.cancelar(); break; } } else { evento.cancelar(); } } qxEnd(); return false; } function bloquear() { try { event.keyCode = 0; } catch(Exception) {} try { event.returnValue = false; } catch(Exception) {} } function criterioOrden(elemento, tecla, actuar) { qxIni("criterioOrden(elemento, tecla, actuar)", 1, "funciones.js"); if(!qFgLV) { var valor = elemento.value; if(elemento!=null && elemento.name!="") { var grupos = split(qGruposOrden, "|"); for(var i=0; i= campo.length ? "" : 1 * valor + 1); }else if(tecla == 40) { // rota descendente el valor de orden elemento.value = valor=="" ? campo.length : (valor <= 1 ? "" : 1 * valor - 1); }else if(tecla == 37) { // intercambia los valores de orden a la izquierda if(j > 0) { elemento.value = findElementFN(campo[j - 1]).value; findElementFN(campo[j - 1]).value = valor; findElementFN(campo[j - 1]).focus(); }else { elemento.value = findElementFN(campo[campo.length - 1]).value; findElementFN(campo[campo.length - 1]).value = valor; findElementFN(campo[campo.length - 1]).focus(); } }else { // intercambia los valores de orden a la derecha if(j < campo.length - 1) { elemento.value = findElementFN(campo[j + 1]).value; findElementFN(campo[j + 1]).value = valor; findElementFN(campo[j + 1]).focus(); }else { elemento.value = findElementFN(campo[0]).value; findElementFN(campo[0]).value = valor; findElementFN(campo[0]).focus(); } } }else { // Navegación en campos de orden if(tecla == 38) { // sube un grupo if(i > 0) findElementFN(split(split(qGruposOrden, "|")[i - 1], ",")[0]).focus(); else findElementFN(split(split(qGruposOrden, "|")[grupos.length - 1], ",")[0]).focus(); }else if(tecla == 40) { // baja un grupo if(i < grupos.length - 1) findElementFN(split(split(qGruposOrden, "|")[i + 1], ",")[0]).focus(); else findElementFN(split(split(qGruposOrden, "|")[0], ",")[0]).focus(); }else if(tecla == 37) { // salta a izquierda if(j > 0) findElementFN(campo[j - 1]).focus(); else findElementFN(campo[campo.length - 1]).focus(); }else { // salta a derecha if(j < campo.length - 1) findElementFN(campo[j + 1]).focus(); else findElementFN(campo[0]).focus(); } } }catch(Exception) { } qxEnd(); return; } } } } } qxEnd(); } function split(d, e) { qxIni("split(d, e)", 1, "funciones.js"); var f = new Array(); kf = d.lastIndexOf(e); ko = i = 0; while(ko < kf) { f[i++] = d.substring(ko, k1 = d.indexOf(e, ko)); ko = k1 + 1; } f[i++] = d.substring(ko); qxEnd(); return f; } var stListeners = []; var ptListeners = []; function addStatusListener(f) { stListeners.push(f); } function addTransactionListener(f) { ptListeners.push(f); } var qkFCaja = "040123|030114|040171|030112|030110|040120|030128|060217|030113|040130|030138|030139|" + "040388|050102|070104|030114|060219|040164"; // Formularios de Caja var qkNoMen = "ACCION NEGADA|ACCION CANCELADA|NO SE ENCONTRO NINGUN REGISTRO|CAMBIO REALIZADO CORRECTAMENTE|" + "FORMULARIO NO PERMITE CONSULTA|NO EXISTEN TRANSACCIONES PARA ESTE SUBSISTEMA|" + "FORMULARIO NO PERMITE MANTENIMIENTO, SOLO CONSULTA"; // Condiciones para no poner mensaje con color function st(d, e, f) { qxIni("st(d, e, f)", 1, "funciones.js"); if(document.getElementById("estatus")) { var error = f!=0 && ( (f!=1 && f!=5 && f!=111006) || (f==1 && qkNoMen.indexOf(d)<0) ); if ( d && error && !e ) { dh = ' ' + d; } else if ( d && !e ) { dh = ' ' + d; } else { dh = d; } if(qFgLV && d.indexOf("TRANSACCION REALIZADA CORRECTAMENTE")){ var posicion = d.indexOf("TRANSACCION REALIZADA CORRECTAMENTE"); if(posicion>0){ document.getElementById("qzTitulo").innerHTML = d.substring(0,posicion); document.getElementById("estatus").innerHTML = ' ' + "TRANSACCION REALIZADA CORRECTAMENTE"; } else document.getElementById("estatus").innerHTML = dh; } else document.getElementById("estatus").innerHTML = dh; if(!qFgLV) { qkForm = document.getElementById('ps').value + document.getElementById('pt').value; if( error ) { // if( f!=null && ( (f>1 && f!=5 && f!=111006) || (f==1 && qkNoMen.indexOf(d)<0) ) ) { document.getElementById("estatus").style.background = "rgb(255,255,140)"; document.getElementById("estatus").style.color = "black"; document.getElementById("estatus").style.padding = "3"; if(qkForm && qkFCaja.indexOf(qkForm)>=0) { // Condición para alertar error en formularios de caja alert(" ¡ E R R O R !\n\nTRANSACCION NO REALIZADA"); document.getElementById('estatus').style.background = ''; }else { clearTimeout(qStts); qStts = setTimeout("document.getElementById('estatus').style.background='';document.getElementById('estatus').style.color = 'white';",1618); } genNotif(f); } } if(document.getElementById("codEstatus") && f!=-1) document.getElementById("codEstatus").value = f ? f : -1; dk = !e; }else if(d && d != "") alert(d); if (stListeners.length > 0) { for (i = 0; i < stListeners.length; i++) { stListeners[i](d, e, f || 0); } return; } qxEnd(); } function getTitulo() { return tituloFormulario; } function ge(d) { e = ""; for(var a=0; a vf){ men = "INGRESO (" + d.value + ") NO VALIDO ... Fuera de Rango: " + vo + " - " + vf; if(al) alert(men); else st(men, false, 1); d.value = ""; d.focus(); } qxEnd(); } function flim(d, sep, min, al) { qxIni("flim(d,sep,min,al)", 1, "funciones.js"); al = al && al!=0 && al!=false ? true : false; ref = new Date(); anio = ref.getFullYear() - min; mes = ref.getMonth() + 1; valdate(d); if(d.value.length == 10){ if(parseInt(d.value.substring(6), 10)>anio || (parseInt(d.value.substring(6), 10)==anio && ( (sep=="-" && parseInt(d.value.substring(3, 5), 10)>=mes) || (sep=="/" && parseInt(d.value.substring(0, 2), 10)>=mes)))) { men = "FECHA INGRESADA (" + d.value + ") NO ADMITIDA: Menor al mínimo requerido (" + min + " años)"; if(al) alert(men); else st(men, false, 1); d.value = ""; } } qxEnd(); } /* Función que recibe el campo al que pertenece la Imagen, el path superior de la Imagen, la extensión de la imagen, y el nombre del campo imagen en el HTML. Realiza la extracción del valor del campo owner y luego reemplaza la propiedad src de la Imagen*/ function loadImages(owner, pathSup, extension, nameImage, isDB){ if (isDB == null || isDB == false) { pathFinal = pathSup + valueOwner + '.' + extension; document.getElementById(nameImage).src = pathFinal; } if (isDB != null && isDB == true) { pathFinal="FBSES"+obtieneSesion()+"?img=si&num=" + document.getElementById(pathSup).value + "&sec=" + document.getElementById(extension).value; var posicion = ",top=" + ((screen.availHeight-402)/2) + ",left=" + ((screen.availWidth-563)/2); var tamanio = ",width=563,height=430"; zoom = "window.open('FBSIM"+obtieneSesion()+"?zoomWin=1&num=" + document.getElementById(pathSup).value + "&sec=" + document.getElementById(extension).value +"','zoom1','"+posicion +tamanio +"')"; document.getElementById(nameImage).src = pathFinal; document.getElementById(nameImage).zoomEvent = zoom; document.getElementById(nameImage).onclick = new Function(zoom); } } function showImages(num, tab) { if(num){ window.open('FBSIM?zoomWin=1&tab='+tab+'&num='+num,tab,'scrollbars=yes,status=no,width=500px,height=348px,menubar=no'); } } /** * Funciones de desvío para usar las nuevas calculadoras **/ function register(d, mizq, msup) { qxIni("register(d,mizq,msup)", 1, "funciones.js"); CalcRegistradora(d, mizq, msup); qxEnd(); } function finanz(d, mizq, msup) { qxIni("finanz(d,mizq,msup)", 1, "funciones.js"); CalcFinanciera(d, mizq, msup); qxEnd(); } function billmon(d, mizq, msup) { qxIni("billmon(d,mizq,msup)", 1, "funciones.js"); CalcDesglosadora(d, mizq, msup); qxEnd(); } /** * Funciones y variables comunes para las calculadoras **/ var qNombreCampo; function qGetCampo(id, todos) { if(todos) return document.getElementsByName(id); else return document.getElementsByName(id)[0]; } function qGetValor(campo) { return qGetCampo(campo).value; } function qGetChar(codigo) { return String.fromCharCode(codigo); } function qBloquear(eve) { if(eve.keyCode) { eve.keyCode = 0; eve.returnValue = false; }else{ eve.preventDefault(); } } /** * Funciones de la nueva Registradora **/ var qCalc = false, qBlock = false; var qOperador, qMenos; function qReg(e, campo) { var eve = (e) ? e : event; ev = eve.which ? eve.which : eve.keyCode ? eve.keyCode : 0; if(ev == 32) { qGetCampo("aceptar").click(); qBloquear(eve); return; } qLargo = campo.value.length; qChar1 = campo.value.substring(0, 1); if(qLargo == 0) { if(ev > 47 && ev < 58 || ev == 46) { // [0-9] . campo.value = "+"; }else if(qCalc && (ev == 61 || ev == 13)) { // = Enter qCalc = false; qGetCampo("qtotal").value = qEval(qGetValor("qtotal"), campo.value); if(qGetValor("qtotal") != "Infinity") { dc(qGetCampo("qtotal"), 2); } qPrintHoja("= " + qGetValor("qtotal")); campo.value = ""; qBlock = true; }else if(ev == 61 || ev == 13) { // = Enter qGetCampo("qtotal").value = ""; qPrintHoja(""); qBlock = true; }else if(!(ev == 42 || ev == 43 || ev == 45 || ev == 47)) { // * + - / qBlock = true; } }else if(qLargo == 1) { if(ev == 45 && (campo.value == "*" || campo.value == "/")) { // - //deja poner "-" despues de "*" o "/" }else if(ev == 42 || ev == 43 || ev == 45 || ev == 47) { // * + - / campo.value = ""; //cambia el signo }else if(qCalc && (ev == 61 || ev == 13)) { // = Enter qCalc = false; if(qGetValor("qtotal") != "Infinity") { dc(qGetCampo("qtotal"), 2); } qPrintHoja("= " + qGetValor("qtotal")); campo.value = ""; qBlock = true; }else if(!(ev > 47 && ev < 58 || ev == 46)) { // [0-9] . qBlock = true; } }else if(qLargo > 1) { if(campo.value.length == 2 && campo.value.substring(1) == "-" && (ev < 48 || ev > 57) && ev != 46) { campo.value = campo.value.substring(0, 1); qBlock = true; }else if(ev == 67 || ev == 99) { // C c campo.value = campo.value.substring(0, qLargo - 1); qBlock = true; }else if(ev == 42 || ev == 43 || ev == 45 || ev == 47) { // * + - / qGetCampo("qtotal").value = qEval(qGetValor("qtotal"), campo.value); qPrintHoja(campo.value); campo.value = ""; qCalc = false; }else if(ev == 61 || ev == 13) { // = Enter qGetCampo("qtotal").value = qEval(qGetValor("qtotal"), campo.value); if(qGetValor("qtotal") != "Infinity") { dc(qGetCampo("qtotal"), 2); } qPrintHoja(campo.value); qPrintHoja("= " + qGetValor("qtotal")); campo.value = ""; qBlock = true; }else if((ev < 48 || ev > 57) && ev != 46) { // diferente a: [0-9] . qBlock = true; qCalc = true; } } if(qBlock) { if(eve.keyCode) { eve.keyCode = 0; eve.returnValue = false; }else{ eve.preventDefault(); } qBlock = false; } qSetSelectionRange(qGetCampo("qhoja"), qGetValor("qhoja").length, qGetValor("qhoja").length); qSetSelectionRange(qGetCampo("qstack"), qGetValor("qstack").length, qGetValor("qstack").length); qGetCampo("qstack").focus(); } function qEval(p1, p2) { qOperador = p2.substring(0, 1); p1 = p1 != "" ? qGetParseFloat(p1) : 0.00; p2 = p2 != "" ? qGetParseFloat(p2.substring(1)) : 0.00; switch(qOperador) { case "+": p3 = p1 + p2; break; case "-": p3 = p1 - p2; break; case "*": p3 = p1 * p2; break; case "/": p3 = p1 / p2; break; default: p3 = 0.00; break; } return p3; } function qGetParseFloat(valor) { if(valor == "") return 0.00; qMenos = valor.substring(0, 1) == "-" ? true : false; if(valor.substring(0, 1).match("\\+|-|\\*|/")) valor = valor.substring(1); while(valor.indexOf(",") >= 0) valor = valor.replace(",", ""); valor = parseFloat(valor, 10); return qMenos ? -valor : valor; } function qRegT(p7) { p8 = p7.name; if(qGetValor("qstack") == "" && p8.match("B[0-9]")) { qGetCampo("qstack").value = "+"; } if(p8.match("B[0-9]")) { qGetCampo("qstack").value += p8.substring(1); }else if(p8 == "Bpun") { qGetCampo("qstack").value += "."; }else if(p8 == "Bigu" && qGetValor("qstack") == "") { qGetCampo("qhoja").value += qNuevaLinea(); qGetCampo("qtotal").value = ""; }else if(qGetValor("qstack").length > 1) { if(p8 == "Bigu") { qGetCampo("qtotal").value = qEval(qGetValor("qtotal"), qGetValor("qstack")); if(qGetValor("qtotal") != "Infinity") { dc(qGetCampo("qtotal"), 2); } qPrintHoja(qGetValor("qstack")); qPrintHoja("= " + qGetValor("qtotal")); qGetCampo("qstack").value = ""; }else if(p8.match("B[^0-9]")) { qGetCampo("qtotal").value = qEval(qGetValor("qtotal"), qGetValor("qstack")); qPrintHoja(qGetValor("qstack")); qGetCampo("qstack").value = p8 == "Bsum" ? "+" : p8 == "Bres" ? "-" : p8 == "Bmul" ? "*" : "/"; } }else { qGetCampo("qstack").value = p8 == "Bsum" ? "+" : p8 == "Bres" ? "-" : p8 == "Bmul" ? "*" : p8 == "Bdiv" ? "/" : ""; } qSetSelectionRange(qGetCampo("qhoja"), qGetValor("qhoja").length, qGetValor("qhoja").length); qSetSelectionRange(qGetCampo("qstack"), qGetValor("qstack").length, qGetValor("qstack").length); qGetCampo("qstack").focus(); } function qNuevaLinea() { return " " + qGetChar(13); } function qPrintHoja(valor) { qGetCampo("qhoja").value += valor + qNuevaLinea(); } function qSetSelectionRange(input, selectionStart, selectionEnd) { if(input.setSelectionRange) { input.focus(); input.setSelectionRange(selectionStart, selectionEnd); }else if(input.createTextRange) { var range = input.createTextRange(); range.collapse(true); range.moveEnd("character", selectionEnd); range.moveStart("character", selectionStart); range.select(); } } function qBorrarReg() { qGetCampo("qstack").value = ""; qGetCampo("qhoja").value = "------------------------- \n"; qGetCampo("qtotal").value = ""; qGetCampo("qstack").focus(); } function qBajarValorReg() { if(qNombreCampo != null && qGetCampo(qNombreCampo)) { qGetCampo(qNombreCampo).value = qGetValor("qtotal"); } qNombreCampo = null; closePop(); return false; } function CalcRegistradora(d, mizq, msup) { qxIni("CalcRegistradora(d,mizq,msup)", 1, "funciones.js"); qNombreCampo = d ? d.name : null; closePop(); //Se usa las mismas funciones de pop if(document.getElementById("registercalc")) { document.getElementById("registercalc").parentNode.removeChild(document.getElementById("registercalc")); } fondoMensaje = new Element('div', { 'class': "ventana-fondo" }); if(Prototype.Browser.IE) fondoMensaje.className = "ventana-fondo"; fondoMensaje.setOpacity(0.2); Event.observe(fondoMensaje, 'click', closePop); document.body.appendChild(fondoMensaje); mizq = mizq ? mizq : '400'; msup = msup ? msup : '100'; ventanaPop = new Element('div', { 'class': "ventana" }).hide(); if(Prototype.Browser.IE) ventanaPop.className = "ventana"; ventanaPop.style.top = msup + 'px'; ventanaPop.style.left = mizq + 'px'; ventanaPop.style.width = '280px'; ventanaPop.style.height = '442px'; var tituloPop = new Element("div", { 'class': "titulo" }); if(Prototype.Browser.IE) tituloPop.className = "titulo"; ventanaPop.insert(tituloPop); var cerrar; if (document.getElementById("estatus")) { cerrar = new Element('img', { src: globalVars['jspathSpecificImages'] + "/close.gif" }); }else { cerrar = new Element('img', { src: "imagenes/close.gif" }); } cerrar.observe('click', closePop.curry()); tituloPop.update(cerrar).insert( new Element("span").update("R E G I S T R A D O R A") ); funcionMover = moverPop.curry(tituloPop); tituloPop.observe('mousedown', function(e) { if(window.event) e = window.event; if (e.layerX && e.layerY) { posX = e.layerX; posY = e.layerY; } else { posX = e.offsetX; posY = e.offsetY; } tituloPop.x = posX; tituloPop.y = posY; Event.observe(document.body, 'mousemove', funcionMover); }); Event.observe(document.body, 'mouseup', function(e) { Event.stopObserving(document.body, 'mousemove', funcionMover); }); divContenido = new Element("div", { 'id': "registercalc", 'class': "qRegister" }); if(Prototype.Browser.IE) { divContenido.id = "registercalc"; divContenido.className = "qRegister"; }else if(Prototype.Browser.Gecko) { divContenido.style.height = "432px"; } calc = "
"; divContenido.update(calc); ventanaPop.insert(divContenido); ventanaPop.show(); Element.insert(document.body, ventanaPop); //Se carga el div en el formulario. qGetCampo("qstack").focus(); qxEnd(); } // FIN de Funciones de la nueva Registradora /** * Funciones de la nueva Calculadora Financiera **/ var qVM = qVC = qVP = qVI = 0.00; var qUnidadP = qFactorC = 12.00; var qUnidadI = 1.00; var qMarker = "0"; var qValor = new Array(); var qRevision, qListo = false; function qInitFinanz() { qPinta(); qPonerListo(false); qGetCampo("qMonto").focus(); } function qCalcularReg(campo) { qPinta(campo); qMarcaRadio(campo.name); qRevision = qRevisaParametros(campo.name); if(qRevision != true) { if(qRevision.substring(0, 1) != "*") qGetCampo("qDisplay").value = "Ingresa [ " + qRevision + " ] "; else qGetCampo("qDisplay").value = "Error [ " + qRevision + " ] "; qPonerListo(false); }else { qMarker = campo.name.substring(3); switch (campo.name) { case "qCF1": qCalMonto(); break; case "qCF2": qCalCuota(); break; case "qCF3": qCalPeriodo(); break; case "qCF4": qCalInteres(); break; default: } } return false; } function qPinta(campo) { for(var i=1; i<5; i++) { qGetCampo("qCF" + i).parentNode.style.backgroundColor = "silver"; qGetCampo("qCF" + i).parentNode.style.color = "black"; } if(campo) { campo.parentNode.style.backgroundColor = "gray"; campo.parentNode.style.color = "white"; } } function qPonerListo(val) { qListo = val; qGetCampo("qCF0").style.backgroundColor = qListo ? "green" : "darkred"; } function qMarcaRadio(who) { qMarker = who.substring(3); qValor = qMarker!="1" ? qGetValor("qU" + qMarker).split("|") : ["", "-", "0"]; qGetCampo("qTiempo", true)[qValor[2]].checked = true; if(qMarker == "1") qGetCampo("qTiempo", true)[0].checked = false; document.getElementById("qRotulo").innerHTML = " " + qValor[0] + " "; if(qValor[1] == "-") qGetCampo("qUnidadTiempo").disabled = true; else qGetCampo("qUnidadTiempo").disabled = false; qGetCampo("qUnidadTiempo").value = qValor[1]; } function qRevisaParametros(campoName) { if(campoName != "qCF1" && qGetValor("qMonto") == "") return "Capital"; else if(campoName != "qCF2" && qGetValor("qCuota") == "") return "Cuota"; else if(campoName != "qCF3" && qGetValor("qPeriodo") == "") return "Período"; else if(campoName != "qCF4" && qGetValor("qInteres") == "") return "Interés"; if(campoName != "qCF1" && qGetValor("qMonto") == "0.00") return "*Capital"; else if(campoName != "qCF2" && qGetValor("qCuota") == "0.00") return "*Cuota"; else if(campoName != "qCF3" && (qGetValor("qPeriodo") == "0.00" || qGetValor("qPeriodo").indexOf("-") >= 0)) return "*Período"; return true; } function qChangeVar(valor) { valor = valor==null ? qGetValor("qU" + qMarker).split("|")[1] + "|" + qGetCampo("qTiempo", true)[qGetValor("qU" + qMarker).split("|")[2]].value.split("|")[1] : valor; switch(qMarker) { case "2": qFactorC = parseFloat(eval(valor.split("|")[1]), 10) / parseFloat(qGetValor("qUnidadTiempo"), 10); if(qRevisaParametros("qCF2") == true) qCalCuota(); break; case "3": qUnidadP = parseFloat(eval(valor.split("|")[1]), 10); if(qRevisaParametros("qCF3") == true) qCalPeriodo(); break; case "4": qUnidadI = parseFloat(eval(valor.split("|")[1]), 10) / parseFloat(qGetValor("qUnidadTiempo"), 10); if(qRevisaParametros("qCF4") == true) qCalInteres(); break; default: } if(qMarker.match("2|3|4")) { qGetCampo("qU" + qMarker).value = qGetValor("qU" + qMarker).split("|")[0] + "|" + (qMarker=="3" ? "-" : qGetValor("qUnidadTiempo")) + "|" + valor.split("|")[0]; } } function qBorrarFinanz() { qGetCampo("qMonto").value = ""; //$ total qGetCampo("qPeriodo").value = ""; //mes qGetCampo("qInteres").value = ""; //% anual qGetCampo("qCuota").value = ""; //$ mensual qGetCampo("qDisplay").value = ""; //pantalla qVM = qVC = qVP = qVI = 0.00; qPonerListo(false); qPinta(); qGetCampo("qMonto").focus(); qGetCampo("qPeriodo").style.backgroundColor = ""; qGetCampo("qU2").value = qGetValor("qU2").split("|")[0] + "|1|1"; qGetCampo("qU3").value = qGetValor("qU3").split("|")[0] + "|-|1"; qGetCampo("qU4").value = qGetValor("qU4").split("|")[0] + "|1|0"; return false; } function qAjustar(campo, who) { switch (who) { case "M": qVM = parseFloat(0 + qc(campo.value), 10); break; case "C": qVC = parseFloat(0 + qc(campo.value), 10) * qFactorC / 12; break; case "P": qVP = parseFloat(0 + qc(campo.value), 10) * 12 / qUnidadP; break; case "I": qVI = parseFloat(0 + qc(campo.value), 10) * qUnidadI; break; default: } if(who.match("M|C|P|I")) qPonerListo(false); } function qAjustarUnidadParaRespuesta() { switch(qMarker) { case "1": qGetCampo("qMonto").value = qVM; dc(qGetCampo("qMonto"), 2); break; case "2": qGetCampo("qCuota").value = 12 * qVC / qFactorC; dc(qGetCampo("qCuota"), 2); break; case "3": qGetCampo("qPeriodo").value = qUnidadP * qVP / 12; dc(qGetCampo("qPeriodo"), 2); break; case "4": qGetCampo("qInteres").value = qVI / qUnidadI; dc(qGetCampo("qInteres"), 2); break; default: } } function qRevisarValor(valor, campo) { qAjustarUnidadParaRespuesta(); if(!qCheckValorEntero(qGetValor("qPeriodo"))) { qGetCampo("qPeriodo").style.backgroundColor = "rgb(255,255,140)"; qGetCampo("qPeriodo").title = "Advertencia: Período no presenta valor entero."; }else { qGetCampo("qPeriodo").style.backgroundColor = ""; qGetCampo("qPeriodo").title = ""; } if(valor < 0) { qGetCampo("qDisplay").value = "Err data: " + campo.value; campo.value = ""; qPonerListo(false); return false; }else { qGetCampo("qDisplay").value = campo.value; qPonerListo(true); return true; } } function qCalCapitalFinal() { if(qListo) { qGetCampo("qDisplay").value = qVC * qVP; dc(qGetCampo("qDisplay"), 2); qGetCampo("qDisplay").value = "$ " + qGetValor("qDisplay"); }else { qGetCampo("qDisplay").value = "Valor No Disponible "; } return false; } function qCalMonto() { qGetCampo("qMonto").value = qVM = qVI==0 ? qVC * qVP : 1200 * qVC * (1 - Math.pow((1 + qVI / 1200), -qVP)) / qVI; qRevisarValor(qVM, qGetCampo("qMonto")); } function qCalCuota() { qGetCampo("qCuota").value = qVC = qVI==0 ? qVM / qVP : qVM * (qVI / 1200) / (1 - Math.pow((1 + qVI / 1200), -qVP)); qRevisarValor(qVC, qGetCampo("qCuota")); } function qCalPeriodo() { qGetCampo("qPeriodo").value = qVP = qVI==0 ? qVM / qVC : -Math.log(1 - qVM * (qVI / 1200) / qVC) / Math.log(1 + qVI / 1200); qRevisarValor(qVP, qGetCampo("qPeriodo")); } function qCalInteres() { qSube = true; i = 50; inc = 14; do { ii = qVM * (i / 1200) / (1 - Math.pow((1 + i / 1200), -qVP)) - qVC; if(qSube && ii.toFixed(7) > 0 || !qSube && ii.toFixed(7) < 0) { inc -= inc / 2; } if(ii.toFixed(7) > 0) { qSube = false; i -= inc; }else if(ii.toFixed(7) < 0) { qSube = true; i += inc; } }while(ii.toFixed(7) != 0 && i != 100); qVI = qGetCampo("qInteres").value = i; qRevisarValor(qVI, qGetCampo("qInteres")); } function qCheckValorEntero(valor) { if(valor.indexOf(".") < 0) return true; return valor.substring(valor.length - 2) == "00"; } function qddc(campo) { campo.value = qComa(campo.value); } function qNavegaFinanz(e, d) { var eve = (e) ? e : event; ev = eve.which ? eve.which : eve.keyCode ? eve.keyCode : 0; if(eve.shiftKey && ev == 9) { switch(d.name) { case "qMonto": qPonerFoco("qInteres"); break; case "qCuota": qPonerFoco("qMonto"); break; case "qPeriodo": qPonerFoco("qCuota"); break; case "qInteres": qPonerFoco("qPeriodo"); break; default: qPonerFoco("qMonto"); } }else if(ev == 9 || ev == 13) { switch(d.name) { case "qMonto": qPonerFoco("qCuota"); break; case "qCuota": qPonerFoco("qPeriodo"); break; case "qPeriodo": qPonerFoco("qInteres"); break; case "qInteres": qPonerFoco("qMonto"); break; default: qPonerFoco("qMonto"); } } if(ev == 9 || ev == 13) { if(eve.keyCode) { eve.keyCode = 0; eve.returnValue = false; }else{ eve.preventDefault(); } } } function qPonerFoco(campo) { //solo para calculadora financiera if(Prototype.Browser.IE) { setTimeout("qGetCampo('" + campo + "').focus()", 40); }else { qGetCampo(campo).focus(); } } function qBajarValorFinanz() { if(qListo && qNombreCampo != null && qGetCampo(qNombreCampo)) { if(qGetValor("qDisplay").substring(0, 1) == "$") { qGetCampo(qNombreCampo).value = qGetValor("qDisplay").substring(2); }else { qGetCampo(qNombreCampo).value = qGetValor("qDisplay"); } } qNombreCampo = null; closePop(); return false; } function CalcFinanciera(d, mizq, msup) { qxIni("CalcFinanciera(d,mizq,msup)", 1, "funciones.js"); qNombreCampo = d ? d.name : null; closePop(); //Se usa las mismas funciones de pop if(document.getElementById("finanzcalc")) { document.getElementById("finanzcalc").parentNode.removeChild(document.getElementById("finanzcalc")); } fondoMensaje = new Element('div', { 'class': "ventana-fondo" }); if(Prototype.Browser.IE) fondoMensaje.className = "ventana-fondo"; fondoMensaje.setOpacity(0.2); Event.observe(fondoMensaje, 'click', closePop); document.body.appendChild(fondoMensaje); mizq = mizq ? mizq : '400'; msup = msup ? msup : '100'; ventanaPop = new Element('div', { 'class': "ventana" }).hide(); if(Prototype.Browser.IE) ventanaPop.className = "ventana"; ventanaPop.style.top = msup + 'px'; ventanaPop.style.left = mizq + 'px'; ventanaPop.style.width = '500px'; ventanaPop.style.height = '220px'; var tituloPop = new Element("div", { 'class': "titulo" }); if(Prototype.Browser.IE) tituloPop.className = "titulo"; ventanaPop.insert(tituloPop); var cerrar; if (document.getElementById("estatus")) { cerrar = new Element('img', { src: globalVars['jspathSpecificImages'] + "/close.gif" }); }else { cerrar = new Element('img', { src: "imagenes/close.gif" }); } cerrar.observe('click', closePop.curry()); tituloPop.update(cerrar).insert( new Element("span").update("C A L C U L A D O R A     F I N A N C I E R A") ); funcionMover = moverPop.curry(tituloPop); tituloPop.observe('mousedown', function(e) { if(window.event) e = window.event; if (e.layerX && e.layerY) { posX = e.layerX; posY = e.layerY; } else { posX = e.offsetX; posY = e.offsetY; } tituloPop.x = posX; tituloPop.y = posY; Event.observe(document.body, 'mousemove', funcionMover); }); Event.observe(document.body, 'mouseup', function(e) { Event.stopObserving(document.body, 'mousemove', funcionMover); }); divContenido = new Element("div", { 'id': "finanzcalc", 'class': "qfinanz" }); if(Prototype.Browser.IE) { divContenido.id = "finanzcalc"; divContenido.className = "qfinanz"; } calc = "
 Capital
 Cuota  
 
 
 
 
 Período
 Interés
"; divContenido.update(calc); ventanaPop.insert(divContenido); ventanaPop.show(); Element.insert(document.body, ventanaPop); //Se carga el div en el formulario. qInitFinanz(); qxEnd(); } // FIN de Funciones de la nueva Calculadora Financiera /** * Funciones de la nueva Calculadora Desglosadora o Dispensadora de Dinero **/ var qCamposDesg = ["B100", "B050", "B020", "B010", "B005", "B002", "B001", "M100", "M050", "M025", "M010", "M005", "M001"]; var qax, qbx, qcx, qnx, qar; function qInitDesg() { qar = qax = 0; if(qNombreCampo != null && qGetCampo(qNombreCampo) && qGetValor(qNombreCampo) != "") { qar = qGetCampo("desglosador").value = qComa(qGetValor(qNombreCampo)); qCalcularDesg(); qGetCampo("okD").click(); } qGetCampo('B100').focus(); } function qCalcularDesg() { qGetCampo("vTotalM").value = qGetCampo("vTotalB").value = "0.00"; for(var i=0; i 0 ? 1 * qComa(qGetValor("vGranTotal")) - 1 * qar : 0; if(qax == 0) { qGetCampo("desglosador").value = ""; }else { qGetCampo("desglosador").value = -qax; dc(qGetCampo("desglosador"), 2); } qGetCampo("desglosador").style.color = qax > 0 ? "red" : "black"; } function qDetallar(ax) { qax = qComa(ax); while(qax > 0.00) { if(qax >= (qbx = 20)) qnx = "B020"; else if(qax >= (qbx = 10)) qnx = "B010"; else if(qax >= (qbx = 5)) qnx = "B005"; else if(qax >= (qbx = 1)) qnx = "B001"; else if(qax >= (qbx = 0.50)) qnx = "M050"; else if(qax >= (qbx = 0.25)) qnx = "M025"; else if(qax >= (qbx = 0.10)) qnx = "M010"; else if(qax >= (qbx = 0.05)) qnx = "M005"; else if(qax >= (qbx = 0.01)) qnx = "M001"; qcx = parseInt(qax / qbx, 10); qGetCampo(qnx).value = 1 * qGetValor(qnx) + qcx; qax = 1 * qax - qcx * qbx; qax = qax.toFixed(2) } qCalcularDesg(); } function qDesgDown(campo) { qax = qComa(qGetValor("vDen" + campo)); qGetCampo(campo).value = ""; while(qax > 0.00) { if(campo.substring(0, 1) == "B") { if(qax >= (qbx = 50) && campo > "B050") qnx = "B050"; else if(qax >= (qbx = 20) && campo > "B020") qnx = "B020"; else if(qax >= (qbx = 10) && campo > "B010") qnx = "B010"; else if(qax >= (qbx = 5) && campo > "B005") qnx = "B005"; else if(qax >= (qbx = 1) && campo > "B001") qnx = "B001"; else { qbx = 1; qnx = "M100"; } }else { if(qax >= (qbx = 1) && campo > "M100") qnx = "M100"; else if(qax >= (qbx = 0.50) && campo > "M050") qnx = "M050"; else if(qax >= (qbx = 0.25) && campo > "M025") qnx = "M025"; else if(qax >= (qbx = 0.10) && campo > "M010") qnx = "M010"; else if(qax >= (qbx = 0.05) && campo > "M005") qnx = "M005"; else if(qax >= (qbx = 0.01) && campo > "M001") qnx = "M001"; } qcx = parseInt(qax / qbx, 10); qGetCampo(qnx).value = 1 * qGetValor(qnx) + qcx; qax = 1 * qax - qcx * qbx; qax = qax.toFixed(2); } qCalcularDesg(); qGetCampo(campo).focus(); } function qDesgUp(campo) { qax = qComa(qGetValor("vDen" + campo)); if(qax > 0.00) { if(campo.substring(0, 1) == "M") { if(qax >= (qbx = 0.05) && campo < "M005") qnx = "M005"; else if(qax >= (qbx = 0.10) && campo < "M010") qnx = "M010"; else if(qax >= (qbx = 0.25) && campo < "M025") qnx = "M025"; else if(qax >= (qbx = 0.50) && campo < "M050") qnx = "M050"; else if(qax >= (qbx = 1.00) && campo < "M100") qnx = "M100"; else { qbx = 1; qnx = "B001"; } }else { if(qax >= (qbx = 1) && campo < "B001") qnx = "B001"; else if(qax >= (qbx = 5) && campo < "B005") qnx = "B005"; else if(qax >= (qbx = 10) && campo < "B010") qnx = "B010"; else if(qax >= (qbx = 20) && campo < "B020") qnx = "B020"; else if(qax >= (qbx = 50) && campo < "B050") qnx = "B050"; else if(qax >= (qbx = 100) && campo < "B100") qnx = "B100"; } qcx = parseInt(qax / qbx, 10); qGetCampo(qnx).value = 1 * qGetValor(qnx) + qcx; qax = 1 * qax - qcx * qbx; qax = qax.toFixed(2); if(qax > 0.00) { qGetCampo(campo).value = 1 * qGetValor(campo) - qbx * qcx / (1 * campo.replace("B", "").replace("M0", "0.").replace("M1", "1.")); qCalcularDesg(); if(qGetValor(campo).indexOf(".") > 0) { qDesgDown(campo); } }else { qGetCampo(campo).value = ""; } } qCalcularDesg(); qGetCampo(campo).focus(); } function qBorrarDesglosadora() { for(var i=0; i 0 ? qCampo - 1 : qCamposDesg.length - 1]).focus(); }else if(ev == 40 || ev == 13) { qGetCampo(qCamposDesg[qCampo < qCamposDesg.length - 1 ? qCampo + 1 : 0]).focus(); } } } if(ev != 8 && ev != 37 && ev != 39 && ev != 46 && (ev < 48 || ev > 57 && !(ev > 96 && ev < 106)) && !(eve.shiftKey || eve.ctrlKey)) { qBloquear(eve); } } function qBajarValorDesg() { qCalcularDesg(); qax = qax.toFixed(2); if(qar == 0 || qax == "0.00") { try { if(qNombreCampo != null && qGetCampo(qNombreCampo)) { qGetCampo(qNombreCampo).value = qGetValor("vGranTotal"); qGetCampo(qNombreCampo).focus(); } copiaCamp(); }catch (exception) { } qNombreCampo = null; closePop(); return false; }else if(qax > 0) { alert("Debes retirar = " + qax); }else { qax = - qax; alert("Debes agregar = " + qax); } } function copiaCamp() { //copia valores desglosados a campos equivalentes en formulario (notar cambia nombre de "v" a "f") for(var i=0; iB I L L E T ECant.Valor   M O N E D ACant.Valor100 1.00    50 0.50   20 0.25   10 0.10    5 0.05     2 0.01   1  T. Billetes:T. Monedas:   Cantidad por DetallarT O T A L     E F E C T I V O"; divContenido.update(calc); ventanaPop.insert(divContenido); ventanaPop.show(); Element.insert(document.body, ventanaPop); //Se carga el div en el formulario. qInitDesg(); qxEnd(); } // FIN de Funciones de la nueva Calculadora Desglosadora function compararMascara(elemento, mascara) { qxIni("compararMascara(elemento,mascara)", 1, "funciones.js"); var count = 0; var valor = elemento.value; var longitud = valor.length; for(var i=0; i"; for(var i=0; i" + elMenu.items[i] + ""; } html += ""; } document.getElementById("1_q000r000").innerHTML += html; } function menuMouseOver(menuBloque) { document.getElementById("menuBloque" + menuBloque).className = "zMenu zMenuMouseOver"; } function menuMouseOut(menuBloque) { if (menuActivo != -1 && menuActivo == menuBloque) timeOut = setTimeout("ocultarMenu(" + menuActivo + ");desactivaMenu();", 250); else document.getElementById("menuBloque" + menuBloque).className = "zMenu"; } function activaMenu(menuBloque) { document.getElementById("menuBloque" + menuBloque).className = "zMenu zActivaMenu"; menuActivo = menuBloque; } function desactivaMenu() { if (menuActivo != -1) { document.getElementById("menuBloque" + menuActivo).className = "zMenu"; menuActivo = -1; } } function menuMouseClick(cual) { if(menuActivo != -1) { clearTimeout(timeOut); ocultarMenu(menuActivo); desactivaMenu(); } activaMenu(cual); mostrarMenu(cual); } // Fin de Métodos que habilitan la operación y presentación del elemento ListaMenu. function stringToFecha(d) { qxIni("stringToFecha(d)", 1, "funciones.js"); var a, b, c; if(d.charAt(2) == '-') { a = d.substring(0, 2); b = d.substring(3, 5); c = d.substring(6, 10); }else if(d.charAt(2)=='/') { a = d.substring(3, 5); b = d.substring(0, 2); c = d.substring(6, 10); }else { a = d.substring(8, 10); b = d.substring(5, 7); c = d.substring(0, 4); } qxEnd(); return new Date(c, b-1, a); } function fechaToString(d, e) { qxIni("fechaToString(d, e)", 1, "funciones.js"); switch(e) { case "mm/dd/yyyy": a = (d.getMonth()<9 ? "0" : "") + (d.getMonth() + 1); a += "/" + (d.getDate()<=9 ? "0" : "") + d.getDate(); a += "/" + d.getFullYear(); break; case "dd-mm-yyyy": a = (d.getDate()<=9 ? "0" : "") + d.getDate(); a += "-" + (d.getMonth()<9 ? "0" : "") + (d.getMonth() + 1); a += "-" + d.getFullYear(); break; case "yyyy-mm-dd": a = d.getFullYear(); a += "-"+(d.getMonth()<9 ? "0" : "") + (d.getMonth() + 1); a += "-" + (d.getDate()<=9 ? "0" : "") + d.getDate(); break; case "dd de mm de yyyy": var dd = (d.getDate()<=9 ? "0" : "") + d.getDate(); var yyyy = d.getFullYear(); var mm = d.getMonth(); switch(mm){ case 0: mm = 'Enero'; break; case 1: mm = 'Febrero'; break; case 2: mm = 'Marzo'; break; case 3: mm = 'Abril'; break; case 4: mm = 'Mayo'; break; case 5: mm = 'Junio'; break; case 6: mm = 'Julio'; break; case 7: mm = 'Agosto'; break; case 8: mm = 'Septiembre'; break; case 9: mm = 'Octubre'; break; case 10: mm = 'Noviembre'; break; case 11: mm = 'Diciembre'; break; } a = dd + " de " + mm + " de " + yyyy; break; } qxEnd(); return a; } /* Imprime fecha con formato +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Códigos para formato: D DD DDD DDDD M MM MMM MMMM YY YYYY h hh H HH m mm s ss t tt * Formas de llamado: * fechaToFormato(); * -> Jueves, 15 de Febrero de 2007 17:05:09 (usa formato, fecha y tiempo local) * * fechaToFormato('DDDD, DD de MMMM de YYYY - HH:mm:ss DDDD'); * -> Jueves, 15 de Febrero de 2007 - 17:05:09 Jueves (usa fecha y tiempo local) * * fechaToFormato('DDDD, DD de MMMM de YYYY - HH:mm:ss DDDD',new Date()); * -> Jueves, 15 de Febrero de 2007 - 17:05:08 Jueves * * fechaToFormato('DDDD, DD de MMMM de YYYY - HH:mm:ss DDDD',new Date(),true); * -> Jueves, 15 de Febrero de 2007 - 17:05:09 Jueves (usa tiempo local) */ function fechaToFormato(qFormato, qFecha, takeHMS) { qxIni("fechaToFormato(qFormato, qFecha, takeHMS)", 1, "funciones.js"); var x = new Date(); if(qFecha) { if(takeHMS) x = new Date(qFecha.getFullYear(), qFecha.getMonth(), qFecha.getDate(), x.getHours(), x.getMinutes(), x.getSeconds()); else x = new Date(qFecha.getFullYear(), qFecha.getMonth(), qFecha.getDate(), qFecha.getHours(), qFecha.getMinutes(), qFecha.getSeconds()); } var result = ""; if(qFormato == null || qFormato == "") { result = x.toLocaleString(); }else if(qFormato.length > 0) { var months = ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto", "Septiembre","Octubre","Noviembre","Diciembre"]; var days = ["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"]; var meses = ["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"]; var dias = ["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"]; var diaSemana = x.getDay(); var diaMes = x.getDate(); var mes = x.getMonth() + 1; var anio = "" + x.getFullYear(); var hora24 = x.getHours(); var hora12 = x.getHours() > 12 ? (x.getHours() - 12) : x.getHours(); var minuto = x.getMinutes(); var segundo = x.getSeconds(); var tt = x.getHours() > 12 ? true : false; var result = qFormato; result = result.replace(/DDDD/g, (diaSemana<7 ? days[diaSemana] : "") ); result = result.replace(/DDD/g, (diaSemana<7 ? dias[diaSemana] : "") ); result = result.replace(/DD/g, (diaMes<10 ? "0" + diaMes : diaMes) ); result = result.replace(/D[^o]/g, (diaMes) ); result = result.replace(/MMMM/g, (mes<13 ? months[mes - 1] : "") ); result = result.replace(/MMM/g, (mes<13 ? meses[mes - 1] : "") ); result = result.replace(/MM/g, (mes<10 ? "0" + mes : mes) ); result = result.replace(/M[^ai]/g, (mes) ); result = result.replace(/YYYY/g, (anio) ); result = result.replace(/YY/g, (anio.substring(2)) ); result = result.replace(/hh/g, (hora12<10 ? "0" + hora12 : hora12) ); result = result.replace(/h/g, (hora12) ); result = result.replace(/HH/g, (hora24<10 ? "0" + hora24 : hora24) ); result = result.replace(/H/g, (hora24) ); result = result.replace(/mm/g, (minuto<10 ? "0" + minuto : minuto) ); result = result.replace(/m/g, (minuto) ); result = result.replace(/ss/g, (segundo<10 ? "0" + segundo : segundo) ); result = result.replace(/[^eo]s/g, (segundo) ); result = result.replace(/tt/g, (tt ? "PM" : "AM") ); result = result.replace(/[^spcr]t/g, (tt ? "P" : "A") ); } qxEnd(); return result; } // Métodos para navegación en HTML con Lista de TabIndex function navegaIndex(indexN) { qxIni("navegaIndex(indexN)", 1, "funciones.js"); if(indexN != "") { indexNAux = split(indexN,","); var indexTab = new Array(); var j = 0; for(var i=0; i=j-1 ? indexTab[0] : indexTab[i+2]; indexTab[i].proximoTres = (i+2)>=j-1 ? indexTab[0] : indexTab[i+3]; indexTab[i].proximoCuatro = (i+3)>=j-1 ? indexTab[0] : indexTab[i+4]; indexTab[i].proximoCinco = (i+4)>=j-1 ? indexTab[0] : indexTab[i+5]; indexTab[i].proximoSeis = (i+5)>=j-1 ? indexTab[0] : indexTab[i+6]; indexTab[i].proximoSiete = (i+6)>=j-1 ? indexTab[0] : indexTab[i+7]; indexTab[i].proximoOcho = (i+7)>=j-1 ? indexTab[0] : indexTab[i+8]; indexTab[i].proximoNueve = (i+8)>=j-1 ? indexTab[0] : indexTab[i+9]; indexTab[i].proximoDiez = (i+9)>=j-1 ? indexTab[0] : indexTab[i+10]; if(indexTab[i].id == "ps" || indexTab[i].id == "pt") indexTab[i].onkeydownOld = pp; else if(indexTab[i].onkeydown != null) indexTab[i].onkeydownOld = indexTab[i].onkeydown; indexTab[i].onkeydown = keydownIndex; } } qxEnd(); } /** * Función que simula el tab para navegar en los formularios */ function keydownIndex(e) { qxIni("keydownIndex(e)", 1, "funciones.js"); var evento = new Evento(e); try { try { if(evento.elemento.onkeydownOld != null) { evento.elemento.onkeydownOld(); } }catch(error) { // Cuando un elemento no contiene la función onkeydownOld poner envento en ps y pt document.getElementById("ps").onfocus = sa; document.getElementById("pt").onfocus = sa; document.getElementById("ps").onkeydown = pp; document.getElementById("pt").onkeydown = pp; document.getElementById("ps").onkeydownOld = null; document.getElementById("pt").onkeydownOld = null; } var code = evento.tecla; if(code==9 && evento.shift) { // Función de retroceso if(this.anterior.tab!=null && this.tab!=this.anterior.tab) MostrarTab(this.anterior.tab); // Secuencia de admisión para la función focus() sólo de elementos habilitados if(!this.anterior.disabled){ this.anterior.focus(); }else if(!this.anteriorDos.disabled) { this.anteriorDos.focus(); }else if(!this.anteriorTres.disabled) { this.anteriorTres.focus(); }else if(!this.anteriorCuatro.disabled) { this.anteriorCuatro.focus(); }else if(!this.proximoCinco.disabled) { this.anteriorCinco.focus(); }else if(!this.proximoSeis.disabled) { this.anteriorSeis.focus(); }else if(!this.proximoSiete.disabled) { this.anteriorSiete.focus(); }else if(!this.proximoOcho.disabled) { this.anteriorOcho.focus(); }else if(!this.proximoNueve.disabled) { this.anteriorNueve.focus(); }else if(!this.proximoDiez.disabled) { this.anteriorDiez.focus(); }else { alert("No se puede dar foco a más de 10 elementos seguidos que se encuentren deshabilitados"); } evento.cancelar(); } else if(code==9) { // Función hacia adelante if(this.proximo.tab!=null && this.tab!=this.proximo.tab) { MostrarTab(this.proximo.tab); } // Secuencia de admición para la función focus() solo de elementos habilitados if(!this.proximo.disabled) { this.proximo.focus(); }else if(!this.proximoDos.disabled) { this.proximoDos.focus(); }else if(!this.proximoTres.disabled) { this.proximoTres.focus(); }else if(!this.proximoCuatro.disabled) { this.proximoCuatro.focus(); }else if(!this.proximoCinco.disabled) { this.proximoCinco.focus(); }else if(!this.proximoSeis.disabled) { this.proximoSeis.focus(); }else if(!this.proximoSiete.disabled) { this.proximoSiete.focus(); }else if(!this.proximoOcho.disabled) { this.proximoOcho.focus(); }else if(!this.proximoNueve.disabled) { this.proximoNueve.focus(); }else if(!this.proximoDiez.disabled) { this.proximoDiez.focus(); }else { alert("No se puede dar foco a más de 10 elementos seguidos que se encuentren deshabilitados"); } evento.cancelar(); } }catch(ex) { if(document.getElementById("estatus")) try { document.getElementById("ps").focus(); } catch(e) {} try{ evento.cancelar(); }catch(err){ } } qxEnd(); } // Fin de métodos para navegación en HTML con Lista de TabIndex // Para poder cargar los formularios en Bancomáticos efectuados en asp // ruta = la dirección donde se encuentra la página con sus parámetros // Fecha : 20040727 (JHM) function pagina(ruta) { document.forms["fb"].action = ruta + obtieneSesion(); document.forms["fb"].target = '_blank'; document.forms["fb"].method = 'post'; document.forms["fb"].submit(); } /**** Funciones de escaneo y manipulacion de imagenes en la base de datos ****/ // Deshabilita el botón derecho en el objeto para evitar utilizar funciones // como grabar imagen o ver propiedades. Compatible con IE y browsers estandar // (Mozilla, Netscape). function disableRightClick(e) { if (document.all) { if (event.button == 2 || event.button == 3) { alert("Botón secundario deshabilitado para este objeto."); return false; } } else if (document.layers) { if (e.which == 3) { alert("Botón secundario deshabilitado para este objeto."); return false; } } } // Sirve para cambiar entre páginas dentro de la ventana de zoom function pagZoom(num, sec, tabla, tipDoc, tipPer, maxPagRef) { if (sec < 0) sec = 0; /*if (maxPagRef != null) { if (sec >= maxPagRef.value) sec = maxPagRef.value; }*/ reloadString = "FBSIM" + obtieneSesion() + "?zoomWin=1&num=" + num + "&sec=" + sec + "&tab=" + tabla + "&prueba=2" + (tipDoc != null && tipPer != null ? "&tipDoc=" + tipDoc + "&tipPrs=" + tipPer : ""); return reloadString; } //Funcion para cambiar de pagina dentro de una Imagen multipagina. //img = id de imagen a cambiar, num = identificador de imagen //en la base de datos, pag = pagina de la imagen. function moverImgPagina(img, num, pag) { if(document.getElementById(img + "MaxPagina").value < 0) ejecutaClick(document.getElementById(img + "Maxpag")); maxPag = document.getElementById(img + "MaxPagina").value; if((pag >= 0 || pag == -2) && pag <= maxPag) { if(pag == -2) { pag = maxPag; if(pag == -1) pag = 0; } document.getElementById(img + "PagNum").value = parseInt(pag) + 1; document.getElementById(img).src = "FBSIM" + obtieneSesion() + "?num=" + num + "&sec=" + pag; document.getElementById(img + "Pagina").value = pag; }else { document.getElementById(img + "PagNum").value = parseInt( document.getElementById(img + "Pagina").value) + 1; } } //Si no se ha aceptado una imagen, esta funcion permite reescanearla //o si se decide no reescanear, entonces desecharla. //nom=nombre del objeto escaner. //noi=nombre del objeto que permite visualizar la imagen function clearScan(nom, noi) { winCls = false; if (noi != "") opener.document.getElementById(noi).src = ""; if (confirm("Desea reescanear la imagen?\n" + "Prepare la página antes de aceptar.")) { ejecutaClick(opener.document.getElementById(nom + "escaner")); window.close(); return true; }else { opener.st('Finalizada captura de imagen.', false, 0); opener.document.getElementById(nom).disabled = false; document.location = "FBSES?finish=si"; return false; } } //Si se acepta una imagen, entra al servlet y la inserta en la //base de datos. nom=nombre del objeto que contiene la imagen function insertImageDB(nom, num, max, curr) { winCls = false; document.location = "FBSES?insert=si&num=" + num; if((max > 0 && curr < max) || max <= 0) { if(confirm("Desea escanear otra página?\n" + "Prepare la página antes de aceptar.")) { opener.document.getElementById(nom + "escaner").sec = curr; ejecutaClick(opener.document.getElementById(nom + "escaner")); window.close(); }else { opener.st('Finalizada captura de imagen', false, 0); opener.document.getElementById(nom).disabled = false; document.location = "FBSES?finish=si"; } }else { alert("Número máximo de páginas (" + max + ") escaneado.\n" + "Presione OK/Aceptar para cerrar."); opener.st('Finalizada captura de imagen', false, 0); opener.document.getElementById(nom).disabled = false; document.location = "FBSES?finish=si"; } } // En el generador simula un escaneo llamando al applet que se conecta // con el ServidorEscaner. Argumentos: // wid = ancho de la página; hei = alto de la página // res = resolución de escaneo; uni = unidades a utilizar // oui = 1:ocultar GUI de driver, 0:mostrar gui de driver. function scanSimulate(wid, hei, res, uni, oui) { qxIni("scanSimulate(wid, hei, res, uni, oui)", 1, "funciones.js"); winSc = window.open("", "qWinSc", "left=0,top=0,height=510,width=680,resizable=0,scrollbars=1,toolbar=0,location=0,menubar=0,status=1"); wrt = "Simulador de escaneo"; wrt += ""; wrt += ""; wrt += ""; wrt += ""; winSc.document.write(wrt); winSc.document.close(); qxEnd(); } /** * Funcion que permite iniciar el escaneo. * * @param x Margen superior en cm * @param y Margen inferior en cm * @param w Ancho en cm (0 para todo el ancho posible) * @param h Alto en cm (0 para todo el alto posible) * @param res Resolución de escaneo (puede ser ignorado por el dispositivo) * @param name Name del campo que contiene el CIMAGEN * @param nameImg Name de la imagen a ser actualizada o en blanco para no actualizar * @param tipoImagen Tipo de la imagen a ser escaneada * @param pagina 0 para multipagina, 1 para una sola página, 2 para dos paginas */ function escanear(x, y, w, h, res, type, name, nameImg, tipoImagen, pagina) { // TODO ver que se hace con nameImg newValue = qdf[name].value || -Math.round(Math.random() * 100000); Escaneo.escanear( { x: x, y: y, w: w, h: h, resolution: res, scannerType: type }, { paginar: pagina == 0, onComplete: function(trabajoEscaneo) { new Ajax.Request('FBSES;jsessionid=' + JSESSIONID, { parameters: { save: true, num: newValue, sec: trabajoEscaneo.pagina, tipo: tipoImagen, img: trabajoEscaneo.data }, onComplete: function() { qdf[name].value = newValue; document.getElementById("qCCM").value = "0"; st("Escaneo finalizado. Por favor guarde cualquier cambio con F12.", false, 0); } }); }, onCancel: function(trabajoEscaneo) { new Ajax.Request('FBSES;jsessionid=' + JSESSIONID, { parameters: { del: true, num: newValue }, onComplete: function() { st("Escaneo cancelado.", false, 0); } }); } } ); } /*** Fin funciones escaneo/imagenDB ***/ /**** Funciones para ventana de zoom de imagenes ****/ //Precarga la imagen a visualizar, necesario para obtener el tamano //del largo y ancho originales de la imagen. //num=codigo de imagen raiz, sec=numero de pagina (cero es la primera). function preLoadZoom(num, sec, tabla, tipDoc, tipPrs) { zoomImg = new Image(); if (tipDoc != null && tipPrs != null) zoomImg.src = "FBSIM" + obtieneSesion() + "?num=" + num + "&tab=" + tabla + "&sec=" + sec + "&tipDoc=" + tipDoc + "&tipPrs=" + tipPrs; else zoomImg.src = "FBSIM" + obtieneSesion() + "?num=" + num + "&sec=" + sec + "&tab=" + tabla; } //Cambia directamente el tamano (zoom) de la imagen //imgName=cadena con el nombre de la imagen a manipular //zoomFact=factor de zoom en tanto por 1 //(1 = tamano original, 0.5 = 50% del tamano, 2 = 200% del tamano, etc.) function absoluteZoom(imgName, zoomFact) { if (zoomImg.complete) { if (origW == null && origH == null) { origW = zoomImg.width; origH = zoomImg.height; } imag = eval(imgName); if (zoomFact <= 0) zoomFact = 1; imag.style.width = origW * zoomFact; imag.style.height = origH * zoomFact; } return zoomFact; } //Incrementa o decrementa el zoom de la imagen en 5 puntos porcentuales. //imgName=cadena con el nombre de la imagen //currZm=variable con el factor de zoom actual //inout= mayor que 0:zoom in, menor que 0:zoom out, igual a 0:tamano original. function stepZoom(imgName, currZm, inout) { if (inout < 0) currZm -= 0.05; else if (inout > 0) currZm += 0.05; else if (inout == 0) currZm = 1; currZm = absoluteZoom(imgName, currZm); return currZm; } /*** Fin funciones de zoom ***/ /** * Funciones para manejar eventos * El objeto evento contiene las siguentes propiedades una vez inicializado * Evento.prototype.evento Es el evento en si * Evento.prototype.tecla Contiene la tecla si se apalastó una tecla * Evento.prototype.alt Verdadero si se aplastó alt * Evento.prototype.ctrl Verdadero si se aplastó ctrl * Evento.prototype.shift Verdadero si se aplastó shift * Evento.prototype.caracter Contiene el caracter correspondiente a la tecla * Evento.prototype.elemento Contiene el elemento que lanzó el evento * Evento.prototype.cancelar() Cancela la propagación del evento **/ function Evento(e,d) { // capturar el evento para todos los navegadores this.evento =(e)? e : window.event; this.initTeclas(); // capturar tecla del evento if(this.evento.keyCode){ this.tecla = this.evento.keyCode; }else if(this.evento.which){ this.tecla = this.evento.which; } this.caracter = String.fromCharCode(this.tecla); this.alt = this.evento.altKey; this.ctrl = this.evento.ctrlKey; this.shift = this.evento.shiftKey; this.esEspecial(); // capturar origen del evento if(this.evento.srcElement) this.elemento = this.evento.srcElement; else if(this.evento.target) this.elemento = this.evento.target; //else alert("Error no hay elemento que genere el evento!!!!"); //if(this.elemento.nodeType == 3) // evita un bug en Safari //this.elemento = this.elemento.parentNode; if(d) alert(this.toString()); } Evento.prototype.toString = function() { var ret = ""; ret += "Evento\n"; ret += "evento:" + this.evento + "\n"; ret += "tecla:" + this.tecla + "\n"; ret += "caracter:" + this.caracter + "\n"; ret += "alt:" + this.alt + "\n"; ret += "ctrl:" + this.ctrl + "\n"; ret += "shift:" + this.shift + "\n"; ret += "elemento:" + this.elemento + "\n"; return ret; } Evento.prototype.cancelar = function(e) { if(!e || !this.esEspecial) { try { this.evento.cancelBubble = true; } catch(e) {} try { if(this.evento.stopPropagation) this.evento.stopPropagation(); } catch(e) {} try { if(this.evento.returnValue) this.evento.returnValue = false; } catch(e) {} try { if(this.evento.keyCode) this.evento.keyCode = 0; } catch(e) {} Event.stop(this.evento); } } Evento.prototype.esEspecial = function() { this.esEspecial = (this.tecla == this.TAB) || (this.tecla == this.BACKSPACE) || (this.tecla == this.ENTER) || (this.tecla == this.FIN) || (this.tecla == this.INICIO) || (this.tecla == this.IZQUIERDA) || (this.tecla == this.ARRIBA) || (this.tecla == this.DERECHA) || (this.tecla == this.ABAJO) || (this.tecla == this.SUPR); } Evento.prototype.initTeclas = function() { this.TAB = 9; this.BACKSPACE = 8; this.ENTER = 13; this.ESPACIO = 32; this.PGUP = 33; this.PGDOWN = 34; this.FIN = 35; this.INICIO = 36; this.IZQUIERDA = 37; this.ARRIBA = 38; this.DERECHA = 39; this.ABAJO = 40; this.INS = 45; this.SUPR = 46; this.PUNTO = 190; this.DECIMAL = 110; this.F1 = 112; this.F2 = 113; this.F3 = 114; this.F4 = 115; this.F5 = 116; this.F6 = 117; this.F7 = 118; this.F8 = 119; this.F9 = 120; this.F10 = 121; this.F11 = 122; this.F12 = 123; } /* function marcarNumeroTelefonico(numero) { var args = new Array(); var marcador; args[0] = numero; dialer = showModalDialog("marcarTelefono.html", args, "status:false;dialogWidth:150px;dialogHeight:350px;scroll:no;help:no;status:no;"); return dialer; } */ /*Función que carga en un objeto combobox los valores obtenidos para los códigos alternos de transacciones desde un array global*/ function cargarcombosubmenu(combo, idsubmenu) { if(globalVarsSubMenu[idsubmenu] != null && globalVarsSubMenu[idsubmenu] != '') { transacciones = globalVarsSubMenu[idsubmenu].split(','); combo.length = transacciones.length + 1; combo.options[0].text = ''; combo.options[0].value = ''; for(var m=0; m' + mensaje + ''); loadingDialog.show(); } /** *revisa si una cuenta a la vista tiene saldo */ function getBalanceAcount(_cuenta, _monto) { var rec = getJsonRecord('queryaccountbalances', 'CCUENTA', _cuenta, 'cLov_CCUENTA=' + _cuenta + '&cLov_CPERSONA_COMPANIA=2' + '&cLov_MONTO=' + _monto); if(rec == null) { initLoadingDialog('LA CUENTA NO TIENE SALDO DISPONIBLE'); return false; } var _saldo = parseFloat(0 + revisaNull(rec['SALDODISPONIBLE']), 10); if(_saldo == 0) { initLoadingDialog('LA CUENTA NO TIENE SALDO DISPONIBLE'); return true; } st('TRANSACCION REALIZADA CORRECTAMENTE', false, 0); return false; } /** * JsonRecord para el cambio de moneda **/ function cambioMoneda (ind, _montocta) { if(qdf.f_monedacta.value == '' ){ initLoadingDialog('NO EXISTE MONEDA DESTINO'); return; } var _monto = '&cLov_' + ( (_montocta ) ? "VALORMONEDA=" + qComa(qdf.fValorMonedacta[ind].value) : "MONTO=" + qComa(qdf.fmonto[ind].value)); var _cpersona = qdf.fcpersona.value == '' ? '' : '&cLov_CPERSONA=' + qdf.fcpersona.value; var rec = getJsonRecord('cambiomoneda', 'CMONEDAORIGEN', qdf.fMonedacta.value, 'cLov_CMONEDAORIGEN=' + qdf.fMonedacta.value + '&cLov_CMONEDADESTINO=' + qdf.fcmonedacta[ind].value + '&cLov_CSUBSISTEMA=' + qdf.fsubsistema.value + '&cLov_CTRANSACCION=' + qdf.ftransaccion.value + '&cLov_VERSIONTRANSACCION=' + qdf.fversion.value + _monto + _cpersona); if(rec == null) { st(getInnerHTML(document.getElementById('estatus')), false, 1); return false; } var monto = revisaNull(rec['MONTO']); if(monto !='' ) { qdf.fmonto[ind].value = revisaNull(rec['MONTO']); dc(qdf.fmonto[ind], 2); } qdf.fCotizacionCom[ind].value = revisaNull(rec['COTIZACIONCOMPRA']); qdf.fCotizacionVent[ind].value = revisaNull(rec['COTIZACIONVENTA']); monto=revisaNull(rec['VALORMONEDA']); if(monto!='' ) { qdf.fValorMonedacta[ind].value = revisaNull(rec['VALORMONEDA']); dc(qdf.fValorMonedacta[ind], 2); } qdf.fcmoneda[ind].value = qdf.fMonedacta.value ; var __totalExchange = 0; for(var a=0; a 0 ? __totalExchange : ''; dc(qdf.ftotalExchange, 2); st('TRANSACCION REALIZADA CORRECTAMENTE', false, 0); } function mostrarCampos (names) { for(var name in names) { var el = document.getElementsByName(name)[0]; var numero = document.createElement("span"); numero.innerText = names[name]; numero.style.backgroundImage = "url(img/circulo.png)"; numero.style.position = "absolute"; numero.style.textAlign = "center"; numero.style.zIndex = "1000"; numero.style.width = "20px"; numero.style.height = "20px"; var node = el.parentNode; if(node.tagName != "TD") { numero.style.top = node.style.top; numero.style.left = node.style.left; node.parentNode.insertBefore(numero, node); }else { node.insertBefore(numero, el); } } } /** * Insertar funciones arriba de estas lineas **/ document.onError = "st('Error',false,1);return false;"; document.onhelp = function() { event.cancelBubble = true; event.returnValue = false; }