19
| <![CDATA[<SCRIPT>
function janela(local,tamanho,altura)
{
jan1=window.open(local,'janela1','scrollbars=yes,status=yes,resizable=yes,location=no,toolbar=no,width=400,height=200')
}
function rel(local)
{
jan1=window.open(local,'recibo','scrollbars=yes,status=yes,resizable=yes,location=no,toolbar=no,width=680,height=550')
}
</SCRIPT>]]>
|
163
| <![CDATA[<script>
function validacnpj(){
if(VerifyCNPJ(document.formmtc_entidade.ent_cnpj.value) == 1)
{ok=true;}
else
{alert("CNPJ não é válido!");document.formmtc_entidade.ent_nome.focus();return false;}
return;
if(ok)
{return true;}
}
function valida_cpf(){
if (document.formmtc_entidade.ent_cpf_dirigente.value=="")
{return true;}
var i;
s = document.formmtc_entidade.ent_cpf_dirigente.value;
s = s.replace( ".", "" );
s = s.replace( ".", "" );
s = s.replace( "-", "" );
var c = s.substr(0,9);
var dv = s.substr(9,2);
var d1 = 0;
for (i = 0; i < 9; i++)
{
d1 += c.charAt(i)*(10-i);
}
if (d1 == 0)
{
alert("CPF Invalido")
document.formmtc_entidade.ent_cpf_dirigente.focus();
return false;
}
d1 = 11 - (d1 % 11);
if (d1 > 9) d1 = 0;
if (dv.charAt(0) != d1)
{
document.formmtc_entidade.ent_cpf_dirigente.focus();
alert("CPF Invalido")
return false;
}
d1 *= 2;
for (i = 0; i < 9; i++)
{
d1 += c.charAt(i)*(11-i);
}
d1 = 11 - (d1 % 11);
if (d1 > 9) d1 = 0;
if (dv.charAt(1) != d1)
{
document.formmtc_entidade.ent_ent_cpf_dirigente.focus();
alert("CPF Invalido")
return false;
}
}
function FormataCpf(campo,tammax,teclapres) {
var tecla = teclapres.keyCode;
vr = event.srcElement.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 ){
event.srcElement.value = vr ; }
if ( (tam > 2) && (tam <= 5) ){
event.srcElement.value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ) ; }
if ( (tam >= 6) && (tam <= 8) ){
event.srcElement.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ) ; }
if ( (tam >= 9) && (tam <= 11) ){
event.srcElement.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) ){
event.srcElement.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) ){
event.srcElement.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 isNUMB(c)
{
if((cx=c.indexOf(","))!=-1)
{c = c.substring(0,cx)+"."+c.substring(cx+1);}
if((parseFloat(c) / c != 1))
{
if(parseFloat(c) * c == 0)
{return(1);}
else
{return(0);} }
else
{return(1);}
}
function LIMP(c)
{
while((cx=c.indexOf("-"))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
while((cx=c.indexOf("/"))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
while((cx=c.indexOf(","))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
while((cx=c.indexOf("."))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
while((cx=c.indexOf("("))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
while((cx=c.indexOf(")"))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
while((cx=c.indexOf(" "))!=-1)
{c = c.substring(0,cx)+c.substring(cx+1);}
return(c);
}
function VerifyCNPJ(CNPJ)
{
CNPJ = LIMP(CNPJ);
if(isNUMB(CNPJ) != 1)
{return(0);}
else
{
if(CNPJ == 0)
{return(0);}
else
{
g=CNPJ.length-2;
if(RealTestaCNPJ(CNPJ,g) == 1)
{
g=CNPJ.length-1;
if(RealTestaCNPJ(CNPJ,g) == 1)
{return(1);}
else
{return(0);}
}
else
{return(0);}
}
}
}
function RealTestaCNPJ(CNPJ,g)
{
var VerCNPJ=0;
var ind=2;
var tam;
for(f=g;f>0;f--)
{
VerCNPJ+=parseInt(CNPJ.charAt(f-1))*ind;
if(ind>8)
{ind=2;}
else
{ind++;}
}
VerCNPJ%=11;
if(VerCNPJ==0 || VerCNPJ==1)
{VerCNPJ=0;}
else
{VerCNPJ=11-VerCNPJ;}
if(VerCNPJ!=parseInt(CNPJ.charAt(g)))
{return(0);}
else
{return(1);}
}
function FormataCGC(Formulario, Campo, TeclaPres)
{
var tecla = TeclaPres.keyCode;
var strCampo;
var vr;
var tam;
var TamanhoMaximo = 14;
eval("strCampo = document." + Formulario + "." + Campo);
vr = strCampo.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 < TamanhoMaximo && 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)
{strCampo.value = vr;}
if ((tam > 2) && (tam <= 6))
{strCampo.value = vr.substr(0, tam - 2) + '-' + vr.substr(tam - 2, tam);}
if ((tam >= 7) && (tam <= 9))
{strCampo.value = vr.substr(0, tam - 6) + '/' + vr.substr(tam - 6, 4) + '-' + vr.substr(tam - 2, tam);}
if ((tam >= 10) && (tam <= 12))
{strCampo.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))
{strCampo.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))
{strCampo.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);}
}
}
</script>]]>
|