| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- 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
|