Public Class ReportosCE Private _CodigoInversion As String Private _CodigoCasa As String Private _Nombre As String Private _FechaDeCompra As Date Private _ValorTransado As Double Private _Dias As Integer Private _FechaVencimiento As Date Private _Rendimiento As Double Private _Impuestos As Double Private _OtrosCostos As Double Private _TotalCostos As Double Private _MontoALiquidar As Double Private _InteresAGenerar As Double Private _CostoDeTransferencia As Double Private _RendimientoNetoAntesDeImpuestos As Double Private _ValorReCompra As Double Private _ImpuestosLiquidacion As Double Private _IngresoNeto As Double Private _ValorNeto As Double Private _RendimientoNetoDespuesDeImpuestos As Double Private Operaciones As New Operaciones Public Property CodigoInversion As String Get Return _CodigoInversion End Get Set(value As String) _CodigoInversion = value End Set End Property Public Property CodigoCasa As String Get Return _CodigoCasa End Get Set(value As String) _CodigoCasa = value End Set End Property Public Property Nombre As String Get Return _Nombre End Get Set(value As String) _Nombre = value End Set End Property Public Property FechaDeCompra As Date Get Return _FechaDeCompra End Get Set(value As Date) _FechaDeCompra = value End Set End Property Public Property ValorTransado As Double Get Return _ValorTransado End Get Set(value As Double) _ValorTransado = value Calcular_MontoALiquidar() Calcular_InteresAGenerar() Caluclar_RendimientoNetoAntesImpuestos() Calcular_ValorRecompra() Calcular_ValorNeto() Calcular_RendimientoNetoDespuesImpuestos() End Set End Property Public Property Dias As Integer Get Return _Dias End Get Set(value As Integer) _Dias = value Calcular_InteresAGenerar() Caluclar_RendimientoNetoAntesImpuestos() Calcular_RendimientoNetoDespuesImpuestos() End Set End Property Public Property FechaVencimiento As Date Get Return _FechaVencimiento End Get Set(value As Date) _FechaVencimiento = value End Set End Property Public Property Rendimiento As Double Get Return _Rendimiento End Get Set(value As Double) _Rendimiento = value Calcular_InteresAGenerar() End Set End Property Public Property Impuestos As Double Get Return _Impuestos End Get Set(value As Double) _Impuestos = value End Set End Property Public Property OtrosCostos As Double Get Return _OtrosCostos End Get Set(value As Double) _OtrosCostos = value End Set End Property Public ReadOnly Property TotalCostos As Double Get Return _TotalCostos End Get End Property Public Property MontoALiquidar As Double Get Return _MontoALiquidar End Get Set(value As Double) _MontoALiquidar = value End Set End Property Public ReadOnly Property InteresAGenerar As Double Get Return _InteresAGenerar End Get End Property Public Property CostoDeTransferencia As Double Get Return _CostoDeTransferencia End Get Set(value As Double) _CostoDeTransferencia = value Calcular_ValorNeto() End Set End Property Public ReadOnly Property RendimientoNetoAntesDeImpuestos As Double Get Return _RendimientoNetoAntesDeImpuestos End Get End Property Public Property ValorReCompra As Double Get Return _ValorReCompra End Get Set(value As Double) _ValorReCompra = value End Set End Property Public Property ImpuestosLiquidacion As Double Get Return _ImpuestosLiquidacion End Get Set(value As Double) _ImpuestosLiquidacion = value End Set End Property Public ReadOnly Property IngresoNeto As Double Get Return _IngresoNeto End Get End Property Public Property ValorNeto As Double Get Return _ValorNeto End Get Set(value As Double) _ValorNeto = value End Set End Property Public ReadOnly Property RendimientoNetoDespuesDeImpuestos As Double Get Return _RendimientoNetoDespuesDeImpuestos End Get End Property Private Sub Calcular_TotalCostos() Dim valor As Double valor = 0 _TotalCostos = valor Calcular_MontoALiquidar() Caluclar_RendimientoNetoAntesImpuestos() Calcular_RendimientoNetoDespuesImpuestos() End Sub Private Sub Calcular_MontoALiquidar() Dim valor As Double valor = _ValorTransado + _TotalCostos _MontoALiquidar = valor End Sub Private Sub Calcular_InteresAGenerar() Dim valor As Double valor = _ValorTransado * (_Rendimiento / 100) * _Dias / 365 _InteresAGenerar = valor Caluclar_RendimientoNetoAntesImpuestos() Calcular_ValorRecompra() Calcular_ISR() Calcular_IngresoNeto() End Sub Private Sub Caluclar_RendimientoNetoAntesImpuestos() Dim valor As Double valor = ((_InteresAGenerar - _TotalCostos) / _ValorTransado) * (365 / _Dias) _RendimientoNetoAntesDeImpuestos = valor * 100 End Sub Private Sub Calcular_ValorRecompra() Dim valor As Double valor = _ValorTransado + _InteresAGenerar _ValorReCompra = valor End Sub Private Sub Calcular_ISR() Dim valor As Double valor = _InteresAGenerar * 0.1 _ImpuestosLiquidacion = valor Calcular_IngresoNeto() End Sub Private Sub Calcular_IngresoNeto() Dim valor As Double valor = _InteresAGenerar - _ImpuestosLiquidacion _IngresoNeto = valor Calcular_ValorNeto() Calcular_RendimientoNetoDespuesImpuestos() End Sub Private Sub Calcular_ValorNeto() Dim valor As Double valor = _ValorTransado + _IngresoNeto - _CostoDeTransferencia _ValorNeto = valor End Sub Private Sub Calcular_RendimientoNetoDespuesImpuestos() Dim valor As Double valor = (_IngresoNeto - _TotalCostos) / _ValorTransado * 365 / _Dias _RendimientoNetoDespuesDeImpuestos = valor * 100 End Sub Function FechaDeVencimiento(ByVal fecha As Date, ByVal dias As Integer) Dim Valor = fecha.AddDays(dias) Return Valor End Function Function Comision(ByVal valortrasado As String, ByVal dias As Integer, ByVal por As Double, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer) Dim Valor As Double = 0 Valor = valortrasado * dias * por / 365 Return Valor 'If (IndexBase = 0) Then ' Valor = valortrasado * dias * (por / 100) / 360 ' Return Valor 'ElseIf (IndexBase = 1) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = valortrasado * DiasPrimeraFecha * (por / 100) / 366 ' PrOpc2 = valortrasado * DiasSegundaFecha * (por / 100) / 365 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = valortrasado * DiasSegundaFecha * (por / 100) / 365 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = valortrasado * DiasPrimeraFecha * (por / 100) / 366 ' Else ' Valor = 0 ' End If ' Return Valor 'ElseIf (IndexBase = 2) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = valortrasado * DiasPrimeraFecha * (por / 100) / 366 ' PrOpc2 = valortrasado * DiasSegundaFecha * (por / 100) / 365 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = valortrasado * DiasSegundaFecha * (por / 100) / 365 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = valortrasado * DiasPrimeraFecha * (por / 100) / 366 ' Else ' Valor = 0 ' End If ' Return Valor 'Else ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = valortrasado * DiasPrimeraFecha * (por / 100) / 360 ' PrOpc2 = valortrasado * DiasSegundaFecha * (por / 100) / 360 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = valortrasado * DiasSegundaFecha * (por / 100) / 360 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = valortrasado * DiasPrimeraFecha * (por / 100) / 360 ' Else ' Valor = 0 ' End If ' Return Valor 'End If 'Return Valor End Function Function IOF(ByVal valortrasado As Double, comisioncasa As Double, ByVal comisionbolsa As Double, ByVal dias As Integer, ByVal VALIOF As Double, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer) Dim Valor As Double = 0 Valor = ((valortrasado + comisioncasa + comisionbolsa) * (dias * VALIOF)) / 365 Return Valor 'If (IndexBase = 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (dias * VALIOF)) / 360 ' Return Valor 'ElseIf (IndexBase = 1) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ((valortrasado + comisioncasa + comisionbolsa) * (DiasPrimeraFecha * VALIOF)) / 366 ' PrOpc2 = ((valortrasado + comisioncasa + comisionbolsa) * (DiasSegundaFecha * VALIOF)) / 365 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (DiasSegundaFecha * VALIOF)) / 365 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (DiasPrimeraFecha * VALIOF)) / 366 ' Else ' Valor = 0 ' End If ' Return Valor 'ElseIf (IndexBase = 2) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ((valortrasado + comisioncasa + comisionbolsa) * (DiasPrimeraFecha * VALIOF)) / 366 ' PrOpc2 = ((valortrasado + comisioncasa + comisionbolsa) * (DiasSegundaFecha * VALIOF)) / 365 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (DiasSegundaFecha * VALIOF)) / 365 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (DiasPrimeraFecha * VALIOF)) / 366 ' Else ' Valor = 0 ' End If ' Return Valor 'Else ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ((valortrasado + comisioncasa + comisionbolsa) * (DiasPrimeraFecha * VALIOF)) / 360 ' PrOpc2 = ((valortrasado + comisioncasa + comisionbolsa) * (DiasSegundaFecha * VALIOF)) / 360 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (DiasSegundaFecha * VALIOF)) / 360 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ((valortrasado + comisioncasa + comisionbolsa) * (DiasPrimeraFecha * VALIOF)) / 360 ' Else ' Valor = 0 ' End If ' Return Valor 'End If 'Return Valor End Function Function TotCostos(ByVal ComisionCasa As Double, ByVal ComisionBolsa As Double, ByVal IOF As Double, ByVal OC As Double, ByVal ValorTransado As Double, ByVal Instrumento As String) Dim Valor As Double = 0 Valor = ComisionCasa + ComisionBolsa + IOF + OC Return Valor End Function Function MontoLiquidacion(ByVal ValorTrasado As Double, ByVal totalcosto As Double) Dim Valor = ValorTrasado + totalcosto Return Valor End Function Function InteresGenerar(ByVal ValorTrasado As Double, ByVal rendimiento As Double, ByVal dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer) Dim Valor As Double = 0 Valor = ValorTrasado * rendimiento * dias / 365 Return Valor 'If (IndexBase = 0) Then ' Valor = ValorTrasado * rendimiento * dias / 360 ' Return Valor 'ElseIf (IndexBase = 1) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ValorTrasado * rendimiento * DiasPrimeraFecha / 366 ' PrOpc2 = ValorTrasado * rendimiento * DiasSegundaFecha / 365 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ValorTrasado * rendimiento * DiasSegundaFecha / 365 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ValorTrasado * rendimiento * DiasPrimeraFecha / 366 ' Else ' Valor = 0 ' End If ' Return Valor 'ElseIf (IndexBase = 2) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ValorTrasado * rendimiento * DiasPrimeraFecha / 366 ' PrOpc2 = ValorTrasado * rendimiento * DiasSegundaFecha / 365 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ValorTrasado * rendimiento * DiasSegundaFecha / 365 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ValorTrasado * rendimiento * DiasPrimeraFecha / 366 ' Else ' Valor = 0 ' End If ' Return Valor 'Else ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ValorTrasado * rendimiento * DiasPrimeraFecha / 360 ' PrOpc2 = ValorTrasado * rendimiento * DiasSegundaFecha / 360 ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ValorTrasado * rendimiento * DiasSegundaFecha / 360 ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ValorTrasado * rendimiento * DiasPrimeraFecha / 360 ' Else ' Valor = 0 ' End If ' Return Valor 'End If 'Return Valor End Function Function RendimientoAntes(ByVal interesgenerar As Double, ByVal totcostos As Double, ByVal valortra As Double, ByVal dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer, ByVal Tabla As String) Dim Valor As Double = 0 If Tabla = "REP0" Then Valor = ((interesgenerar - totcostos) / valortra) * (365 / dias) Else Valor = ((interesgenerar + totcostos) / valortra) * (365 / dias) End If 'If (IndexBase = 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (360 / dias) ' Return Valor * 100 'ElseIf (IndexBase = 1) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ((interesgenerar - totcostos) / valortra) * (366 / DiasPrimeraFecha) ' PrOpc2 = ((interesgenerar - totcostos) / valortra) * (365 / DiasSegundaFecha) ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (365 / DiasSegundaFecha) ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (366 / DiasPrimeraFecha) ' Else ' Valor = 0 ' End If ' Return Valor * 100 'ElseIf (IndexBase = 2) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ((interesgenerar - totcostos) / valortra) * (366 / DiasPrimeraFecha) ' PrOpc2 = ((interesgenerar - totcostos) / valortra) * (365 / DiasSegundaFecha) ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (365 / DiasSegundaFecha) ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (366 / DiasPrimeraFecha) ' Else ' Valor = 0 ' End If ' Return Valor * 100 'Else ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = ((interesgenerar - totcostos) / valortra) * (360 / DiasPrimeraFecha) ' PrOpc2 = ((interesgenerar - totcostos) / valortra) * (360 / DiasSegundaFecha) ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (360 / DiasSegundaFecha) ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = ((interesgenerar - totcostos) / valortra) * (360 / DiasPrimeraFecha) ' Else ' Valor = 0 ' End If ' Return Valor * 100 'End If 'Return Valor * 100 Return Valor * 100 End Function Function ValorRecompras(ByVal Valortrasado As Double, ByVal InteresGenerar As Double) Dim Valor = Valortrasado + InteresGenerar Return Valor End Function Function Renta(ByVal InteresGenerar As Double, ByVal Porcentaje As Double) Dim Valor = InteresGenerar * Porcentaje Return Valor End Function Function IngresoNet(ByVal InteresGenerar As Double, ByVal Renta As Double) Dim Valor = InteresGenerar - Renta Return Valor End Function Function ValorNet(ByVal ValorTrasado As Double, ByVal IngresoNeto As Double, ByVal CostoTrans As Double) Dim Valor = ValorTrasado + IngresoNeto - CostoTrans Return Valor End Function Function RendimientoDespues(ByVal IngresoNeto As Double, ByVal totalcosto As Double, ByVal valortrasado As Double, ByVal dias As Integer, ByVal Fecha1 As Date, Fecha2 As Date, ByVal IndexBase As Integer) Dim Valor As Double = 0 Valor = (IngresoNeto - totalcosto) / valortrasado * 365 / dias 'If (IndexBase = 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 360 / dias ' Return Valor * 100 'ElseIf (IndexBase = 1) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = (IngresoNeto - totalcosto) / valortrasado * 366 / DiasPrimeraFecha ' PrOpc2 = (IngresoNeto - totalcosto) / valortrasado * 365 / DiasSegundaFecha ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 365 / DiasSegundaFecha ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 366 / DiasPrimeraFecha ' Else ' Valor = 0 ' End If ' Return Valor * 100 'ElseIf (IndexBase = 2) Then ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = (IngresoNeto - totalcosto) / valortrasado * 366 / DiasPrimeraFecha ' PrOpc2 = (IngresoNeto - totalcosto) / valortrasado * 365 / DiasSegundaFecha ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 365 / DiasSegundaFecha ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 366 / DiasPrimeraFecha ' Else ' Valor = 0 ' End If ' Return Valor * 100 'Else ' Dim PrOpc1 = 0.0, PrOpc2 = 0.0 ' Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0 ' DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2) ' DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2) ' If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' PrOpc1 = (IngresoNeto - totalcosto) / valortrasado * 360 / DiasPrimeraFecha ' PrOpc2 = (IngresoNeto - totalcosto) / valortrasado * 360 / DiasSegundaFecha ' Valor = PrOpc1 + PrOpc2 ' ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 360 / DiasSegundaFecha ' ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then ' Valor = (IngresoNeto - totalcosto) / valortrasado * 360 / DiasPrimeraFecha ' Else ' Valor = 0 ' End If ' Return Valor * 100 'End If 'Return Valor * 100 Return Valor * 100 End Function End Class