Public Class FondosDeInversionCE Private _ValorNominal As Double Private _CuotasDeParticipacion As Double Private _ValorDeParticipacion As Double Private _PorcentajeComisionCasa As Double Private _ComisionCasa As Double Private _PorcentajeComisionBolsa As Double Private _ComisionBolsa As Double Private _ValorTransado As Double Private _FechaOperacion As Date Private _FechaLiquidacion As Date Private _FechaVencimiento As Date Private _RendimientoOfrecido As Double Private _Periodicidad As String Private _AnioBase As Integer Private _Plazo As Integer Private _Dividendo As Double Public FondoInversionDAO = New FondoInversionDAO Public Property ValorNominal As Double Get Return _ValorNominal End Get Set(value As Double) _ValorNominal = value CalcularValorTransado() End Set End Property Public Property CuotasDeParticipacion As Double Get Return _CuotasDeParticipacion End Get Set(value As Double) _CuotasDeParticipacion = value CalcularValorNominal() End Set End Property Public Property ValorDeParticipacion As Double Get Return _ValorDeParticipacion End Get Set(value As Double) _ValorDeParticipacion = value CalcularValorNominal() End Set End Property Public Property PorcentajeComisionCasa As Double Get Return _PorcentajeComisionCasa End Get Set(value As Double) _PorcentajeComisionCasa = value End Set End Property Public Property ComisionCasa As Double Get Return _ComisionCasa End Get Set(value As Double) _ComisionCasa = value CalcularValorTransado() End Set End Property Public Property PorcentajeComisionBolsa As Double Get Return _PorcentajeComisionBolsa End Get Set(value As Double) _PorcentajeComisionBolsa = value End Set End Property Public Property ComisionBolsa As Double Get Return _ComisionBolsa End Get Set(value As Double) _ComisionBolsa = value CalcularValorTransado() End Set End Property Public Property ValorTransado As Double Get Return _ValorTransado End Get Set(value As Double) _ValorTransado = value End Set End Property Public Property FechaOperacion As Date Get Return _FechaOperacion End Get Set(value As Date) _FechaOperacion = value End Set End Property Public Property FechaLiquidacion As Date Get Return _FechaLiquidacion End Get Set(value As Date) _FechaLiquidacion = value 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 RendimientoOfrecido As Double Get Return _RendimientoOfrecido End Get Set(value As Double) _RendimientoOfrecido = value End Set End Property Public Property Periodicidad As String Get Return _Periodicidad End Get Set(value As String) _Periodicidad = value End Set End Property Public Property AnioBase As Integer Get Return _AnioBase End Get Set(value As Integer) _AnioBase = value End Set End Property Public Property Plazo As Integer Get Return _Plazo End Get Set(value As Integer) _Plazo = value End Set End Property Public Property Dividendo As Double Get Return _Dividendo End Get Set(value As Double) _Dividendo = value End Set End Property Sub New() ValorNominal = 0 CuotasDeParticipacion = 0 ValorDeParticipacion = 0 PorcentajeComisionCasa = 0 ComisionCasa = 0 PorcentajeComisionBolsa = 0 ComisionBolsa = 0 ValorTransado = 0 FechaOperacion = Date.Now.Date FechaLiquidacion = Date.Now.Date FechaVencimiento = Date.Now.Date RendimientoOfrecido = 0 Periodicidad = "" AnioBase = 365 Plazo = 0 Dividendo = 0 End Sub Public Sub CalcularValorNominal() Dim valor As Double Dim vCuotasParticipacion As Double = CuotasDeParticipacion Dim vValorDeParticipacion As Double = ValorDeParticipacion Try valor = vCuotasParticipacion * vValorDeParticipacion Catch ex As Exception valor = 0 End Try ValorNominal = valor End Sub Public Sub CalcularComisionCasa() End Sub Public Sub CalcularComisionBolsa() End Sub Public Sub CalcularValorTransado() Dim valor As Double Dim vValorNominal As Double = ValorNominal Dim vComisionCasa As Double = ComisionCasa Dim vComisionBolsa As Double = ComisionBolsa Try valor = vValorNominal + vComisionCasa + vComisionBolsa Catch ex As Exception valor = 0 End Try ValorTransado = valor End Sub Public Function TablaIngresos() As DataTable Dim dtIngresos As DataTable Dim vFilas As DataRow Dim vColumnas As DataColumn Dim vFechaInicial As Date Dim vSiguienteFecha As Date Dim vDias As Integer Dim vDividendo As Double = Dividendo Dim vIngreso As Double Dim vRendimiento As Double Dim vCuotasDeParticipacion As Double = CuotasDeParticipacion Dim vValorNominal As Double = ValorNominal Dim vAnioBase As Integer = AnioBase Dim vDiasDelMes As Integer Dim vEstaFecha As Date Dim vPrimerCalculo As Boolean = True dtIngresos = New DataTable vColumnas = New DataColumn vColumnas.DataType = GetType(Date) vColumnas.ColumnName = "Fecha" vColumnas.Caption = "Fecha de Corte" vColumnas.AllowDBNull = False dtIngresos.Columns.Add(vColumnas) vColumnas = New DataColumn vColumnas.DataType = GetType(Integer) vColumnas.ColumnName = "Dias" vColumnas.Caption = "Dias" vColumnas.AllowDBNull = False dtIngresos.Columns.Add(vColumnas) vColumnas = New DataColumn vColumnas.DataType = GetType(Double) vColumnas.ColumnName = "Dividendo" vColumnas.Caption = "Dividendo" vColumnas.AllowDBNull = False dtIngresos.Columns.Add(vColumnas) vColumnas = New DataColumn vColumnas.DataType = GetType(Double) vColumnas.ColumnName = "Ingreso" vColumnas.Caption = "Ingreso" vColumnas.AllowDBNull = False dtIngresos.Columns.Add(vColumnas) vColumnas = New DataColumn vColumnas.DataType = GetType(Double) vColumnas.ColumnName = "Rendimiento" vColumnas.Caption = "Rendimiento" vColumnas.AllowDBNull = False dtIngresos.Columns.Add(vColumnas) vFechaInicial = FechaOperacion vDiasDelMes = Date.DaysInMonth(vFechaInicial.Year, vFechaInicial.Month) vSiguienteFecha = New Date(vFechaInicial.Year, vFechaInicial.Month, vDiasDelMes) vDias = DateDiff(DateInterval.Day, vFechaInicial, vSiguienteFecha) While vSiguienteFecha.Date <= FechaVencimiento.Date If vPrimerCalculo Then vIngreso = ((vDividendo * vCuotasDeParticipacion) / 30) * vDias vPrimerCalculo = False Else vIngreso = vDividendo * vCuotasDeParticipacion End If vRendimiento = vIngreso / vValorNominal * vAnioBase / vDias vFilas = dtIngresos.NewRow vFilas("Fecha") = vSiguienteFecha vFilas("Dias") = vDias vFilas("Dividendo") = vDividendo vFilas("Ingreso") = vIngreso vFilas("Rendimiento") = vRendimiento dtIngresos.Rows.Add(vFilas) vEstaFecha = vSiguienteFecha vSiguienteFecha = vSiguienteFecha.AddDays(1) vDiasDelMes = Date.DaysInMonth(vSiguienteFecha.Year, vSiguienteFecha.Month) vSiguienteFecha = New Date(vSiguienteFecha.Year, vSiguienteFecha.Month, vDiasDelMes) vDias = DateDiff(DateInterval.Day, vEstaFecha, vSiguienteFecha) End While Return dtIngresos dtIngresos.Dispose() End Function Public Function CalculoValorNominal(ByVal CuotasParticipacion As Double, ByVal ValorParticipacion As Double) Dim Total = CuotasParticipacion * ValorParticipacion Return Total End Function Public Function CalculoFechaLiq(ByVal FechaOperaciones As Date, ByVal Dias As Integer) Dim fecha = FechaOperaciones.AddDays(Dias) Return fecha End Function Public Sub Modificar(ByVal Coleccion As Collection, ByVal Codigo As String) FondoInversionDAO.Modificar(Coleccion, Codigo) End Sub Public Sub Nuevo(ByVal Coleccion As Collection, ByVal Codigo As String) FondoInversionDAO.Nuevo(Coleccion, Codigo) End Sub Public Sub Eliminar(ByVal Codigo As String) FondoInversionDAO.Eliminar(Codigo) End Sub End Class