Public Class frmReporto Dim oDAOGeneral As New DAOGeneral Const PorcentajeComisionCasa As Double = 0.2825 Const PorcentajeComisionBolsa As Double = 0.2825 Dim oCEReporto As ReportosCE Dim oDAOReportos As ReportosDAO Dim Reporto As New ReportosCE Dim ReportoConsula As New ReportosDAO Dim Estado As String = String.Empty Dim CargarUnaVez As Boolean = True Dim Operaciones As New Operaciones Dim Modificado As Boolean = False Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo) Dim CodigoRotar As Integer = 0 Private _Modo As String Private Cargado As Boolean = False Private Procesado As Boolean = False Private Tabla As String = String.Empty Private Base As Integer = 0 Private CodigoProveniente As String = String.Empty Sub New() ' Esta llamada es exigida por el diseñador. InitializeComponent() ' Agregue cualquier inicialización después de la llamada a InitializeComponent(). End Sub Public Property Modo As String Get Return _Modo End Get Set(value As String) _Modo = value End Set End Property Sub AgregarCampos(ByVal Tipo As Integer) Dim ValTrans, Dias, FVen, Rend, IOF, ComisionCB, CB, OtrosCostos, TotCostos, MontoLiq, InterGen, codigo As New DataGridViewTextBoxColumn Dim CostoTransfv, Correlativo, RendNetoAntImp, ValReCompra, ImpLiquidacion, IngrNeto, ValNeto, RendNetoDespImp As New DataGridViewTextBoxColumn Dim Nombre, FCompra, ComisionCasa, ComisionBolsa, Casa, Base, EstadoIOF, EstadoRenta As New DataGridViewTextBoxColumn Dim Cantidad As Integer = dgvReportos.ColumnCount If Cantidad = 0 Then Correlativo.Name = "Correlativo" codigo.Name = "Codigo" codigo.Visible = False ValTrans.Name = "Valor Trasado" Dias.Name = "Dias" FVen.Name = "Fecha de Vencimiento" Rend.Name = "Rendimiento" IOF.Name = "IOF" ComisionCB.Name = "Comision CB" CB.Name = "Comision Bolsa" OtrosCostos.Name = "Otros Costos" TotCostos.Name = "Total Costos" MontoLiq.Name = "Monto a Liquidar" InterGen.Name = "Interes a Genrerar" CostoTransfv.Name = "Costo de Transferencia" RendNetoAntImp.Name = "R% Neto (Antes de Impuesto)" ValReCompra.Name = "Valor de ReCompra" ImpLiquidacion.Name = "Impuesto de Liquidacion" IngrNeto.Name = "Ingreso Neto" ValNeto.Name = "Valor Neto" RendNetoDespImp.Name = "R% Neto (Despues de Impuesto)" Nombre.Name = "Nombre" FCompra.Name = "FCompra" ComisionCasa.Name = "ComisionCasa" ComisionBolsa.Name = "ComisionBolsa" Casa.Name = "Casa" Base.Name = "Base" EstadoIOF.Name = "EstadoIOF" EstadoRenta.Name = "EstadoRenta" Nombre.Visible = False FCompra.Visible = False ComisionCasa.Visible = False ComisionBolsa.Visible = False Casa.Visible = False Base.Visible = False EstadoIOF.Visible = False EstadoRenta.Visible = False Dim cod As String = Variables.Codigo If cod.IndexOf("REPOVENTA") > -1 Then RendNetoAntImp.HeaderText = "Costo Financiero (Antes de Impuesto)" RendNetoDespImp.HeaderText = "Costo Financiero (Despues de Impuesto)" Rend.HeaderText = "Costo Financiero" TotCostos.HeaderText = "Total a Pagar" Else RendNetoAntImp.HeaderText = "R% Neto (Antes de Impuesto)" RendNetoDespImp.HeaderText = "R% Neto (Despues de Impuesto)" Rend.HeaderText = "Rendimiento" TotCostos.HeaderText = "Total Costos" End If dgvReportos.Columns.Add(Correlativo) dgvReportos.Columns.Add(ValTrans) dgvReportos.Columns.Add(Dias) dgvReportos.Columns.Add(FVen) dgvReportos.Columns.Add(Rend) dgvReportos.Columns.Add(ComisionCB) dgvReportos.Columns.Add(CB) dgvReportos.Columns.Add(IOF) dgvReportos.Columns.Add(OtrosCostos) dgvReportos.Columns.Add(TotCostos) dgvReportos.Columns.Add(MontoLiq) dgvReportos.Columns.Add(InterGen) dgvReportos.Columns.Add(CostoTransfv) dgvReportos.Columns.Add(RendNetoAntImp) dgvReportos.Columns.Add(ValReCompra) dgvReportos.Columns.Add(ImpLiquidacion) dgvReportos.Columns.Add(IngrNeto) dgvReportos.Columns.Add(ValNeto) dgvReportos.Columns.Add(RendNetoDespImp) dgvReportos.Columns.Add(Nombre) dgvReportos.Columns.Add(FCompra) dgvReportos.Columns.Add(ComisionCasa) dgvReportos.Columns.Add(ComisionBolsa) dgvReportos.Columns.Add(Casa) dgvReportos.Columns.Add(codigo) dgvReportos.Columns.Add(Base) dgvReportos.Columns.Add(EstadoIOF) dgvReportos.Columns.Add(EstadoRenta) End If End Sub Sub LlenarBase() Dim Index As Integer = dgvReportos.Rows.Count - 2 Base = cboAnioBase.SelectedIndex Dim i As Integer = 0 While i <= Index dgvReportos.Rows(i).Cells("Base").Value = Base i += 1 End While End Sub Sub IngresarDatos() If Cargado Then If Procesado Then If Not dgvReportos.CurrentRow Is Nothing Then Dim Index As Integer = dgvReportos.CurrentRow.Index dgvReportos.Rows(Index).Cells("Nombre").Value = txtCodigoTitulo.Text.ToString dgvReportos.Rows(Index).Cells("FCompra").Value = dtpFechaCompra.Value dgvReportos.Rows(Index).Cells("ComisionCasa").Value = Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString) / 100 dgvReportos.Rows(Index).Cells("ComisionBolsa").Value = Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString) / 100 dgvReportos.Rows(Index).Cells("Casa").Value = cboCasaCorredora.SelectedValue End If End If End If End Sub Sub IngresarDatosReves() Procesado = False If Cargado Then If Not dgvReportos.CurrentRow Is Nothing Then Dim Index As Integer = dgvReportos.CurrentRow.Index Dim Nombre As String = CStr(dgvReportos.Rows(Index).Cells("Nombre").Value) Dim FCompra As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value) Dim ComisionCasa As Double = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value) * 100 Dim ComisionBolsa As Double = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value) * 100 Dim EstadoIOF As Boolean = Operaciones.ConvertirBoolNum(dgvReportos.Rows(Index).Cells("EstadoIOF").Value) Dim EstadoRenta As Boolean = Operaciones.ConvertirBoolNum(dgvReportos.Rows(Index).Cells("EstadoRenta").Value) Dim Casa As String = Operaciones.ConvertirCadena(dgvReportos.Rows(Index).Cells("Casa").Value) txtCodigoTitulo.Text = Nombre dtpFechaCompra.Value = FCompra txtComisionCasa.Text = ComisionCasa txtComisionBolsa.Text = ComisionBolsa If Index = 0 Then ChkIOF.Checked = EstadoIOF Else Dim EstadoIOFAnt = Operaciones.ConvertirBoolNum(dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value) ChkIOF.Checked = EstadoIOFAnt End If If Index = 0 Then ChkRenta.Checked = EstadoRenta Else Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value ChkRenta.Checked = EstadoRentaAnt End If cboCasaCorredora.SelectedValue = Casa End If End If Procesado = True End Sub Sub ComisionCasa(ByVal ComisionCasa As Double, ByVal Index As Integer) Dim ValorTrasado As Double = 0.0 Dim Dias As Integer = 0 Dim por As Double = 0 ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) por = ComisionCasa Dim Fecha1 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) Dim Fecha2 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString) dgvReportos.Rows(Index).Cells("Comision CB").Value = Operaciones.ConvertirDecimal(Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base).ToString) End Sub Sub ComisionBolsa(ByVal ComisionBolsa As Double, ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim Dias As Integer = 0 Dim por As Double = 0 ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) por = ComisionBolsa Dim Fecha1 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) Dim Fecha2 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString) dgvReportos.Rows(Index).Cells("Comision Bolsa").Value = Operaciones.ConvertirDecimal(Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base).ToString) End Sub Sub IOF(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim ComisionCasa As Double = 0 Dim ComisionBolsa As Double = 0 Dim dias As Integer = 0 Dim Porcentaje As Double = 0.0025 Dim Fecha1 As Date = Date.Now.Date Dim Fecha2 As Date = Date.Now.Date If ChkIOF.Checked Then ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value.ToString) ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value.ToString) dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString) dgvReportos.Rows(Index).Cells("IOF").Value = Operaciones.ConvertirDecimal(Reporto.IOF(ValorTrasado, ComisionCasa, ComisionBolsa, dias, Porcentaje, Fecha1, Fecha2, Base).ToString) Else dgvReportos.Rows(Index).Cells("IOF").Value = 0 End If End Sub Sub TotalCostos(ByVal Index As Integer) Dim ComisionCasa As Double = 0 Dim ComisionBolsa As Double = 0 Dim IOF As Double = 0 Dim OC As Double = 0 Dim ValorTransado As Double = 0 Dim Instrumento As String = String.Empty If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then Instrumento = "REPOVENTA" Else Instrumento = "REPO" End If ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value.ToString) ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value.ToString) IOF = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("IOF").Value.ToString) OC = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Otros Costos").Value.ToString) ValorTransado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) dgvReportos.Rows(Index).Cells("Total Costos").Value = Operaciones.ConvertirDecimal(Reporto.TotCostos(ComisionCasa, ComisionBolsa, IOF, OC, ValorTransado, Instrumento).ToString) End Sub Sub MontoLiquidacion(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim TotalCosto As Double = 0 ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) TotalCosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString) dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value = Operaciones.ConvertirDecimal(Reporto.MontoLiquidacion(ValorTrasado, TotalCosto).ToString) End Sub Sub InteresGenerar(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim rendimiento As Double = 0 Dim dias As Integer = 0 Dim Fecha1 As Date = Date.Now.Date Dim Fecha2 As Date = Date.Now.Date ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) rendimiento = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Rendimiento").Value.ToString) dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString) dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value = Operaciones.ConvertirDecimal(Reporto.InteresGenerar(ValorTrasado, rendimiento, dias, Fecha1, Fecha2, Base).ToString) End Sub Sub RendimientoAntes(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim dias As Integer = 0 Dim InteresGenerar As Double = 0 Dim Totcosto As Double = 0 Dim Fecha1 As Date = Date.Now.Date Dim Fecha2 As Date = Date.Now.Date ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString) Totcosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString) Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString) dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value = Operaciones.ConvertirDecimal(Reporto.RendimientoAntes(InteresGenerar, Totcosto, ValorTrasado, dias, Fecha1, Fecha2, Base, Tabla).ToString) End Sub Sub ValorRecompra(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim InteresGenerar As Double = 0 ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString) dgvReportos.Rows(Index).Cells("Valor de ReCompra").Value = Operaciones.ConvertirDecimal(Reporto.ValorRecompras(ValorTrasado, InteresGenerar).ToString) End Sub Sub Renta(ByVal Index As String) Dim InteresGenerar As Double = 0 If ChkRenta.Checked Then InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString) dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = (InteresGenerar * 0.1) Else dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0 End If End Sub Sub IngresoNeto(ByVal Index As Integer) Dim InteresGenerar As Double = 0 Dim Renta As Double = 0 InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString) Renta = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value.ToString) dgvReportos.Rows(Index).Cells("Ingreso Neto").Value = Operaciones.ConvertirDecimal(Reporto.IngresoNet(InteresGenerar, Renta).ToString) End Sub Sub ValorNeto(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim IngresoNeto As Double = 0 Dim CostoTrans As Double = 0 ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) IngresoNeto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString) CostoTrans = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value.ToString) dgvReportos.Rows(Index).Cells("Valor Neto").Value = Operaciones.ConvertirDecimal(Reporto.ValorNet(ValorTrasado, IngresoNeto, CostoTrans).ToString) End Sub Sub RendimientoDespues(ByVal Index As Integer) Dim ValorTrasado As Double = 0 Dim IngresoNeto As Double = 0 Dim TotalCosto As Double = 0 Dim dias As Integer = 0 Dim Fecha1 As Date = Date.Now.Date Dim Fecha2 As Date = Date.Now.Date ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString) IngresoNeto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString) TotalCosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString) dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString) dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value = Operaciones.ConvertirDecimal(Reporto.RendimientoDespues(IngresoNeto, TotalCosto, ValorTrasado, dias, Fecha1, Fecha2, Base).ToString) End Sub Sub CargarFecha() Dim Index As Integer = dgvReportos.CurrentRow.Index Dim Fecha As Date = dtpFechaCompra.Value Dim Fecha2 As Date = Date.Now.Date Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value) End Sub Private Sub CargarCasaCorredora() If cboCasaCorredora.Items.Count = 0 Or cboCasaCorredora.Items.Count = 1 Then Me.cboCasaCorredora.DataSource = oDAOGeneral.ListaTiposImpuesto Me.cboCasaCorredora.DisplayMember = "Descripcion" Me.cboCasaCorredora.ValueMember = "Codigo" Me.cboCasaCorredora.SelectedIndex = 0 End If End Sub Sub CargarBase() If cboAnioBase.Items.Count = 0 Or cboAnioBase.Items.Count = 1 Then Me.cboAnioBase.DataSource = oDAOGeneral.ListaBase Me.cboAnioBase.DisplayMember = "Descripcion" Me.cboAnioBase.ValueMember = "Codigo" Me.cboAnioBase.SelectedIndex = 0 End If End Sub Private Sub frmReporto_Load(sender As Object, e As EventArgs) Handles MyBase.Load Titulo.TabPages.Remove(TbImpuestos) Dim CantidadFilas As Integer = dgvReportos.Rows.Count CargarCasaCorredora() CargarBase() If Variables.Codigo.IndexOf("REPO") > -1 And Not Variables.Codigo.IndexOf("REPOVENTA") > -1 Then Tabla = "REP0" lblReporto.Text = "Reporto de Compra" Variables.Inicio = True txtComisionCasa.Text = PorcentajeComisionCasa txtComisionBolsa.Text = PorcentajeComisionBolsa If CantidadFilas <= 1 Then AgregarCampos(1) CargarReporto(Tabla) End If Calculos() Variables.Inicio = False Calculos() CargarUnaVez = False CodigoRotar = 0 ElseIf Variables.Codigo.IndexOf("REPOVENTA") > -1 Then OcultarValoresImp() Tabla = "REP0VENTA" lblReporto.Text = "Reporto de Venta" lblFechaCompra.Text = "Fecha de Venta" lblCodigoInstrumento.Visible = True txtCodigoInstrumento.Visible = True If Not String.IsNullOrEmpty(CodigoProveniente) Then txtCodigoInstrumento.Text = CodigoProveniente End If If CantidadFilas <= 1 Then AgregarCampos(2) CargarReporto(Tabla) End If CodigoRotar = 0 Calculos() CargarMontoRepoVenta() End If Cargado = True CorrelativoSinBD() ExisteInversion() ValidarExistencia() Formato() CargarTransladoNuevo() End Sub Sub CargarMontoRepoVenta() If Operaciones.ConvertirDecimal(txtMonto.Text.ToString) > 0 Then If dgvReportos.Rows(0).Cells("Valor Trasado").Value = 0 Then dgvReportos.Rows(0).Cells("Valor Trasado").Value = txtMonto.Text txtMonto.Text = 0 End If End If End Sub Sub OcultarValoresImp() ChkIOF.Checked = False ChkRenta.Checked = False ChkRenta.Visible = False ChkIOF.Visible = False 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 Formato() If (String.IsNullOrEmpty(txtDias.Text.ToString)) Then txtDias.Text = 0 End If If (String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%"))) Then txtComisionCasa.Text = "0.2825%" End If If (String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.Trim("%"))) Then txtComisionBolsa.Text = "0.2825%" End If If txtComisionBolsa.Text.ToString.IndexOf("%") = -1 Then txtComisionBolsa.Text = txtComisionBolsa.Text.ToString + "%" End If If txtComisionCasa.Text.ToString.IndexOf("%") = -1 Then txtComisionCasa.Text = txtComisionCasa.Text.ToString + "%" End If If cboCasaCorredora.SelectedIndex = -1 Then Try cboCasaCorredora.SelectedIndex = 0 Catch ex As Exception End Try End If End Sub Sub IOFRentaEstado() Dim CantidadRegistro As Integer = dgvReportos.Rows.Count - 2 Dim EstadoImpIOF As Integer = 0 Dim EstadoImpRenta As Integer = 0 If ChkIOF.Checked Then EstadoImpIOF = 1 Else EstadoImpIOF = 0 End If If ChkRenta.Checked Then EstadoImpRenta = 1 Else EstadoImpRenta = 0 End If Dim i As Integer = 0 While i <= CantidadRegistro dgvReportos.Rows(i).Cells("EstadoIOF").Value = EstadoImpIOF dgvReportos.Rows(i).Cells("EstadoRenta").Value = EstadoImpRenta i += 1 End While End Sub Sub Calculos() Dim Cantidad As Integer = dgvReportos.Rows.Count - 2 Dim Index As Integer = 0 While Index <= Cantidad Dim FCompra As Date Dim VComisionCasa As Double = 0 Dim VComisionBolsa As Double = 0 FCompra = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString) VComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value.ToString) VComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value.ToString) FechaVen(FCompra, Index) ComisionCasa(VComisionCasa, Index) ComisionBolsa(VComisionBolsa, Index) IOF(Index) TotalCostos(Index) MontoLiquidacion(Index) InteresGenerar(Index) RendimientoAntes(Index) ValorRecompra(Index) Renta(Index) IngresoNeto(Index) ValorNeto(Index) RendimientoDespues(Index) Index += 1 End While End Sub Sub NuevaFila() Dim i As Integer = dgvReportos.CurrentRow.Index Dim IndexAnterior As Integer = dgvReportos.CurrentRow.Index - 1 If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Codigo").Value)) Then dgvReportos.Rows(i).Cells("Codigo").Value = Correlativo() End If If Not i = 0 Then If (Not String.IsNullOrEmpty(dgvReportos.Rows(IndexAnterior).Cells("EstadoIOF").Value)) Then dgvReportos.Rows(i).Cells("EstadoIOF").Value = dgvReportos.Rows(IndexAnterior).Cells("EstadoIOF").Value Else dgvReportos.Rows(i).Cells("EstadoIOF").Value = 0 End If If (Not String.IsNullOrEmpty(dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value)) Then dgvReportos.Rows(i).Cells("EstadoRenta").Value = dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value Else dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value = 0 End If End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor Trasado").Value)) Then dgvReportos.Rows(i).Cells("Valor Trasado").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Dias").Value)) Then dgvReportos.Rows(i).Cells("Dias").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Fecha de Vencimiento").Value)) Then Dim FechaVenc As String = Format(Date.Now.Date, "dd/MM/yyyy") dgvReportos.Rows(i).Cells("Fecha de Vencimiento").Value = FechaVenc End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Rendimiento").Value)) Then dgvReportos.Rows(i).Cells("Rendimiento").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("IOF").Value)) Then dgvReportos.Rows(i).Cells("IOF").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Comision CB").Value)) Then dgvReportos.Rows(i).Cells("Comision CB").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Comision Bolsa").Value)) Then dgvReportos.Rows(i).Cells("Comision Bolsa").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Otros Costos").Value)) Then dgvReportos.Rows(i).Cells("Otros Costos").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Total Costos").Value)) Then dgvReportos.Rows(i).Cells("Total Costos").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Monto a Liquidar").Value)) Then dgvReportos.Rows(i).Cells("Monto a Liquidar").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Interes a Genrerar").Value)) Then dgvReportos.Rows(i).Cells("Interes a Genrerar").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Costo de Transferencia").Value)) Then dgvReportos.Rows(i).Cells("Costo de Transferencia").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("R% Neto (Antes de Impuesto)").Value)) Then dgvReportos.Rows(i).Cells("R% Neto (Antes de Impuesto)").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor de ReCompra").Value)) Then dgvReportos.Rows(i).Cells("Valor de ReCompra").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value)) Then dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Ingreso Neto").Value)) Then dgvReportos.Rows(i).Cells("Ingreso Neto").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor Neto").Value)) Then dgvReportos.Rows(i).Cells("Valor Neto").Value = 0 End If If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("R% Neto (Despues de Impuesto)").Value)) Then dgvReportos.Rows(i).Cells("R% Neto (Despues de Impuesto)").Value = 0 End If End Sub Sub QuitarFila() 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 = dgvReportos.CurrentRow.Cells("codigo").Value If result = MsgBoxResult.Ok Then Try dgvReportos.Rows.Remove(dgvReportos.CurrentRow) ReportoConsula.Eliminar(codigo, Numero, Tabla) Catch ex As Exception MsgBox("No ha seleccionado una fila") End Try End If End Sub Sub FechaVen(ByVal FCompra As Date, ByVal Index As Integer) Dim FechaCompra As Date = FCompra Dim Dias As Integer = 0 Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString) dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value = CStr(Format(Reporto.FechaDeVencimiento(FechaCompra, Dias), "dd/MM/yyyy")) End Sub Sub CorrelativoSinBD() Dim Index As Integer = 0 Dim IndexCantidad As Integer = dgvReportos.Rows.Count - 2 Dim NumeroMayor As Integer = 0 While Index <= IndexCantidad dgvReportos.Rows(Index).Cells("Correlativo").Value = Index + 1 Index += 1 End While End Sub Function Correlativo() Dim Index As Integer = 0 Dim IndexCantidad As Integer = dgvReportos.Rows.Count - 2 Dim NumeroMayor As Integer = 0 While Index <= IndexCantidad Dim Numero As Integer = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("codigo").Value) If Numero > NumeroMayor Then NumeroMayor = Numero End If Index += 1 End While Return NumeroMayor + 1 End Function Sub CargarReporto(ByVal Tabla As String) Dim FechaVencimientoFormatoCadena As String Dim Activo = 0.0, ActivoRenta = 0.0 Dim EstadoIOF, EstadoRenta Dim dr = ReportoConsula.CargarReporto(Codigo, Tabla) Dim ValorTransado As Double = 0 Dim Rendimiento As Double = 0 Dim CostoTransferencia As Double = 0 Dim Nombre As String = String.Empty Dim FechaCompra As Date = Date.Now.Date Dim CasaCorredora As String = String.Empty Dim Correlativo As Integer = 0 If (Not dr Is Nothing) Then While dr.Read If dr("EstadoIOF") Then EstadoIOF = 1 ChkIOF.Checked = True Else EstadoIOF = 0 ChkIOF.Checked = False End If If dr("EstadoRenta") Then EstadoRenta = 1 ChkRenta.Checked = True Else EstadoRenta = 0 ChkRenta.Checked = False End If Dim FechaVencimiento As Date = Operaciones.ConvertirFecha(dr("FCompra").ToString) Dim Dias As Integer = Operaciones.ConvertirEntero(dr("Dias").ToString) FechaVencimiento = FechaVencimiento.AddDays(Dias) FechaVencimientoFormatoCadena = Format(FechaVencimiento, "dd/MM/yyyy") dtpFechaCompra.Value = Operaciones.ConvertirFecha(dr("FCompra").ToString) If (dr("IOF")) Then Activo = 1 Else Activo = 0 End If If (dr("Renta")) Then ActivoRenta = 1 Else ActivoRenta = 0 End If Dim ComisionCasa As Double = 0 Dim ComisionBolsa As Double = 0 ComisionCasa = Operaciones.ConvertirDecimal(dr("ComisionCasa").ToString) ComisionBolsa = Operaciones.ConvertirDecimal(dr("ComisionBolsa").ToString) ValorTransado = Operaciones.ConvertirDecimal(dr("ValTrans").ToString) CostoTransferencia = Operaciones.ConvertirDecimal(dr("CostoTransfr").ToString) Nombre = dr("Nombre").ToString FechaCompra = Operaciones.ConvertirFecha(dr("FCompra").ToString) CasaCorredora = dr("Casa").ToString Correlativo = Operaciones.ConvertirEntero(dr("codigo").ToString) If Tabla = "REP0VENTA" Then dgvReportos.Rows.Add("", ValorTransado, Dias, FechaVencimientoFormatoCadena, Rendimiento, 0, 0, 0, 0, 0, 0, 0, 0, 0, CostoTransferencia, ActivoRenta, "", "", "", Nombre, FechaCompra, ComisionCasa, ComisionBolsa, CasaCorredora, Correlativo, "", EstadoIOF, EstadoRenta) End If End While End If End Sub Function ObtenerDatos(ByVal Index As Integer) Dim coleccion As New Collection Dim Renta, IOF, Nombre, FCompra, ValTrans, Dias, FVenc, Rend, CostoTransfr, codigo, ComisionCasa, ComisionBolsa, Casa, Casa2 Dim EstadoIOF, EstadoRenta If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then Dim ComisionCasaValor, ComisionBolsaValor, IOFValor, OtrosCostos, TotalCostos, MontoLiq Dim IntGenerar, RendAntImp, RendDesImp, ImpLiq, IngrNet, ValorNet ValorNet = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Neto").Value.ToString) IngrNet = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString) ImpLiq = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value) RendDesImp = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value) RendAntImp = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value) IntGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value) MontoLiq = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value) TotalCostos = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value) OtrosCostos = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Otros Costos").Value) IOFValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("IOF").Value) ComisionBolsaValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value) ComisionCasaValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value) Nombre = dgvReportos.Rows(Index).Cells("Nombre").Value.ToString FCompra = Operaciones.ConvertirFechaBaseDatos(dgvReportos.Rows(Index).Cells("FCompra").Value) ValTrans = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value) FVenc = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value) Rend = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Rendimiento").Value) CostoTransfr = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value) codigo = dgvReportos.Rows(Index).Cells("Codigo").Value.ToString ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value) ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value) Casa = dgvReportos.Rows(Index).Cells("Casa").Value.ToString If (Not dgvReportos.Rows(Index).Cells("IOF").Value = 0) Then IOF = 1 Else IOF = 0 End If If (Not dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0) Then Renta = 1 Else Renta = 0 End If If (dgvReportos.Rows(Index).Cells("EstadoIOF").Value = 1) Then EstadoIOF = 1 Else EstadoIOF = 0 End If If (dgvReportos.Rows(Index).Cells("EstadoRenta").Value = 1) Then EstadoRenta = 1 Else EstadoRenta = 0 End If coleccion.Add(Nombre) coleccion.Add(FCompra) coleccion.Add(ValTrans) coleccion.Add(Dias) coleccion.Add(FVenc) coleccion.Add(Rend) coleccion.Add(CostoTransfr) coleccion.Add(codigo) coleccion.Add(ComisionCasa) coleccion.Add(ComisionBolsa) coleccion.Add(Casa) coleccion.Add(IOF) coleccion.Add(Renta) coleccion.Add(Base) coleccion.Add(ComisionCasaValor) coleccion.Add(ComisionBolsaValor) coleccion.Add(IOFValor) coleccion.Add(OtrosCostos) coleccion.Add(TotalCostos) coleccion.Add(MontoLiq) coleccion.Add(IntGenerar) coleccion.Add(RendAntImp) coleccion.Add(RendDesImp) coleccion.Add(ImpLiq) coleccion.Add(IngrNet) coleccion.Add(ValorNet) coleccion.Add(EstadoIOF) coleccion.Add(EstadoRenta) End If Return coleccion End Function 'GETS Private Sub dgvReportos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellEndEdit CorrelativoSinBD() Correlativo() Calculos() End Sub Private Sub dtpFechaCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaCompra.ValueChanged Formato() IngresarDatos() Modificado = True Calculos() End Sub Private Sub dgvReportos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellClick IOFRentaEstado() IngresarDatosReves() NuevaFila() Dim Index = Operaciones.ConvertirEntero(dgvReportos.CurrentRow.Cells("codigo").Value) CargarFecha() Calculos() Formato() End Sub Private Sub dgvReportos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellContentClick End Sub Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click End Sub Private Sub txtCodigoTitulo_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoTitulo.TextChanged Modificado = True End Sub Private Sub txtIOF_TextChanged(sender As Object, e As EventArgs) End Sub Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click btnAccion.Text = "Modificar" Estado = "M" End Sub Sub NuevoIngreso(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer, ByVal Tabla As String) Dim i As Integer = 0 Dim Index = dgvReportos.Rows.Count - 2 i = Cantidad While i <= Index Dim coleccion = ObtenerDatos(i) If ReportoConsula.Nuevo(coleccion, Codigo, Tabla) Is Nothing Then Exit Sub End If i += 1 End While MsgBox("Reportos actualizados") End Sub Function NuevoIngresoColeccion() Dim i As Integer = 0 Dim Index = dgvReportos.Rows.Count - 2 Dim diccionario As New Dictionary(Of String, Collection) While i <= Index Dim coleccion = ObtenerDatos(i) diccionario.Add(i, coleccion) i += 1 End While Return diccionario End Function Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click LlenarBase() Dim Codigo = Variables.Codigo Dim diccionario As Dictionary(Of String, Collection) = NuevoIngresoColeccion() If (Estado = "N") Then ReportoConsula.ProcesoDatos(diccionario, Codigo, Tabla) ValidarExistencia() ElseIf Not ExisteValidacion() Then Variables.ColeccionREPO = diccionario Me.Close() ElseIf (Estado = "M") Then ReportoConsula.ProcesoDatos(diccionario, Codigo, Tabla) ValidarExistencia() ElseIf (Estado = "B") Then QuitarFila() ValidarExistencia() End If End Sub Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click btnAccion.Text = "Agregar" Estado = "N" End Sub Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click btnAccion.Text = "Eliminar" Estado = "B" End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) End Sub Private Sub btnAgregarImpuesto_Click(sender As Object, e As EventArgs) End Sub Private Sub dgvImpuestos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) End Sub Private Sub TabPage3_Click(sender As Object, e As EventArgs) Handles TbImpuestos.Click End Sub Private Sub dgvImpuestoAgregado_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) End Sub Private Sub btnQuitar_Click(sender As Object, e As EventArgs) End Sub Private Sub FlpIOF_Click(sender As Object, e As EventArgs) Handles FlpIOF.Click End Sub Private Sub FlpIOF_MouseClick(sender As Object, e As MouseEventArgs) Handles FlpIOF.MouseClick End Sub Private Sub FlpIOF_ChangeUICues(sender As Object, e As UICuesEventArgs) Handles FlpIOF.ChangeUICues End Sub Private Sub FlpIOF_Paint(sender As Object, e As PaintEventArgs) Handles FlpIOF.Paint End Sub Private Sub txtComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionCasa.KeyPress If String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%")) Then If e.KeyChar = "." Then txtComisionCasa.Text = "0.0%" Exit Sub End If End If If (Not txtComisionCasa.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 txtComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionBolsa.KeyPress If String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.Trim("%")) Then If e.KeyChar = "." Then txtComisionBolsa.Text = "0.2825%" Exit Sub End If End If If (Not txtComisionBolsa.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 BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems End Sub Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged IngresarDatos() Modificado = True Calculos() End Sub Private Sub txtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged IngresarDatos() Modificado = True Calculos() End Sub Private Sub txtDias_TextChanged(sender As Object, e As EventArgs) Handles txtDias.TextChanged IngresarDatos() Modificado = True Calculos() End Sub Private Sub cboCasaCorredora_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasaCorredora.SelectedIndexChanged Modificado = True IngresarDatos() End Sub Private Sub txtCodigoTitulo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCodigoTitulo.KeyPress End Sub Private Sub txtDias_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDias.KeyPress If String.IsNullOrEmpty(txtDias.Text) Then If e.KeyChar = "." Then txtDias.Text = "0" Exit Sub End If End If If (Not txtDias.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 txtCodigoTitulo_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCodigoTitulo.KeyUp IngresarDatos() End Sub Private Sub txtComisionCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionCasa.KeyUp If txtComisionCasa.Text = "." Then txtComisionCasa.Text = ".0%" End If IngresarDatos() Calculos() End Sub Private Sub txtComisionBolsa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionBolsa.KeyUp If txtComisionBolsa.Text = "." Then txtComisionBolsa.Text = ".0%" End If IngresarDatos() Calculos() End Sub Sub ValidarExistencia() Dim General As New DAOGeneral Dim Codigo As String = Variables.Codigo Dim Tabla As String = String.Empty If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then Tabla = "REP0VENTA" ElseIf Variables.Codigo.IndexOf("REPO") > -1 Then Tabla = "REP0" End If 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 btnAccion.Text = "Aceptar" End Sub Function ExisteValidacion() Dim General As New DAOGeneral Dim Codigo As String = Variables.Codigo Dim Tabla As String = String.Empty If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then Tabla = "REP0VENTA" ElseIf Variables.Codigo.IndexOf("REPO") > -1 Then Tabla = "REP0" End If Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla) Return Existe End Function Private Sub btnGuardar_Click(sender As Object, e As EventArgs) End Sub Private Sub dgvReportos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvReportos.CellBeginEdit CorrelativoSinBD() Correlativo() End Sub Private Sub txtDias_KeyUp(sender As Object, e As KeyEventArgs) Handles txtDias.KeyUp If txtDias.Text = "." Then txtDias.Text = ".0" End If IngresarDatos() Calculos() End Sub Private Sub cboAnioBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBase.SelectedIndexChanged LlenarBase() IngresarDatos() Modificado = True Calculos() End Sub Private Sub txtDias_Leave(sender As Object, e As EventArgs) Handles txtDias.Leave Formato() End Sub Private Sub txtComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionCasa.Leave Formato() End Sub Private Sub txtComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtComisionBolsa.Leave Formato() End Sub Private Sub frmReporto_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize dgvReportos.Width = Me.Width - 10 dgvReportos.Height = Me.Height - 290 End Sub Private Sub ChkIOF_CheckedChanged(sender As Object, e As EventArgs) Handles ChkIOF.CheckedChanged IOFRentaEstado() Modificado = True IngresarDatos() Calculos() End Sub Private Sub ChkRenta_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRenta.CheckedChanged IOFRentaEstado() Modificado = True IngresarDatos() Calculos() End Sub Private Sub txtCodigoInstrumento_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoInstrumento.TextChanged IngresarDatos() Modificado = True Calculos() End Sub Sub SeleccionarInstrumento() Dim frmInstrumentos As New frmSeleccionTitulosReportos frmInstrumentos.Show() End Sub Private Sub btnSaldoDisponible_Click(sender As Object, e As EventArgs) SeleccionarInstrumento() End Sub Private Sub btnRequisicion_Click(sender As Object, e As EventArgs) End Sub Sub CargarTransladoNuevo() Dim Existe As Boolean = ExisteInversion() If Not RetCodigoInversionExiste And Not Existe Then If dgvReportos.Rows(0).Cells("Valor Trasado").Value = 0 Then dgvReportos.Rows(0).Cells("Valor Trasado").Value = Variables.RetMonto End If End If End Sub End Class