Public Class PrestamoPersonalCE

    Public Function TIR(ByVal VP As Double, ByVal n As Double, ByVal i As Double)
        Dim Periodicidad As String = Variables.Periodicidad
        Dim numero As Integer = 0
        If (Periodicidad = "M") Then
            numero = 12
        ElseIf (Periodicidad = "T") Then
            numero = 4
        ElseIf (Periodicidad = "S") Then
            numero = 2
        ElseIf (Periodicidad = "A") Then
            numero = 1
        Else
            numero = 12
        End If


        i = i / numero
            Dim ValorTIR As Double = VP * ((((1 + i) ^ n) * i) / (((1 + i) ^ n) - 1))

            Return ValorTIR


    End Function

    Public Function SumarCuota(ByVal Cuota As Double, ByVal Seguro As Double)
        Dim Suma As Double = 0.0
        Suma = Cuota + Seguro
        Return Suma
    End Function

    Public Function Periodo(ByVal FechaPago As Date, ByVal Fecha As Date) As Integer

        Dim Dias = DateDiff(DateInterval.Day, FechaPago, Fecha)
        Return Dias
    End Function

End Class
