|
|
|
|
|
|
|
|
|
function SelecionaTodosChecks(spanChk) {
|
|
|
|
|
|
|
|
|
|
var oItem = spanChk.children;
|
|
|
|
|
var theBox = (spanChk.type == "checkbox") ? spanChk : spanChk.children.item[0];
|
|
|
|
|
|
|
|
|
|
xState = theBox.checked;
|
|
|
|
|
elm = theBox.form.elements;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < elm.length; i++)
|
|
|
|
|
if (elm[i].type == "checkbox" && elm[i].id != theBox.id)
|
|
|
|
|
{
|
|
|
|
|
if (elm[i].checked != xState)
|
|
|
|
|
elm[i].click();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function LimpaSenha(campo) {
|
|
|
|
|
document.aspnetForm[campo].value = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function FormataData(campo, teclapres) {
|
|
|
|
|
var tecla = teclapres.keyCode;
|
|
|
|
|
vr = document.aspnetForm[campo].value;
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
tam = vr.length + 1;
|
|
|
|
|
|
|
|
|
|
if (vr.length >= 8)
|
|
|
|
|
vr = vr.substr(0, 7);
|
|
|
|
|
|
|
|
|
|
if (tecla != 9 && tecla != 8) {
|
|
|
|
|
if (tam > 2 && tam < 5)
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 2) + '/' + vr.substr(tam - 2, tam);
|
|
|
|
|
if (tam >= 5 && tam <= 10)
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, 2) + '/' + vr.substr(2, 2) + '/' + vr.substr(4, 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function validaData(campo) {
|
|
|
|
|
var valor = campo.value;
|
|
|
|
|
var date = valor;
|
|
|
|
|
var ardt = new Array;
|
|
|
|
|
var ExpReg = new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/[12][0-9]{3}");
|
|
|
|
|
ardt = date.split("/");
|
|
|
|
|
erro = false;
|
|
|
|
|
|
|
|
|
|
if (date.search(ExpReg) == -1) {
|
|
|
|
|
erro = true;
|
|
|
|
|
} else if (((ardt[1] == 4) || (ardt[1] == 6) || (ardt[1] == 9) || (ardt[1] == 11)) && (ardt[0] > 30))
|
|
|
|
|
erro = true;
|
|
|
|
|
else if (ardt[1] == 2) {
|
|
|
|
|
if ((ardt[0] > 28) && ((ardt[2] % 4) != 0))
|
|
|
|
|
erro = true;
|
|
|
|
|
if ((ardt[0] > 29) && ((ardt[2] % 4) == 0))
|
|
|
|
|
erro = true;
|
|
|
|
|
}
|
|
|
|
|
if (erro) {
|
|
|
|
|
alert("\"" + valor + "\" n<EFBFBD>o <EFBFBD> uma data v<EFBFBD>lida!!!");
|
|
|
|
|
campo.focus();
|
|
|
|
|
campo.value = "";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function FormataCpf(campo, tammax, teclapres) {
|
|
|
|
|
var tecla = teclapres.keyCode;
|
|
|
|
|
vr = document.aspnetForm[campo].value;
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace(",", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
|
|
|
|
|
if (tam < tammax && tecla != 8) {
|
|
|
|
|
tam = vr.length + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tecla == 8) {
|
|
|
|
|
tam = tam - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105) {
|
|
|
|
|
if (tam <= 2) {
|
|
|
|
|
document.aspnetForm[campo].value = vr;
|
|
|
|
|
}
|
|
|
|
|
if ((tam > 2) && (tam <= 5)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 2) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 6) && (tam <= 8)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 5) + '.' + vr.substr(tam - 5, 3) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 9) && (tam <= 11)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 8) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 12) && (tam <= 14)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 11) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 15) && (tam <= 17)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 14) + '.' + vr.substr(tam - 14, 3) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function FormataCgc(campo, tammax, teclapres) {
|
|
|
|
|
var tecla = teclapres.keyCode;
|
|
|
|
|
vr = document.aspnetForm[campo].value;
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace(",", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
vr = vr.replace("-", "");
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
|
|
|
|
|
if (tam < tammax && tecla != 8) {
|
|
|
|
|
tam = vr.length + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tecla == 8) {
|
|
|
|
|
tam = tam - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105) {
|
|
|
|
|
if (tam <= 2) {
|
|
|
|
|
document.aspnetForm[campo].value = vr;
|
|
|
|
|
}
|
|
|
|
|
if ((tam > 2) && (tam <= 6)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 2) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 7) && (tam <= 9)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 6) + '/' + vr.substr(tam - 6, 4) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 10) && (tam <= 12)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 9) + '.' + vr.substr(tam - 9, 3) + '/' + vr.substr(tam - 6, 4) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 13) && (tam <= 14)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 12) + '.' + vr.substr(tam - 12, 3) + '.' + vr.substr(tam - 9, 3) + '/' + vr.substr(tam - 6, 4) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 15) && (tam <= 17)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 14) + '.' + vr.substr(tam - 14, 3) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + '-' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function FormataValor(campo, tammax, teclapres) {
|
|
|
|
|
var tecla = teclapres.keyCode;
|
|
|
|
|
vr = document.aspnetForm[campo].value;
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace("/", "");
|
|
|
|
|
vr = vr.replace(",", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
|
|
|
|
|
if (tam < tammax && tecla != 8) {
|
|
|
|
|
tam = vr.length + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tecla == 8) {
|
|
|
|
|
tam = tam - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105) {
|
|
|
|
|
if (tam <= 2) {
|
|
|
|
|
document.aspnetForm[campo].value = vr;
|
|
|
|
|
}
|
|
|
|
|
if ((tam > 2) && (tam <= 5)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 2) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 6) && (tam <= 8)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 5) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 9) && (tam <= 11)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 8) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 12) && (tam <= 14)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 11) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 15) && (tam <= 17)) {
|
|
|
|
|
document.aspnetForm[campo].value = vr.substr(0, tam - 14) + '.' + vr.substr(tam - 14, 3) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var ct = 0; ct < document.aspnetForm.elements.length; ct++) {
|
|
|
|
|
if (document.aspnetForm.elements[ct].name == document.aspnetForm.elements[campo].name) {
|
|
|
|
|
if (!teclapres.shiftKey && tecla == 9 && document.aspnetForm.elements[ct + 1] && document.aspnetForm.elements[ct + 1].name == "senhaConta" && document.applets['tclJava']) {
|
|
|
|
|
document.applets['tclJava'].setFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Abre(URL) {
|
|
|
|
|
window.open(URL, "nomeJan", "top=100, left=200, width=720,height=550,scrollbars=YES, Resizable=YES")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Abre1(URL) {
|
|
|
|
|
w = 800
|
|
|
|
|
h = 600
|
|
|
|
|
if (window.screen) {
|
|
|
|
|
w = window.screen.availWidth;
|
|
|
|
|
h = window.screen.availHeight;
|
|
|
|
|
}
|
|
|
|
|
window.open(URL, "nomeJan1", 'top=0, left=0, width=' + w + ',height=' + h + ',scrollbars=YES, Resizable=YES, Maximized=YES')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Max(URL) {
|
|
|
|
|
var win = window.open(URL, "maxJan", "top=100, left=100, width=720,height=550,scrollbars=YES, Resizable=YES, Maximized=YES")
|
|
|
|
|
win.moveTo(-4, -4)
|
|
|
|
|
win.resizeTo(screen.availWidth + 8, screen.availHeight + 8)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function PegaFoco(Campo) {
|
|
|
|
|
var control = document.getElementById(Campo);
|
|
|
|
|
if (control) {
|
|
|
|
|
control.focus();
|
|
|
|
|
control.Select();
|
|
|
|
|
} else
|
|
|
|
|
window.setTimeout("PegaFoco('" + Campo + "');", 100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function PegaFoco2(Campo) {
|
|
|
|
|
var control = document.getElementById(Campo);
|
|
|
|
|
if (control) {
|
|
|
|
|
control.focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SetFocus(campo, teclapres) {
|
|
|
|
|
var tecla = teclapres.keyCode;
|
|
|
|
|
if (tecla == 13)
|
|
|
|
|
PegaFoco2(campo);
|
|
|
|
|
|
|
|
|
|
//document.aspnetForm[campo].focus();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//sintaxe: NovaJanela('arquivo.aspx','janPop',500,500,'resizable=yes , scrollbars=YES')
|
|
|
|
|
var win;
|
|
|
|
|
|
|
|
|
|
function NovaJanela(pagina, nome, w, h, add_atributos) {
|
|
|
|
|
|
|
|
|
|
w = w > 800 ? w : 800;
|
|
|
|
|
h = h > 600 ? h : 600;
|
|
|
|
|
|
|
|
|
|
var winl = (screen.width - w) / 2;
|
|
|
|
|
var wint = (screen.height - h) / 2;
|
|
|
|
|
//Atributos
|
|
|
|
|
var settings = 'height=' + h + ',';
|
|
|
|
|
settings += 'width=' + w + ',';
|
|
|
|
|
settings += 'top=' + wint + ',';
|
|
|
|
|
settings += 'left=' + winl + ',';
|
|
|
|
|
settings += 'resizable=yes,scrollbars=yes,location=no, toolbar=no';
|
|
|
|
|
//setWin = pagina + ';' + nome+ ';' + w + ';' + h;
|
|
|
|
|
|
|
|
|
|
//if(add_atributos!=""){settings += ',' + add_atributos;}
|
|
|
|
|
|
|
|
|
|
win = window.open(pagina + '&window=1', nome, settings);
|
|
|
|
|
//Corre<EFBFBD><EFBFBD>o para outros navegadores
|
|
|
|
|
if (parseInt(navigator.appVersion) >= 4) {
|
|
|
|
|
win.window.focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetWindowTop()
|
|
|
|
|
{
|
|
|
|
|
NovaJanela('index.php?idProg=14', 'AgenteCallcenter', 650, 330, '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function NovaJanelaFull(pagina, nome) {
|
|
|
|
|
|
|
|
|
|
//Atributos
|
|
|
|
|
var settings = 'height=' + screen.height + ',';
|
|
|
|
|
settings += 'width=' + screen.width + ',';
|
|
|
|
|
settings += 'top=' + 0 + ',';
|
|
|
|
|
settings += 'left=' + 0 + ',';
|
|
|
|
|
settings += 'toolbar=' + 1 + ',';
|
|
|
|
|
settings += 'location=' + 1 + ',';
|
|
|
|
|
settings += 'directories=' + 1 + ',';
|
|
|
|
|
settings += 'status=' + 1 + ',';
|
|
|
|
|
settings += 'menubar=' + 1 + ',';
|
|
|
|
|
settings += 'scrollbars=' + 1 + ',';
|
|
|
|
|
settings += 'resizable=' + 1;
|
|
|
|
|
|
|
|
|
|
win = window.open(pagina, nome, settings);
|
|
|
|
|
//Corre<EFBFBD><EFBFBD>o para outros navegadores
|
|
|
|
|
if (parseInt(navigator.appVersion) >= 4) {
|
|
|
|
|
win.window.focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function indexOfA(array, value)
|
|
|
|
|
{
|
|
|
|
|
for (i = 0; i < array.length; i++)
|
|
|
|
|
if (array[i] == value)
|
|
|
|
|
return i;
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var emails = new Array();
|
|
|
|
|
var idx = 0;
|
|
|
|
|
|
|
|
|
|
function AbreLista(lista)
|
|
|
|
|
{
|
|
|
|
|
var obj = document.getElementById(lista);
|
|
|
|
|
var str = 'listaemail.aspx?txt=' + lista + '&lista=' + obj.value;
|
|
|
|
|
NovaJanela(str, 'listaEmail', 600, 500, 'resizable=yes , scrollbars=YES');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SetEmail(sender, email, id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var vr = opener.document.getElementById(id);
|
|
|
|
|
|
|
|
|
|
if ((vr.value.length > 0) && emails.length == 0)
|
|
|
|
|
emails = vr.value.split(';');
|
|
|
|
|
|
|
|
|
|
var idEmail = indexOfA(emails, email);
|
|
|
|
|
|
|
|
|
|
if (idEmail < 0)
|
|
|
|
|
{
|
|
|
|
|
sender.value = 'Remover';
|
|
|
|
|
emails[idx++] = email;
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
sender.value = ' Incluir ';
|
|
|
|
|
//alert(emails[idEmail] + '->' idEmail);
|
|
|
|
|
emails[idEmail] = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vr.value = '';
|
|
|
|
|
for (i = 0; i < emails.length; i++)
|
|
|
|
|
if (emails[i] != '')
|
|
|
|
|
vr.value += (vr.value == '') ? emails[i] : ';' + emails[i];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function FecharPop() {
|
|
|
|
|
if (win)
|
|
|
|
|
win.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Formata data no padr?o DDMMAAAA
|
|
|
|
|
function formataData(campo)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Autor: Amarildo Pereira
|
|
|
|
|
* Data: 19/04/2017
|
|
|
|
|
*/
|
|
|
|
|
var text = soNumero(campo.value);
|
|
|
|
|
var tam = text.length;
|
|
|
|
|
var ret = '';
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < tam; i++)
|
|
|
|
|
{
|
|
|
|
|
ret = ret + text.substr(i, 1);
|
|
|
|
|
if (((i == 1) && (tam > 2)) || ((i == 3) && (tam > 4)))
|
|
|
|
|
{
|
|
|
|
|
ret = ret + '/';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
campo.value = ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function somenteNumeros(campo)
|
|
|
|
|
{
|
|
|
|
|
var vr = soNumero(campo.value);
|
|
|
|
|
campo.value = vr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formataDataHora(campo) {
|
|
|
|
|
var vr = soNumero(campo.value);
|
|
|
|
|
var tam = vr.length;
|
|
|
|
|
var str = "";
|
|
|
|
|
for (i = 0; i < tam; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i < 13)
|
|
|
|
|
str += vr.substr(i, 1);
|
|
|
|
|
if ((i == 1) && (tam > 2))
|
|
|
|
|
str += '/';
|
|
|
|
|
if ((i == 3) && (tam > 4))
|
|
|
|
|
str += '/';
|
|
|
|
|
if ((i == 7) && (tam > 8))
|
|
|
|
|
str += ' ';
|
|
|
|
|
if ((i == 9) && (tam > 10))
|
|
|
|
|
str += ':';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
campo.value = str;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SplitA(value, chars)
|
|
|
|
|
{
|
|
|
|
|
value += "/";
|
|
|
|
|
var res = new Array();
|
|
|
|
|
var element = "";
|
|
|
|
|
var idx = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < value.length; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((value.substr(i, 1) == '/') || (value.substr(i, 1) == ' ') || (value.substr(i, 1) == ':'))
|
|
|
|
|
{
|
|
|
|
|
res[idx] = element;
|
|
|
|
|
idx++;
|
|
|
|
|
element = "";
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
element += value.substr(i, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Formata hora no padrao HH:MM
|
|
|
|
|
function formataHora(campo, teclapres) {
|
|
|
|
|
var tecla = teclapres.keyCode;
|
|
|
|
|
campo.value = filtraCampo(campo);
|
|
|
|
|
vr = campo.value;
|
|
|
|
|
vr = vr.replace(".", "");
|
|
|
|
|
vr = vr.replace(":", "");
|
|
|
|
|
vr = vr.replace(":", "");
|
|
|
|
|
tam = vr.length + 1;
|
|
|
|
|
|
|
|
|
|
if (tecla != 9 && tecla != 8) {
|
|
|
|
|
if (tam > 2 && tam < 5)
|
|
|
|
|
campo.value = vr.substr(0, tam - 2) + ':' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formataTelefone(campo) {
|
|
|
|
|
campo.value = filtraCampo(campo);
|
|
|
|
|
vr = campo.value;
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
|
|
|
|
|
if (tam <= 4)
|
|
|
|
|
campo.value = vr;
|
|
|
|
|
if (tam > 4)
|
|
|
|
|
campo.value = vr.substr(0, tam - 4) + '-' + vr.substr(tam - 4, tam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Formata o campo valor
|
|
|
|
|
function formataValor(campo) {
|
|
|
|
|
campo.value = filtraCampo(campo);
|
|
|
|
|
vr = campo.value;
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
|
|
|
|
|
if (tam <= 2) {
|
|
|
|
|
campo.value = vr;
|
|
|
|
|
}
|
|
|
|
|
if ((tam > 2) && (tam <= 5)) {
|
|
|
|
|
campo.value = vr.substr(0, tam - 2) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 6) && (tam <= 8)) {
|
|
|
|
|
campo.value = vr.substr(0, tam - 5) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 9) && (tam <= 11)) {
|
|
|
|
|
campo.value = vr.substr(0, tam - 8) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 12) && (tam <= 14)) {
|
|
|
|
|
campo.value = vr.substr(0, tam - 11) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
if ((tam >= 15) && (tam <= 18)) {
|
|
|
|
|
campo.value = vr.substr(0, tam - 14) + '.' + vr.substr(tam - 14, 3) + '.' + vr.substr(tam - 11, 3) + '.' + vr.substr(tam - 8, 3) + '.' + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Formata o campo valor
|
|
|
|
|
function formataNumerico(campo) {
|
|
|
|
|
|
|
|
|
|
campo.value = filtraCampo(campo);
|
|
|
|
|
vr = campo.value;
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// limpa todos os caracteres especiais do campo solicitado
|
|
|
|
|
function filtraCampo(campo) {
|
|
|
|
|
var s = "";
|
|
|
|
|
var cp = "";
|
|
|
|
|
vr = campo.value;
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
for (i = 0; i < tam; i++) {
|
|
|
|
|
if (vr.substring(i, i + 1) != "/" && vr.substring(i, i + 1) != "-" && vr.substring(i, i + 1) != "." && vr.substring(i, i + 1) != ",") {
|
|
|
|
|
s = s + vr.substring(i, i + 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
campo.value = s;
|
|
|
|
|
return cp = campo.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// limpa todos os caracteres diferente de numero e branco
|
|
|
|
|
function soNumero(str) {
|
|
|
|
|
var s = "";
|
|
|
|
|
// var charValido = new Array('0','1','2','3','4','5','6','7','8','9', ' ');
|
|
|
|
|
var vr = str;
|
|
|
|
|
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
for (i = 0; i < tam; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((vr.substr(i, 1) == '0') ||
|
|
|
|
|
(vr.substr(i, 1) == '1') ||
|
|
|
|
|
(vr.substr(i, 1) == '2') ||
|
|
|
|
|
(vr.substr(i, 1) == '3') ||
|
|
|
|
|
(vr.substr(i, 1) == '4') ||
|
|
|
|
|
(vr.substr(i, 1) == '5') ||
|
|
|
|
|
(vr.substr(i, 1) == '6') ||
|
|
|
|
|
(vr.substr(i, 1) == '7') ||
|
|
|
|
|
(vr.substr(i, 1) == '8') ||
|
|
|
|
|
(vr.substr(i, 1) == '9')
|
|
|
|
|
)
|
|
|
|
|
s += vr.substr(i, 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function limpaEspaco(campo) {
|
|
|
|
|
var s = "";
|
|
|
|
|
var vr = campo.value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tam = vr.length;
|
|
|
|
|
for (i = 0; i < tam; i++)
|
|
|
|
|
{
|
|
|
|
|
if (vr.substr(i, 1) != ' ')
|
|
|
|
|
s += vr.substr(i, 1);
|
|
|
|
|
}
|
|
|
|
|
campo.value = s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function DeletaUser(id, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> desabilitar o usu<EFBFBD>rio! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=21&idDelete=' + id + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaCliPortabilidade(id, nomeCli) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o cliente:' + nomeCli + '! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=217&acaoUser=6&cli_id=' + id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function BloqCliPortabilidade(id, nomeCli, status) {
|
|
|
|
|
|
|
|
|
|
var acao = status == 9 ? 'desbloquear' : 'bloquear'
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> ' + acao + ' o cliente:' + nomeCli + '! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=217&acaoUser=9&cli_id=' + id + '&cli_status=' + status;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ResetCliPortabilidade(id, nomeCli) {
|
|
|
|
|
|
|
|
|
|
var acao = 'Reiniciar a Opera<EFBFBD><EFBFBD>o do Clientes'
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> ' + acao + ' o cliente:' + nomeCli + '! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=217&acaoUser=RESET_CLIENTE&cli_id=' + id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaPesquisa(id, nome, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir Pesquisa: ' + nome + '! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=181&idDelete=' + id + '&pp_nome=' + nome + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function DeletaPesquisaLibera(id, nome, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir a Libera<EFBFBD><EFBFBD>o: ' + nome + '! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=185&idDelete=' + id + '&pl_descricao=' + nome + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function DeletaWkfEmail(id) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o email! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=178&wkf_email_id=' + id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaDep(id, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o departamento! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=139&acao=deletaDep&dpto=' + id + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaRamal(idRamal, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o Ramal! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=140&acao=deletaRamal&ramal=' + idRamal + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function DeletaMunicipio(id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o Municipio e todos os prefixos relacionados! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=163&acao=deletaMunicipio&municipio=' + id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaPrefixo(prefixo, municipio)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir este prefixo! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=168&acao=deleta&prefixo=' + prefixo, +municipio;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaContribuinte(id, param)
|
|
|
|
|
{
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=45&formAction=6&id=' + id + param;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaSite(id, param)
|
|
|
|
|
{
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=105&formAction=6&id=' + id + param;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ResetaSenhaUser(id, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> redefinir a senha do usu<EFBFBD>rio! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=21&idReset=' + id + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaIndispo(id)
|
|
|
|
|
{
|
|
|
|
|
var indice = document.forms[0].listaDacs.selectedIndex;
|
|
|
|
|
var idDac = document.forms[0].listaDacs.options[indice].value;
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
var url = 'index.php?idProg=46&formAction=6&id=' + id + '&idDac=' + idDac;
|
|
|
|
|
window.location.href = url;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaIntegAtiva(id, params)
|
|
|
|
|
{
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro selecionado! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=190&formAction=6&id=' + id + '&txtConsulta=' + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function DeletaIntegAtivaMetodo(id, idPai)
|
|
|
|
|
{
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro selecionado! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=191&formAction=6&id=' + id + '&itgm_id_pai=' + idPai;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function DeletaAnotacao(id) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=17&formAction=6&id=' + id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function DeletaAgenda(id) {
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir o registro! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=18&formAction=6&id=' + id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SelContribuinte()
|
|
|
|
|
{
|
|
|
|
|
var fone = document.getElementById("ajfone").innerHTML;
|
|
|
|
|
NovaJanela('index.php?idProg=45&formActon=2&selContrib=1&fone=' + fone, 'ClasContrib', '500', '300', 'scrollbars=YES');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SelContribuinteRt()
|
|
|
|
|
{
|
|
|
|
|
var fone = document.getElementById("fone").innerHTML;
|
|
|
|
|
NovaJanela('index.php?idProg=45&formActon=2&selContrib=1&fone=' + fone, 'ClasContrib', '500', '300', 'scrollbars=YES');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ChamSetContribuinte(id, nome)
|
|
|
|
|
{
|
|
|
|
|
SetContribuinte(id, nome);
|
|
|
|
|
}
|
|
|
|
|
function SetContribuinte(id, nome)
|
|
|
|
|
{
|
|
|
|
|
window.opener.document.formGeral.txtCliente.value = id + "-" + nome;
|
|
|
|
|
window.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function enviar_formulario()
|
|
|
|
|
{
|
|
|
|
|
document.getElementById("EXCEL").value = '1';
|
|
|
|
|
document.formGeral.submit();
|
|
|
|
|
document.getElementById("EXCEL").value = '0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetSomIndisponibilidade()
|
|
|
|
|
{
|
|
|
|
|
var indice = document.forms[0].listaArqIndisponivel.selectedIndex;
|
|
|
|
|
var file = document.forms[0].listaArqIndisponivel.options[indice].value;
|
|
|
|
|
|
|
|
|
|
if (!file)
|
|
|
|
|
{
|
|
|
|
|
alert('Selecione um Arquivo!');
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
NovaJanela('index.php?idProg=149&audioIndisp=' + file, 'SomIndisponivel', '250', '200', 'resizable=NO,scrollbars=0');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function ApagaGrupoVendas(id, params) {
|
|
|
|
|
|
|
|
|
|
if (confirm('Esta a<EFBFBD><EFBFBD>o ir<EFBFBD> excluir a Regional! Deseja continuar?'))
|
|
|
|
|
{
|
|
|
|
|
window.location.href = 'index.php?idProg=285&acao=deleta&id=' + id + params;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function printDiv(nomeDiv) {
|
|
|
|
|
var printContents = document.getElementById(nomeDiv).innerHTML;
|
|
|
|
|
var originalContents = document.body.innerHTML;
|
|
|
|
|
document.body.innerHTML = printContents;
|
|
|
|
|
window.print();
|
|
|
|
|
document.body.innerHTML = originalContents;
|
|
|
|
|
}
|