Attribute VB_Name = "cnv"
Option Explicit
'------------------------------------------------------------------------------------------
'Classe     :   bConversioni
'
'Utilizza   :   nessuno
'
'Esporta    :   LireToEuro
'               EutoToLire
'               NullToEmpty
'               EmptyToNull
'               NullToZero
'               ZeroToEmpty
'               SNToTF
'               TFToSN
'
'Private    :
'------------------------------------------------------------------------------------------
'
'
'
Public Function LireToEuro(strImporto As Variant) As Currency
    If IsNumeric(strImporto) Then
        LireToEuro = CCur(strImporto) / 1936.27
    Else
        LireToEuro = 0
    End If
End Function
'
'
'
Public Function EuroToLire(strImporto As Variant) As Currency
    If IsNumeric(strImporto) Then
        EuroToLire = Int((CCur(strImporto) * 1936.27) + 0.4)
    Else
        EuroToLire = 0
    End If
End Function
'
'
'
Public Function NullToEmpty(Var As Variant) As Variant
    If IsNull(Var) Then
        NullToEmpty = ""
    Else
        NullToEmpty = Var
    End If
End Function

'
'
'
Public Function NullToZero(Var As Variant) As Variant
    If IsNull(Var) Then
        NullToZero = "0"
    Else
        NullToZero = Var
    End If
End Function

'
'
'
Public Function EmptyToNull(Var As Variant) As Variant
    If Var = "" Then
        EmptyToNull = Null
    Else
        EmptyToNull = Var
    End If
End Function

'
'
'
Public Function EmptyToZero(Var As Variant) As Variant
    If Var = "" Then
        EmptyToZero = "0"
    Else
        EmptyToZero = Var
    End If
End Function

'
'
'
Public Function ZeroToEmpty(Var As Variant) As Variant
    If IsNull(Var) Then
        ZeroToEmpty = ""
    Else
        ZeroToEmpty = Var
    End If
End Function
'
'
'
Public Function NullToBool(Var As Variant) As Boolean
    If IsNull(Var) Then
        NullToBool = False
    Else
        NullToBool = Var
    End If
End Function
'
'
'
Public Function SNToTF(Var As Variant) As Integer
    If UCase(Trim$(Var)) = "SI" Or UCase(Trim$(Var)) = "YES" Then
        SNToTF = 1
    Else
        SNToTF = 0
    End If
End Function
'
'
'
Public Function TFToSN(Var As Variant) As String
    If UCase(Trim$(Var)) = "VERO" Or UCase(Trim$(Var)) = "TRUE" Then
        TFToSN = "SI"
    Else
        TFToSN = "NO"
    End If
End Function
'
'
'
Public Function DateToStr(strDate As String) As String
    
    DateToStr = Left(strDate, 2) & _
                Mid(strDate, 4, 2) & _
                Right(strDate, 4)
    
End Function
'
'
'
Public Function Pad(strStringa As String, intLen As Integer, Optional strFiller As String)
    Dim lun As Integer
    
    If IsMissing(strFiller) Then strFiller = " "
    lun = Len(strStringa)
    Pad = String(intLen - lun, strFiller) & strStringa
End Function






