|
Iniciado por adrianoboller, out., 29 2015 5:43 PM - 5 respostas |
| |
| | | |
|
| |
Membro registado 3.657 mensagems Popularité : +175 (223 votes) |
|
Publicado em outubro, 29 2015 - 5:43 PM |
Procedure ValidaCPF(cpf)
cpf=LimpaCampo(cpf)
SWITCH cpf CASE"00000000000" cpf="" RESULT(False) CASE"11111111111" cpf="" RESULT(False) CASE"2222222222" cpf="" RESULT(False) CASE"33333333333" cpf="" RESULT(False) CASE"44444444444" cpf="" RESULT(False) CASE"55555555555" cpf="" RESULT(False) CASE"66666666666" cpf="" RESULT(False) CASE"77777777777" cpf="" RESULT(False) CASE"88888888888" cpf="" RESULT(False) CASE"99999999999" cpf="" RESULT(False) END
Soma isint Resto isint Digito_1,Digito_2 isint
Soma= (Val(Middle(cpf,1,1)) *10) + ... (Val(Middle(cpf,2,1)) *09) + ... (Val(Middle(cpf,3,1)) *08) + ... (Val(Middle(cpf,4,1)) *07) + ... (Val(Middle(cpf,5,1)) *06) + ... (Val(Middle(cpf,6,1)) *05) + ... (Val(Middle(cpf,7,1)) *04) + ... (Val(Middle(cpf,8,1)) *03) + ... (Val(Middle(cpf,9,1)) *02)
Resto=Modulo(Soma,11)
IFResto=0 OR Resto=1 THEN Digito_1=0 ELSE Digito_1=11-Resto END
Soma=(Val(Middle(cpf,01,1))*11) + ... (Val(Middle(cpf,02,1))*10) + ... (Val(Middle(cpf,03,1))*09) + ... (Val(Middle(cpf,04,1))*08) + ... (Val(Middle(cpf,05,1))*07) + ... (Val(Middle(cpf,06,1))*06) + ... (Val(Middle(cpf,07,1))*05) + ... (Val(Middle(cpf,08,1))*04) + ... (Val(Middle(cpf,09,1))*03) + ... (Val(Middle(cpf,10,1))*02)
Resto=Modulo(Soma,11)
IFResto=0 OR Resto=1 THEN Digito_2=0 ELSE Digito_2=11-Resto END
Resultado isstring
Resultado=NumToString(Digito_1) +NumToString(Digito_2)
IF Val(Middle(cpf,10,2)) =Resultado THEN RESULT(True) ELSE RESULT(False
-- Adriano Jose Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller ______________________________________________ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.657 mensagems Popularité : +175 (223 votes) |
|
Publicado em outubro, 30 2015 - 12:22 PM |
IF Val(Middle(cpf,10,2)) =Resultado THEN RESULT(True) ELSE RESULT(False) END
//Agora sim esta ok
-- Adriano Jose Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller ______________________________________________ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.657 mensagems Popularité : +175 (223 votes) |
|
Publicado em abril, 02 2019 - 9:47 PM |
Procedure ValidaCPF(sGCpf is string)
Cpf is string = sGCpf Cpf = Replace(Cpf,".","") Cpf = Replace(Cpf,"-","")
SWITCH Cpf CASE "00000000000" Cpf = "" RESULT(False) CASE "11111111111" Cpf = "" RESULT(False) CASE "2222222222" Cpf = "" RESULT(False) CASE "33333333333" Cpf = "" RESULT(False) CASE "44444444444" Cpf = "" RESULT(False) CASE "55555555555" Cpf = "" RESULT(False) CASE "66666666666" Cpf = "" RESULT(False) CASE "77777777777" Cpf = "" RESULT(False) CASE "88888888888" Cpf = "" RESULT(False) CASE "99999999999" Cpf = "" RESULT(False) END
nSoma is int nResto is int nDigito_1, nDigito_2 is int
nSoma = (Val(Middle(Cpf,1,1)) * 10) + ... (Val(Middle(Cpf,2,1)) * 09) + ... (Val(Middle(Cpf,3,1)) * 08) + ... (Val(Middle(Cpf,4,1)) * 07) + ... (Val(Middle(Cpf,5,1)) * 06) + ... (Val(Middle(Cpf,6,1)) * 05) + ... (Val(Middle(Cpf,7,1)) * 04) + ... (Val(Middle(Cpf,8,1)) * 03) + ... (Val(Middle(Cpf,9,1)) * 02)
nResto = Modulo(nSoma, 11)
IF nResto = 0 OR nResto = 1 THEN nDigito_1 = 0 ELSE nDigito_1 = 11 - nResto END
nSoma = (Val(Middle(Cpf,01,1)) * 11) + ... (Val(Middle(Cpf,02,1)) * 10) + ... (Val(Middle(Cpf,03,1)) * 09) + ... (Val(Middle(Cpf,04,1)) * 08) + ... (Val(Middle(Cpf,05,1)) * 07) + ... (Val(Middle(Cpf,06,1)) * 06) + ... (Val(Middle(Cpf,07,1)) * 05) + ... (Val(Middle(Cpf,08,1)) * 04) + ... (Val(Middle(Cpf,09,1)) * 03) + ... (Val(Middle(Cpf,10,1)) * 02)
nResto = Modulo(nSoma, 11)
IF nResto = 0 OR nResto = 1 THEN nDigito_2 = 0 ELSE nDigito_2 = 11 - nResto END
sResultado is string
sResultado = NumToString(nDigito_1) + NumToString(nDigito_2)
IF Val(Middle(Cpf,10,2)) = sResultado THEN RESULT(True) ELSE RESULT(False) END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.657 mensagems Popularité : +175 (223 votes) |
|
Publicado em abril, 02 2019 - 9:48 PM |
Procedure ValidaCNPJ(gcnpj is string)
scnpj is string = gcnpj scnpj = Replace(scnpj,".","") scnpj = Replace(scnpj,"-","") scnpj = Replace(scnpj,"/","")
SWITCH scnpj CASE "0000000000000" scnpj = "" CASE "1111111111111" scnpj = "" CASE "2222222222222" scnpj = "" CASE "33333333333333" scnpj = "" CASE "44444444444444" scnpj = "" CASE "55555555555555" scnpj = "" CASE "66666666666666" scnpj = "" CASE "77777777777777" scnpj = "" CASE "88888888888888" scnpj = "" CASE "99999999999999" scnpj = "" END
nLOC_num is int nLOC_num2 is int nLOC_num = (Val(Middle(scnpj,1,1)) * 5) + ... (Val(Middle(scnpj,2,1)) * 4) + ... (Val(Middle(scnpj,3,1)) * 3) + ... (Val(Middle(scnpj,4,1)) * 2) + ... (Val(Middle(scnpj,5,1)) * 9) + ... (Val(Middle(scnpj,6,1)) * 8) + ... (Val(Middle(scnpj,7,1)) * 7) +... (Val(Middle(scnpj,8,1)) * 6) + ... (Val(Middle(scnpj,9,1)) * 5) + ... (Val(Middle(scnpj,10,1)) * 4) + ... (Val(Middle(scnpj,11,1)) * 3) + ... (Val(Middle(scnpj,12,1)) * 2)
nLOC_num = Modulo(nLOC_num,11) IF nLOC_num < 2 THEN nLOC_num = 0 ELSE nLOC_num = 11 - nLOC_num END
nLOC_num2 = (Val(Middle(scnpj,1,1)) * 6) + ... (Val(Middle(scnpj,2,1)) * 5) + ... (Val(Middle(scnpj,3,1)) * 4) + ... (Val(Middle(scnpj,4,1)) * 3) + ... (Val(Middle(scnpj,5,1)) * 2) + ... (Val(Middle(scnpj,6,1)) * 9) + ... (Val(Middle(scnpj,7,1)) * 8) + ... (Val(Middle(scnpj,8,1)) * 7) + ... (Val(Middle(scnpj,9,1)) * 6) + ... (Val(Middle(scnpj,10,1)) * 5) + ... (Val(Middle(scnpj,11,1)) * 4) + ... (Val(Middle(scnpj,12,1)) * 3) + ... (nLOC_num) * 2
nLOC_num2 = Modulo(nLOC_num2,11) IF nLOC_num2 < 2 THEN nLOC_num2 = 0 ELSE nLOC_num2 = 11 - nLOC_num2 END
sResultado is string
sResultado = NumToString(nLOC_num) + NumToString(nLOC_num2)
IF Val(Middle(scnpj,13,2)) = Val(sResultado) THEN RESULT(True) ELSE RESULT(False) END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.657 mensagems Popularité : +175 (223 votes) |
|
Publicado em abril, 10 2019 - 7:19 PM |
IF RADIO__column_radio_button_TP_PESSOA = "F" AND EDT_T001_CPF <> "" THEN IF ValidaCPF(EDT_T001_CPF) = False THEN Info("CPF digitado invalido!") SetFocus(EDT_T001_CPF) EDT_T001_CPF = "" RETURN END END
IF RADIO__column_radio_button_TP_PESSOA = "J" AND EDT_T001_CPF <> "" THEN IF ValidaCNPJ(EDT_T001_CPF) = False THEN Info("CNPJ digitado invalido!") SetFocus(EDT_T001_CPF) EDT_T001_CPF = "" RETURN END END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Membro registado 3.657 mensagems Popularité : +175 (223 votes) |
|
Publicado em outubro, 03 2019 - 2:53 AM |
Procedure F_CPF(Gcpf)
cpf is string =Gcpf
IF Length(cpf) = 9 THEN cpf = "00"+cpf ELSE IF Length(cpf) = 10 THEN cpf = "0"+cpf END
cpf = CPFSoNumeros(cpf)
SWITCH cpf CASE "00000000000" cpf="" RESULT(False) CASE "11111111111" cpf="" RESULT(False) CASE"2222222222" cpf="" RESULT(False) CASE"33333333333" cpf="" RESULT(False) CASE "44444444444" cpf="" RESULT(False) CASE "55555555555" cpf="" RESULT(False) CASE "66666666666" cpf="" RESULT(False) CASE "77777777777" cpf="" RESULT(False) CASE "88888888888" cpf="" RESULT(False) CASE "99999999999" cpf="" RESULT(False) END
Soma is int Resto is int Digito_1,Digito_2 is int
Soma = (Val(Middle(cpf,1,1)) *10) + ... (Val(Middle(cpf,2,1)) *09) + ... (Val(Middle(cpf,3,1)) *08) + ... (Val(Middle(cpf,4,1)) *07) + ... (Val(Middle(cpf,5,1)) *06) + ... (Val(Middle(cpf,6,1)) *05) + ... (Val(Middle(cpf,7,1)) *04) + ... (Val(Middle(cpf,8,1)) *03) + ... (Val(Middle(cpf,9,1)) *02)
Resto=Modulo(Soma,11)
IF Resto=0 OR Resto=1 THEN Digito_1=0 ELSE Digito_1=11-Resto END
Soma = (Val(Middle(cpf,01,1))*11) + ... (Val(Middle(cpf,02,1))*10) + ... (Val(Middle(cpf,03,1))*09) + ... (Val(Middle(cpf,04,1))*08) + ... (Val(Middle(cpf,05,1))*07) + ... (Val(Middle(cpf,06,1))*06) + ... (Val(Middle(cpf,07,1))*05) + ... (Val(Middle(cpf,08,1))*04) + ... (Val(Middle(cpf,09,1))*03) + ... (Val(Middle(cpf,10,1))*02)
Resto=Modulo(Soma,11)
IF Resto=0 OR Resto=1THEN Digito_2=0 ELSE Digito_2=11-Resto END
Resultado is string
Resultado=NumToString(Digito_1) +NumToString(Digito_2)
IF Val(Middle(cpf,10,2)) =Resultado THEN gsCpfCliente = cpf RESULT(True) ELSE gsCpfCliente = "" RESULT(False) END
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | | | |
| | |
|