question

hertim avatar image
hertim asked

Convert VB to SQL

Function DvCosif(NrConta As String) As Integer
'CALCULA DV DO PLANO DE CONTAS COSIF
Dim i As Double, k As String
k = Mid$(Replace(CStr(NrConta), ".", ""), 1, 7)
k = IIf(Len(k) < 7, Replace(k & Space(7 - Len(k)), Space(1), 0, 1, 7 - Len(k)), k)
i = (CDbl(Mid(k, 7, 1)) * 3) + (CDbl(Mid(k, 6, 1)) * 7) + (CDbl(Mid(k, 5, 1)) * 1) + _
(CDbl(Mid(k, 4, 1)) * 3) + (CDbl(Mid(k, 3, 1)) * 7) + (CDbl(Mid(k, 2, 1)) * 1) + _
(CDbl(Mid(k, 1, 1)) * 3)
i = i Mod 10
DvCosif = IIf(i = 0, 0, 10 - i)
End Function

sqlconvert
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.