' === Exemplo Guiado (ATIVO) ===
Public Function SomarTaxaExpedicao(ByVal curValor As Currency) As Currency
    SomarTaxaExpedicao = curValor + 35
End Function

' === Pratica Obrigatoria 1 (COMENTADO PARA EVITAR CONFLITO) ===
'Option Explicit
'
'Public Function CALCULARFRETE(ByVal dblDistanciaKm As Double, _
'                             ByVal dblPesoKg As Double, _
'                             ByVal strTipoCarga As String) As Variant
'    Dim curTarifaBase As Currency
'    Dim curAdicionalPeso As Currency
'    Dim curFatorRisco As Currency
'    Dim curTotal As Currency
'    
'    If dblDistanciaKm <= 0 Or dblPesoKg <= 0 Then
'        CALCULARFRETE = CVErr(xlErrNum)
'        Exit Function
'    End If
'    
'    curTarifaBase = dblDistanciaKm * 3.8
'    curAdicionalPeso = dblPesoKg * 0.15
'    
'    Select Case UCase(Trim(strTipoCarga))
'        Case "PERIGOSA", "QUIMICA"
'            curFatorRisco = 1.35
'        Case "REFRIGERADA"
'            curFatorRisco = 1.2
'        Case "VALIOSA"
'            curFatorRisco = 1.5
'        Case "PADRAO", "SECA"
'            curFatorRisco = 1#
'        Case Else
'            CALCULARFRETE = "CATEGORIA INVÁLIDA"
'            Exit Function
'    End Select
'    
'    curTotal = (curTarifaBase + curAdicionalPeso) * curFatorRisco
'    CALCULARFRETE = Round(curTotal, 2)
'End Function
'
'Public Function VALIDARCNPJ(ByVal varCNPJ As Variant) As Boolean
'    Dim strLimpo As String
'    Dim i As Long
'    Dim strChar As String
'    
'    If IsMissing(varCNPJ) Or IsEmpty(varCNPJ) Then
'        VALIDARCNPJ = False
'        Exit Function
'    End If
'    
'    strLimpo = ""
'    For i = 1 To Len(CStr(varCNPJ))
'        strChar = Mid(CStr(varCNPJ), i, 1)
'        If IsNumeric(strChar) Then
'            strLimpo = strLimpo & strChar
'        End If
'    Next i
'    
'    If Len(strLimpo) <> 14 Then
'        VALIDARCNPJ = False
'        Exit Function
'    End If
'    
'    If strLimpo = "00000000000000" Or strLimpo = "11111111111111" Then
'        VALIDARCNPJ = False
'        Exit Function
'    End If
'    
'    VALIDARCNPJ = True
'End Function
'
'' Desafio de Fixação: Previsão Logística
'Public Function PREVISAOENTREGA(ByVal dblKm As Double, ByVal dtmInicio As Date) As Date
'    Dim lngDias As Long
'    If dblKm <= 0 Then
'        PREVISAOENTREGA = dtmInicio
'        Exit Function
'    End If
'    
'    ' 650 km por dia limite
'    lngDias = -Int(-dblKm / 650) ' Arredondamento para cima
'    PREVISAOENTREGA = dtmInicio + lngDias
'End Function

