Fórum DIGITO VERIFICADO #1344
11/12/2008
0
Diogenes Dourado
Curtir tópico
+ 0Posts
11/12/2008
Wesley Yamazack
Gostei + 0
12/12/2008
Wesley Yamazack
Continuo no aguardo sobre o seu algoritmo do digito verificador.
Gostei + 0
12/12/2008
Diogenes Dourado
Dim Quo As Integer
Dim Resto, I, Prod, intParte, nDV, nSubtr As Integer
Dim strNum, strParte As String strNum = Mid(Num_Med, 1, 8)
nDV = Right(Num_Med, 1)
DV = 0 If Str(Mid(Num_Med, 1, 2)) = 0 Then Caso inicie por 00 o DV deve ser sempre 0
GoTo Testa
End If Tot = 0
Resto = 0
Quo = 0
nSubtr = 9 For I = 2 To 9
intParte = Val(Mid(strNum, (I - 1), 1))
Prod = intParte * nSubtr
Tot = Tot + Prod
nSubtr = nSubtr - 1
Next I Quo = Int(Tot / 11)
Resto = Tot - (Quo * 11)
DV = 11 - Resto
If DV = 10 Or DV = 11 Then
DV = 0
End If Testa: If DV <> nDV Then
MsgBox "NÚMERO OU DV ÍNVÁLIDO.@ VERIFIQUE... @ ", 0, "E R R O"
Campo.SetFocus
End If Fim_Sub: End Function Verifica DV Function VerifDv(Num_Med As String, Campo As TextBox) As Integer Dim Tot, DV As Integer
Dim Quo As Integer
Dim Resto, I, Prod, intParte, nDV, nSubtr As Integer
Dim strNum, strParte As String strNum = Mid(Num_Med, 1, 8)
nDV = Right(Num_Med, 1)
DV = 0 If Str(Mid(Num_Med, 1, 2)) = 0 Then Caso inicie por 00 o DV deve ser sempre 0
GoTo Testa
End If Tot = 0
Resto = 0
Quo = 0
nSubtr = 9 For I = 2 To 9
intParte = Val(Mid(strNum, (I - 1), 1))
Prod = intParte * nSubtr
Tot = Tot + Prod
nSubtr = nSubtr - 1
Next I Quo = Int(Tot / 11)
Resto = Tot - (Quo * 11)
DV = 11 - Resto
If DV = 10 Or DV = 11 Then
DV = 0
End If Testa: If DV <> nDV Then
MsgBox "NÚMERO OU DV ÍNVÁLIDO.@ VERIFIQUE... @ ", 0, "E R R O"
Campo.SetFocus
End If Fim_Sub: End Function Pois os mesmos são usados em um banco de dados em ACCESS Grato Diogenes
Gostei + 0
12/12/2008
Wesley Yamazack
Estaremos analisando o código e convertendo o mesmo para delphi. Logo enviaremos a resposta
Gostei + 0
14/12/2008
Diogenes Dourado
Dim Quo As Integer
Dim Resto, I, Prod, intParte, nDV, nSubtr As Integer
Dim strNum, strParte As String strNum = Mid(Num_Med, 1, 8)
nDV = Right(Num_Med, 1)
DV = 0 If Str(Mid(Num_Med, 1, 2)) = 0 Then Caso inicie por 00 o DV deve ser sempre 0
GoTo Testa
End If Tot = 0
Resto = 0
Quo = 0
nSubtr = 9 For I = 2 To 9
intParte = Val(Mid(strNum, (I - 1), 1))
Prod = intParte * nSubtr
Tot = Tot + Prod
nSubtr = nSubtr - 1
Next I Quo = Int(Tot / 11)
Resto = Tot - (Quo * 11)
DV = 11 - Resto
If DV = 10 Or DV = 11 Then
DV = 0
End If Testa: If DV <> nDV Then
MsgBox "NÚMERO OU DV ÍNVÁLIDO.@ VERIFIQUE... @ ", 0, "E R R O"
Campo.SetFocus
End If Fim_Sub: End Function o proximo é quando digitamos uma quantidade grande por exemplo digitamos o primeiro e em outro edit colomas a quantidade e o sistema preenche a quantidade informada exemplo 12-227-056-8 com a quantidade de 100 pcs o sistema coloca a sequencio 12-227-057 em diante com o digita verificador Grato Diogenes
Gostei + 0
15/12/2008
Wesley Yamazack
http://www.4shared.com/file/76076210/b53bd8b5/algortimo.html
Att,
Wesley Yamazack
Gostei + 0
16/12/2008
Diogenes Dourado
Gostei + 0
16/12/2008
Wesley Yamazack
Que bom que conseguimos resolver seu problema. Espero poder ajudar em um próximo chamado.
Estamos fechando o chamado.
Att,
Wesley Yamazack
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)