Public Class frmNotaEstructurada Dim AnioBase As Integer = 365 Dim oNETSCE As New NotaEstructuradaCE Dim oDAONEST As New DAONotaEstructurada Dim oDAOGeneral As New DAOGeneral Private vCargado As Boolean = False Dim Estado As String = " " Dim codigo As String = Variables.Codigo Dim Operaciones As New Operaciones Dim NotaCalcular As New NotaEstructuradaCE Private _TipoTransaccion As String Private _IdDocumento As Integer Private _TipoDocumento As String Private _CodigoInversion As String Private Property CodigoInversion As String Get Return _CodigoInversion End Get Set(value As String) _CodigoInversion = value End Set End Property 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 Sub frmNotaEstructurada_Load(sender As Object, e As EventArgs) Handles MyBase.Load dgvIntereses.Columns.Clear() AgregarCampos() Call CargarPeriodos() If TipoTransaccion Is Nothing Then TipoTransaccion = "N" PrepararNuevo() End If If TipoTransaccion = "C" Then Call CargarRegistroBD() End If CalcularPlazo() Calculo() vCargado = True ExisteInversion() ValidarExistencia() CargarTransladoNuevo() End Sub Sub RellenarDatos() If (String.IsNullOrEmpty(txtMontoInversion.Text.ToString)) Then txtMontoInversion.Text = "0.0" End If If (String.IsNullOrEmpty(txtPlazo.Text.ToString)) Then txtPlazo.Text = "0.0" End If If (String.IsNullOrEmpty(txtTasa.Text.ToString.Trim("%"))) Then txtTasa.Text = "0.0%" 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 ValidarExistencia() Dim General As New DAOGeneral Dim Codigo As String = Variables.Codigo Dim Tabla As String = String.Empty Tabla = "NEST0" Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla) If (Existe) Then navNuevo.Enabled = False navModificar.Enabled = True navEliminar.Enabled = True Else navNuevo.Enabled = True navModificar.Enabled = False navEliminar.Enabled = False End If Estado = String.Empty btnGME.Text = "Aceptar" End Sub Function ExisteValidacion() Dim General As New DAOGeneral Dim Codigo As String = Variables.Codigo Dim Tabla As String = String.Empty Tabla = "NEST0" Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla) Return Existe End Function Private Sub txtPlazo_TextChanged(sender As Object, e As EventArgs) Calculo() End Sub Private Sub txtPlazo_LostFocus(sender As Object, e As EventArgs) End Sub Private Sub ControlPlazo() Dim valor As Integer If Not Integer.TryParse(txtPlazo.Text.ToString, valor) Then txtPlazo.Focus() txtPlazo.BackColor = Configuraciones.ColorFondoError Else txtPlazo.BackColor = Color.White If TipoTransaccion = "N" Or TipoTransaccion = "M" Then oNETSCE.Plazo = valor End If RefrescarValorControles() End If End Sub Private Sub dtpFechaOperacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacion.ValueChanged CalcularPlazo() Calculo() End Sub Private Sub ControlFechaOperacion() Dim valor As Date valor = dtpFechaOperacion.Value.Date If TipoTransaccion = "N" Then oNETSCE.FechaOperacion = valor End If RefrescarValorControles() End Sub Private Sub txtIngresoBruto_TextChanged(sender As Object, e As EventArgs) End Sub Private Sub txtTasa_TextChanged(sender As Object, e As EventArgs) Handles txtTasa.TextChanged Calculo() If (txtTasa.ToString.IndexOf("%") = -1) Then txtTasa.Text += "%" End If CalcularPlazo() Calculo() End Sub Private Sub txtTasa_LostFocus(sender As Object, e As EventArgs) Handles txtTasa.LostFocus End Sub Private Sub ControlTasa() Dim valor As Double If Not Double.TryParse(txtTasa.Text, valor) Then txtTasa.Focus() txtTasa.BackColor = Configuraciones.ColorFondoError Else txtTasa.BackColor = Color.White If TipoTransaccion = "N" Or TipoTransaccion = "M" Then oNETSCE.Tasa = valor End If RefrescarValorControles() End If End Sub Private Sub txtMontoInversion_TextChanged(sender As Object, e As EventArgs) Handles txtMontoInversion.TextChanged CalcularPlazo() Calculo() End Sub Private Sub txtMontoInversion_LostFocus(sender As Object, e As EventArgs) Handles txtMontoInversion.LostFocus End Sub Private Sub ControlMontoInversion() Dim valor As Double If Not Double.TryParse(txtMontoInversion.Text, valor) Then txtMontoInversion.Focus() txtMontoInversion.BackColor = Configuraciones.ColorFondoError Else txtMontoInversion.BackColor = Color.White If TipoTransaccion = "N" Or TipoTransaccion = "M" Then oNETSCE.MontoDeInversion = valor End If RefrescarValorControles() End If End Sub Private Sub txtIngresoNeto_TextChanged(sender As Object, e As EventArgs) End Sub Sub CargarPeriodos() If cboPeriodicidad.Items.Count = 0 Or cboPeriodicidad.Items.Count = 1 Then Me.cboPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad Me.cboPeriodicidad.DisplayMember = "Descripcion" Me.cboPeriodicidad.ValueMember = "Codigo" Me.cboPeriodicidad.SelectedIndex = 0 End If End Sub Private Sub btnAceptar_Click(sender As Object, e As EventArgs) If (Estado = "N") Then NuevoElemento() ElseIf (Estado = "M") Then ModificarElemento() ElseIf (Estado = "B") Then EliminarElemento() End If End Sub Private Sub CargarRegistroBD() oNETSCE = Nothing oDAONEST = New DAONotaEstructurada CodigoInversion = Variables.Codigo oNETSCE = oDAONEST.CargarRegistro(Me.CodigoInversion) TipoTransaccion = "C" RefrescarValorControles() End Sub Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged CalcularPlazo() Calculo() End Sub Private Sub ControlFechaVencimiento() Dim valor As Date valor = dtpFechaVencimiento.Value.Date.ToString If TipoTransaccion = "N" Or TipoTransaccion = "M" Then oNETSCE.FechaVencimiento = valor End If RefrescarValorControles() End Sub Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodicidad.SelectedIndexChanged CalcularPlazo() Calculo() End Sub Private Sub ControlPreriodicidad() Dim valor As String If vCargado Then If TipoTransaccion = "N" Or TipoTransaccion = "M" Then valor = cboPeriodicidad.SelectedValue oNETSCE.Periodicidad = valor End If If TipoTransaccion IsNot Nothing Then RefrescarValorControles() End If End If End Sub Public Sub CargarRegistro(ByRef vCodigoInversion As String) TipoTransaccion = "C" Me.CodigoInversion = vCodigoInversion End Sub Private Sub RefrescarValorControles() If Not oNETSCE Is Nothing Then Me.txtMontoInversion.Text = oNETSCE.MontoDeInversion.ToString(Configuraciones.CodigoTXTMontos) Me.dtpFechaOperacion.Value = oNETSCE.FechaOperacion Me.dtpFechaVencimiento.Value = oNETSCE.FechaVencimiento Me.txtTasa.Text = oNETSCE.Tasa.ToString(Configuraciones.CodigoTXTMontos) txtPlazo.Text = oNETSCE.Plazo.ToString 'anio base Me.cboPeriodicidad.SelectedValue = oNETSCE.Periodicidad Me.txtRendimientoBruto.Text = oNETSCE.RendimientoBruto.ToString(Configuraciones.CodigoTXTMontos) Me.txtRendimientoNeto.Text = oNETSCE.RendimientoNeto.ToString(Configuraciones.CodigoTXTMontos) For Each item As DataRow In oNETSCE.dtIntereses.Rows Me.txtImpuesto.Text = item("PorcImp") * 100 Next End If End Sub Private Sub dgvIntereses_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvIntereses.CellBeginEdit End Sub Private Sub RefrescarClaseEntidad() ControlMontoInversion() ControlFechaOperacion() ControlFechaVencimiento() ControlTasa() ControlPlazo() ControlPreriodicidad() End Sub Private Sub dgvIntereses_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIntereses.CellEndEdit End Sub Private Sub dgvIntereses_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIntereses.CellContentClick End Sub Private Sub PrepararNuevo() oNETSCE = New NotaEstructuradaCE RefrescarValorControles() End Sub Private Sub dgvIntereses_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIntereses.CellLeave End Sub Private Sub dgvIntereses_CellEnter(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIntereses.CellEnter End Sub Private Sub dgvIntereses_RowPostPaint(sender As Object, e As DataGridViewRowPostPaintEventArgs) Handles dgvIntereses.RowPostPaint End Sub Private Sub dgvIntereses_RowPrePaint(sender As Object, e As DataGridViewRowPrePaintEventArgs) Handles dgvIntereses.RowPrePaint End Sub Private Sub dgvIntereses_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles dgvIntereses.RowsAdded End Sub Private Sub dgvIntereses_RowValidated(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIntereses.RowValidated End Sub Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click btnGME.Text = "Modificar" Estado = "M" End Sub Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click btnGME.Text = "Nuevo" Estado = "N" End Sub Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click btnGME.Text = "Eliminar" Estado = "B" End Sub Function ColeccionDatos() Dim Coleccion As New Collection Dim MontoInv, FOper, FVenc, Tasa, Plazo, Periodic, RendBr, RendNet, IngrBrutoTot, IngrNetoTot, Renta As String MontoInv = CDec(txtMontoInversion.Text) FOper = CDate(dtpFechaOperacion.Value) FVenc = CDate(dtpFechaVencimiento.Value) Tasa = CDec(txtTasa.Text.ToString.Trim("%")) Plazo = CInt(txtPlazo.Text) Periodic = cboPeriodicidad.SelectedValue RendBr = CDec(txtRendimientoBruto.Text.ToString.Trim("%")) / 100 RendNet = CDec(txtRendimientoNeto.Text.ToString.Trim("%")) / 100 IngrBrutoTot = txtIngresoBruto.Text IngrNetoTot = txtIngresoNeto.Text Renta = txtRenta.Text Coleccion.Add(MontoInv) Coleccion.Add(FOper) Coleccion.Add(FVenc) Coleccion.Add(Tasa) Coleccion.Add(Plazo) Coleccion.Add(Periodic) Coleccion.Add(RendBr) Coleccion.Add(RendNet) Coleccion.Add(IngrBrutoTot) Coleccion.Add(IngrNetoTot) Coleccion.Add(Renta) Return Coleccion End Function Function ColeccionElementos(ByVal Index As Integer) Dim Coleccion As New Collection Dim Correlativo, plazo, Fecha, IngBruto, PorcImp, MontoImp, IngrNeto As String Correlativo = dgvIntereses.Rows(Index).Cells("Correlativo").Value.ToString plazo = dgvIntereses.Rows(Index).Cells("Plazo").Value.ToString Fecha = dgvIntereses.Rows(Index).Cells("Fecha").Value.ToString IngBruto = dgvIntereses.Rows(Index).Cells("Ingreso Bruto").Value.ToString PorcImp = dgvIntereses.Rows(Index).Cells("% Impuesto").Value.ToString.Trim("%") MontoImp = dgvIntereses.Rows(Index).Cells("Monto del Impuesto").Value.ToString IngrNeto = dgvIntereses.Rows(Index).Cells("Ingreso Neto").Value.ToString Coleccion.Add(Correlativo) Coleccion.Add(plazo) Coleccion.Add(Fecha) Coleccion.Add(IngBruto) Coleccion.Add(PorcImp) Coleccion.Add(MontoImp) Coleccion.Add(IngrNeto) Return Coleccion End Function Sub Calculo() Dim Plazo As Integer = 0 If Not String.IsNullOrEmpty(txtPlazo.Text.ToString) Then Plazo = txtPlazo.Text End If dtpFechaVencimiento.Value = dtpFechaOperacion.Value.AddDays(Plazo) CalcularRendBruto() CalcularRendNeto() End Sub Sub CalcularRendBruto() If (Not String.IsNullOrEmpty(txtMontoInversion.Text.ToString) And Not txtMontoInversion.Text.ToString = "0.0" And Not String.IsNullOrEmpty(txtPlazo.Text.ToString) And Not txtPlazo.Text.ToString = "0.0") Then Dim Total = TotalIngreso() Dim MontoInv = CDec(txtMontoInversion.Text) Dim Base = 365 Dim pla = CDec(txtPlazo.Text) Dim tot As Double = 0 If (Not MontoInv = 0 And Not pla = 0) Then tot = (Total / MontoInv) * (Base / pla) End If txtRendimientoBruto.Text = CStr((tot * 100)) + "%" Else txtRendimientoBruto.Text = "0.0%" End If End Sub Sub CalcularRendNeto() If (Not String.IsNullOrEmpty(txtMontoInversion.Text.ToString) And Not txtMontoInversion.Text.ToString = "0.0" And Not String.IsNullOrEmpty(txtPlazo.Text.ToString) And Not txtPlazo.Text.ToString = "0.0") Then Dim Total = TotalIngresoNeto() Dim MontoInv = CDec(txtMontoInversion.Text) Dim Base = 365 Dim pla = CDec(txtPlazo.Text) Dim tot As Double = 0 If (Not MontoInv = 0 And Not pla = 0) Then tot = (Total / MontoInv) * (Base / pla) End If txtRendimientoNeto.Text = CStr((tot * 100)) + "%" Else txtRendimientoNeto.Text = "0.0%" End If End Sub Function TotalIngreso() Dim Cantidad = CDec(dgvIntereses.Rows.Count - 1) Dim TotalIngr As Double = 0 For i As Integer = 0 To Cantidad TotalIngr = TotalIngr + CDec(dgvIntereses.Rows(i).Cells("Ingreso Bruto").Value) Next Return TotalIngr End Function Function TotalIngresoNeto() Dim Cantidad = dgvIntereses.Rows.Count - 1 Dim TotalIngr As Double = 0 For i As Integer = 0 To Cantidad TotalIngr = TotalIngr + CDec(dgvIntereses.Rows(i).Cells("Ingreso Neto").Value) Next Return TotalIngr End Function Private Sub Button1_Click(sender As Object, e As EventArgs) End Sub Function NuevoElemento() Dim Index As Integer = dgvIntereses.Rows.Count - 2 Dim diccionario As New Dictionary(Of String, Collection) For i As Integer = 0 To Index Dim colec As Collection = ColeccionElementos(i) diccionario.Add(i, colec) Next Return diccionario End Function Function NuevoElementoGuardar() Dim Index As Integer = dgvIntereses.Rows.Count - 2 For i As Integer = 0 To Index Dim colec As Collection = ColeccionElementos(i) oDAONEST.NuevoElemento(colec, codigo) Next End Function Sub ModificarElemento() oDAONEST.EliminarElemento(codigo) NuevoElementoGuardar() End Sub Sub EliminarElemento() oDAONEST.EliminarElemento(codigo) End Sub Sub Nuevo() Dim colec As Collection = ColeccionDatos() Dim Diccionario As Dictionary(Of String, Collection) = NuevoElemento() oDAONEST.NuevoDato(colec, Diccionario, codigo) End Sub Sub Modificar() Dim colec As Collection = ColeccionDatos() Dim Diccionario As Dictionary(Of String, Collection) = NuevoElemento() oDAONEST.ModificarDato(colec, codigo, NuevoElemento()) End Sub Sub Eliminar() Dim codigo As String = Variables.Codigo oDAONEST.Eliminar(codigo) End Sub Private Sub btnGME_Click(sender As Object, e As EventArgs) Handles btnGME.Click If (Estado = "N") Then Nuevo() ElseIf (Estado = "M") Then Modificar() ElseIf (Estado = "B") Then Eliminar() ElseIf Not ExisteValidacion() Then Variables.ColeccionNEST = ColeccionDatos() Variables.ColeccionNESTDi = NuevoElemento() Me.Close() End If End Sub Private Sub txtRendimientoBruto_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.TextChanged End Sub Private Sub Button1_Click_1(sender As Object, e As EventArgs) Me.Operaciones.CambioBase(dtpFechaOperacion.Value, dtpFechaVencimiento.Value) End Sub Private Sub txtPlazo_TextChanged_1(sender As Object, e As EventArgs) Handles txtPlazo.TextChanged CalcularPlazo() Calculo() End Sub Sub AgregarCampos() Dim Correlativo, Plazo, Fecha, IngrBruto, PorcImp, MontoImp, IngrNeto As New DataGridViewTextBoxColumn Correlativo.Name = "Correlativo" Plazo.Name = "Plazo" Fecha.Name = "Fecha" IngrBruto.Name = "Ingreso Bruto" PorcImp.Name = "% Impuesto" PorcImp.DefaultCellStyle.Format = Configuraciones.CodigoTXTPorcentaje MontoImp.Name = "Monto del Impuesto" IngrNeto.Name = "Ingreso Neto" dgvIntereses.Columns.Add(Correlativo) dgvIntereses.Columns.Add(Plazo) dgvIntereses.Columns.Add(Fecha) dgvIntereses.Columns.Add(IngrBruto) dgvIntereses.Columns.Add(PorcImp) dgvIntereses.Columns.Add(MontoImp) dgvIntereses.Columns.Add(IngrNeto) End Sub Sub CalcularPlazo() dgvIntereses.Rows.Clear() Dim PlazoGlobal As Integer = 0 If String.IsNullOrEmpty(txtPlazo.Text) Then PlazoGlobal = 0 Else PlazoGlobal = CDec(txtPlazo.Text) End If Dim Periodicidad As String = String.Empty If Not cboPeriodicidad.SelectedValue Is Nothing Then Try Periodicidad = cboPeriodicidad.SelectedValue Catch ex As Exception End Try End If Dim FechaInicial As Date = dtpFechaOperacion.Value Dim IngrBruto As Double = 0.0 Dim Monto If String.IsNullOrEmpty(txtMontoInversion.Text) Then Monto = 0 Else Monto = txtMontoInversion.Text End If Dim Tasa As Double = 0 If (Not String.IsNullOrEmpty(txtTasa.Text.ToString.Trim("%")) And Not txtTasa.Text.ToString.Trim("%") = "0") Then Tasa = (txtTasa.Text.Trim("%") / 100) End If Dim Impuesto As Double = 0 If (Not String.IsNullOrEmpty(txtImpuesto.Text.ToString.Trim("%")) And Not txtImpuesto.Text.ToString.Trim("%") = "0") Then Impuesto = (txtImpuesto.Text.Trim("%") / 100) End If Dim Renta As Double = 0.0 Dim FechaAnterior As Date Dim IngresoNeto As Double = 0.0 Dim SumaIngresoBruto, SumaRenta, SumaIngresoNeto As Double Dim Plazo = NotaCalcular.CalcularPlazo(Periodicidad) Dim Cantidad = NotaCalcular.CalcularIteraciones(PlazoGlobal, Plazo) Dim Fecha As String = String.Empty For i As Integer = 1 To Cantidad If (i = 1) Then Fecha = Format(NotaCalcular.CalcularFecha(Plazo, FechaInicial), "dd/MM/yyyy") IngrBruto = NotaCalcular.CalculosIngrBruto(FechaInicial, Fecha, Monto, Tasa, Plazo) Else If (String.IsNullOrEmpty(Fecha.ToString)) Then Exit Sub End If FechaAnterior = Fecha Fecha = Format(NotaCalcular.CalcularFecha(Plazo, Fecha), "dd/MM/yyyy") IngrBruto = NotaCalcular.CalculosIngrBruto(FechaAnterior, Fecha, Monto, Tasa, Plazo) End If Renta = NotaCalcular.Renta(Impuesto, IngrBruto) IngresoNeto = NotaCalcular.CalculosIngNeto(IngrBruto, Renta) SumaIngresoBruto = SumaIngresoBruto + IngrBruto SumaRenta = SumaRenta + Renta SumaIngresoNeto = SumaIngresoNeto + IngresoNeto dgvIntereses.Rows.Add(i, Plazo, Fecha, IngrBruto, Impuesto, Renta, IngresoNeto) Next txtIngresoBruto.Text = SumaIngresoBruto txtRenta.Text = SumaRenta txtIngresoNeto.Text = SumaIngresoNeto End Sub Private Sub txtMontoInversion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMontoInversion.KeyPress If String.IsNullOrEmpty(txtMontoInversion.Text) Then If e.KeyChar = "." Then txtMontoInversion.Text = "0" Exit Sub End If End If If (Not txtMontoInversion.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 txtPlazo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPlazo.KeyPress If String.IsNullOrEmpty(txtPlazo.Text) Then If e.KeyChar = "." Then txtPlazo.Text = "0" Exit Sub End If End If If (Not txtPlazo.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 txtTasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtTasa.KeyPress If String.IsNullOrEmpty(txtTasa.Text) Then If e.KeyChar = "." Then txtTasa.Text = "0" Exit Sub End If End If If (Not txtTasa.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 txtMontoInversion_Leave(sender As Object, e As EventArgs) Handles txtMontoInversion.Leave RellenarDatos() End Sub Private Sub txtPlazo_Leave(sender As Object, e As EventArgs) Handles txtPlazo.Leave RellenarDatos() End Sub Private Sub txtTasa_Leave(sender As Object, e As EventArgs) Handles txtTasa.Leave RellenarDatos() End Sub Private Sub txtMontoInversion_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMontoInversion.KeyUp If txtMontoInversion.Text = "." Then txtMontoInversion.Text = ".0" End If End Sub Private Sub txtPlazo_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPlazo.KeyUp If txtPlazo.Text = "." Then txtPlazo.Text = ".0" End If End Sub Private Sub txtTasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtTasa.KeyUp If txtTasa.Text = "." Then txtTasa.Text = ".0" End If End Sub Private Sub txtImpuesto_TextChanged(sender As Object, e As EventArgs) Handles txtImpuesto.TextChanged CalcularPlazo() Calculo() End Sub Sub CargarTransladoNuevo() Dim Existe As Boolean = ExisteInversion() If Not RetCodigoInversionExiste And Not Existe Then txtMontoInversion.Text = Variables.RetMonto txtTasa.Text = Variables.RetRendimiento End If End Sub End Class