|
|
@@ -0,0 +1,4376 @@
|
|
|
+Public Class frmCertificadosDeInversion
|
|
|
+ Dim oCEPrincipal As New CertificadoDeInversionCE
|
|
|
+ Dim oDAOPrincipal As New CertificadosDeInversionDAO
|
|
|
+ Dim oDAOGeneral As New DAOGeneral
|
|
|
+ Dim Bonos As New BonosCE
|
|
|
+ Dim TotalValorCupones As Double
|
|
|
+ Dim Index
|
|
|
+ Dim BonoCalculo As New FormulasBonoCE
|
|
|
+ Dim Cargar As Boolean = True
|
|
|
+ Dim BonosConsulta As New BonosDAO
|
|
|
+ Dim Operaciones As New Operaciones
|
|
|
+ Dim ModificarRenta As Boolean = True
|
|
|
+ Dim Tipo As Integer = 0
|
|
|
+ Dim IndexBaseC As Integer = 0
|
|
|
+ Dim IndexBaseV As Integer = 0
|
|
|
+ Dim PeriodoC As Integer = 0
|
|
|
+ Dim PeriodoV As Integer = 0
|
|
|
+ 'Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
|
|
|
+ 'Private _Modo As String
|
|
|
+ Private _IdDocumento As Integer
|
|
|
+ Private _TipoDocumento As String
|
|
|
+ Private _CodigoInversion As String
|
|
|
+ Private _TipoTransaccion As String 'N=Nuevo, A=Actualizar, C=Consulta
|
|
|
+ Private TipoPeriodicidad As Integer = 0
|
|
|
+ Public InstanciaAmortizacion As New DataGridView
|
|
|
+ Public InstanciaIngresos As New DataGridView
|
|
|
+ Private TipoOperacion As String
|
|
|
+ Public Sub New()
|
|
|
+ InitializeComponent()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Public Sub New(TipoOper As String)
|
|
|
+ Me.New
|
|
|
+ TipoOperacion = TipoOper
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Sub CargarBase()
|
|
|
+
|
|
|
+ If cboAnioBaseC.Items.Count = 0 Or cboAnioBaseC.Items.Count = 1 Then
|
|
|
+
|
|
|
+
|
|
|
+ Me.cboAnioBaseC.DataSource = oDAOGeneral.ListaBase
|
|
|
+ Me.cboAnioBaseC.DisplayMember = "Descripcion"
|
|
|
+ Me.cboAnioBaseC.ValueMember = "Codigo"
|
|
|
+ Me.cboAnioBaseC.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ If cboAnioBaseV.Items.Count = 0 Or cboAnioBaseV.Items.Count = 1 Then
|
|
|
+
|
|
|
+
|
|
|
+ Me.cboAnioBaseV.DataSource = oDAOGeneral.ListaBase
|
|
|
+ Me.cboAnioBaseV.DisplayMember = "Descripcion"
|
|
|
+ Me.cboAnioBaseV.ValueMember = "Codigo"
|
|
|
+ Me.cboAnioBaseV.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Public Property TipoTransaccion As String
|
|
|
+ Get
|
|
|
+ Return _TipoTransaccion
|
|
|
+ End Get
|
|
|
+ Set(value As String)
|
|
|
+ _TipoTransaccion = value
|
|
|
+ End Set
|
|
|
+ End Property
|
|
|
+ Private Property IdDocumento As Integer
|
|
|
+ Get
|
|
|
+ Return _IdDocumento
|
|
|
+ End Get
|
|
|
+ Set(value As Integer)
|
|
|
+ _IdDocumento = value
|
|
|
+ End Set
|
|
|
+ End Property
|
|
|
+ Private Property TipoDocumento As String
|
|
|
+ Get
|
|
|
+ Return _TipoDocumento
|
|
|
+ End Get
|
|
|
+ Set(value As String)
|
|
|
+ _TipoDocumento = value
|
|
|
+ End Set
|
|
|
+ End Property
|
|
|
+ Private Property CodigoInversion As String
|
|
|
+ Get
|
|
|
+ Return _CodigoInversion
|
|
|
+ End Get
|
|
|
+ Set(value As String)
|
|
|
+ _CodigoInversion = value
|
|
|
+ End Set
|
|
|
+ End Property
|
|
|
+
|
|
|
+ Function FechaCupon(ByVal liquidacion As Date, ByVal Vencimiento As Date, ByVal frecuencia As Integer)
|
|
|
+ Dim periodos As Integer = 0
|
|
|
+
|
|
|
+ If frecuencia = 1 Then
|
|
|
+ periodos = -12
|
|
|
+ ElseIf frecuencia = 2 Then
|
|
|
+ periodos = -6
|
|
|
+ ElseIf frecuencia = 4 Then
|
|
|
+ periodos = -3
|
|
|
+
|
|
|
+ ElseIf frecuencia = 12 Then
|
|
|
+ periodos = -1
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (Not periodos = 0) Then
|
|
|
+ While Vencimiento > liquidacion
|
|
|
+
|
|
|
+ Vencimiento = Vencimiento.AddMonths(periodos)
|
|
|
+
|
|
|
+ End While
|
|
|
+ Else
|
|
|
+ Return liquidacion
|
|
|
+ End If
|
|
|
+ Return Vencimiento
|
|
|
+
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Sub ValidarExistencia()
|
|
|
+ Dim General As New DAOGeneral
|
|
|
+ Dim Codigo As String = Variables.Codigo
|
|
|
+ Dim Tabla As String = String.Empty
|
|
|
+ Dim Ins As String = Instrumento()
|
|
|
+
|
|
|
+ If (Ins = "TIT") Then
|
|
|
+ Tabla = "TIT"
|
|
|
+ ElseIf (Ins = "EURB") Then
|
|
|
+ Tabla = "EURB0"
|
|
|
+ ElseIf (Ins = "BONO") Then
|
|
|
+ Tabla = "BON0"
|
|
|
+
|
|
|
+ ElseIf (Ins = "CINV") Then
|
|
|
+ Tabla = "CIN0"
|
|
|
+
|
|
|
+ End If
|
|
|
+ Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
|
|
|
+
|
|
|
+
|
|
|
+ If Tabla = "TIT" Then
|
|
|
+ If (Existe) Then
|
|
|
+ navNuevo.Enabled = False
|
|
|
+ 'TbIngresos.rea = False
|
|
|
+ navModificar.Enabled = True
|
|
|
+ navEliminar.Enabled = True
|
|
|
+ btnIngresos.Enabled = True
|
|
|
+
|
|
|
+ Else
|
|
|
+ navNuevo.Enabled = True
|
|
|
+ 'TbIngresos.Enabled = False
|
|
|
+ navModificar.Enabled = False
|
|
|
+ navEliminar.Enabled = False
|
|
|
+ btnIngresos.Enabled = False
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ Else
|
|
|
+ If (Existe) Then
|
|
|
+ navNuevo.Enabled = False
|
|
|
+ 'TbIngresos.Enabled = True
|
|
|
+ navModificar.Enabled = True
|
|
|
+ navEliminar.Enabled = True
|
|
|
+ btnIngresos.Enabled = True
|
|
|
+ Else
|
|
|
+ navNuevo.Enabled = True
|
|
|
+ 'TbIngresos.Enabled = False
|
|
|
+ navModificar.Enabled = False
|
|
|
+ navEliminar.Enabled = False
|
|
|
+ btnIngresos.Enabled = False
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ TipoTransaccion = String.Empty
|
|
|
+ btnAceptar.Text = "Aceptar"
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Function ExisteValidacion()
|
|
|
+ Dim General As New DAOGeneral
|
|
|
+ Dim Codigo As String = Variables.Codigo
|
|
|
+ Dim Tabla As String = String.Empty
|
|
|
+ Dim Ins As String = Instrumento()
|
|
|
+
|
|
|
+ If (Ins = "TIT") Then
|
|
|
+ Tabla = "TIT"
|
|
|
+ ElseIf (Ins = "EURB") Then
|
|
|
+ Tabla = "EURB0"
|
|
|
+ ElseIf (Ins = "BONO") Then
|
|
|
+ Tabla = "BON0"
|
|
|
+
|
|
|
+ ElseIf (Ins = "CINV") Then
|
|
|
+ Tabla = "CIN0"
|
|
|
+
|
|
|
+ End If
|
|
|
+ Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
|
|
|
+ Return Existe
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub frmBonos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
+ Dim VExisteInversion As Boolean = False
|
|
|
+ If Variables.TipoOperacionCMVTA = "C" Then
|
|
|
+ GrpVenta.Enabled = False
|
|
|
+ GrpCompra.Enabled = True
|
|
|
+ Else
|
|
|
+ GrpVenta.Enabled = True
|
|
|
+ GrpCompra.Enabled = False
|
|
|
+ End If
|
|
|
+ VExisteInversion = ExisteInversion()
|
|
|
+ ValidarExistencia()
|
|
|
+ Dim Ins As String = Instrumento()
|
|
|
+
|
|
|
+ CargarBase()
|
|
|
+ AsignacionPeriodicidad()
|
|
|
+ If (Not Ins = "TIT") Then
|
|
|
+ btnIngresos.Visible = False
|
|
|
+ 'TbIngresos.Enabled = False
|
|
|
+ End If
|
|
|
+ If (Ins = "TIT") Then
|
|
|
+ btnIngresos.Visible = True
|
|
|
+ lblBono.Text = "Titularizacion"
|
|
|
+ ConfTitularizacion()
|
|
|
+ ElseIf (Ins = "EURB") Then
|
|
|
+ lblBono.Text = "Euro Bonos"
|
|
|
+
|
|
|
+ ElseIf (Ins = "BONO") Then
|
|
|
+ lblBono.Text = "Bonos"
|
|
|
+ End If
|
|
|
+ Bono()
|
|
|
+ Tipo = 1
|
|
|
+
|
|
|
+ Call CargarPeriodos()
|
|
|
+ 'PrepararTablaImpuestosYComisiones()
|
|
|
+
|
|
|
+ PrepararTablaIngresos()
|
|
|
+
|
|
|
+ If Me.TipoTransaccion Is Nothing Then
|
|
|
+ Me.TipoTransaccion = "N"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ If Me.TipoTransaccion = "C" Then
|
|
|
+ ' Call CargarRegistroBD()
|
|
|
+ End If
|
|
|
+
|
|
|
+ CargarIngresos()
|
|
|
+ ' CargarComisiones()
|
|
|
+
|
|
|
+ RefrescarValorControles()
|
|
|
+
|
|
|
+ Cargar = False
|
|
|
+
|
|
|
+ 'Calculos()
|
|
|
+ 'Formato()
|
|
|
+ 'ValidacionErrores()
|
|
|
+ BotonQuitar()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ CamposTiempo()
|
|
|
+
|
|
|
+ CargarTransladoNuevo()
|
|
|
+ ConfiguracionCMVTA(VExisteInversion)
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub ConfiguracionCMVTA(ByRef VExisteInversion As Boolean)
|
|
|
+ Dim Codigo As String = Variables.Codigo
|
|
|
+ Dim ExisteCMVTA As Boolean = oDAOGeneral.ExisteCMVTA(Codigo)
|
|
|
+ If Not ExisteCMVTA And Variables.InvocadorProInv = "frmINV" Then
|
|
|
+ btnVenderTitulo.Visible = True
|
|
|
+ End If
|
|
|
+ If CantFormAbierto = False And Not VExisteInversion Then
|
|
|
+ If Not Variables.TrasladarCMVTA Is Nothing Then
|
|
|
+ cboAnioBaseC.SelectedIndex = Variables.TrasladarCMVTA.BaseCINV
|
|
|
+ txtPorcentajeCuponCompra.Text = Variables.TrasladarCMVTA.CuponCINV
|
|
|
+ dtpFechaLiquidacionCompra.Value = Variables.TrasladarCMVTA.FechaLiquidacionCINV
|
|
|
+ dtpFechaVencimientoCompra.Value = Variables.TrasladarCMVTA.FechaVencimientoCINV
|
|
|
+ cboPeriodosC.SelectedValue = Variables.TrasladarCMVTA.PeriodicidadCINV
|
|
|
+ txtComisionPorBolsaCompra.Text = Variables.TrasladarCMVTA.PorcentajeComisionBolsaCINV
|
|
|
+ txtComisionPorCompraCasa.Text = Variables.TrasladarCMVTA.PorcentajeComisionCasaCINV
|
|
|
+ txtPrecioCompra.Text = Variables.TrasladarCMVTA.PrecioCompraCINV
|
|
|
+ txtPrecioAlVencimientoCompra.Text = Variables.TrasladarCMVTA.PrecioVencimientoCINV
|
|
|
+ dtpUltimaFechaCuponCompra.Value = Variables.TrasladarCMVTA.UltimaFechaCuponCINV
|
|
|
+ txtValorNominalCompra.Text = Variables.TrasladarCMVTA.ValorNominalCINV
|
|
|
+ txtYTMAlVencimientoCompra.Text = Variables.TrasladarCMVTA.YTMVencimientoCINV
|
|
|
+
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Function ExisteVenta()
|
|
|
+ Dim Ventas As Boolean = False
|
|
|
+ Dim General As New DAOGeneral
|
|
|
+ Dim Codigo As String = Variables.Codigo
|
|
|
+ Ventas = General.ExisteVenta(Codigo)
|
|
|
+
|
|
|
+ Return Ventas
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Sub CamposTiempo()
|
|
|
+ If Not TypeOf cboPeriodosC.SelectedValue Is DataRowView Then
|
|
|
+ Variables.PeriodicidadTIT = cboPeriodosC.SelectedValue
|
|
|
+ End If
|
|
|
+
|
|
|
+ Variables.BaseTIT = cboAnioBaseC.SelectedIndex
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Sub ConfTitularizacion()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ dgvIngresos.Dispose()
|
|
|
+ TbIngresos.Parent = Nothing
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim TbAmortizacion As New TabPage
|
|
|
+ Dim frmTitularizacion As New frmResultadoTitularizacion()
|
|
|
+ TbAmortizacion.Name = "tbAmortizacion"
|
|
|
+ TbAmortizacion.Text = "Amortizacion"
|
|
|
+ If TabCampos.TabCount = 2 Then
|
|
|
+ frmTitularizacion.Dock = DockStyle.Fill
|
|
|
+ frmTitularizacion.TopLevel = False
|
|
|
+ frmTitularizacion.Parent = TbAmortizacion
|
|
|
+ TabCampos.Controls.Add(TbAmortizacion)
|
|
|
+ frmTitularizacion.Show()
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Function ExisteInversion()
|
|
|
+ Dim Codigo As String = Variables.Codigo
|
|
|
+ Dim TablaINV As String = "INV0"
|
|
|
+ Dim TablaPINV As String = "PIN0"
|
|
|
+ Dim General As New DAOGeneral
|
|
|
+ Dim InvPro = Variables.InvPro
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If InvPro = "I" Then
|
|
|
+
|
|
|
+ Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
|
|
|
+ If INV0 Then
|
|
|
+ navNuevo.Visible = True
|
|
|
+
|
|
|
+ Return True
|
|
|
+ Else
|
|
|
+ navNuevo.Visible = False
|
|
|
+
|
|
|
+ Return False
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If InvPro = "P" Then
|
|
|
+ Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
|
|
|
+ If PINV0 Then
|
|
|
+ navNuevo.Visible = True
|
|
|
+ Return True
|
|
|
+ Else
|
|
|
+ navNuevo.Visible = False
|
|
|
+ Return False
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+ Return False
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Sub Bono()
|
|
|
+ dtpSiguienteFechaCuponCompra.Enabled = False
|
|
|
+ dtpSiguienteFechaCuponVenta.Enabled = False
|
|
|
+ dtpUltimaFechaCuponCompra.Enabled = True
|
|
|
+ dtpUltimaFechaCuponVenta.Enabled = True
|
|
|
+ End Sub
|
|
|
+ Private Function Parametros()
|
|
|
+ Dim Coleccion As New Collection
|
|
|
+ Dim PeriodoCompra = cboPeriodosC.SelectedValue
|
|
|
+ Dim ValorNominalCompra = txtValorNominalCompra.Text
|
|
|
+ Dim UltCuponCompra = dtpUltimaFechaCuponCompra.Value
|
|
|
+ Dim SigFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
|
|
|
+ Dim FechaLiqCompra = dtpFechaLiquidacionCompra.Value
|
|
|
+ Dim FechaVenCompra = dtpFechaVencimientoCompra.Value
|
|
|
+ Dim PorcentajeCuponCompra = txtPorcentajeCuponCompra.Text.TrimEnd("%") / 100
|
|
|
+ Dim PrecioVenciCompra = txtPrecioAlVencimientoCompra.Text
|
|
|
+ Dim PrecioCompra = txtPrecioCompra.Text
|
|
|
+ Dim DiasBase = IndexBaseC
|
|
|
+ Dim CostoTransCompra = txtCostoTransferenciaCompra.Text
|
|
|
+ Dim PorcCupC = txtPorcentajeCuponCompra.Text.TrimEnd("%") / 100
|
|
|
+
|
|
|
+ Dim PeriodoVenta = cboPeriodosV.SelectedValue
|
|
|
+ Dim ValorNominalVenta = txtValorNominalVenta.Text
|
|
|
+ Dim UltCuponVenta = dtpUltimaFechaCuponVenta.Value
|
|
|
+ Dim SigFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
|
|
|
+ Dim FechaLiqVenta = dtpFechaLiquidacionVenta.Value
|
|
|
+ Dim FechaVenVenta = dtpFechaVencimientoVenta.Value
|
|
|
+ Dim PorcentajeCuponVenta = txtPorcentajeCuponVenta.Text.TrimEnd("%") / 100
|
|
|
+ Dim PrecioVenciVenta = txtPrecioAlVencimientoVenta.Text
|
|
|
+ Dim PrecioVenta = txtPrecioVenta.Text
|
|
|
+ Dim DiasBaseV = IndexBaseV
|
|
|
+ Dim CostoTransVenta = txtCuponesRecibidos.Text
|
|
|
+ Dim PorcCupV = txtPorcentajeCuponVenta.Text.TrimEnd("%") / 100
|
|
|
+
|
|
|
+ Dim ComisionPorCompraCasa = txtComisionPorCompraCasa.Text.TrimEnd("%") / 100
|
|
|
+ Dim ComisionPorCompraBolsa = txtComisionPorBolsaCompra.Text.TrimEnd("%") / 100
|
|
|
+ Dim ComisionPorVentaCasa = txtComisionPorVentaCasa.Text.TrimEnd("%") / 100
|
|
|
+ Dim ComisionPorVentaBolsa = txtComisionPorBolsaVenta.Text.TrimEnd("%") / 100
|
|
|
+ Dim YTMCompra = txtYTMAlVencimientoComisionCompra.Text.TrimEnd("%") / 100
|
|
|
+ Dim YTMVenta = txtYTMAlVencimientoComisionVenta.Text.TrimEnd("%") / 100
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim DiasVenC, DiasVenV, DiasAcuC, DiasAcuV, YTMVenC, YTMVenV, IntAcuC, IntAcuV, IntPorAcuC, IntPorAcuV, PrecSucioC, PrecSucioV
|
|
|
+ Dim ComisionCasaC, ComisionCasaV, ComisionBolsaC, ComisionBolsaV, ValTransC, ValTransV, MontoPagar, MontoRecibir, CostTrans, CupRecibidos
|
|
|
+
|
|
|
+ DiasVenC = txtDiasAlVencimientoCompra.Text
|
|
|
+ DiasVenV = txtDiasAlVencimientoVenta.Text
|
|
|
+ DiasAcuC = txtDiasAcumuladosCompra.Text
|
|
|
+ DiasAcuV = txtDiasAcumuladosVenta.Text
|
|
|
+ YTMVenC = txtYTMAlVencimientoCompra.Text.ToString.Trim("%") / 100
|
|
|
+ YTMVenV = txtYTMAlVencimientoVenta.Text.ToString.Trim("%") / 100
|
|
|
+ IntAcuC = txtInteresAcumuladoCompra.Text
|
|
|
+ IntAcuV = txtInteresAcumuladoVenta.Text
|
|
|
+ IntPorAcuC = txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%") / 100
|
|
|
+ IntPorAcuV = txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%") / 100
|
|
|
+ PrecSucioC = txtPrecioSucioCompra.Text.ToString.Trim("%") / 100
|
|
|
+ PrecSucioV = txtPrecioSucioVenta.Text.ToString.Trim("%") / 100
|
|
|
+ ComisionCasaC = txtComisionCompraCasa.Text
|
|
|
+ ComisionCasaV = txtComisionVentaCasa.Text
|
|
|
+
|
|
|
+ ComisionBolsaC = txtComisionCompraBolsa.Text
|
|
|
+ ComisionBolsaV = txtComisionVentaBolsa.Text
|
|
|
+ ValTransC = txtValorTransadoCompra.Text
|
|
|
+ ValTransV = txtValorTransadoVenta.Text
|
|
|
+ MontoPagar = txtMontoAPagar.Text
|
|
|
+ MontoRecibir = txtMontoARecibir.Text
|
|
|
+ CostTrans = txtCostoTransferenciaCompra.Text
|
|
|
+ CupRecibidos = txtCuponesRecibidos.Text
|
|
|
+
|
|
|
+
|
|
|
+ Dim Codigo = Variables.Codigo
|
|
|
+ Coleccion.Add(PeriodoCompra)
|
|
|
+ Coleccion.Add(ValorNominalCompra)
|
|
|
+ Coleccion.Add(UltCuponCompra)
|
|
|
+ Coleccion.Add(SigFechaCuponCompra)
|
|
|
+ Coleccion.Add(FechaLiqCompra)
|
|
|
+ Coleccion.Add(FechaVenCompra)
|
|
|
+ Coleccion.Add(PorcentajeCuponCompra)
|
|
|
+ Coleccion.Add(PrecioVenciCompra)
|
|
|
+ Coleccion.Add(PrecioCompra)
|
|
|
+
|
|
|
+ Coleccion.Add(DiasBase)
|
|
|
+ Coleccion.Add(CostoTransCompra)
|
|
|
+
|
|
|
+
|
|
|
+ Coleccion.Add(PeriodoVenta)
|
|
|
+ Coleccion.Add(ValorNominalVenta)
|
|
|
+ Coleccion.Add(UltCuponVenta)
|
|
|
+ Coleccion.Add(SigFechaCuponVenta)
|
|
|
+ Coleccion.Add(FechaLiqVenta)
|
|
|
+ Coleccion.Add(FechaVenVenta)
|
|
|
+ Coleccion.Add(PorcentajeCuponVenta)
|
|
|
+ Coleccion.Add(PrecioVenciVenta)
|
|
|
+ Coleccion.Add(PrecioVenta)
|
|
|
+ Coleccion.Add(DiasBaseV)
|
|
|
+ Coleccion.Add(CostoTransVenta)
|
|
|
+ Coleccion.Add(Codigo)
|
|
|
+ Coleccion.Add(PorcCupC)
|
|
|
+ Coleccion.Add(PorcCupV)
|
|
|
+
|
|
|
+
|
|
|
+ Coleccion.Add(ComisionPorCompraCasa)
|
|
|
+ Coleccion.Add(ComisionPorCompraBolsa)
|
|
|
+ Coleccion.Add(ComisionPorVentaCasa)
|
|
|
+ Coleccion.Add(ComisionPorVentaBolsa)
|
|
|
+ Coleccion.Add(YTMCompra)
|
|
|
+ Coleccion.Add(YTMVenta)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Coleccion.Add(CInt(DiasVenC))
|
|
|
+ Coleccion.Add(CInt(DiasVenV))
|
|
|
+ Coleccion.Add(CInt(DiasAcuC))
|
|
|
+ Coleccion.Add(CInt(DiasAcuV))
|
|
|
+ Coleccion.Add(CDec(YTMVenC))
|
|
|
+ Coleccion.Add(CDec(YTMVenV))
|
|
|
+ Coleccion.Add(CDec(IntAcuC))
|
|
|
+ Coleccion.Add(CDec(IntAcuV))
|
|
|
+
|
|
|
+ Coleccion.Add(CDec(IntPorAcuC))
|
|
|
+ Coleccion.Add(CDec(IntPorAcuV))
|
|
|
+ Coleccion.Add(CDec(PrecSucioC))
|
|
|
+ Coleccion.Add(CDec(PrecSucioV))
|
|
|
+ Coleccion.Add(CDec(ComisionCasaC))
|
|
|
+ Coleccion.Add(CDec(ComisionCasaV))
|
|
|
+ Coleccion.Add(CDec(ComisionBolsaC))
|
|
|
+ Coleccion.Add(CDec(ComisionBolsaV))
|
|
|
+ Coleccion.Add(CDec(ValTransC))
|
|
|
+ Coleccion.Add(CDec(ValTransV))
|
|
|
+ Coleccion.Add(CDec(MontoPagar))
|
|
|
+ Coleccion.Add(CDec(MontoRecibir))
|
|
|
+ Coleccion.Add(CDec(CostTrans))
|
|
|
+ Coleccion.Add(CDec(CupRecibidos))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Return Coleccion
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Sub LimpiarElementos()
|
|
|
+ Dim Fecha = DateTime.Today
|
|
|
+ dgvIngresos.Rows.Clear()
|
|
|
+
|
|
|
+ cboPeriodosC.SelectedIndex = -1
|
|
|
+ txtValorNominalCompra.Text = String.Empty
|
|
|
+ dtpUltimaFechaCuponCompra.Value = Fecha
|
|
|
+ dtpSiguienteFechaCuponCompra.Value = Fecha
|
|
|
+ dtpFechaLiquidacionCompra.Value = Fecha
|
|
|
+ dtpFechaVencimientoCompra.Value = Fecha
|
|
|
+ txtPorcentajeCuponCompra.Text = String.Empty
|
|
|
+ txtPrecioAlVencimientoCompra.Text = String.Empty
|
|
|
+ txtPrecioCompra.Text = String.Empty
|
|
|
+ cboAnioBaseC.SelectedIndex = 0
|
|
|
+ txtCostoTransferenciaCompra.Text = String.Empty
|
|
|
+ txtYTMAlVencimientoCompra.Text = String.Empty
|
|
|
+ txtYTMAlVencimientoComisionCompra.Text = String.Empty
|
|
|
+
|
|
|
+ txtComisionCompraCasa.Text = String.Empty
|
|
|
+ txtComisionCompraBolsa.Text = String.Empty
|
|
|
+
|
|
|
+
|
|
|
+ cboPeriodosV.SelectedIndex = -1
|
|
|
+ txtValorNominalVenta.Text = String.Empty
|
|
|
+ dtpUltimaFechaCuponVenta.Value = Fecha
|
|
|
+ dtpSiguienteFechaCuponVenta.Value = Fecha
|
|
|
+ dtpFechaLiquidacionVenta.Value = Fecha
|
|
|
+ dtpFechaVencimientoVenta.Value = Fecha
|
|
|
+ txtPorcentajeCuponVenta.Text = String.Empty
|
|
|
+ txtPrecioAlVencimientoVenta.Text = String.Empty
|
|
|
+ txtPrecioVenta.Text = String.Empty
|
|
|
+ cboAnioBaseV.SelectedIndex = 0
|
|
|
+ txtCuponesRecibidos.Text = String.Empty
|
|
|
+ txtYTMAlVencimientoVenta.Text = String.Empty
|
|
|
+ txtYTMAlVencimientoComisionVenta.Text = String.Empty
|
|
|
+
|
|
|
+ txtComisionVentaCasa.Text = String.Empty
|
|
|
+ txtComisionVentaBolsa.Text = String.Empty
|
|
|
+ End Sub
|
|
|
+ Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
|
|
|
+
|
|
|
+ Dim Codigo = Variables.Codigo
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If TipoTransaccion = "N" Then
|
|
|
+
|
|
|
+ oDAOPrincipal.Nuevo(Parametros, Instrumento)
|
|
|
+ ElseIf Not ExisteValidacion() Then
|
|
|
+ Variables.ColeccionCINV = Parametros()
|
|
|
+
|
|
|
+ Me.Close()
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If TipoTransaccion = "M" Then
|
|
|
+ Dim Diccionario As New Dictionary(Of Integer, Collection)
|
|
|
+ Diccionario = ModificarIngreso()
|
|
|
+ oDAOPrincipal.ProcesoDatos(Parametros, Diccionario, Instrumento)
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+ If TipoTransaccion = "B" Then
|
|
|
+ oDAOPrincipal.
|
|
|
+ Eliminar(Codigo, Instrumento)
|
|
|
+
|
|
|
+ 'EliminarIngreso()
|
|
|
+ LimpiarElementos()
|
|
|
+
|
|
|
+ End If
|
|
|
+ ValidarExistencia()
|
|
|
+ End Sub
|
|
|
+ Function RetornarObjeto()
|
|
|
+ Return oCEPrincipal
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Public Sub CargarRegistro(vId As Integer, vTipo As String)
|
|
|
+ TipoTransaccion = "C"
|
|
|
+ IdDocumento = vId
|
|
|
+ TipoDocumento = vTipo
|
|
|
+ End Sub
|
|
|
+ Public Sub CargarRegistro(ByVal CodInversion As String)
|
|
|
+ TipoTransaccion = "C"
|
|
|
+ CodigoInversion = CodInversion
|
|
|
+ End Sub
|
|
|
+ Private Sub CargarRegistroBD()
|
|
|
+ oCEPrincipal = Nothing
|
|
|
+ ' oCEPrincipal = oDAOPrincipal.CargarRegistro(Me.CodigoInversion)
|
|
|
+
|
|
|
+ TipoTransaccion = "C"
|
|
|
+ RefrescarValorControles()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub dtpUltimaFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponCompra.ValueChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ ' ControlUltimaFechaCuponCompra()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+ Private Sub dtpSiguienteFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponCompra.ValueChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ ' ControlSiguienteFechaCuponCompra()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+ Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionCompra.ValueChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ ' ControlFechaLiquidacionCompra()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+ Private Sub dtpFechaVencimientoCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ ' ControlFechaVencimientoCompra()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+ Private Sub txtPorcentajeCuponCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.TextChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra.TextChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+ Private Sub txtPrecioAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.TextChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+ Private Sub txtCostoTransferenciaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.TextChanged
|
|
|
+ 'RefrescarMontoAPagarCompra()
|
|
|
+ 'ActivarEdicion()
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dtpFechaVencimientoVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ 'ActivarEdicion()
|
|
|
+ ' ControlFechaVencimientoVenta()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlFechaVencimientoVenta()
|
|
|
+ Dim valor As Date
|
|
|
+ valor = dtpFechaVencimientoVenta.Value.Date
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ oCEPrincipal.FechaVencimientoVenta = valor
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub cboAnioBaseC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseC.SelectedIndexChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ ' ControlAnioBaseCompra()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ CamposTiempo()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub cboAnioBaseV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseV.SelectedIndexChanged
|
|
|
+ 'RefrescarInteresAcumuladoVenta()
|
|
|
+ 'RefrescarDiasAlVencimientoVenta()
|
|
|
+ 'RefrescarDiasAcumuladosVenta()
|
|
|
+ ' ControlAnioBaseVenta()
|
|
|
+ 'ActivarEdicion()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ CamposTiempo()
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlAnioBaseVenta()
|
|
|
+ Dim valor As Integer
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ If cboAnioBaseV.SelectedIndex > -1 Then
|
|
|
+ oCEPrincipal.DiasBaseVenta = cboAnioBaseV.SelectedItem
|
|
|
+ Else
|
|
|
+ oCEPrincipal.DiasBaseVenta = 365
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+ Sub CargarPeriodos()
|
|
|
+ If cboPeriodosC.Items.Count = 0 Or cboPeriodosC.Items.Count = 1 Then
|
|
|
+
|
|
|
+
|
|
|
+ Me.cboPeriodosC.DataSource = oDAOGeneral.ListaPeriodicidad
|
|
|
+ Me.cboPeriodosC.ValueMember = "Codigo"
|
|
|
+ Me.cboPeriodosC.DisplayMember = "Descripcion"
|
|
|
+ Me.cboPeriodosC.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+ If cboPeriodosV.Items.Count = 0 Or cboPeriodosV.Items.Count = 1 Then
|
|
|
+
|
|
|
+
|
|
|
+ Me.cboPeriodosV.DataSource = oDAOGeneral.ListaPeriodicidad
|
|
|
+ Me.cboPeriodosV.ValueMember = "Codigo"
|
|
|
+ Me.cboPeriodosV.DisplayMember = "Descripcion"
|
|
|
+ Me.cboPeriodosV.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+ Private Sub cboPeriodosC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosC.SelectedIndexChanged
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ControlPeriodosCompra()
|
|
|
+ ValidacionErrores()
|
|
|
+ CamposTiempo()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub cboPeriodosV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosV.SelectedIndexChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ CamposTiempo()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'Sub RefrescarTablaIngresos()
|
|
|
+ ' 'Me.dgvIngresos.DataSource = CalcularCupones()
|
|
|
+ 'End Sub
|
|
|
+ Private Sub RefrescarValorControles()
|
|
|
+
|
|
|
+
|
|
|
+ Dim codigo = Variables.Codigo
|
|
|
+
|
|
|
+ Dim coleccion = oDAOPrincipal.CargarRegistro(codigo, Instrumento)
|
|
|
+
|
|
|
+ If (Not coleccion.Count = 1) Then
|
|
|
+ Dim Operaciones As New Operaciones
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If coleccion(10) = 0 Then
|
|
|
+ IndexBaseC = 0
|
|
|
+ ElseIf coleccion(10) = 1 Then
|
|
|
+ IndexBaseC = 1
|
|
|
+ ElseIf coleccion(10) = 2 Then
|
|
|
+ IndexBaseC = 2
|
|
|
+ Else
|
|
|
+
|
|
|
+ IndexBaseC = 3
|
|
|
+ End If
|
|
|
+
|
|
|
+ If coleccion(21) = 0 Then
|
|
|
+ IndexBaseV = 0
|
|
|
+ ElseIf coleccion(21) = 1 Then
|
|
|
+ IndexBaseV = 1
|
|
|
+ ElseIf coleccion(21) = 2 Then
|
|
|
+ IndexBaseV = 2
|
|
|
+ Else
|
|
|
+
|
|
|
+ IndexBaseV = 3
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ cboPeriodosC.SelectedValue = coleccion(1).ToString
|
|
|
+ If (String.IsNullOrEmpty(coleccion(2).ToString)) Then
|
|
|
+ txtValorNominalCompra.Text = 0
|
|
|
+ Else
|
|
|
+ txtValorNominalCompra.Text = coleccion(2).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(3).ToString)) Then
|
|
|
+ dtpUltimaFechaCuponCompra.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpUltimaFechaCuponCompra.Value = coleccion(3).ToString
|
|
|
+ End If
|
|
|
+ If (String.IsNullOrEmpty(coleccion(4).ToString)) Then
|
|
|
+ dtpSiguienteFechaCuponCompra.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpSiguienteFechaCuponCompra.Value = coleccion(4).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(5).ToString)) Then
|
|
|
+ dtpFechaLiquidacionCompra.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpFechaLiquidacionCompra.Value = coleccion(5).ToString
|
|
|
+ End If
|
|
|
+ If (String.IsNullOrEmpty(coleccion(6).ToString)) Then
|
|
|
+ dtpFechaVencimientoCompra.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpFechaVencimientoCompra.Value = coleccion(6).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ ' txtPorcentajeCuponCompra.Text = coleccion(7)
|
|
|
+ If (String.IsNullOrEmpty(coleccion(8).ToString)) Then
|
|
|
+ txtPrecioAlVencimientoCompra.Text = 0
|
|
|
+ Else
|
|
|
+ txtPrecioAlVencimientoCompra.Text = coleccion(8).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(9).ToString)) Then
|
|
|
+
|
|
|
+ Else
|
|
|
+ txtPrecioCompra.Text = coleccion(9).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ cboAnioBaseC.SelectedIndex = IndexBaseC
|
|
|
+ If (String.IsNullOrEmpty(coleccion(11).ToString)) Then
|
|
|
+ txtCostoTransferenciaCompra.Text = 0
|
|
|
+ Else
|
|
|
+ txtCostoTransferenciaCompra.Text = coleccion(11).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = String.Empty
|
|
|
+ If (String.IsNullOrEmpty(coleccion(23).ToString)) Then
|
|
|
+ txtPorcentajeCuponCompra.Text = 0
|
|
|
+ Else
|
|
|
+ txtPorcentajeCuponCompra.Text = (CDec(coleccion(23) * 100).ToString)
|
|
|
+ End If
|
|
|
+
|
|
|
+ 'txtDiasAlVencimientoCompra.Text = BonoCalculo.DiasVencimiento(dtpFechaLiquidacionCompra.Value, dtpFechaVencimientoCompra.Value, IndexBaseC).ToString
|
|
|
+ 'txtDiasAcumuladosCompra.Text = Operaciones.DiasAcumulados(dtpUltimaFechaCuponCompra.Value, dtpFechaLiquidacionCompra.Value, IndexBaseC).ToString
|
|
|
+
|
|
|
+
|
|
|
+ 'txtInteresAcumuladoCompra.Text = Operaciones.InteresAcumulado(txtValorNominalCompra.Text, txtPorcentajeCuponCompra.Text.TrimEnd("%") / 100, txtDiasAcumuladosCompra.Text, IndexBaseC).ToString
|
|
|
+ 'txtPorcentajeInteresAcumuladoCompra.Text = Operaciones.InteresAcumuladoPor(txtInteresAcumuladoCompra.Text, txtValorNominalCompra.Text) * 100
|
|
|
+ 'txtPrecioSucioCompra.Text = Operaciones.PrecioSucio(txtPrecioCompra.Text, txtPorcentajeInteresAcumuladoCompra.Text / 100).ToString
|
|
|
+ 'txtValorTransadoCompra.Text = Operaciones.ValorTrasado(txtPrecioCompra.Text, txtValorNominalCompra.Text).ToString
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorCompraCasa.Text)) Then
|
|
|
+ txtComisionPorCompraCasa.Text = 0
|
|
|
+ End If
|
|
|
+ If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
|
|
|
+ txtValorTransadoCompra.Text = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text)) Then
|
|
|
+ txtComisionPorBolsaCompra.Text = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+ txtComisionCompraCasa.Text = Operaciones.Comisiones(CDec(txtComisionPorCompraCasa.Text.TrimEnd("%") / 100), CDec(txtValorTransadoCompra.Text)).ToString
|
|
|
+
|
|
|
+ txtComisionCompraBolsa.Text = Operaciones.Comisiones(CDec(txtComisionPorBolsaCompra.Text.TrimEnd("%") / 100), CDec(txtValorTransadoCompra.Text)).ToString
|
|
|
+ If (String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text.ToString)) Then
|
|
|
+ txtYTMAlVencimientoCompra.Text = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+ 'txtYTMAlVencimientoComisionCompra.Text = Bonos.CalcularYTMComision(CDec(txtYTMAlVencimientoCompra.Text.TrimEnd("%") / 100), CDec(txtComisionPorCompraCasa.Text.ToString.Trim("%")), CDec(txtDiasAlVencimientoCompra.Text), CDec(txtComisionPorBolsaCompra.Text.ToString.Trim("%")), dtpFechaLiquidacionCompra.Value, dtpFechaVencimientoCompra.Value, IndexBaseC).ToString
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'txtMontoAPagar.Text = Operaciones.MontoPagar(CDec(txtValorTransadoCompra.Text), CDec(txtComisionCompraBolsa.Text), CDec(txtComisionCompraCasa.Text), CDec(txtInteresAcumuladoCompra.Text), CDec(txtCostoTransferenciaCompra.Text)).ToString
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(12).ToString)) Then
|
|
|
+ cboPeriodosV.SelectedValue = 0
|
|
|
+ Else
|
|
|
+ cboPeriodosV.SelectedValue = coleccion(12).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(13).ToString)) Then
|
|
|
+ txtValorNominalVenta.Text = 0
|
|
|
+ Else
|
|
|
+ txtValorNominalVenta.Text = coleccion(13).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(14).ToString)) Then
|
|
|
+ dtpUltimaFechaCuponVenta.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpUltimaFechaCuponVenta.Value = coleccion(14).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(15).ToString)) Then
|
|
|
+ dtpSiguienteFechaCuponVenta.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpSiguienteFechaCuponVenta.Value = coleccion(15).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(16).ToString)) Then
|
|
|
+ dtpFechaLiquidacionVenta.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpFechaLiquidacionVenta.Value = coleccion(16).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(17).ToString)) Then
|
|
|
+ dtpFechaVencimientoVenta.Value = Date.Now.Date
|
|
|
+ Else
|
|
|
+ dtpFechaVencimientoVenta.Value = coleccion(17).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(24).ToString)) Then
|
|
|
+ txtPorcentajeCuponVenta.Text = 0
|
|
|
+ Else
|
|
|
+ txtPorcentajeCuponVenta.Text = CDec(coleccion(24) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(19).ToString)) Then
|
|
|
+ txtPrecioAlVencimientoVenta.Text = 0
|
|
|
+ Else
|
|
|
+ txtPrecioAlVencimientoVenta.Text = coleccion(19).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(20).ToString)) Then
|
|
|
+ txtPrecioVenta.Text = 0
|
|
|
+ Else
|
|
|
+ txtPrecioVenta.Text = coleccion(20).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ cboAnioBaseV.SelectedIndex = IndexBaseV
|
|
|
+ If (String.IsNullOrEmpty(coleccion(22).ToString)) Then
|
|
|
+ txtCuponesRecibidos.Text = 0
|
|
|
+ Else
|
|
|
+ txtCuponesRecibidos.Text = coleccion(22).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ 'txtDiasAlVencimientoVenta.Text = BonoCalculo.DiasVencimiento(dtpFechaLiquidacionVenta.Value, dtpFechaVencimientoVenta.Value, IndexBaseV).ToString
|
|
|
+ 'txtDiasAcumuladosVenta.Text = Operaciones.DiasAcumulados(dtpUltimaFechaCuponVenta.Value, dtpFechaLiquidacionVenta.Value, IndexBaseV).ToString
|
|
|
+ 'txtInteresAcumuladoVenta.Text = Operaciones.InteresAcumulado(txtValorNominalVenta.Text, txtPorcentajeCuponVenta.Text.TrimEnd("%") / 100, txtDiasAcumuladosVenta.Text, IndexBaseV).ToString
|
|
|
+ 'txtPorcentajeInteresAcumuladoVenta.Text = Operaciones.InteresAcumuladoPor(txtInteresAcumuladoVenta.Text, txtValorNominalVenta.Text) * 100
|
|
|
+ 'txtPrecioSucioVenta.Text = Operaciones.PrecioSucio(txtPrecioVenta.Text, txtPorcentajeInteresAcumuladoVenta.Text / 100).ToString
|
|
|
+ 'txtValorTransadoVenta.Text = Operaciones.ValorTrasado(txtPrecioVenta.Text, txtValorNominalCompra.Text).ToString
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorVentaCasa.Text)) Then
|
|
|
+ txtComisionPorVentaCasa.Text = 0
|
|
|
+ End If
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text)) Then
|
|
|
+ txtComisionPorBolsaVenta.Text = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ 'txtComisionVentaCasa.Text = Operaciones.Comisiones(CDec(txtComisionPorVentaCasa.Text.TrimEnd("%") / 100), CDec(txtValorTransadoVenta.Text)).ToString
|
|
|
+ 'txtComisionVentaBolsa.Text = Operaciones.Comisiones(CDec(txtComisionPorBolsaVenta.Text.TrimEnd("%") / 100), CDec(txtValorTransadoVenta.Text)).ToString
|
|
|
+ If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text.ToString) Then
|
|
|
+ txtYTMAlVencimientoVenta.Text = 0
|
|
|
+ End If
|
|
|
+ 'txtYTMAlVencimientoComisionVenta.Text = Bonos.CalcularYTMComision(CDec(txtYTMAlVencimientoCompra.Text.TrimEnd("%") / 100), CDec(txtComisionPorCompraCasa.Text.ToString.Trim("%")), CDec(txtDiasAlVencimientoCompra.Text), CDec(txtComisionPorBolsaCompra.Text.ToString.Trim("%")), dtpFechaLiquidacionCompra.Value, dtpFechaVencimientoCompra.Value, IndexBaseC).ToString
|
|
|
+ 'txtMontoARecibir.Text = Operaciones.MontoRecibir(txtValorTransadoVenta.Text, txtComisionVentaBolsa.Text, txtComisionVentaCasa.Text, txtInteresAcumuladoVenta.Text).ToString
|
|
|
+ 'txtCuponesRecibidos.Text = Recibido().ToString
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(25).ToString)) Then
|
|
|
+ txtComisionPorCompraCasa.Text = 0
|
|
|
+ Else
|
|
|
+ txtComisionPorCompraCasa.Text = (CDec(coleccion(25)) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(26).ToString)) Then
|
|
|
+ txtComisionPorBolsaCompra.Text = 0
|
|
|
+ Else
|
|
|
+ txtComisionPorBolsaCompra.Text = (CDec(coleccion(26)) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(27).ToString)) Then
|
|
|
+ txtComisionPorVentaCasa.Text = 0
|
|
|
+ Else
|
|
|
+ txtComisionPorVentaCasa.Text = (CDec(coleccion(27)) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(28).ToString)) Then
|
|
|
+ txtComisionPorBolsaVenta.Text = 0
|
|
|
+ Else
|
|
|
+ txtComisionPorBolsaVenta.Text = (CDec(coleccion(28)) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(29).ToString)) Then
|
|
|
+ txtYTMAlVencimientoComisionCompra.Text = 0
|
|
|
+ Else
|
|
|
+ txtYTMAlVencimientoComisionCompra.Text = (CDec(coleccion(29)) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(coleccion(30).ToString)) Then
|
|
|
+
|
|
|
+ txtYTMAlVencimientoComisionVenta.Text = 0
|
|
|
+ Else
|
|
|
+ txtYTMAlVencimientoComisionVenta.Text = (CDec(coleccion(30)) * 100).ToString
|
|
|
+ End If
|
|
|
+
|
|
|
+ 'Campos Extras'
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(31).ToString) Then
|
|
|
+
|
|
|
+ txtDiasAlVencimientoCompra.Text = coleccion(31).ToString
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(32).ToString) Then
|
|
|
+
|
|
|
+ txtDiasAlVencimientoVenta.Text = coleccion(32).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(33).ToString) Then
|
|
|
+
|
|
|
+ txtDiasAcumuladosCompra.Text = coleccion(33).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(34).ToString) Then
|
|
|
+
|
|
|
+ txtDiasAcumuladosVenta.Text = coleccion(34).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(35).ToString) Then
|
|
|
+
|
|
|
+ txtYTMAlVencimientoCompra.Text = (coleccion(35) * 100).ToString + "%"
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(36).ToString) Then
|
|
|
+
|
|
|
+ txtYTMAlVencimientoVenta.Text = (coleccion(36) * 100).ToString + "%"
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(37).ToString) Then
|
|
|
+
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = (coleccion(37) * 100).ToString + "%"
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(38).ToString) Then
|
|
|
+
|
|
|
+
|
|
|
+ txtPorcentajeInteresAcumuladoVenta.Text = (coleccion(38) * 100).ToString + "%"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(39).ToString) Then
|
|
|
+
|
|
|
+ txtInteresAcumuladoCompra.Text = coleccion(39).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(40).ToString) Then
|
|
|
+
|
|
|
+ txtInteresAcumuladoVenta.Text = coleccion(40).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(41).ToString) Then
|
|
|
+
|
|
|
+ txtPrecioSucioCompra.Text = (coleccion(41) * 100).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(42).ToString) Then
|
|
|
+
|
|
|
+ txtPrecioSucioVenta.Text = (coleccion(42) * 100).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(43).ToString) Then
|
|
|
+
|
|
|
+ txtComisionCompraCasa.Text = coleccion(43).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(44).ToString) Then
|
|
|
+
|
|
|
+ txtComisionVentaCasa.Text = coleccion(44).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(45).ToString) Then
|
|
|
+
|
|
|
+ txtComisionCompraBolsa.Text = coleccion(45).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(46).ToString) Then
|
|
|
+
|
|
|
+
|
|
|
+ txtComisionVentaBolsa.Text = coleccion(46).ToString
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(47).ToString) Then
|
|
|
+
|
|
|
+ txtValorTransadoCompra.Text = coleccion(47).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(48).ToString) Then
|
|
|
+
|
|
|
+ txtValorTransadoVenta.Text = coleccion(48).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(49).ToString) Then
|
|
|
+
|
|
|
+ txtMontoAPagar.Text = coleccion(49).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(50).ToString) Then
|
|
|
+
|
|
|
+
|
|
|
+ txtMontoARecibir.Text = coleccion(50).ToString
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(coleccion(51).ToString) Then
|
|
|
+
|
|
|
+ txtCuponesRecibidos.Text = coleccion(51).ToString
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Sub Formato()
|
|
|
+
|
|
|
+ If cboPeriodosC.SelectedIndex = -1 Then
|
|
|
+ If cboPeriodosC.Items.Count > 0 Then
|
|
|
+ cboPeriodosC.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If cboPeriodosV.SelectedIndex = -1 Then
|
|
|
+ If cboPeriodosV.Items.Count > 0 Then
|
|
|
+ cboPeriodosV.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If cboAnioBaseC.SelectedIndex = -1 Then
|
|
|
+ If cboAnioBaseC.Items.Count > 0 Then
|
|
|
+ cboAnioBaseC.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If cboAnioBaseV.SelectedIndex = -1 Then
|
|
|
+ If cboAnioBaseV.Items.Count > 0 Then
|
|
|
+ cboAnioBaseV.SelectedIndex = 0
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If IsNumeric(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
|
|
|
+ If Double.IsNaN(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If IsNumeric(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
|
|
|
+ If Double.IsNaN(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
|
|
|
+ txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If IsNumeric(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
|
|
|
+ If Double.IsNaN(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
|
|
|
+ txtPrecioSucioCompra.Text = "0.0%"
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If IsNumeric(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
|
|
|
+ If Double.IsNaN(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
|
|
|
+ txtPrecioSucioVenta.Text = "0.0%"
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtValorNominalCompra.Text.ToString)) Then
|
|
|
+ txtValorNominalCompra.Text = "0.0"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtDiasAlVencimientoCompra.Text)) Then
|
|
|
+ txtDiasAlVencimientoCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtDiasAcumuladosCompra.Text)) Then
|
|
|
+ txtDiasAcumuladosCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text)) Then
|
|
|
+ txtPorcentajeCuponCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtYTMAlVencimientoComisionCompra.Text)) Then
|
|
|
+ txtYTMAlVencimientoComisionCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text)) Then
|
|
|
+ txtYTMAlVencimientoCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text)) Then
|
|
|
+ txtPrecioAlVencimientoCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPrecioCompra.Text)) Then
|
|
|
+ txtPrecioCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtInteresAcumuladoCompra.Text)) Then
|
|
|
+ txtInteresAcumuladoCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoCompra.Text)) Then
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPrecioSucioCompra.Text)) Then
|
|
|
+ txtPrecioSucioCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorCompraCasa.Text)) Then
|
|
|
+ txtComisionPorCompraCasa.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionCompraCasa.Text)) Then
|
|
|
+ txtComisionCompraCasa.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text)) Then
|
|
|
+ txtComisionPorBolsaCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionCompraBolsa.Text)) Then
|
|
|
+ txtComisionCompraBolsa.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
|
|
|
+ txtValorTransadoCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtMontoAPagar.Text)) Then
|
|
|
+ txtMontoAPagar.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text)) Then
|
|
|
+ txtCostoTransferenciaCompra.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtValorNominalVenta.Text)) Then
|
|
|
+ txtValorNominalVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtDiasAlVencimientoVenta.Text)) Then
|
|
|
+ txtDiasAlVencimientoVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtDiasAcumuladosVenta.Text)) Then
|
|
|
+ txtDiasAcumuladosVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text)) Then
|
|
|
+ txtPorcentajeCuponVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtYTMAlVencimientoComisionVenta.Text)) Then
|
|
|
+ txtYTMAlVencimientoComisionVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text)) Then
|
|
|
+ txtYTMAlVencimientoVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text)) Then
|
|
|
+ txtPrecioAlVencimientoVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPrecioVenta.Text)) Then
|
|
|
+ txtPrecioVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtInteresAcumuladoVenta.Text)) Then
|
|
|
+ txtInteresAcumuladoVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoVenta.Text)) Then
|
|
|
+ txtPorcentajeInteresAcumuladoVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtPrecioSucioVenta.Text)) Then
|
|
|
+ txtPrecioSucioVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorVentaCasa.Text)) Then
|
|
|
+ txtComisionPorVentaCasa.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionVentaCasa.Text)) Then
|
|
|
+ txtComisionVentaCasa.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text)) Then
|
|
|
+ txtComisionPorBolsaVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtComisionVentaBolsa.Text)) Then
|
|
|
+ txtComisionVentaBolsa.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
|
|
|
+ txtValorTransadoVenta.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtMontoARecibir.Text)) Then
|
|
|
+ txtMontoARecibir.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(txtCuponesRecibidos.Text)) Then
|
|
|
+ txtCuponesRecibidos.Text = "0.0"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (txtPorcentajeCuponCompra.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtPorcentajeCuponCompra.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (txtYTMAlVencimientoCompra.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtYTMAlVencimientoCompra.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (txtPorcentajeCuponVenta.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtPorcentajeCuponVenta.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (txtYTMAlVencimientoVenta.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtYTMAlVencimientoVenta.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (txtComisionPorCompraCasa.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtComisionPorCompraCasa.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (txtComisionPorBolsaCompra.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtComisionPorBolsaCompra.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (txtComisionPorVentaCasa.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtComisionPorVentaCasa.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (txtComisionPorBolsaVenta.ToString.IndexOf("%") = -1) Then
|
|
|
+ txtComisionPorBolsaVenta.Text += "%"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Sub Calculos()
|
|
|
+
|
|
|
+ If (Not Cargar) Then
|
|
|
+
|
|
|
+ Dim V_dtpSiguienteFechaCuponCompra = Date.Now.Date, V_dtpFechaVencimientoCompra = Date.Now.Date, V_dtpFechaLiquidacionCompra = Date.Now.Date, V_dtpUltimaFechaCuponCompra = Date.Now.Date
|
|
|
+ Dim V_txtValorNominalCompra = 0.0, V_txtPorcentajeCuponCompra = 0.0, V_txtDiasAcumuladosCompra = 0, V_txtInteresAcumuladoCompra = 0.0
|
|
|
+ Dim V_txtPorcentajeInteresAcumuladoCompra = 0.0, V_txtComisionPorCompraCasa = 0.0, V_txtValorTransadoCompra = 0.0
|
|
|
+ Dim V_txtComisionPorBolsaCompra = 0.0, V_txtComisionCompraCasa = 0.0, V_txtComisionCompraBolsa = 0.0
|
|
|
+ Dim V_txtYTMAlVencimientoCompra = 0.0, V_txtYTMAlVencimientoComisionCompra = 0.0, V_txtMontoAPagar = 0.0, V_txtPrecioCompra = 0.0
|
|
|
+ Dim V_txtPrecioAlVencimientoCompra = 0.0, V_txtCostoTransferenciaCompra = 0.0, V_txtPrecioSucioCompra = 0.0
|
|
|
+ Dim V_txtDiasAlVencimientoCompra = 0
|
|
|
+ Dim TipoPeriodoCompra As Integer = 0
|
|
|
+
|
|
|
+
|
|
|
+ Dim V_dtpSiguienteFechaCuponVenta = Date.Now.Date, V_dtpFechaVencimientoVenta = Date.Now.Date, V_dtpFechaLiquidacionVenta = Date.Now.Date, V_dtpUltimaFechaCuponVenta = Date.Now.Date
|
|
|
+ Dim V_txtValorNominalVenta = 0.0, V_txtPorcentajeCuponVenta = 0.0, V_txtDiasAcumuladosVenta = 0, V_txtInteresAcumuladoVenta = 0.0
|
|
|
+ Dim V_txtPorcentajeInteresAcumuladoVenta = 0.0, V_txtComisionPorVentaCasa = 0.0, V_txtValorTransadoVenta = 0.0
|
|
|
+ Dim V_txtComisionPorBolsaVenta = 0.0, V_txtComisionVentaCasa = 0.0, V_txtComisionVentaBolsa = 0.0
|
|
|
+ Dim V_txtYTMAlVencimientoVenta = 0.0, V_txtYTMAlVencimientoComisionVenta = 0.0, V_txtPrecioVenta = 0.0
|
|
|
+ Dim V_txtPrecioAlVencimientoVenta = 0.0, V_txtCostoTransferenciaVenta = 0.0, V_txtPrecioSucioVenta = 0.0
|
|
|
+ Dim V_txtDiasAlVencimientoVenta = 0.0, V_txtMontoARecibir = 0.0, V_txtCuponesRecibidos = 0.0
|
|
|
+ Dim TipoPeriodoVenta As Integer = 0
|
|
|
+
|
|
|
+ V_dtpSiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
|
|
|
+ V_dtpSiguienteFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
|
|
|
+ V_dtpUltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value
|
|
|
+ V_dtpUltimaFechaCuponVenta = dtpUltimaFechaCuponVenta.Value
|
|
|
+ V_dtpFechaVencimientoCompra = dtpFechaVencimientoCompra.Value
|
|
|
+ V_dtpFechaVencimientoVenta = dtpFechaVencimientoVenta.Value
|
|
|
+ V_dtpFechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value
|
|
|
+ V_dtpFechaLiquidacionVenta = dtpFechaLiquidacionVenta.Value
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtValorNominalCompra.Text) Then
|
|
|
+ V_txtValorNominalCompra = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtValorNominalCompra = txtValorNominalCompra.Text
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtValorNominalVenta.Text) Then
|
|
|
+ V_txtValorNominalVenta = 0
|
|
|
+ Else
|
|
|
+ V_txtValorNominalVenta = txtValorNominalVenta.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text.Trim("%")) Then
|
|
|
+ V_txtPorcentajeCuponCompra = 0
|
|
|
+ Else
|
|
|
+ V_txtPorcentajeCuponCompra = CDec(txtPorcentajeCuponCompra.Text.Trim("%") / 100)
|
|
|
+ End If
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text.Trim("%")) Then
|
|
|
+
|
|
|
+ V_txtPorcentajeCuponVenta = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtPorcentajeCuponVenta = CDec(txtPorcentajeCuponVenta.Text.Trim("%") / 100)
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text.Trim("%")) Then
|
|
|
+
|
|
|
+ V_txtYTMAlVencimientoCompra = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtYTMAlVencimientoCompra = CDec(txtYTMAlVencimientoCompra.Text.Trim("%") / 100)
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text.Trim("%")) Then
|
|
|
+
|
|
|
+ V_txtYTMAlVencimientoVenta = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtYTMAlVencimientoVenta = CDec(txtYTMAlVencimientoVenta.Text.Trim("%") / 100)
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtPrecioCompra.Text) Then
|
|
|
+ V_txtPrecioCompra = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtPrecioCompra = txtPrecioCompra.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtPrecioVenta.Text) Then
|
|
|
+
|
|
|
+ V_txtPrecioVenta = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtPrecioVenta = txtPrecioVenta.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text) Then
|
|
|
+
|
|
|
+ V_txtPrecioAlVencimientoCompra = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtPrecioAlVencimientoCompra = txtPrecioAlVencimientoCompra.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text) Then
|
|
|
+
|
|
|
+ V_txtPrecioAlVencimientoVenta = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtPrecioAlVencimientoVenta = txtPrecioAlVencimientoVenta.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorCompraCasa.Text.Trim("%")) Then
|
|
|
+ V_txtComisionPorCompraCasa = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionPorCompraCasa = CDec(txtComisionPorCompraCasa.Text.Trim("%")) / 100
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorVentaCasa.Text.Trim("%")) Then
|
|
|
+
|
|
|
+ V_txtComisionPorVentaCasa = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionPorVentaCasa = CDec(txtComisionPorVentaCasa.Text.Trim("%")) / 100
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionCompraCasa.Text) Then
|
|
|
+
|
|
|
+ V_txtComisionCompraCasa = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionCompraCasa = txtComisionCompraCasa.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionVentaCasa.Text) Then
|
|
|
+
|
|
|
+ V_txtComisionVentaCasa = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionVentaCasa = txtComisionVentaCasa.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text.Trim("%")) Then
|
|
|
+
|
|
|
+ V_txtComisionPorBolsaCompra = 0
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionPorBolsaCompra = CDec(txtComisionPorBolsaCompra.Text.Trim("%")) / 100
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text.Trim("%")) Then
|
|
|
+ V_txtComisionPorBolsaVenta = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionPorBolsaVenta = CDec(txtComisionPorBolsaVenta.Text.Trim("%")) / 100
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionCompraBolsa.Text) Then
|
|
|
+ V_txtComisionCompraBolsa = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionCompraBolsa = txtComisionCompraBolsa.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtComisionVentaBolsa.Text) Then
|
|
|
+ V_txtComisionVentaBolsa = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtComisionVentaBolsa = txtComisionVentaBolsa.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text) Then
|
|
|
+ V_txtCostoTransferenciaCompra = 0
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ V_txtCostoTransferenciaCompra = txtCostoTransferenciaCompra.Text
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (cboPeriodosC.SelectedValue = "M") Then
|
|
|
+ TipoPeriodoCompra = 12
|
|
|
+ PeriodoC = 1
|
|
|
+ ElseIf (cboPeriodosC.SelectedValue = "T") Then
|
|
|
+ TipoPeriodoCompra = 4
|
|
|
+ PeriodoC = 3
|
|
|
+
|
|
|
+ ElseIf (cboPeriodosC.SelectedValue = "S") Then
|
|
|
+ TipoPeriodoCompra = 2
|
|
|
+ PeriodoC = 6
|
|
|
+
|
|
|
+ ElseIf (cboPeriodosC.SelectedValue = "A") Then
|
|
|
+ TipoPeriodoCompra = 1
|
|
|
+ PeriodoC = 12
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (cboPeriodosV.SelectedValue = "M") Then
|
|
|
+ TipoPeriodoVenta = 12
|
|
|
+ PeriodoV = 1
|
|
|
+ ElseIf (cboPeriodosV.SelectedValue = "T") Then
|
|
|
+ TipoPeriodoVenta = 4
|
|
|
+ PeriodoV = 3
|
|
|
+ ElseIf (cboPeriodosV.SelectedValue = "S") Then
|
|
|
+ TipoPeriodoVenta = 2
|
|
|
+ PeriodoV = 6
|
|
|
+ ElseIf (cboPeriodosV.SelectedValue = "A") Then
|
|
|
+ TipoPeriodoVenta = 1
|
|
|
+ PeriodoV = 12
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If cboAnioBaseC.SelectedIndex = 0 Then
|
|
|
+ IndexBaseC = 0
|
|
|
+ ElseIf cboAnioBaseC.SelectedIndex = 1 Then
|
|
|
+ IndexBaseC = 1
|
|
|
+ ElseIf cboAnioBaseC.SelectedIndex = 2 Then
|
|
|
+ IndexBaseC = 2
|
|
|
+ Else
|
|
|
+
|
|
|
+ IndexBaseC = 3
|
|
|
+ End If
|
|
|
+
|
|
|
+ If cboAnioBaseV.SelectedIndex = 0 Then
|
|
|
+ IndexBaseV = 0
|
|
|
+ ElseIf cboAnioBaseV.SelectedIndex = 1 Then
|
|
|
+ IndexBaseV = 1
|
|
|
+ ElseIf cboAnioBaseV.SelectedIndex = 2 Then
|
|
|
+ IndexBaseV = 2
|
|
|
+ Else
|
|
|
+
|
|
|
+ IndexBaseV = 3
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (Tipo = 0) Then
|
|
|
+
|
|
|
+
|
|
|
+ dtpUltimaFechaCuponCompra.Value = FechaCupon(V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, TipoPeriodoCompra)
|
|
|
+ dtpUltimaFechaCuponVenta.Value = FechaCupon(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, TipoPeriodoVenta)
|
|
|
+
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ dtpSiguienteFechaCuponCompra.Value = FechaTipo(V_dtpUltimaFechaCuponCompra, TipoPeriodoCompra)
|
|
|
+ dtpSiguienteFechaCuponVenta.Value = FechaTipo(V_dtpUltimaFechaCuponVenta, TipoPeriodoVenta)
|
|
|
+
|
|
|
+ End If
|
|
|
+ V_dtpSiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
|
|
|
+ V_dtpSiguienteFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
|
|
|
+ V_dtpUltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value
|
|
|
+ V_dtpUltimaFechaCuponVenta = dtpUltimaFechaCuponVenta.Value
|
|
|
+ V_dtpFechaVencimientoCompra = dtpFechaVencimientoCompra.Value
|
|
|
+ V_dtpFechaVencimientoVenta = dtpFechaVencimientoVenta.Value
|
|
|
+ V_dtpFechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value
|
|
|
+ V_dtpFechaLiquidacionVenta = dtpFechaLiquidacionVenta.Value
|
|
|
+
|
|
|
+ 'Valores de Compra
|
|
|
+
|
|
|
+ V_txtDiasAlVencimientoCompra = BonoCalculo.DiasVencimiento(V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, IndexBaseC)
|
|
|
+
|
|
|
+
|
|
|
+ V_txtDiasAcumuladosCompra = Operaciones.DiasAcumulados(V_dtpUltimaFechaCuponCompra, V_dtpFechaLiquidacionCompra, IndexBaseC)
|
|
|
+ V_txtInteresAcumuladoCompra = BonoCalculo.InteresAcumulado(V_txtValorNominalCompra, V_txtPorcentajeCuponCompra, V_dtpUltimaFechaCuponCompra, V_dtpFechaLiquidacionCompra, V_txtDiasAcumuladosCompra, IndexBaseC)
|
|
|
+
|
|
|
+
|
|
|
+ V_txtPorcentajeInteresAcumuladoCompra = BonoCalculo.InteresAcumuladoPor(V_txtInteresAcumuladoCompra, V_txtValorNominalCompra, PeriodoC, IndexBaseC) * 100
|
|
|
+ V_txtPrecioSucioCompra = BonoCalculo.PrecioSucio(V_txtPrecioCompra, V_txtPorcentajeInteresAcumuladoCompra / 100)
|
|
|
+ V_txtValorTransadoCompra = BonoCalculo.ValorTrasado(V_txtPrecioCompra, V_txtValorNominalCompra)
|
|
|
+ 'V_txtComisionCompraCasa = BonoCalculo.Comisiones(CDec(V_txtComisionPorCompraCasa), CDec(V_txtValorTransadoCompra))
|
|
|
+ ' V_txtComisionCompraBolsa = BonoCalculo.Comisiones(CDec(V_txtComisionPorBolsaCompra), CDec(V_txtValorTransadoCompra))
|
|
|
+ V_txtComisionCompraCasa = CalcularComision(V_txtComisionPorCompraCasa, V_txtValorTransadoCompra)
|
|
|
+ V_txtComisionCompraBolsa = CalcularComision(V_txtComisionPorBolsaCompra, V_txtValorTransadoCompra)
|
|
|
+ V_txtYTMAlVencimientoComisionCompra = Bonos.CalcularYTMComision(CDec(V_txtYTMAlVencimientoCompra), CDec(V_txtComisionPorCompraCasa), V_txtDiasAlVencimientoCompra, CDec(V_txtComisionPorBolsaCompra), V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, IndexBaseC)
|
|
|
+ V_txtMontoAPagar = BonoCalculo.MontoPagar(V_txtValorTransadoCompra, V_txtComisionCompraBolsa, V_txtComisionCompraCasa, V_txtInteresAcumuladoCompra, V_txtCostoTransferenciaCompra)
|
|
|
+
|
|
|
+
|
|
|
+ 'Valores de Venta
|
|
|
+
|
|
|
+ V_txtDiasAlVencimientoVenta = BonoCalculo.DiasVencimiento(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, IndexBaseV)
|
|
|
+ V_txtDiasAcumuladosVenta = Operaciones.DiasAcumulados(V_dtpUltimaFechaCuponVenta, V_dtpFechaLiquidacionVenta, IndexBaseV)
|
|
|
+ V_txtInteresAcumuladoVenta = BonoCalculo.InteresAcumulado(V_txtValorNominalVenta, V_txtPorcentajeCuponVenta, V_dtpUltimaFechaCuponVenta, V_dtpFechaLiquidacionVenta, V_txtDiasAcumuladosVenta, IndexBaseV)
|
|
|
+ V_txtPorcentajeInteresAcumuladoVenta = BonoCalculo.InteresAcumuladoPor(V_txtInteresAcumuladoVenta, V_txtValorNominalVenta, PeriodoV, IndexBaseV) * 100
|
|
|
+ V_txtPrecioSucioVenta = BonoCalculo.PrecioSucio(V_txtPrecioVenta, V_txtPorcentajeInteresAcumuladoVenta / 100)
|
|
|
+ V_txtValorTransadoVenta = BonoCalculo.ValorTrasado(V_txtPrecioVenta, V_txtValorNominalVenta)
|
|
|
+ 'V_txtComisionVentaCasa = BonoCalculo.Comisiones(CDec(V_txtComisionPorVentaCasa), CDec(V_txtValorTransadoVenta))
|
|
|
+ ' V_txtComisionVentaBolsa = BonoCalculo.Comisiones(CDec(V_txtComisionPorBolsaVenta), CDec(V_txtValorTransadoVenta))
|
|
|
+
|
|
|
+ V_txtComisionVentaCasa = CalcularComision(V_txtComisionPorVentaCasa, V_txtValorTransadoVenta)
|
|
|
+ V_txtComisionVentaBolsa = CalcularComision(V_txtComisionPorBolsaVenta, V_txtValorTransadoVenta)
|
|
|
+
|
|
|
+ V_txtYTMAlVencimientoComisionVenta = Bonos.CalcularYTMComision(V_txtYTMAlVencimientoVenta, V_txtComisionPorVentaCasa, V_txtDiasAlVencimientoVenta, V_txtComisionPorBolsaVenta, V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, IndexBaseV)
|
|
|
+ V_txtMontoARecibir = BonoCalculo.MontoRecibir(V_txtValorTransadoVenta, V_txtComisionVentaBolsa, V_txtComisionVentaCasa, V_txtInteresAcumuladoVenta)
|
|
|
+ V_txtCuponesRecibidos = Recibido()
|
|
|
+
|
|
|
+ 'Valores de Compra
|
|
|
+
|
|
|
+
|
|
|
+ txtDiasAlVencimientoCompra.Text = Format(V_txtDiasAlVencimientoCompra, "0.0000")
|
|
|
+ txtDiasAcumuladosCompra.Text = Format(V_txtDiasAcumuladosCompra, "0.0000")
|
|
|
+ txtInteresAcumuladoCompra.Text = Format(V_txtInteresAcumuladoCompra, "0.0000")
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = CStr(Format(V_txtPorcentajeInteresAcumuladoCompra, "0.000")) + "%"
|
|
|
+ txtPrecioSucioCompra.Text = Format(V_txtPrecioSucioCompra, "0.0000")
|
|
|
+ txtValorTransadoCompra.Text = Format(V_txtValorTransadoCompra, "0.0000")
|
|
|
+ txtComisionCompraCasa.Text = Format(V_txtComisionCompraCasa, "0.0000")
|
|
|
+ txtComisionCompraBolsa.Text = Format(V_txtComisionCompraBolsa, "0.0000")
|
|
|
+ txtYTMAlVencimientoComisionCompra.Text = CStr(Format(V_txtYTMAlVencimientoComisionCompra, "0.0000") * 100) + "%"
|
|
|
+ txtMontoAPagar.Text = Format(V_txtMontoAPagar, "0.0000")
|
|
|
+ txtComisionCompraCasa.Text = Format(V_txtComisionCompraCasa, "0.0000")
|
|
|
+ txtComisionCompraBolsa.Text = Format(V_txtComisionCompraBolsa, "0.0000")
|
|
|
+
|
|
|
+ 'Valores de Venta
|
|
|
+
|
|
|
+ FechaCupon(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, TipoPeriodoVenta)
|
|
|
+ txtDiasAlVencimientoVenta.Text = Format(V_txtDiasAlVencimientoVenta, "0.0000")
|
|
|
+ txtDiasAcumuladosVenta.Text = Format(V_txtDiasAcumuladosVenta, "0.0000")
|
|
|
+ txtInteresAcumuladoVenta.Text = Format(V_txtInteresAcumuladoVenta, "0.0000")
|
|
|
+ txtPorcentajeInteresAcumuladoVenta.Text = CStr(Format(V_txtPorcentajeInteresAcumuladoVenta, "0.0000")) + "%"
|
|
|
+ txtPrecioSucioVenta.Text = Format(V_txtPrecioSucioVenta, "0.0000")
|
|
|
+ txtValorTransadoVenta.Text = Format(V_txtValorTransadoVenta, "0.0000")
|
|
|
+ txtComisionVentaCasa.Text = Format(V_txtComisionVentaCasa, "0.0000")
|
|
|
+ txtComisionVentaBolsa.Text = Format(V_txtComisionVentaBolsa, "0.0000")
|
|
|
+ txtYTMAlVencimientoComisionVenta.Text = CStr(Format(V_txtYTMAlVencimientoComisionVenta, "0.0000") * 100) + "%"
|
|
|
+ txtMontoARecibir.Text = Format(V_txtMontoARecibir, "0.0000")
|
|
|
+ txtCuponesRecibidos.Text = Format(V_txtCuponesRecibidos, "0.0000")
|
|
|
+ txtComisionVentaCasa.Text = Format(V_txtComisionVentaCasa, "0.0000")
|
|
|
+ txtComisionVentaBolsa.Text = Format(V_txtComisionVentaBolsa, "0.0000")
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ CorrelativoSinBD()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Function CalcularComision(ByVal Porcentaje As Double, ByVal VTransado As Double)
|
|
|
+ Return Porcentaje * VTransado
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub RefrescarClaseEntidad()
|
|
|
+ ControlValorNominalCompra()
|
|
|
+ ControlUltimaFechaCuponCompra()
|
|
|
+ ControlSiguienteFechaCuponCompra()
|
|
|
+ ControlFechaLiquidacionCompra()
|
|
|
+ ControlFechaVencimientoCompra()
|
|
|
+ ControlPorcentajeCuponCompra()
|
|
|
+ 'ControlYTMAlVencimientoCompra()
|
|
|
+ ControlPrecioAlVencimientoCompra()
|
|
|
+ ControlPrecioCompra()
|
|
|
+ ControlAnioBaseCompra()
|
|
|
+ ControlCostosDeTransferencia()
|
|
|
+
|
|
|
+ 'ControlValorNominalv
|
|
|
+ ControlUltimaFechaCuponCompra()
|
|
|
+ ControlSiguienteFechaCuponCompra()
|
|
|
+ ControlFechaLiquidacionCompra()
|
|
|
+ ControlFechaVencimientoCompra()
|
|
|
+ ControlPorcentajeCuponCompra()
|
|
|
+ 'ControlYTMAlVencimientoCompra()
|
|
|
+ ControlPrecioAlVencimientoCompra()
|
|
|
+ ControlPrecioCompra()
|
|
|
+ ControlAnioBaseCompra()
|
|
|
+ ControlCostosDeTransferencia()
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub GuardarNuevoRegistro()
|
|
|
+ Dim res As Integer
|
|
|
+ RefrescarClaseEntidad()
|
|
|
+
|
|
|
+ res = oDAOPrincipal.Nuevo(oCEPrincipal)
|
|
|
+ If res = 1 Then
|
|
|
+ MsgBox("Registro Guardado")
|
|
|
+ Else
|
|
|
+ MsgBox("Algo no salio bien.")
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub ActualizarRegistro()
|
|
|
+ Dim res As Integer
|
|
|
+ RefrescarClaseEntidad()
|
|
|
+
|
|
|
+ ' res = oDAOPrincipal.Actualizar(oCEPrincipal)
|
|
|
+
|
|
|
+ If res = 1 Then
|
|
|
+ MsgBox("Registro Guardado")
|
|
|
+ Else
|
|
|
+ MsgBox("Algo no salio bien.")
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ 'Private Sub ActivarEdicion()
|
|
|
+ ' If TipoTransaccion = "C" Then
|
|
|
+ ' Me.TipoTransaccion = "A"
|
|
|
+ ' Me.btnAceptar.Text = "Guardar"
|
|
|
+ ' End If
|
|
|
+
|
|
|
+ 'End Sub
|
|
|
+ Private Sub ControlPeriodosCompra()
|
|
|
+ Dim valor As String
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ If Me.cboPeriodosC.SelectedIndex = -1 Then
|
|
|
+ valor = ""
|
|
|
+ Else
|
|
|
+ If (String.IsNullOrEmpty(Me.cboPeriodosC.SelectedValue)) Then
|
|
|
+ valor = String.Empty
|
|
|
+ Else
|
|
|
+ valor = Me.cboPeriodosC.SelectedValue
|
|
|
+ End If
|
|
|
+
|
|
|
+ End If
|
|
|
+ oCEPrincipal.PeriodicidadCompra = valor
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Function FechaTipo(ByVal ultimafecha As DateTime, ByVal frecuencia As Integer)
|
|
|
+ Dim periodos As Integer = 0
|
|
|
+ Dim Fecha As Date
|
|
|
+ If frecuencia = 1 Then
|
|
|
+ periodos = 12
|
|
|
+ ElseIf frecuencia = 2 Then
|
|
|
+ periodos = 6
|
|
|
+ ElseIf frecuencia = 4 Then
|
|
|
+ periodos = 3
|
|
|
+ ElseIf frecuencia = 12 Then
|
|
|
+ periodos = 1
|
|
|
+
|
|
|
+ End If
|
|
|
+ Fecha = ultimafecha.AddMonths(periodos)
|
|
|
+
|
|
|
+ Return Fecha
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Sub ControlValorNominalCompra()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlUltimaFechaCuponCompra()
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ Me.oCEPrincipal.UltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value.Date
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlSiguienteFechaCuponCompra()
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ Me.oCEPrincipal.SiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value.Date
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlFechaLiquidacionCompra()
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ Me.oCEPrincipal.FechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value.Date
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlFechaVencimientoCompra()
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ Me.oCEPrincipal.FechaVencimientoCompra = dtpFechaVencimientoCompra.Value.Date
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlPorcentajeCuponCompra()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlAnioBaseCompra()
|
|
|
+ Dim valor As Integer
|
|
|
+ If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
|
|
|
+ valor = cboAnioBaseC.SelectedItem
|
|
|
+ Me.oCEPrincipal.DiasBaseCompra = valor
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalCompra_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalCompra.LostFocus
|
|
|
+ ' ControlValorNominalCompra()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub ControlPrecioAlVencimientoCompra()
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlPrecioCompra()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlCostosDeTransferencia()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ Private Sub txtPorcentajeCuponCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.LostFocus
|
|
|
+ ControlPorcentajeCuponCompra()
|
|
|
+ End Sub
|
|
|
+ Private Sub txtPrecioAlVencimientoCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.LostFocus
|
|
|
+ ControlPrecioAlVencimientoCompra()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioCompra.LostFocus
|
|
|
+ ControlPrecioCompra()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtCostoTransferenciaCompra_LostFocus(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.LostFocus
|
|
|
+ ControlCostosDeTransferencia()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dtpSiguienteFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponVenta.ValueChanged
|
|
|
+ 'ActivarEdicion()
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub txtCostoTransferenciaVenta_TextChanged(sender As Object, e As EventArgs)
|
|
|
+ 'ActivarEdicion()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ 'Private Sub PrepararTablaImpuestosYComisiones()
|
|
|
+ ' Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
|
|
|
+ ' Dim oDataGridViewComboBoxColumn As DataGridViewComboBoxColumn
|
|
|
+
|
|
|
+ ' oDataGridViewComboBoxColumn = New DataGridViewComboBoxColumn
|
|
|
+ ' oDataGridViewComboBoxColumn.Name = "CodImp"
|
|
|
+ ' oDataGridViewComboBoxColumn.HeaderText = "Tipo Impuesto"
|
|
|
+ ' oDataGridViewComboBoxColumn.DataSource = oDAOGeneral.ListaTiposImpuesto
|
|
|
+ ' oDataGridViewComboBoxColumn.ValueMember = "Codigo"
|
|
|
+ ' oDataGridViewComboBoxColumn.DisplayMember = "Descripcion"
|
|
|
+ ' oDataGridViewComboBoxColumn.DataPropertyName = "CodImp"
|
|
|
+ ' oDataGridViewComboBoxColumn.DisplayIndex = 0
|
|
|
+ ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewComboBoxColumn)
|
|
|
+
|
|
|
+ ' oDataGridViewComboBoxColumn = New DataGridViewComboBoxColumn
|
|
|
+ ' oDataGridViewComboBoxColumn.Name = "TipoOper"
|
|
|
+ ' oDataGridViewComboBoxColumn.HeaderText = "Tipo Operación"
|
|
|
+ ' oDataGridViewComboBoxColumn.DataSource = oDAOGeneral.ListaTipoOperacion
|
|
|
+ ' oDataGridViewComboBoxColumn.ValueMember = "Codigo"
|
|
|
+ ' oDataGridViewComboBoxColumn.DisplayMember = "Descripcion"
|
|
|
+ ' oDataGridViewComboBoxColumn.DataPropertyName = "TipoOper"
|
|
|
+ ' oDataGridViewComboBoxColumn.DisplayIndex = 1
|
|
|
+ ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewComboBoxColumn)
|
|
|
+
|
|
|
+ ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ ' oDataGridViewTextBoxColumn.Name = "PorcImp"
|
|
|
+ ' oDataGridViewTextBoxColumn.HeaderText = "Porcentaje"
|
|
|
+ ' oDataGridViewTextBoxColumn.DataPropertyName = "PorcImp"
|
|
|
+ ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTPorcentaje
|
|
|
+ ' oDataGridViewTextBoxColumn.DisplayIndex = 2
|
|
|
+ ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ ' oDataGridViewTextBoxColumn.Name = "MontoSujeto"
|
|
|
+ ' oDataGridViewTextBoxColumn.HeaderText = "Monto Sujeto"
|
|
|
+ ' oDataGridViewTextBoxColumn.DataPropertyName = "MontoSujeto"
|
|
|
+ ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
|
|
|
+ ' oDataGridViewTextBoxColumn.ReadOnly = True
|
|
|
+ ' oDataGridViewTextBoxColumn.DisplayIndex = 3
|
|
|
+ ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ ' oDataGridViewTextBoxColumn.Name = "MontoImp"
|
|
|
+ ' oDataGridViewTextBoxColumn.HeaderText = "Monto Impuesto"
|
|
|
+ ' oDataGridViewTextBoxColumn.DataPropertyName = "MontoImp"
|
|
|
+ ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ ' oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
|
|
|
+ ' oDataGridViewTextBoxColumn.DisplayIndex = 4
|
|
|
+ ' oDataGridViewTextBoxColumn.ReadOnly = True
|
|
|
+ ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ ' oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ ' oDataGridViewTextBoxColumn.Name = "CodInv"
|
|
|
+ ' oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
|
|
|
+ ' oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ ' oDataGridViewTextBoxColumn.Visible = False
|
|
|
+ ' Me.dgvImpuestosYComisiones.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ ' Me.dgvImpuestosYComisiones.DataSource = oCEPrincipal.ImpuestosYComisiones
|
|
|
+ 'End Sub
|
|
|
+ 'Private Sub PrepararImpuestosYComisiones(ByVal IdFila As Integer)
|
|
|
+ ' Dim vFila As DataGridViewRow = dgvImpuestosYComisiones.Rows(IdFila)
|
|
|
+ ' If vFila.IsNewRow Then
|
|
|
+ ' vFila.Cells("TipoOper").Value = "V"
|
|
|
+ ' vFila.Cells("PorcImp").Value = 0
|
|
|
+ ' vFila.Cells("MontoSujeto").Value = oCEPrincipal.ValorTransadoVenta
|
|
|
+ ' vFila.Cells("MontoImp").Value = 0.00
|
|
|
+ ' End If
|
|
|
+ 'End Sub
|
|
|
+
|
|
|
+ Private Sub dgvImpuestosYComisiones_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
|
|
|
+ 'ActivarEdicion()
|
|
|
+ 'PrepararImpuestosYComisiones(e.RowIndex)
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvImpuestosYComisiones_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellContentClick
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvImpuestosYComisiones_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs)
|
|
|
+ 'ActivarEdicion()
|
|
|
+ oCEPrincipal.ImpuestosYComisiones.AcceptChanges()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub PrepararTablaIngresos()
|
|
|
+
|
|
|
+ Dim CantidadColumnas As Integer = dgvIngresos.ColumnCount
|
|
|
+ If CantidadColumnas = 0 Then
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "CodInv"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "Código Inversión"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(String)
|
|
|
+ oDataGridViewTextBoxColumn.Visible = False
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "NumCupon"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "NumCupon"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
|
|
|
+ oDataGridViewTextBoxColumn.Visible = False
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "Correlativo"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "Correlativo"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "FechaCupon"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "FechaCupon"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "Fecha Cupón"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Date)
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "Dias"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "Dias"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "Dias "
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "Ingreso"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "Ingreso"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "Ingreso"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "PorcentajeImpuesto"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "PorcImpuesto"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "% Impuesto"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(String)
|
|
|
+ oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "MontoImpuesto"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "MontoImpuesto"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "Impuesto"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+
|
|
|
+ oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
|
|
|
+ oDataGridViewTextBoxColumn.Name = "Liquido"
|
|
|
+ oDataGridViewTextBoxColumn.DataPropertyName = "Liquido"
|
|
|
+ oDataGridViewTextBoxColumn.HeaderText = "Liquido"
|
|
|
+ oDataGridViewTextBoxColumn.ValueType = GetType(Double)
|
|
|
+ oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
|
|
|
+ Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalVenta_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalVenta.LostFocus
|
|
|
+ ControlValorNominalVenta()
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlValorNominalVenta()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.LostFocus
|
|
|
+ ControlPorcentajeCuponVenta()
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlPorcentajeCuponVenta()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.LostFocus
|
|
|
+ ControlPrecioAlVencimientoVenta()
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlPrecioAlVencimientoVenta()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioVenta.LostFocus
|
|
|
+ ControlPrecioVenta()
|
|
|
+ End Sub
|
|
|
+ Private Sub ControlPrecioVenta()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvIngresos.CellBeginEdit
|
|
|
+ 'ActivarEdicion()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellEndEdit
|
|
|
+ Dim Tabla As String = Instrumento()
|
|
|
+
|
|
|
+ If Not Tabla = "TIT" Then
|
|
|
+
|
|
|
+ CalculoIngresosBONO()
|
|
|
+ End If
|
|
|
+
|
|
|
+ 'Calculos()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvIngresos.UserDeletedRow
|
|
|
+ 'ActivarEdicion()
|
|
|
+ oCEPrincipal.Ingresos.AcceptChanges()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominal_Op_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub LLenarResultadosOperacion()
|
|
|
+
|
|
|
+ Dim FechaCompra = dtpFechaLiquidacionCompra.Value
|
|
|
+ Dim FechaVenta = dtpFechaLiquidacionVenta.Value
|
|
|
+ Dim Dias As Integer = Operaciones.Dias(FechaCompra, FechaVenta, IndexBaseC)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ txtValorNominal_Op.Text = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
|
|
|
+ txtPlazo_Op.Text = Operaciones.ConvertirDecimal(PlazoOperacion().ToString)
|
|
|
+ txtPrecioCompra_Op.Text = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
|
|
|
+ txtPrecioVenta_Op.Text = Operaciones.ConvertirDecimal(txtPrecioVenta.Text.ToString)
|
|
|
+ txtGananciaPerdidaCapital_Op.Text = Operaciones.ConvertirDecimal(GananciaPerdida().ToString)
|
|
|
+ txtIngresosPorIntereses_Op.Text = Operaciones.ConvertirDecimal(IngresosInteres().ToString)
|
|
|
+ txtCostosTotales_Op.Text = Operaciones.ConvertirDecimal(CostosTotales().ToString)
|
|
|
+ txtGananciaPerdidaTotal_Op.Text = Operaciones.ConvertirDecimal(MontoGananciaPerdida().ToString)
|
|
|
+ txtRendimientoGananciaPerdida_Op.Text = Operaciones.ConvertirDecimal(RendimientoGananciaPerdida(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
|
|
|
+ txtRendimientoIntereses_Op.Text = Operaciones.ConvertirDecimal(RendimientoInteres(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
|
|
|
+ txtRendimientoAntesISR_Op.Text = Operaciones.ConvertirDecimal(RendimientoNeto(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
|
|
|
+ txtRendimientoDespuesISR_Op.Text = Operaciones.ConvertirDecimal(RendimientoNetoDespues(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Function PlazoOperacion()
|
|
|
+ Dim FechaVenta As Date = dtpFechaLiquidacionVenta.Value
|
|
|
+ Dim FechaCompra As Date = dtpFechaLiquidacionCompra.Value
|
|
|
+ Dim Dias = Operaciones.Dias(FechaCompra, FechaVenta, IndexBaseC)
|
|
|
+ Return Dias
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function GananciaPerdida()
|
|
|
+ Dim ValorTrasadoVenta = txtValorTransadoVenta.Text
|
|
|
+ Dim ValorTrasadoCompra = txtValorTransadoCompra.Text
|
|
|
+
|
|
|
+ Dim Total = ValorTrasadoVenta - ValorTrasadoCompra
|
|
|
+ Return Total
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function IngresosInteres()
|
|
|
+ Dim Registros = dgvIngresos.Rows.Count
|
|
|
+ Dim Suma As Double = 0.0
|
|
|
+ Registros = Registros - 2
|
|
|
+ For i As Integer = 0 To Registros
|
|
|
+
|
|
|
+ Suma = Suma + Double.Parse(dgvIngresos.Item(4, i).Value)
|
|
|
+ Next
|
|
|
+ Dim InteresAcumulado = txtInteresAcumuladoVenta.Text
|
|
|
+ Return (Suma + InteresAcumulado)
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function CostosTotales()
|
|
|
+ Dim ComisionCompraCasa = txtComisionCompraCasa.Text
|
|
|
+ Dim ComisionVentaCasa = txtComisionVentaCasa.Text
|
|
|
+
|
|
|
+ Dim ComisionCompraBolsa = txtComisionCompraBolsa.Text
|
|
|
+ Dim ComisionVentaBolsa = txtComisionVentaBolsa.Text
|
|
|
+ Dim CostoTransferenciaCompra = txtCostoTransferenciaCompra.Text
|
|
|
+ If (Double.TryParse(ComisionCompraCasa, Nothing) And Double.TryParse(ComisionCompraBolsa, Nothing) And Double.TryParse(CostoTransferenciaCompra, Nothing) And Double.TryParse(ComisionCompraBolsa, Nothing) And Double.TryParse(ComisionVentaBolsa, Nothing)) Then
|
|
|
+ Dim Total = (CDec(ComisionCompraCasa) + CDec(ComisionCompraBolsa) + CDec(CostoTransferenciaCompra) + CDec(ComisionVentaCasa) + CDec(ComisionVentaBolsa)) * -1
|
|
|
+
|
|
|
+ Return Total
|
|
|
+ End If
|
|
|
+ Return "0"
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function MontoGananciaPerdida()
|
|
|
+ Dim GananciaPerdida = txtGananciaPerdidaCapital_Op.Text
|
|
|
+ Dim CostosTotales = txtCostosTotales_Op.Text
|
|
|
+ Dim IngresoInteres = txtIngresosPorIntereses_Op.Text
|
|
|
+
|
|
|
+ Dim Total = CDec(GananciaPerdida) + CDec(CostosTotales) + txtIngresosPorIntereses_Op.Text
|
|
|
+
|
|
|
+ Return Total
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function RendimientoGananciaPerdida(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
|
|
|
+ Dim GananciaCapital = txtGananciaPerdidaCapital_Op.Text
|
|
|
+ Dim ValorNominal = txtValorNominal_Op.Text
|
|
|
+ Dim Valor As Double = 0
|
|
|
+
|
|
|
+ If (IndexBase = 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 360 / Dias
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+ 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 = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = GananciaCapital / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = GananciaCapital / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = GananciaCapital / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function RendimientoInteres(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
|
|
|
+ Dim IngresosInteres = txtIngresosPorIntereses_Op.Text
|
|
|
+ Dim ValorNominal = txtValorNominal_Op.Text
|
|
|
+
|
|
|
+ Dim Valor As Double = 0
|
|
|
+
|
|
|
+ If (IndexBase = 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 360 / Dias
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+ 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 = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = IngresosInteres / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = IngresosInteres / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = IngresosInteres / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Private Function RendimientoNeto(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
|
|
|
+ Dim MontoGananciaPerdidaTotal = txtGananciaPerdidaTotal_Op.Text
|
|
|
+ Dim ValorNominal = txtValorNominal_Op.Text
|
|
|
+
|
|
|
+ Dim Valor As Double = 0
|
|
|
+
|
|
|
+ If (IndexBase = 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / Dias
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+ 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 = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Private Function Recibido()
|
|
|
+ Dim Registros = dgvIngresos.Rows.Count
|
|
|
+ Dim Suma As Double = 0.0
|
|
|
+ Registros = Registros - 1
|
|
|
+ For i As Integer = 0 To Registros
|
|
|
+
|
|
|
+ If (Not String.IsNullOrEmpty(dgvIngresos.Rows(i).Cells("Ingreso").Value)) Then
|
|
|
+ Suma = Suma + Double.Parse(dgvIngresos.Rows(i).Cells("Ingreso").Value)
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ Next
|
|
|
+ Return Suma
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Private Function RendimientoNetoDespues(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
|
|
|
+ Dim Registros = dgvIngresos.Rows.Count
|
|
|
+ Dim Suma As Double = 0.0
|
|
|
+ Registros = Registros - 1
|
|
|
+ For i As Integer = 0 To Registros
|
|
|
+
|
|
|
+ If (Not String.IsNullOrEmpty(dgvIngresos.Rows(i).Cells("MontoImpuesto").Value)) Then
|
|
|
+ Suma = Suma + Double.Parse(dgvIngresos.Rows(i).Cells("MontoImpuesto").Value)
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ Next
|
|
|
+ Dim MontoGananciaTotal = txtGananciaPerdidaTotal_Op.Text
|
|
|
+ Dim Impuesto = Suma
|
|
|
+ Dim ValorNominal = txtValorNominal_Op.Text
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim Valor As Double = 0
|
|
|
+
|
|
|
+ If (IndexBase = 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / Dias
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+ 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasSegundaFecha
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasPrimeraFecha
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return (Valor * 100).ToString() + "%"
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub TabPage4_Click(sender As Object, e As EventArgs) Handles TabPage4.Click
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Function CalcularIngreso(ByVal ValorNominal As Double, ByVal Cupon As Double, ByVal Dias As Integer)
|
|
|
+ Dim Base As Integer = 365
|
|
|
+ Dim Calculo = ValorNominal * Cupon * Dias / Base
|
|
|
+ Return Calculo
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub TabPage2_Click(sender As Object, e As EventArgs) Handles TbIngresos.Click
|
|
|
+ If (dgvIngresos.Rows.Count > 1) Then
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
|
|
|
+ TipoTransaccion = "M"
|
|
|
+ btnAceptar.Text = "Modificar"
|
|
|
+
|
|
|
+ 'btnAccionComisiones.Text = "Modificar"
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
|
|
|
+ TipoTransaccion = "N"
|
|
|
+ btnAceptar.Text = "Nuevo"
|
|
|
+
|
|
|
+ 'btnAccionComisiones.Text = "Nuevo"
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
|
|
|
+ TipoTransaccion = "B"
|
|
|
+ btnAceptar.Text = "Eliminar"
|
|
|
+
|
|
|
+ 'btnAccionComisiones.Text = "Eliminar"
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeInteresAcumuladoVenta_TextChanged(sender As Object, e As EventArgs)
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoComisionCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoComisionCompra.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalVenta.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalCompra.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioSucioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioCompra.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub Button1_Click(sender As Object, e As EventArgs)
|
|
|
+ RefrescarValorControles()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub btnAccionIngreso_Click(sender As Object, e As EventArgs)
|
|
|
+ 'If (TipoTransaccion = "N") Then
|
|
|
+ ' NuevoIngreso(False, 0)
|
|
|
+ 'ElseIf (TipoTransaccion = "M") Then
|
|
|
+ ' ModificarIngreso()
|
|
|
+ 'ElseIf (TipoTransaccion = "B") Then
|
|
|
+ ' EliminarIngreso()
|
|
|
+ 'End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub TabControl1_TabIndexChanged(sender As Object, e As EventArgs) Handles TabCampos.TabIndexChanged
|
|
|
+
|
|
|
+ Formato()
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellClick
|
|
|
+ Index = e.RowIndex
|
|
|
+ PrepararCalculos()
|
|
|
+ Formato()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtDiasAcumuladosCompra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosCompra.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabCampos.SelectedIndexChanged
|
|
|
+ ValidacionErrores()
|
|
|
+ BotonQuitar()
|
|
|
+ If (dgvIngresos.Rows.Count < 2) Then
|
|
|
+
|
|
|
+ End If
|
|
|
+ If (TabCampos.SelectedIndex = 2) Or (TabCampos.SelectedIndex = 1) Then
|
|
|
+ LLenarResultadosOperacion()
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dtpUltimaFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponVenta.ValueChanged
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionVenta.ValueChanged
|
|
|
+ Formato()
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub btnAmortizacion_Click(sender As Object, e As EventArgs)
|
|
|
+ frmResultadoTitularizacion.Show()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'Function ColecccionComisiones()
|
|
|
+ ' Dim coleccion As New Collection
|
|
|
+ ' Dim TipoImp, TipOp, CodImp, PorcImp, MontoImp As String
|
|
|
+ ' TipoImp = dgvImpuestosYComisiones.CurrentRow.Cells("NumCupon").Value
|
|
|
+ ' TipOp = dgvImpuestosYComisiones.CurrentRow.Cells(1).Value
|
|
|
+ ' CodImp = dgvImpuestosYComisiones.CurrentRow.Cells(2).Value
|
|
|
+ ' PorcImp = CDec(dgvImpuestosYComisiones.CurrentRow.Cells(3).Value.ToString.TrimEnd("%") / 100)
|
|
|
+ ' MontoImp = dgvImpuestosYComisiones.CurrentRow.Cells(4).Value.ToString.TrimEnd("%")
|
|
|
+
|
|
|
+ ' coleccion.Add(TipoImp)
|
|
|
+ ' coleccion.Add(TipOp)
|
|
|
+ ' coleccion.Add(CodImp)
|
|
|
+ ' coleccion.Add(PorcImp)
|
|
|
+ ' coleccion.Add(MontoImp)
|
|
|
+ ' Return coleccion
|
|
|
+ 'End Function
|
|
|
+
|
|
|
+
|
|
|
+ Function ColeccionIngresos(ByRef index As Integer)
|
|
|
+ Dim coleccion As New Collection
|
|
|
+
|
|
|
+
|
|
|
+ Dim NoCupon, Fecha, Ingreso, PorcImpuesto, Impuesto, Dias, Liquido As String
|
|
|
+ NoCupon = dgvIngresos.Rows(index).Cells("NumCupon").Value
|
|
|
+ Fecha = dgvIngresos.Rows(index).Cells("FechaCupon").Value
|
|
|
+ Dias = dgvIngresos.Rows(index).Cells("Dias").Value
|
|
|
+ Ingreso = dgvIngresos.Rows(index).Cells("Ingreso").Value
|
|
|
+
|
|
|
+ PorcImpuesto = dgvIngresos.Rows(index).Cells("PorcentajeImpuesto").Value
|
|
|
+ If Not PorcImpuesto Is Nothing Then
|
|
|
+ PorcImpuesto = CDec((PorcImpuesto.ToString().Trim("%")) / 100)
|
|
|
+ End If
|
|
|
+ Impuesto = dgvIngresos.Rows(index).Cells("MontoImpuesto").Value
|
|
|
+ Liquido = dgvIngresos.Rows(index).Cells("Liquido").Value
|
|
|
+ coleccion.Add(NoCupon)
|
|
|
+ coleccion.Add(Fecha)
|
|
|
+ coleccion.Add(Dias)
|
|
|
+ coleccion.Add(Ingreso)
|
|
|
+ coleccion.Add(PorcImpuesto)
|
|
|
+ coleccion.Add(Impuesto)
|
|
|
+ coleccion.Add(Liquido)
|
|
|
+ Return coleccion
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'Sub NuevaComision()
|
|
|
+ ' Dim coleccion = ColecccionComisiones()
|
|
|
+ ' BonosConsulta.NuevoImpuesto(coleccion, Codigo)
|
|
|
+ 'End Sub
|
|
|
+
|
|
|
+ Sub NuevoIngreso(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer)
|
|
|
+ Dim i As Integer = 0
|
|
|
+
|
|
|
+ Dim Index = dgvIngresos.Rows.Count - 2
|
|
|
+
|
|
|
+ i = Cantidad
|
|
|
+ While i <= Index
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim coleccion = ColeccionIngresos(i)
|
|
|
+ If (BonosConsulta.NuevoIngreso(coleccion, Codigo, Instrumento) Is Nothing) Then
|
|
|
+
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ i += 1
|
|
|
+ End While
|
|
|
+ MsgBox("Registro de ingresos actualizados")
|
|
|
+
|
|
|
+ End Sub
|
|
|
+ 'Sub ModificarComision()
|
|
|
+ ' Dim coleccion = ColecccionComisiones()
|
|
|
+ ' BonosConsulta.ModificarImpuesto(coleccion, Codigo)
|
|
|
+ 'End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Function Instrumento()
|
|
|
+ Dim codigo As String = Variables.Codigo
|
|
|
+ Dim Tabla As String = String.Empty
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If codigo.IndexOf("TIT") > -1 Then
|
|
|
+ Tabla = "TIT"
|
|
|
+ ElseIf codigo.IndexOf("EURB") > -1 Then
|
|
|
+ Tabla = "EURB"
|
|
|
+ ElseIf codigo.IndexOf("BONO") > -1 Then
|
|
|
+ Tabla = "BONO"
|
|
|
+
|
|
|
+ ElseIf codigo.IndexOf("CINV") > -1 Then
|
|
|
+ Tabla = "CINV"
|
|
|
+
|
|
|
+ End If
|
|
|
+ Return Tabla
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Function CanRegistros()
|
|
|
+ Dim Tabla As String = String.Empty
|
|
|
+ Dim Ins As String = Instrumento()
|
|
|
+ If (Ins = "TIT") Then
|
|
|
+ Tabla = "TIT0_0"
|
|
|
+ ElseIf (Ins = "EURB") Then
|
|
|
+ Tabla = "EURB1"
|
|
|
+ ElseIf (Ins = "BONO") Then
|
|
|
+ Tabla = "BON1"
|
|
|
+
|
|
|
+ ElseIf (Ins = "CINV") Then
|
|
|
+ Tabla = "CIN1"
|
|
|
+
|
|
|
+ End If
|
|
|
+ Dim Codigo = Variables.Codigo
|
|
|
+ Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
|
|
|
+
|
|
|
+ Return Cantidad
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Function ModificarIngreso()
|
|
|
+ Dim i As Integer = 0
|
|
|
+ Dim Cantidad As Integer = dgvIngresos.Rows.Count - 2
|
|
|
+ Dim Diccionario As New Dictionary(Of Integer, Collection)
|
|
|
+ While i <= Cantidad
|
|
|
+
|
|
|
+
|
|
|
+ Dim coleccion = ColeccionIngresos(i)
|
|
|
+ Diccionario.Add(i, coleccion)
|
|
|
+ i += 1
|
|
|
+ End While
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Return Diccionario
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Sub EliminarComision()
|
|
|
+ BonosConsulta.EliminarImpuesto(Codigo)
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub EliminarIngreso()
|
|
|
+
|
|
|
+
|
|
|
+ BonosConsulta.EliminarIngresoCompleto(Codigo, Instrumento)
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ 'Private Sub btnAccionComisiones_Click(sender As Object, e As EventArgs)
|
|
|
+ ' 'If (TipoTransaccion = "N") Then
|
|
|
+ ' ' NuevaComision()
|
|
|
+ ' 'ElseIf (TipoTransaccion = "M") Then
|
|
|
+ ' ' ModificarComision()
|
|
|
+ ' ElseIf (TipoTransaccion = "B") Then
|
|
|
+ ' EliminarComision()
|
|
|
+ ' End If
|
|
|
+ 'End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'Sub CargarComisiones()
|
|
|
+
|
|
|
+ ' Dim codigo As String = Variables.Codigo
|
|
|
+ ' Dim dr = BonosConsulta.CargarImpuestos(codigo)
|
|
|
+ ' While dr.Read
|
|
|
+ ' dgvImpuestosYComisiones.Rows.Add(dr("TipoImp"), dr("TipoOp"), dr("CodImp"), dr("PorcImp"), dr("MontoImp"))
|
|
|
+ ' End While
|
|
|
+
|
|
|
+
|
|
|
+ 'End Sub
|
|
|
+
|
|
|
+ Sub CargarIngresos()
|
|
|
+
|
|
|
+ Dim codigo As String = Variables.Codigo
|
|
|
+
|
|
|
+ Dim dr = BonosConsulta.CargarIngreso(codigo, Instrumento)
|
|
|
+
|
|
|
+ While dr.Read
|
|
|
+ Dim Porc = dr("PorcImpuesto")
|
|
|
+ If String.IsNullOrEmpty(Porc.ToString) Then
|
|
|
+ Porc = "0.0%"
|
|
|
+ Else
|
|
|
+ Porc = (Porc * 100).ToString + "%"
|
|
|
+ End If
|
|
|
+ dgvIngresos.Rows.Add("", dr("NumCupon"), "", dr("FechaCupon"), dr("Dias"), dr("Ingreso"), Porc, dr("MontoImpuesto"), dr("Liquido"))
|
|
|
+ End While
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorCompraCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorCompraCasa.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorBolsaCompra.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorVentaCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorVentaCasa.TextChanged
|
|
|
+
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorBolsaVenta.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ ValidacionErrores()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtMontoARecibir_TextChanged(sender As Object, e As EventArgs) Handles txtMontoARecibir.TextChanged
|
|
|
+
|
|
|
+ Calculos()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtCostosTotales_Op_TextChanged(sender As Object, e As EventArgs) Handles txtCostosTotales_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtRendimientoDespuesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoDespuesISR_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioSucioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioVenta.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtGananciaPerdidaCapital_Op_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaPerdidaCapital_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtValorNominalCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtValorNominalCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtValorNominalCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalVenta.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtValorNominalVenta.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtValorNominalVenta.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtValorNominalVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtPorcentajeCuponCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtPorcentajeCuponCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponVenta.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtPorcentajeCuponVenta.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtPorcentajeCuponVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtYTMAlVencimientoCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtYTMAlVencimientoCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtYTMAlVencimientoCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtYTMAlVencimientoVenta.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtYTMAlVencimientoVenta.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtYTMAlVencimientoVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtPrecioAlVencimientoCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtPrecioAlVencimientoCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoVenta.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtPrecioAlVencimientoVenta.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtPrecioAlVencimientoVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtPrecioCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtPrecioCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtPrecioCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioVenta.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtPrecioVenta.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtPrecioVenta.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtPrecioVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorCompraCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorCompraCasa.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorCompraCasa.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtComisionPorCompraCasa.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtComisionPorCompraCasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorVentaCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorVentaCasa.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorVentaCasa.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtComisionPorVentaCasa.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtComisionPorVentaCasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorBolsaCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtComisionPorBolsaCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtComisionPorBolsaCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorBolsaVenta.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtComisionPorBolsaVenta.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtComisionPorBolsaVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtCostoTransferenciaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCostoTransferenciaCompra.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtCostoTransferenciaCompra.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtCostoTransferenciaCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtMontoARecibir_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMontoARecibir.KeyPress
|
|
|
+ If String.IsNullOrEmpty(txtMontoARecibir.Text) Then
|
|
|
+ If e.KeyChar = "." Then
|
|
|
+ txtMontoARecibir.Text = "0"
|
|
|
+ Exit Sub
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (Not txtMontoARecibir.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
|
|
|
+ Operaciones.ValidarEntrada(sender, e, True)
|
|
|
+
|
|
|
+ Else
|
|
|
+
|
|
|
+ Operaciones.ValidarEntrada(sender, e, False)
|
|
|
+
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioCompra_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioVenta_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumuladoCompra.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub AsignacionPeriodicidad()
|
|
|
+ Dim Periodicidad As String = cboPeriodosC.SelectedValue
|
|
|
+
|
|
|
+ If (Periodicidad = "M") Then
|
|
|
+ TipoPeriodicidad = 1
|
|
|
+ ElseIf (Periodicidad = "T") Then
|
|
|
+ TipoPeriodicidad = 3
|
|
|
+ ElseIf (Periodicidad = "S") Then
|
|
|
+ TipoPeriodicidad = 6
|
|
|
+ ElseIf (Periodicidad = "A") Then
|
|
|
+ TipoPeriodicidad = 12
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub PrepararCalculos()
|
|
|
+
|
|
|
+ AsignacionPeriodicidad()
|
|
|
+ Dim Index = dgvIngresos.CurrentRow.Index
|
|
|
+ Dim IndexAnterior = Index - 1
|
|
|
+ Dim Respaldo As String = Format(dtpSiguienteFechaCuponCompra.Value, "dd/MM/yyyy")
|
|
|
+ Dim FechaSig = CDate(Respaldo)
|
|
|
+ Dim Fechaliq = dtpFechaLiquidacionCompra.Value
|
|
|
+ Dim FechaCupon, Dias, Ingreso, PorcentajeImpuesto, MontoImpuesto, Liquido
|
|
|
+
|
|
|
+ FechaCupon = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
|
|
|
+ Dias = dgvIngresos.Rows(Index).Cells("Dias").Value
|
|
|
+ Ingreso = dgvIngresos.Rows(Index).Cells("Ingreso").Value
|
|
|
+ PorcentajeImpuesto = dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value
|
|
|
+ If (Not PorcentajeImpuesto Is Nothing) Then
|
|
|
+ PorcentajeImpuesto = CDec(PorcentajeImpuesto.ToString.Trim("%")) / 100
|
|
|
+ Else
|
|
|
+ PorcentajeImpuesto = "0.0%"
|
|
|
+ End If
|
|
|
+ MontoImpuesto = dgvIngresos.Rows(Index).Cells("MontoImpuesto").Value
|
|
|
+ Liquido = dgvIngresos.Rows(Index).Cells("Liquido").Value
|
|
|
+ If (String.IsNullOrEmpty(FechaCupon)) Then
|
|
|
+ If (Index = 0) Then
|
|
|
+ FechaCupon = FechaSig
|
|
|
+ Else
|
|
|
+ Dim FechaAnterior As Date = dgvIngresos.Rows(IndexAnterior).Cells("FechaCupon").Value
|
|
|
+ FechaCupon = Operaciones.Meses(TipoPeriodicidad, FechaAnterior, FechaSig)
|
|
|
+ End If
|
|
|
+ dgvIngresos.Rows(Index).Cells("FechaCupon").Value = FechaCupon
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(Dias)) Then
|
|
|
+ Dim Dia As Integer = 0
|
|
|
+ If (Index = 0) Then
|
|
|
+
|
|
|
+ Dia = Operaciones.DiasAcumulados(Fechaliq, FechaSig, IndexBaseC)
|
|
|
+ Else
|
|
|
+ Dim DiaAnterior As Date = dgvIngresos.Rows(IndexAnterior).Cells("FechaCupon").Value
|
|
|
+ Dim DiaActual = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
|
|
|
+ Dia = Operaciones.DiasAcumulados(DiaAnterior, DiaActual, IndexBaseC)
|
|
|
+ End If
|
|
|
+ dgvIngresos.Rows(Index).Cells("Dias").Value = Dia
|
|
|
+ End If
|
|
|
+ If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("NumCupon").Value)) Then
|
|
|
+ dgvIngresos.Rows(Index).Cells("NumCupon").Value = Correlativo()
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(Ingreso)) Then
|
|
|
+ dgvIngresos.Rows(Index).Cells("Ingreso").Value = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If (Index = 0) Then
|
|
|
+ If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value)) Then
|
|
|
+
|
|
|
+
|
|
|
+ dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = "0.0%"
|
|
|
+ End If
|
|
|
+ Else
|
|
|
+ dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = dgvIngresos.Rows(IndexAnterior).Cells("PorcentajeImpuesto").Value
|
|
|
+ End If
|
|
|
+ If dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString.IndexOf("%") = -1 Then
|
|
|
+ dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString + "%"
|
|
|
+ End If
|
|
|
+ If (String.IsNullOrEmpty(MontoImpuesto)) Then
|
|
|
+ dgvIngresos.Rows(Index).Cells("MontoImpuesto").Value = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+ If (String.IsNullOrEmpty(Liquido)) Then
|
|
|
+ dgvIngresos.Rows(Index).Cells("Liquido").Value = 0
|
|
|
+ End If
|
|
|
+ CorrelativoSinBD()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Function Correlativo()
|
|
|
+ Dim Index As Integer = 0
|
|
|
+ Dim IndexCantidad As Integer = dgvIngresos.Rows.Count - 2
|
|
|
+ Dim NumeroMayor As Integer = 0
|
|
|
+ While Index <= IndexCantidad
|
|
|
+ Dim Numero As Integer = dgvIngresos.Rows(Index).Cells("NumCupon").Value
|
|
|
+ If Numero > NumeroMayor Then
|
|
|
+ NumeroMayor = Numero
|
|
|
+ End If
|
|
|
+ Index += 1
|
|
|
+ End While
|
|
|
+ Return NumeroMayor + 1
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Sub CorrelativoSinBD()
|
|
|
+ Dim Index As Integer = 0
|
|
|
+ Dim IndexCantidad As Integer = dgvIngresos.Rows.Count - 2
|
|
|
+ Dim NumeroMayor As Integer = 0
|
|
|
+ While Index <= IndexCantidad
|
|
|
+
|
|
|
+ dgvIngresos.Rows(Index).Cells("Correlativo").Value = Index + 1
|
|
|
+ Index += 1
|
|
|
+
|
|
|
+ End While
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Function PeriodoGracia()
|
|
|
+ Dim FechaEmision As Date = Variables.FechaEmisionTIT
|
|
|
+ Dim FechaPeriodoGracia As Date = FechaEmision
|
|
|
+ Dim CantidadPeriodoGracia As Integer = 0
|
|
|
+ Dim TipoPeriodoGracia As String = Variables.TipoPeriodoGracia
|
|
|
+ Dim CantidadPeriodo As String = Variables.CantidadPeriodo
|
|
|
+
|
|
|
+ If String.IsNullOrEmpty(CantidadPeriodo) Or CantidadPeriodo = "0" Then
|
|
|
+
|
|
|
+ Return False
|
|
|
+
|
|
|
+ Else
|
|
|
+ CantidadPeriodoGracia = CantidadPeriodo
|
|
|
+ End If
|
|
|
+
|
|
|
+ If TipoPeriodoGracia = "D" Or TipoPeriodoGracia = "M" Or TipoPeriodoGracia = "A" Then
|
|
|
+ If TipoPeriodoGracia = "D" Then
|
|
|
+ FechaPeriodoGracia = FechaEmision.AddDays(CantidadPeriodoGracia)
|
|
|
+ ElseIf TipoPeriodoGracia = "M" Then
|
|
|
+ FechaPeriodoGracia = FechaEmision.AddMonths(CantidadPeriodoGracia)
|
|
|
+ Else
|
|
|
+ FechaPeriodoGracia = FechaEmision.AddYears(CantidadPeriodoGracia)
|
|
|
+ End If
|
|
|
+ Return FechaPeriodoGracia
|
|
|
+ Else
|
|
|
+ Return False
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Function IngresosIntereses(ByVal ValorNominal As Double, ByVal PorcCupon As Double, ByVal Dias As Integer, ByVal Fecha1 As Date, Fecha2 As Date, ByVal IndexBase As Integer)
|
|
|
+ Dim Valor As Double = 0
|
|
|
+
|
|
|
+ If (IndexBase = 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 366
|
|
|
+ PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 366
|
|
|
+ PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 360
|
|
|
+ PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 360
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 360
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorNominal * PorcCupon * DiasPrimeraFecha / 360
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return Valor
|
|
|
+
|
|
|
+ End If
|
|
|
+ Return Valor
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Function IngresosInteresesTIT(ByVal ValorSaldo As Double, ByVal PorcCupon As Double, ByVal Dias As Integer, ByVal PrimerosDias As Integer, ByVal RestantesDias As Integer, ByVal IndexBase As Integer)
|
|
|
+ Dim Valor As Double = 0
|
|
|
+ Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
|
|
|
+ DiasPrimeraFecha = PrimerosDias
|
|
|
+ DiasSegundaFecha = RestantesDias
|
|
|
+
|
|
|
+ If (IndexBase = 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * Dias / 360
|
|
|
+ Return Valor
|
|
|
+ ElseIf (IndexBase = 1) Then
|
|
|
+ Dim PrOpc1 = 0.0, PrOpc2 = 0.0
|
|
|
+
|
|
|
+
|
|
|
+ If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
|
|
|
+ PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return Valor
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ElseIf (IndexBase = 2) Then
|
|
|
+ Dim PrOpc1 = 0.0, PrOpc2 = 0.0
|
|
|
+
|
|
|
+ If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
|
|
|
+ PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return Valor
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Else
|
|
|
+ Dim PrOpc1 = 0.0, PrOpc2 = 0.0
|
|
|
+
|
|
|
+ If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 360
|
|
|
+ PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 360
|
|
|
+ Valor = PrOpc1 + PrOpc2
|
|
|
+ ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 360
|
|
|
+ ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
|
|
|
+ Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 360
|
|
|
+ Else
|
|
|
+ Valor = 0
|
|
|
+ End If
|
|
|
+ Return Valor
|
|
|
+
|
|
|
+ End If
|
|
|
+ Return Valor
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Function Impuestos(ByVal Ingresos As Double, PorcentajeRenta As Double)
|
|
|
+ Dim Total As Double
|
|
|
+ Total = Ingresos * PorcentajeRenta
|
|
|
+ Return Total
|
|
|
+ End Function
|
|
|
+
|
|
|
+
|
|
|
+ Function Liquido(ByVal Ingreso As Double, ByVal Renta As Double)
|
|
|
+ Dim Total As Double
|
|
|
+ Total = Ingreso - Renta
|
|
|
+ Return Total
|
|
|
+ End Function
|
|
|
+
|
|
|
+ Sub CalculoIngresosBONO()
|
|
|
+ Dim Ingreso As Double = 0
|
|
|
+ Dim ValorNominal = 0.0, PorcCupon = 0.0, Ingresos = 0.0, PorcentajeRenta = 0.0
|
|
|
+ Dim IngresosInt = 0.0, Impuestos = 0.0, Liquido = 0.0
|
|
|
+ ValorNominal = CDec(txtValorNominalCompra.Text)
|
|
|
+ PorcCupon = CDec(txtPorcentajeCuponCompra.Text.ToString.Trim("%")) / 100
|
|
|
+ Dim Index As Integer = dgvIngresos.CurrentRow.Index
|
|
|
+ Dim Fecha1 As Date = Date.Now.Date
|
|
|
+ Dim Fecha2 As Date = Date.Now.Date
|
|
|
+ Dim Dias As Integer = dgvIngresos.Rows(Index).Cells("Dias").Value
|
|
|
+ If (Index = 0) Then
|
|
|
+ Dim RespaldoFecha As String = Format(dtpFechaLiquidacionCompra.Value, "yyyy/MM/dd")
|
|
|
+ Fecha1 = RespaldoFecha
|
|
|
+ Fecha2 = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
|
|
|
+ Else
|
|
|
+ Fecha1 = dgvIngresos.Rows(Index - 1).Cells("FechaCupon").Value
|
|
|
+ Fecha2 = dgvIngresos.Rows(Index).Cells("FechaCupon").Value
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (Not dgvIngresos.CurrentRow.Cells("PorcentajeImpuesto").Value Is Nothing) Then
|
|
|
+ PorcentajeRenta = CDec(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString.Trim("%")) / 100
|
|
|
+
|
|
|
+ Else
|
|
|
+ PorcentajeRenta = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ IngresosInt = IngresosIntereses(ValorNominal, PorcCupon, Dias, Fecha1, Fecha2, IndexBaseC)
|
|
|
+ Ingresos = Me.Impuestos(IngresosInt, PorcentajeRenta)
|
|
|
+ Liquido = Me.Liquido(IngresosInt, Ingresos)
|
|
|
+
|
|
|
+
|
|
|
+ dgvIngresos.CurrentRow.Cells("Ingreso").Value = IngresosInt
|
|
|
+ dgvIngresos.CurrentRow.Cells("MontoImpuesto").Value = Ingresos
|
|
|
+ dgvIngresos.CurrentRow.Cells("Liquido").Value = Liquido
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Sub PrepararIngresosTIT(ByVal Index As Integer, ByRef Amortizacion As DataGridView)
|
|
|
+
|
|
|
+ AsignacionPeriodicidad()
|
|
|
+
|
|
|
+ Dim IndexAnterior = Index - 1
|
|
|
+ Dim Respaldo As String = Format(dtpSiguienteFechaCuponCompra.Value, "dd/MM/yyyy")
|
|
|
+
|
|
|
+
|
|
|
+ Dim Dias, Ingreso, PorcentajeImpuesto, MontoImpuesto, Liquido, PorcentajeImpuestoAnterior
|
|
|
+
|
|
|
+
|
|
|
+ Dias = dgvIngresos.Rows(Index).Cells("Dias").Value
|
|
|
+ Ingreso = dgvIngresos.Rows(Index).Cells("Ingreso").Value
|
|
|
+ PorcentajeImpuesto = 10
|
|
|
+ If (Not PorcentajeImpuesto Is Nothing) Then
|
|
|
+ PorcentajeImpuesto = CDec(PorcentajeImpuesto.ToString.Trim("%")) / 100
|
|
|
+ Else
|
|
|
+ PorcentajeImpuesto = "0.0%"
|
|
|
+ End If
|
|
|
+ MontoImpuesto = 0
|
|
|
+ Liquido = 0
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("NumCupon").Value)) Then
|
|
|
+ ' dgvIngresos.Rows(Index).Cells("NumCupon").Value = Correlativo()
|
|
|
+ 'End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (Index = 0) Then
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ PorcentajeImpuestoAnterior = "10.0%"
|
|
|
+ Else
|
|
|
+
|
|
|
+ PorcentajeImpuestoAnterior = dgvIngresos.Rows(IndexAnterior).Cells("PorcentajeImpuesto").Value
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ Dim Dia As Integer = 0
|
|
|
+ If Not String.IsNullOrEmpty(Amortizacion.Rows(Index).Cells("Dias").Value) Then
|
|
|
+ Dia = Amortizacion.Rows(Index).Cells("Dias").Value
|
|
|
+ End If
|
|
|
+
|
|
|
+ Dim Fecha As Date = Date.Now.Date
|
|
|
+ If Not String.IsNullOrEmpty(Amortizacion.Rows(Index).Cells("Fecha").Value) Then
|
|
|
+ Fecha = Amortizacion.Rows(Index).Cells("Fecha").Value
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ dgvIngresos.Rows.Add(0, 0, 0, Fecha, Dia, 0, PorcentajeImpuestoAnterior, 0, 0)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Sub CalculoIngresosTIT()
|
|
|
+
|
|
|
+
|
|
|
+ Dim FechaPeriodoGracia = PeriodoGracia()
|
|
|
+ Dim CantidadAmortizacion As Integer = Variables.dgvAmortizacion.Rows.Count - 1
|
|
|
+ Dim Amortizacion = Variables.dgvAmortizacion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim Index As Integer = 0
|
|
|
+ Dim j As Integer = 0
|
|
|
+
|
|
|
+ While Index <= CantidadAmortizacion
|
|
|
+
|
|
|
+ PrepararIngresosTIT(Index, Amortizacion)
|
|
|
+
|
|
|
+ Index += 1
|
|
|
+ End While
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ While j <= CantidadAmortizacion
|
|
|
+ Dim PrimerosDias As Double = Amortizacion.Rows(j).Cells("PrimerosDias").Value
|
|
|
+ Dim RestantesDias As Double = Amortizacion.Rows(j).Cells("RestantesDias").Value
|
|
|
+
|
|
|
+
|
|
|
+ Dim FechaActualCupon = dgvIngresos.Rows(j).Cells("FechaCupon").Value
|
|
|
+ Dim Ingreso As Double = 0
|
|
|
+ Dim ValorSaldo = 0.0, PorcCupon = 0.0, Ingresos = 0.0, PorcentajeRenta = 0.0
|
|
|
+ Dim IngresosInt = 0.0, Impuestos = 0.0, Liquido = 0.0
|
|
|
+ Dim SaldoPendiente As Double = 0
|
|
|
+
|
|
|
+ 'If TypeOf FechaPeriodoGracia Is Boolean Then
|
|
|
+ If j = 0 Then
|
|
|
+
|
|
|
+ ValorSaldo = Variables.MontoCompraTIT
|
|
|
+ Else
|
|
|
+
|
|
|
+ ValorSaldo = Amortizacion.Rows(j - 1).Cells("Saldos").Value
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 'Else
|
|
|
+ ' If FechaPeriodoGracia < FechaActualCupon Then
|
|
|
+
|
|
|
+ ' ValorSaldo = Amortizacion.Rows(j - 1).Cells("Saldos").Value
|
|
|
+ ' Else
|
|
|
+ ' ValorSaldo = Variables.MontoCompraTIT
|
|
|
+ ' End If
|
|
|
+ 'End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ PorcCupon = CDec(txtPorcentajeCuponCompra.Text.ToString.Trim("%")) / 100
|
|
|
+
|
|
|
+ Dim Fecha1 As Date = Date.Now.Date
|
|
|
+ Dim Fecha2 As Date = Date.Now.Date
|
|
|
+ Dim Dias As Integer = dgvIngresos.Rows(j).Cells("Dias").Value
|
|
|
+ If (j = 0) Then
|
|
|
+ Dim RespaldoFecha As String = Format(dtpFechaLiquidacionCompra.Value, "yyyy/MM/dd")
|
|
|
+ Fecha1 = RespaldoFecha
|
|
|
+ Fecha2 = dgvIngresos.Rows(j).Cells("FechaCupon").Value
|
|
|
+ Else
|
|
|
+ Fecha1 = dgvIngresos.Rows(j - 1).Cells("FechaCupon").Value
|
|
|
+ Fecha2 = dgvIngresos.Rows(j).Cells("FechaCupon").Value
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If (Not dgvIngresos.Rows(j).Cells("PorcentajeImpuesto").Value Is Nothing) Then
|
|
|
+ PorcentajeRenta = CDec(dgvIngresos.Rows(j).Cells("PorcentajeImpuesto").Value.ToString.Trim("%")) / 100
|
|
|
+
|
|
|
+ Else
|
|
|
+ PorcentajeRenta = 0
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ IngresosInt = IngresosInteresesTIT(ValorSaldo, PorcCupon, Dias, PrimerosDias, RestantesDias, IndexBaseC)
|
|
|
+ Ingresos = Me.Impuestos(IngresosInt, PorcentajeRenta)
|
|
|
+ Liquido = Me.Liquido(IngresosInt, Ingresos)
|
|
|
+
|
|
|
+
|
|
|
+ dgvIngresos.Rows(j).Cells("Ingreso").Value = IngresosInt
|
|
|
+ dgvIngresos.Rows(j).Cells("MontoImpuesto").Value = Ingresos
|
|
|
+ dgvIngresos.Rows(j).Cells("Liquido").Value = Liquido
|
|
|
+ j += 1
|
|
|
+ End While
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeInteresAcumuladoCompra.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub btnQuitar_Click(sender As Object, e As EventArgs) Handles btnQuitar.Click
|
|
|
+ QuitarFila()
|
|
|
+ Calculos()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub QuitarFila()
|
|
|
+ Dim CantidadFilas As Integer = dgvIngresos.Rows.Count - 1
|
|
|
+ If CantidadFilas > 0 Then
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Dim result As Integer = MsgBox("¿Está seguro que desea eliminar la fila?", MsgBoxStyle.OkCancel)
|
|
|
+ ' Test result.
|
|
|
+ Dim codigo As String = Variables.Codigo
|
|
|
+ Dim Numero As Integer = dgvIngresos.CurrentRow.Cells("NumCupon").Value
|
|
|
+ If result = MsgBoxResult.Ok Then
|
|
|
+ Try
|
|
|
+ dgvIngresos.Rows.Remove(dgvIngresos.CurrentRow)
|
|
|
+ BonosConsulta.EliminarIngreso(codigo, Numero, Instrumento)
|
|
|
+ Catch ex As Exception
|
|
|
+ MsgBox("No ha seleccionado una fila")
|
|
|
+ End Try
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ Else
|
|
|
+ MsgBox("Actualmente no tiene registros")
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtCuponesRecibidos_TextChanged(sender As Object, e As EventArgs) Handles txtCuponesRecibidos.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtIngresosPorIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtIngresosPorIntereses_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtRendimientoGananciaPerdida_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoGananciaPerdida_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtRendimientoIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoIntereses_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtRendimientoAntesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoAntesISR_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPlazo_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPlazo_Op.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtDiasAcumuladosVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosVenta.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub pnlPie_Paint(sender As Object, e As PaintEventArgs) Handles pnlPie.Paint
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalCompra_Leave(sender As Object, e As EventArgs) Handles txtValorNominalCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponCompra_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoCompra_Leave(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorCompraCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionPorCompraCasa.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorBolsaCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtCostoTransferenciaCompra_Leave(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalVenta_Leave(sender As Object, e As EventArgs) Handles txtValorNominalVenta.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponVenta_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoVenta_Leave(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioVenta.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorVentaCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionPorVentaCasa.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorBolsaVenta.Leave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles btnIngresos.Click
|
|
|
+ CalculoIngresosTIT()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominalCompra.KeyUp
|
|
|
+ If txtValorNominalCompra.Text = "." Then
|
|
|
+ txtValorNominalCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeCuponCompra.KeyUp
|
|
|
+ If txtPorcentajeCuponCompra.Text = "." Then
|
|
|
+ txtPorcentajeCuponCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtYTMAlVencimientoCompra.KeyUp
|
|
|
+ If txtYTMAlVencimientoCompra.Text = "." Then
|
|
|
+ txtYTMAlVencimientoCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioAlVencimientoCompra.KeyUp
|
|
|
+ If txtPrecioAlVencimientoCompra.Text = "." Then
|
|
|
+ txtPrecioAlVencimientoCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioCompra.KeyUp
|
|
|
+ If txtPrecioCompra.Text = "." Then
|
|
|
+ txtPrecioCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorCompraCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorCompraCasa.KeyUp
|
|
|
+ If txtComisionPorCompraCasa.Text = "." Then
|
|
|
+ txtComisionPorCompraCasa.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorBolsaCompra.KeyUp
|
|
|
+ If txtComisionPorBolsaCompra.Text = "." Then
|
|
|
+ txtComisionPorBolsaCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtCostoTransferenciaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCostoTransferenciaCompra.KeyUp
|
|
|
+ If txtCostoTransferenciaCompra.Text = "." Then
|
|
|
+ txtCostoTransferenciaCompra.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorNominalVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominalVenta.KeyUp
|
|
|
+ If txtValorNominalVenta.Text = "." Then
|
|
|
+ txtValorNominalVenta.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPorcentajeCuponVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeCuponVenta.KeyUp
|
|
|
+ If txtPorcentajeCuponVenta.Text = "." Then
|
|
|
+ txtPorcentajeCuponVenta.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtYTMAlVencimientoVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtYTMAlVencimientoVenta.KeyUp
|
|
|
+ If txtYTMAlVencimientoVenta.Text = "." Then
|
|
|
+ txtYTMAlVencimientoVenta.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioAlVencimientoVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioAlVencimientoVenta.KeyUp
|
|
|
+ If txtPrecioAlVencimientoVenta.Text = "." Then
|
|
|
+ txtPrecioAlVencimientoVenta.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtPrecioVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioVenta.KeyUp
|
|
|
+ If txtPrecioVenta.Text = "." Then
|
|
|
+ txtPrecioVenta.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorVentaCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorVentaCasa.KeyUp
|
|
|
+ If txtComisionPorVentaCasa.Text = "." Then
|
|
|
+ txtComisionPorVentaCasa.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtComisionPorBolsaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorBolsaVenta.KeyUp
|
|
|
+ If txtComisionPorBolsaVenta.Text = "." Then
|
|
|
+ txtComisionPorBolsaVenta.Text = ".0"
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_KeyPress(sender As Object, e As KeyPressEventArgs) Handles dgvIngresos.KeyPress
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_Leave(sender As Object, e As EventArgs) Handles dgvIngresos.Leave
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_Click(sender As Object, e As EventArgs) Handles dgvIngresos.Click
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub dgvIngresos_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellLeave
|
|
|
+ Formato()
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub ValidacionErrores()
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Double.IsNaN(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If Double.IsInfinity(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
|
|
|
+ txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
|
|
|
+
|
|
|
+ If Double.IsNaN(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
|
|
|
+ txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If Double.IsInfinity(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
|
|
|
+ txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
|
|
|
+
|
|
|
+ If Double.IsNaN(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
|
|
|
+ txtPrecioSucioCompra.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ If Double.IsInfinity(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
|
|
|
+ txtPrecioSucioCompra.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ If Not String.IsNullOrEmpty(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
|
|
|
+
|
|
|
+ If Double.IsNaN(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
|
|
|
+ txtPrecioSucioVenta.Text = "0.0%"
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ If Double.IsInfinity(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
|
|
|
+ txtPrecioSucioVenta.Text = "0.0%"
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Sub BotonQuitar()
|
|
|
+ If TabCampos.SelectedIndex = 1 Then
|
|
|
+ btnQuitar.Visible = True
|
|
|
+ btnQuitar.Enabled = True
|
|
|
+ Else
|
|
|
+ btnQuitar.Visible = False
|
|
|
+ btnQuitar.Enabled = False
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub lblRedencion_Click(sender As Object, e As EventArgs)
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub txtValorTransadoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoVenta.TextChanged
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Sub CargarTransladoNuevo()
|
|
|
+ Dim Existe As Boolean = ExisteInversion()
|
|
|
+ If CantFormAbierto = False Then
|
|
|
+ If Not RetCodigoInversionExiste And Not Existe Then
|
|
|
+ Dim TipoTransaccionCompraVenta As String = Variables.TipoTransaccionCompraVenta
|
|
|
+ If TipoTransaccionCompraVenta = "C" Then
|
|
|
+ txtValorNominalCompra.Text = Variables.RetMonto
|
|
|
+ txtPrecioCompra.Text = Variables.RetPrecio
|
|
|
+ txtPorcentajeCuponCompra.Text = Variables.RetRendimiento
|
|
|
+ ElseIf TipoTransaccionCompraVenta = "V" Then
|
|
|
+ txtValorNominalVenta.Text = Variables.RetMonto
|
|
|
+ txtPrecioVenta.Text = Variables.RetPrecio
|
|
|
+ txtPorcentajeCuponVenta.Text = Variables.RetRendimiento
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+ End Sub
|
|
|
+
|
|
|
+ Private Sub btnVenderTitulo_Click(sender As Object, e As EventArgs) Handles btnVenderTitulo.Click
|
|
|
+
|
|
|
+ If Variables.InvocadorProInv = "frmINV" Then
|
|
|
+ Dim TrasladarDatos As New TrasladarDatosCMVTA
|
|
|
+ Dim General As New DAOGeneral
|
|
|
+ Dim Codigo = Variables.Codigo
|
|
|
+ Dim Tabla As String = "INV0"
|
|
|
+ TrasladarDatos = RellenarDatosCMVTA()
|
|
|
+ Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
|
|
|
+ If Existe Then
|
|
|
+ Dim CodigoInversion As String = Variables.Codigo
|
|
|
+ Dim frmPINVCMVTA As New frmPIN("V", CodigoInversion, TrasladarDatos)
|
|
|
+ frmINV.Close()
|
|
|
+ Me.Close()
|
|
|
+ frmPINVCMVTA.ShowDialog()
|
|
|
+ End If
|
|
|
+ End If
|
|
|
+
|
|
|
+ End Sub
|
|
|
+
|
|
|
+
|
|
|
+ Function RellenarDatosCMVTA()
|
|
|
+ Dim TrasladarDatos As New TrasladarDatosCMVTA
|
|
|
+ TrasladarDatos.BaseCINV = Operaciones.ConvertirEntero(cboAnioBaseC.SelectedIndex.ToString)
|
|
|
+ TrasladarDatos.CuponCINV = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString)
|
|
|
+ TrasladarDatos.FechaLiquidacionCINV = Operaciones.ConvertirFecha(dtpFechaLiquidacionCompra.Value.ToString)
|
|
|
+ TrasladarDatos.FechaVencimientoCINV = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
|
|
|
+ TrasladarDatos.PeriodicidadCINV = cboPeriodosC.SelectedValue.ToString
|
|
|
+ TrasladarDatos.PorcentajeComisionBolsaCINV = Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString)
|
|
|
+ TrasladarDatos.PorcentajeComisionCasaCINV = Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString)
|
|
|
+ TrasladarDatos.PrecioCompraCINV = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
|
|
|
+ TrasladarDatos.PrecioVencimientoCINV = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoCompra.Text.ToString)
|
|
|
+ TrasladarDatos.UltimaFechaCuponCINV = Operaciones.ConvertirFecha(dtpUltimaFechaCuponCompra.Value)
|
|
|
+ TrasladarDatos.ValorNominalCINV = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
|
|
|
+ TrasladarDatos.YTMVencimientoCINV = Operaciones.ConvertirDecimal(txtYTMAlVencimientoCompra.Text.ToString)
|
|
|
+ TrasladarDatos.NombreInstrumento = "CINV"
|
|
|
+ TrasladarDatos.AgregarCMVTA = True
|
|
|
+ Return TrasladarDatos
|
|
|
+ End Function
|
|
|
+End Class
|