// -*- coding: utf-8 -*- function spaInqCriaAjax() { var xmlhttp; try { xmlhttp = new XMLHttpRequest(); } catch (ie1) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (ie2) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { xmlhttp = false; } } } return xmlhttp; } function spaInqTrataAjax(oObj) { lRet = true; if (oAjax.readyState == 4) { if (oAjax.status == 200) { // Estou usando json //window.alert(oAjax.responseText); oJson = eval("(" + oAjax.responseText + ")"); if (oAjax.responseText.indexOf("itens") != -1) { lRet = spaInqGeraResult(oObj,oJson); } } } return lRet; } function spaInqVerifLogin() { nStatus = 0; oUsuario = document.getElementById("spa-inq-usuario"); oSenha = document.getElementById("spa-inq-senha"); if (oUsuario.value.length == 0 || oSenha.value.length == 0) { nStatus = 1; } if (nStatus == 0) { oAjax = spaInqCriaAjax(); if (oAjax) { cURL = "spa_query.php?tp=12&" + "us=" + oUsuario.value + "&" + "se=" + oSenha.value + "&sr=" + gcSpaSrInqPro; oAjax.open('GET',cURL,false); oAjax.send(null); oResultado = document.getElementById("spa-inq-resultado"); nStatus = spaInqTrataAjax(oResultado) ? 0 : 2; } } switch (nStatus) { case 0: gcSpaInqUsu = oUsuario.value; gcSpaInqSen = oSenha.value; document.getElementById("spa-inq-login").style.display = "none"; document.getElementById("spa-inq-resultado").style.display = "block"; break; case 1: window.alert("Voc\u00EA deve informar o usu\u00E1rio e a senha."); oUsuario.select(); oUsuario.focus(); break; case 2: window.alert("Usu\u00E1rio e/ou senha inv\u00E1lidos."); oUsuario.select(); oUsuario.focus(); break; } } function spaInqGeraResult(oObj,oJson) { lRet = true; if (oJson.status == 0) { oSubTit = document.getElementById("spa-inq-subtit"); cSubTit = oSubTit.innerHTML; //cConteudo = '
' + cConteudo = '

' + cSubTit + '' + '
   Inquilino: ' + oJson.inq[0].nome + '
Codigo: ' + oJson.inq[0].cod + '   
'; nImv = -1; nItTb = 0; for (i = 0; i < oJson.itens.length; i++) { if (nImv != oJson.itens[i].imov) { for (j = 0; j < oJson.imov.length; j++) { if (oJson.imov[j].cod == oJson.itens[i].imov) { break; } } if (nImv != -1) { cConteudo += "

"; } cConteudo += '
' + '' + '
Imóvel: ' + oJson.imov[j].end + ' - ' + oJson.imov[j].bai + ' - ' + oJson.imov[j].cid + ' - ' + oJson.imov[j].est + '    Codigo: ' + oJson.imov[j].cod + '

Para consultar ou imprimir o boleto clique no vencimento ou boleto desejado

' + '' + '' + ''; nImv = oJson.itens[i].imov; nItTb = 0; } cChave = oJson.inq[0].cod + "," + oJson.itens[i].ndoc; cConteudo += ''; cClasseEsq = (nItTb % 2 == 0) ? "spa-inq-tab-itens-det-e-p" : "spa-inq-tab-itens-det-e-i"; cClasseDir = (nItTb % 2 == 0) ? "spa-inq-tab-itens-det-d-p" : "spa-inq-tab-itens-det-d-i"; cConteudo += '' + ''; nItTb ++; } cConteudo += "
VencimentoBoleto
' + oJson.itens[i].venc + '
' + '
' + oJson.itens[i].ndoc + '

"; /* if (i > 0) { oObj.innerHTML = cConteudo; } else { */ if (i < 1) { //oObj.innerHTML = '
Nenhum boleto em aberto foi encontrado.
'; cConteudo = '


Nenhum boleto em aberto foi encontrado.
'; } cConteudo += "
" + '
' + '
'; oObj.innerHTML = cConteudo; } else { lRet = false; } return lRet; } function spaInqFechaPesquisa() { document.getElementById("spa-inq-resultado").style.display = "none"; document.getElementById("spa-inq-login").style.display = "block"; document.getElementById("spa-inq-usuario").value = ""; document.getElementById("spa-inq-senha").value = ""; document.getElementById("spa-inq-usuario").focus(); } function spaInqLinkOver(oObj) { //oObj.style.color = "#0000CC"; oObj.style.cursor = "hand"; /* * Um "hack" maluco necessário para o Firefox. Seria um bug ou uma feature? * Curioso é que no IE, com ou sem esta linha, tudo funciona perfeitamente. */ oObj.style.cursor = "pointer"; } function spaInqLinkOut(oObj) { //oObj.style.color = "#000000"; oObj.style.cursor = "pointer"; } function spaInqExibeBoleto(oObj) { /* * O Firefox só obedece width e height. A janela traz barra de endereço, statusbar e permite redimensionamento. * Só é possível mudar este comportamento em about:config. */ cID = oObj.id; cItem = cID.substring(cID.indexOf("_") + 1); cURL = "spa_query.php?tp=13&id=" + document.getElementById("spa-inq-chave_" + cItem).value + "&sr=" + gcSpaSrInqPro + "&us=" + gcSpaInqUsu + "&se=" + gcSpaInqSen; window.open(cURL,"_blank","width=830,height=" + window.clientHeight + ",resizable=1,scrollbars=1,menubar=1,toolbar=1"); /*$lb.launch({ url: cURL, options: 'width:900 height:700 scrollbars:no showPrint:true ', title: '', description: '
Powered by: Spaic Sistemas
' }); */ /* // Usar IFrame oIFrame = parent.document.createElement("iframe"); if (oIFrame) { oIFrame.id = "frm_bol"; oIFrame.src = cURL; cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { oIFrame.id = "frm_bol_ie"; } else { oIFrame.style.position = "fixed"; oIFrame.style.top = "5px"; } oIFrame.style.width = "800px"; oIFrame.style.height = "520px"; //"515px"; window.alert(top.availHeight); oIFrame.style.left = "97px"; if (lMSIE) { nCurScrollOffset = cumulativeScrollOffset(parent.document.getElementById("wrapper")); oIFrame.style.top = nCurScrollOffset + 5; window.alert(oIFrame.style.top); } oIFrame.style.padding = "0px"; oIFrame.style.border = "solid 4px #74653D"; oIFrame.frameBorder = "0"; oBody = parent.document.body; oBody.appendChild(oIFrame); } */ } function spaInqFrmSen() { oAjax = spaInqCriaAjax(); if (oAjax) { cURL = "spa_query.php?tp=22&sr=" + gcSpaSrInqPro; oAjax.open('GET',cURL,false); oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcSpaIDCtn); oDiv.innerHTML = oAjax.responseText; document.getElementById("spa-inq-usuario").focus(); cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { document.getElementById("spa-inq-usuario").focus(); } } } } } function spaInqAltSen() { nStatus = 0; oUsuario = document.getElementById("spa-inq-usuario"); oSenha = document.getElementById("spa-inq-senha"); oNovSen = document.getElementById("spa-inq-nov-sen"); oConfSen = document.getElementById("spa-inq-conf-sen"); if (oUsuario.value.length == 0 || oSenha.value.length == 0) { nStatus = 1; } else if (oNovSen.value.length == 0 || oConfSen.value.length == 0) { nStatus = 2; } else if (oNovSen.value != oConfSen.value) { nStatus = 3; } if (nStatus == 0) { oAjax = spaInqCriaAjax(); if (oAjax) { cURL = "spa_query.php?tp=23&us=" + oUsuario.value + "&se=" + oSenha.value + "&sr=" + gcSpaSrInqPro + "&nse=" + oNovSen.value; oAjax.open('GET',cURL,false); oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { if (oAjax.responseText.indexOf("*NE*") != -1) { nStatus = 4; } else if (oAjax.responseText.indexOf("*ER*") != -1) { nStatus = 5; } else { oDiv = document.getElementById(gcSpaIDCtn); oDiv.innerHTML = oAjax.responseText; } } } } } switch (nStatus) { /* case 0: gcSpaProUsu = oUsuario.value; gcSpaProSen = oSenha.value; document.getElementById("spa-pro-login").style.display = "none"; document.getElementById("spa-pro-resultado").style.display = "block"; break; */ case 1: window.alert("Voc\u00EA deve informar o usu\u00E1rio e a senha atual."); oUsuario.select(); oUsuario.focus(); break; case 2: window.alert("Voc\u00EA deve digitar a nova senha 2 vezes para confirm\u00E1-la."); oNovSen.select(); oNovSen.focus(); break; case 3: window.alert("A nova senha digitada n\u00E3o confere com a confirma\u00E7\u00E3o."); oNovSen.select(); oNovSen.focus(); break; case 4: window.alert("Usu\u00E1rio e/ou senha inv\u00E1lidos."); oUsuario.select(); oUsuario.focus(); break; case 5: window.alert("Erro desconhecido. A senha n\u00E3o p\u00F4de ser alterada!"); oUsuario.select(); oUsuario.focus(); break; } } function spaInqVoltSen() { oAjax = spaInqCriaAjax(); if (oAjax) { cURL = "spa_query.php?tp=11&sr=" + gcSpaSrInqPro; oAjax.open('GET',cURL,false); oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcSpaIDCtn); oDiv.innerHTML = oAjax.responseText; document.getElementById("spa-inq-usuario").focus(); cNav = navigator.userAgent; lMSIE = (cNav.indexOf("MSIE") != -1); if (lMSIE) { document.getElementById("spa-inq-usuario").focus(); } } } } } function spaInqEsqSen() { oAjax = spaInqCriaAjax(); if (oAjax) { cURL = "spa_query.php?tp=24&sr=" + gcSpaSrInqPro; oAjax.open('GET',cURL,false); oAjax.send(null); if (oAjax.readyState == 4) { if (oAjax.status == 200) { oDiv = document.getElementById(gcSpaIDCtn); oDiv.innerHTML = oAjax.responseText; } } } }