PartitaIva




Function CheckPartitaIva(ByVal sz_Codice As String) As Integer
'======================================

'Controllo la partita iva

'======================================

Dim n_Val As Integer
Dim n_Som1 As Integer
Dim n_Som2 As Integer
Dim lcv As Integer

For lcv = 1 To 9 Step 2
n_Val = Val(Mid$(sz_Codice, lcv, 1))
n_Som1 = n_Som1 + n_Val
n_Val = Val(Mid$(sz_Codice, lcv + 1, 1))
n_Som1 = n_Som1 + Int((n_Val * 2) / 10) + ((n_Val * 2) Mod 10)
Next lcv
n_Som2 = 10 - (n_Som1 Mod 10)
If n_Som2 = 10 Then n_Som2 = 0
n_Val = Val(Mid$(sz_Codice, 11, 1))
If n_Som2 = n_Val Then
CheckPartitaIva = 0
Else
CheckPartitaIva = n_Som2 + 48
End If
End Function










( partitaiva.html )- by Paolo Puglisi - Modifica del 17/12/2023