| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855 |
- Public Class frmDetallesPortafolioGeneralRendimiento
- Dim General As New DAOGeneral
- Dim Operaciones As New Operaciones
- Dim Rendimientos As New Rendimientos
- Dim dt As New DataTable
- Dim FinCargado As Boolean = False
- Dim ContinuarEmpresa As Boolean = True
- Dim ContinuarInstrumento As Boolean = True
- Dim Tipo 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
- Sub New(Tipo As String)
- Me.New
- Me.Tipo = Tipo
- 'Cargar(Tipo)
- End Sub
- Private Sub frmDetallesPortafolioGeneralRendimiento_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- CargarEmpresas()
- CargarInstrumento()
- CheckEmpresaTodos()
- CheckInstrumentoTodos()
- OcultarColumnas()
- FinCargado = True
- End Sub
- Sub CargarEmpresas()
- Dim dt As New DataTable
- dt = General.ListaEmpresas
- dt.Rows.Add("Todos", "Todos")
- chklEmpresas.DataSource = dt
- chklEmpresas.DisplayMember = "Descripcion"
- chklEmpresas.ValueMember = "Codigo"
- End Sub
- Sub CargarInstrumento()
- Dim dt As New DataTable
- dt = General.ListaInstrumentos("Propuesta")
- dt.Rows.Add("Todos", "Todos")
- chklInstrumentos.DataSource = dt
- chklInstrumentos.DisplayMember = "Descripcion"
- chklInstrumentos.ValueMember = "Codigo"
- End Sub
- Sub CheckEmpresaTodos()
- Dim Cantidad As Integer = chklEmpresas.Items.Count - 1
- Dim Index As Integer = 0
- While Index <= Cantidad
- chklEmpresas.SetItemChecked(Index, True)
- Index += 1
- End While
- End Sub
- Sub CheckInstrumentoTodos()
- Dim Cantidad As Integer = chklInstrumentos.Items.Count - 1
- Dim Index As Integer = 0
- While Index <= Cantidad
- chklInstrumentos.SetItemChecked(Index, True)
- Index += 1
- End While
- End Sub
- Sub Calcular(ByRef dtGeneral As DataTable, ByRef dtLista As DataTable, value As String, Index As Integer, e As ItemCheckEventArgs)
- If Tipo = "Empresa" Then
- Dim TituloCambio As String = String.Empty
- For Each Item As DataRowView In chklEmpresas.CheckedItems
- Dim valor1 As String = Item.Item(0).ToString
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor2 As String = rows("CodigoEmpresa").ToString
- If Not String.IsNullOrEmpty(valor1) And Not String.IsNullOrEmpty(valor2) Then
- If ((valor1 = valor2 And Not (valor1 = value) And Not valor2 = TituloCambio)) Then
- dtLista.Rows.Add(rows("CodigoEmpresa").ToString,
- rows("Empresa").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- ElseIf (Not valor1 = valor2 And valor2 = value And e.NewValue = CheckState.Checked) Then
- dtLista.Rows.Add(rows("CodigoEmpresa").ToString,
- rows("Empresa").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- TituloCambio = value
- value = String.Empty
- End If
- End If
- Next
- Next
- Dim CantidadCheck As Integer = chklEmpresas.CheckedItems.Count
- If CantidadCheck = 0 And e.NewValue = CheckState.Checked Then
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor3 As String = rows("CodigoEmpresa").ToString
- If valor3 = value Then
- dtLista.Rows.Add(rows("CodigoEmpresa").ToString,
- rows("Empresa").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- value = String.Empty
- End If
- Next
- End If
- ElseIf Tipo = "Instrumento" Then
- Dim TituloCambio As String = String.Empty
- For Each Item As DataRowView In chklInstrumentos.CheckedItems
- Dim valor1 As String = Item.Item(0).ToString
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor2 As String = rows("CodigoInstrumento").ToString
- If Not String.IsNullOrEmpty(valor1) And Not String.IsNullOrEmpty(valor2) Then
- If ((valor1 = valor2 And Not (valor1 = value) And Not valor2 = TituloCambio)) Then
- dtLista.Rows.Add(rows("CodigoInstrumento").ToString,
- rows("Instrumento").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- ElseIf (Not valor1 = valor2 And valor2 = value And e.NewValue = CheckState.Checked) Then
- dtLista.Rows.Add(rows("CodigoInstrumento").ToString,
- rows("Instrumento").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- TituloCambio = value
- value = String.Empty
- End If
- End If
- Next
- Next
- Dim CantidadCheck As Integer = chklInstrumentos.CheckedItems.Count
- If CantidadCheck = 0 And e.NewValue = CheckState.Checked Then
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor3 As String = rows("CodigoInstrumento").ToString
- If valor3 = value Then
- dtLista.Rows.Add(rows("CodigoInstrumento").ToString,
- rows("Instrumento").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- value = String.Empty
- End If
- Next
- End If
- ElseIf Tipo = "DescEmpresa" Then
- Dim ContarRepEmpresa As Integer = 0
- Dim Espr As Integer = 0
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor As String = rows("CodigoEmpresa").ToString
- If valor = value Then
- ContarRepEmpresa += 1
- End If
- Next
- Dim TituloCambio As String = String.Empty
- For Each Item As DataRowView In chklEmpresas.CheckedItems
- Dim valor1 As String = Item.Item(0).ToString
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor2 As String = rows("CodigoEmpresa").ToString
- If Not String.IsNullOrEmpty(valor1) And Not String.IsNullOrEmpty(valor2) Then
- If ((valor1 = valor2 And Not (valor1 = value) And Not valor2 = TituloCambio)) Then
- dtLista.Rows.Add(rows("CodigoEmpresa").ToString,
- rows("Empresa").ToString,
- rows("Instrumento").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- rows("CodigoEmpresaTotal").ToString,
- rows("RendimientoPromedio").ToString,
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- ElseIf (Not valor1 = valor2 And valor2 = value And e.NewValue = CheckState.Checked) Then
- dtLista.Rows.Add(rows("CodigoEmpresa").ToString,
- rows("Empresa").ToString,
- rows("Instrumento").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- rows("CodigoEmpresaTotal").ToString,
- rows("RendimientoPromedio").ToString,
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- Espr += 1
- If Espr >= ContarRepEmpresa Then
- TituloCambio = value
- value = String.Empty
- End If
- End If
- End If
- Next
- Next
- Dim CantidadCheck As Integer = chklEmpresas.CheckedItems.Count
- If CantidadCheck = 0 And e.NewValue = CheckState.Checked Then
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor3 As String = rows("CodigoEmpresa").ToString
- If valor3 = value Then
- dtLista.Rows.Add(rows("CodigoEmpresa").ToString,
- rows("Empresa").ToString,
- rows("Instrumento").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- rows("CodigoEmpresaTotal").ToString,
- rows("RendimientoPromedio").ToString,
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- Espr += 1
- If Espr >= ContarRepEmpresa Then
- value = String.Empty
- End If
- End If
- Next
- End If
- ElseIf Tipo = "DescInstrumento" Then
- Dim ContarRepInstrumento As Integer = 0
- Dim Espr As Integer = 0
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor As String = rows("CodigoInstrumento").ToString
- If valor = value Then
- ContarRepInstrumento += 1
- End If
- Next
- Dim TituloCambio As String = String.Empty
- For Each Item As DataRowView In chklInstrumentos.CheckedItems
- Dim valor1 As String = Item.Item(0).ToString
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor2 As String = rows("CodigoInstrumento").ToString
- If Not String.IsNullOrEmpty(valor1) And Not String.IsNullOrEmpty(valor2) Then
- If ((valor1 = valor2 And Not (valor1 = value) And Not valor2 = TituloCambio)) Then
- dtLista.Rows.Add(rows("CodigoInstrumento").ToString,
- rows("Instrumento").ToString,
- rows("Empresa").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- rows("CodigoInstrumentoTotal").ToString,
- rows("RendimientoPromedio").ToString,
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- ElseIf (Not valor1 = valor2 And valor2 = value And e.NewValue = CheckState.Checked) Then
- dtLista.Rows.Add(rows("CodigoInstrumento").ToString,
- rows("Instrumento").ToString,
- rows("Empresa").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- rows("CodigoInstrumentoTotal").ToString,
- rows("RendimientoPromedio").ToString,
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- Espr += 1
- If Espr >= ContarRepInstrumento Then
- TituloCambio = value
- value = String.Empty
- End If
- End If
- End If
- Next
- Next
- Dim CantidadCheck As Integer = chklInstrumentos.CheckedItems.Count
- If CantidadCheck = 0 And e.NewValue = CheckState.Checked Then
- For Each rows As DataRow In dtGeneral.Rows
- Dim valor3 As String = rows("CodigoInstrumento").ToString
- If valor3 = value Then
- dtLista.Rows.Add(rows("CodigoInstrumento").ToString,
- rows("Instrumento").ToString,
- rows("Empresa").ToString,
- Operaciones.ConvertirDecimal(rows("Rendimiento").ToString),
- Operaciones.ConvertirDecimal(rows("Monto").ToString),
- rows("CodigoInstrumentoTotal").ToString,
- rows("RendimientoPromedio").ToString,
- Operaciones.ConvertirDecimal(rows("Cantidad").ToString),
- Operaciones.ConvertirDecimal(rows("MontoTotal").ToString),
- Operaciones.ConvertirDecimal(rows("Peso").ToString))
- Espr += 1
- If Espr >= ContarRepInstrumento Then
- value = String.Empty
- End If
- End If
- Next
- End If
- End If
- End Sub
- Sub Cargar(Tipo As String, value As String, Index As Integer, e As ItemCheckEventArgs)
- Dim MontoTotal As Double = 0
- Dim RendimientoPromedio As Double = 0
- Dim PesoPromedio As Double = 0
- Dim CantidadRegistros As Integer = 0
- Dim dtListaEmpresa As New DataTable
- If Tipo = "Empresa" Then
- dtListaEmpresa.Columns.Add("CodigoEmpresa")
- dtListaEmpresa.Columns.Add("Empresa")
- dtListaEmpresa.Columns.Add("Rendimiento")
- dtListaEmpresa.Columns.Add("Cantidad")
- dtListaEmpresa.Columns.Add("Monto")
- dtListaEmpresa.Columns.Add("MontoTotal")
- dtListaEmpresa.Columns.Add("Peso")
- ElseIf Tipo = "Instrumento" Then
- dtListaEmpresa.Columns.Add("CodigoInstrumento")
- dtListaEmpresa.Columns.Add("Empresa")
- dtListaEmpresa.Columns.Add("Rendimiento")
- dtListaEmpresa.Columns.Add("Cantidad")
- dtListaEmpresa.Columns.Add("Monto")
- dtListaEmpresa.Columns.Add("MontoTotal")
- dtListaEmpresa.Columns.Add("Peso")
- ElseIf Tipo = "DescEmpresa" Then
- dtListaEmpresa.Columns.Add("CodigoEmpresa")
- dtListaEmpresa.Columns.Add("Empresa")
- dtListaEmpresa.Columns.Add("Instrumento")
- dtListaEmpresa.Columns.Add("Rendimiento")
- dtListaEmpresa.Columns.Add("Monto")
- dtListaEmpresa.Columns.Add("CodigoEmpresaTotal")
- dtListaEmpresa.Columns.Add("RendimientoPromedio")
- dtListaEmpresa.Columns.Add("Cantidad")
- dtListaEmpresa.Columns.Add("MontoTotal")
- dtListaEmpresa.Columns.Add("Peso")
- ElseIf Tipo = "DescInstrumento" Then
- dtListaEmpresa.Columns.Add("CodigoInstrumento")
- dtListaEmpresa.Columns.Add("Instrumento")
- dtListaEmpresa.Columns.Add("Empresa")
- dtListaEmpresa.Columns.Add("Rendimiento")
- dtListaEmpresa.Columns.Add("Monto")
- dtListaEmpresa.Columns.Add("CodigoInstrumentoTotal")
- dtListaEmpresa.Columns.Add("RendimientoPromedio")
- dtListaEmpresa.Columns.Add("Cantidad")
- dtListaEmpresa.Columns.Add("MontoTotal")
- dtListaEmpresa.Columns.Add("Peso")
- End If
- Dim dtGeneral As New DataTable
- If String.IsNullOrEmpty(Tipo) Then
- MsgBox("Error")
- Me.Close()
- Else
- If Tipo = "Empresa" Then
- lblInstrumentos.Visible = False
- chklInstrumentos.Visible = False
- If dtGeneral.Columns.Count = 0 Then
- dt = Rendimientos.CargarPortafolioGeneral(Tipo)
- End If
- dtGeneral = dt
- Calcular(dtGeneral, dtListaEmpresa, value, Index, e)
- dtGeneral = dtListaEmpresa
- For Each rows As DataRow In dtGeneral.Rows
- If Not (rows("Rendimiento")) Is Nothing Then
- rows("Rendimiento") = (rows("Rendimiento") * 100).ToString + " %"
- End If
- If Not (rows("Peso")) Is Nothing Then
- rows("Peso") = (rows("Peso") * 100).ToString + " %"
- End If
- Next
- ElseIf Tipo = "Instrumento" Then
- lblEmpresa.Visible = False
- chklEmpresas.Visible = False
- If dtGeneral.Columns.Count = 0 Then
- dt = Rendimientos.CargarPortafolioGeneral(Tipo)
- End If
- dtGeneral = dt
- Calcular(dtGeneral, dtListaEmpresa, value, Index, e)
- dtGeneral = dtListaEmpresa
- For Each rows As DataRow In dtGeneral.Rows
- If Not (rows("Rendimiento")) Is Nothing Then
- rows("Rendimiento") = (rows("Rendimiento") * 100).ToString + " %"
- End If
- If Not (rows("Peso")) Is Nothing Then
- rows("Peso") = (rows("Peso") * 100).ToString + " %"
- End If
- Next
- ElseIf Tipo = "DescEmpresa" Then
- lblInstrumentos.Visible = False
- chklInstrumentos.Visible = False
- If dtGeneral.Columns.Count = 0 Then
- dt = Rendimientos.CargarPortafolioGeneral(Tipo)
- End If
- dtGeneral = dt
- Calcular(dtGeneral, dtListaEmpresa, value, Index, e)
- dtGeneral = dtListaEmpresa
- For Each rows As DataRow In dtGeneral.Rows
- If Not (rows("Rendimiento") Is Nothing) Then
- rows("Rendimiento") = (rows("Rendimiento") * 100).ToString + " %"
- End If
- If Not (rows("Peso")) Is Nothing Then
- rows("Peso") = (rows("Peso") * 100).ToString + " %"
- End If
- If Not (rows("RendimientoPromedio")) Is Nothing Then
- rows("RendimientoPromedio") = (rows("RendimientoPromedio") * 100).ToString + " %"
- End If
- Next
- ElseIf Tipo = "DescInstrumento" Then
- lblEmpresa.Visible = False
- chklEmpresas.Visible = False
- If dtGeneral.Columns.Count = 0 Then
- dt = Rendimientos.CargarPortafolioGeneral(Tipo)
- End If
- dtGeneral = dt
- Calcular(dtGeneral, dtListaEmpresa, value, Index, e)
- dtGeneral = dtListaEmpresa
- For Each rows As DataRow In dtGeneral.Rows
- If Not (rows("Rendimiento") Is Nothing) Then
- rows("Rendimiento") = (rows("Rendimiento") * 100).ToString + " %"
- End If
- If Not (rows("Peso")) Is Nothing Then
- rows("Peso") = (rows("Peso") * 100).ToString + " %"
- End If
- If Not (rows("RendimientoPromedio")) Is Nothing Then
- rows("RendimientoPromedio") = (rows("RendimientoPromedio") * 100).ToString + " %"
- End If
- Next
- End If
- End If
- dgvPortafolio.DataSource = dtGeneral
- For Each rows As DataRow In dtGeneral.Rows
- If Not rows("Monto") Is Nothing Then
- MontoTotal += Operaciones.ConvertirDecimal(rows("Monto").ToString)
- End If
- Next
- CantidadRegistros = dtGeneral.Rows.Count
- For Each rows As DataRow In dtGeneral.Rows
- If Not rows("Rendimiento") Is Nothing Then
- RendimientoPromedio += (Operaciones.ConvertirDecimal(rows("Rendimiento").ToString) / 100)
- End If
- Next
- For Each rows As DataRow In dtGeneral.Rows
- If Not rows("Peso") Is Nothing Then
- PesoPromedio += (Operaciones.ConvertirDecimal(rows("Peso").ToString) / 100)
- End If
- Next
- txtMontoTotal.Text = MontoTotal
- If Not CantidadRegistros = 0 Then
- txtRendimientoPromedio.Text = (RendimientoPromedio / CantidadRegistros * 100).ToString + " %"
- txtPesoPromedio.Text = (PesoPromedio / CantidadRegistros * 100).ToString + " %"
- Else
- txtRendimientoPromedio.Text = 0.ToString + " %"
- txtPesoPromedio.Text = 0.ToString + " %"
- End If
- End Sub
- Sub OcultarColumnas()
- If Not dgvPortafolio.Columns("MontoTotal") Is Nothing Then
- dgvPortafolio.Columns("MontoTotal").Visible = False
- End If
- If Not dgvPortafolio.Columns("Cantidad") Is Nothing Then
- dgvPortafolio.Columns("Cantidad").Visible = False
- End If
- If Not dgvPortafolio.Columns("CodigoEmpresaTotal") Is Nothing Then
- dgvPortafolio.Columns("CodigoEmpresaTotal").Visible = False
- End If
- If Not dgvPortafolio.Columns("CodigoInstrumentoTotal") Is Nothing Then
- dgvPortafolio.Columns("CodigoInstrumentoTotal").Visible = False
- End If
- If Not dgvPortafolio.Columns("RendimientoTotal") Is Nothing Then
- dgvPortafolio.Columns("RendimientoTotal").Visible = False
- End If
- If Not dgvPortafolio.Columns("CodigoEmpresa") Is Nothing Then
- dgvPortafolio.Columns("CodigoEmpresa").Visible = False
- End If
- If Not dgvPortafolio.Columns("CodigoInstrumento") Is Nothing Then
- dgvPortafolio.Columns("CodigoInstrumento").Visible = False
- End If
- End Sub
- Sub QuitarEmpresas(Value As String, Indice As Integer, e As ItemCheckEventArgs)
- Dim Cantidad As Integer = chklEmpresas.Items.Count - 1
- Dim CantidadSeleccionados = chklEmpresas.CheckedItems.Count - 1
- If Value = "Todos" And e.NewValue = CheckState.Checked Then
- Dim Index As Integer = 0
- While Index <= Cantidad
- chklEmpresas.SetItemChecked(Index, True)
- Index += 1
- End While
- ElseIf Value = "Todos" And Not e.NewValue = CheckState.Checked Then
- Dim Index As Integer = 0
- While Index <= Cantidad
- chklEmpresas.SetItemChecked(Index, False)
- Index += 1
- End While
- Else
- Dim JIndex As Integer = 0
- Dim TodosCheck As Boolean = False
- While JIndex <= Cantidad
- If chklEmpresas.GetItemText(chklEmpresas.Items(JIndex)) = "Todos" Then
- If chklEmpresas.GetItemChecked(JIndex) Then
- TodosCheck = True
- End If
- End If
- JIndex += 1
- End While
- If e.NewValue = CheckState.Unchecked Then
- CantidadSeleccionados -= 1
- Else
- CantidadSeleccionados += 2
- End If
- If CantidadSeleccionados < Cantidad And TodosCheck Then
- Dim Index As Integer = 0
- While Index <= Cantidad
- If chklEmpresas.GetItemText(chklEmpresas.Items(Index)) = "Todos" Then
- chklEmpresas.SetItemChecked(Index, False)
- End If
- Index += 1
- End While
- ElseIf CantidadSeleccionados = Cantidad Then
- e.NewValue = CheckState.Checked
- CheckEmpresaTodos()
- End If
- End If
- End Sub
- Sub QuitarInstrumento(Value As String, Indice As Integer, e As ItemCheckEventArgs)
- Dim Cantidad As Integer = chklInstrumentos.Items.Count - 1
- Dim CantidadSeleccionados = chklInstrumentos.CheckedItems.Count - 1
- If Value = "Todos" And e.NewValue = CheckState.Checked Then
- Dim Index As Integer = 0
- While Index <= Cantidad
- chklInstrumentos.SetItemChecked(Index, True)
- Index += 1
- End While
- ElseIf Value = "Todos" And Not e.NewValue = CheckState.Checked Then
- Dim Index As Integer = 0
- While Index <= Cantidad
- chklInstrumentos.SetItemChecked(Index, False)
- Index += 1
- End While
- Else
- Dim JIndex As Integer = 0
- Dim TodosCheck As Boolean = False
- While JIndex <= Cantidad
- If chklInstrumentos.GetItemText(chklInstrumentos.Items(JIndex)) = "Todos" Then
- If chklInstrumentos.GetItemChecked(JIndex) Then
- TodosCheck = True
- End If
- End If
- JIndex += 1
- End While
- If e.NewValue = CheckState.Unchecked Then
- CantidadSeleccionados -= 1
- Else
- CantidadSeleccionados += 2
- End If
- If CantidadSeleccionados < Cantidad And TodosCheck Then
- Dim Index As Integer = 0
- While Index <= Cantidad
- If chklInstrumentos.GetItemText(chklInstrumentos.Items(Index)) = "Todos" Then
- chklInstrumentos.SetItemChecked(Index, False)
- End If
- Index += 1
- End While
- ElseIf CantidadSeleccionados = Cantidad Then
- e.NewValue = CheckState.Checked
- CheckInstrumentoTodos()
- End If
- End If
- End Sub
- Private Sub chklEmpresas_ItemCheck(sender As Object, e As ItemCheckEventArgs) Handles chklEmpresas.ItemCheck
- If ContinuarEmpresa Then
- ContinuarEmpresa = False
- If FinCargado Then
- QuitarEmpresas(chklEmpresas.SelectedValue.ToString, chklEmpresas.SelectedIndex, e)
- End If
- Cargar(Tipo, chklEmpresas.SelectedValue.ToString, chklEmpresas.SelectedIndex, e)
- ContinuarEmpresa = True
- End If
- End Sub
- Private Sub chklEmpresas_SelectedIndexChanged(sender As Object, e As EventArgs) Handles chklEmpresas.SelectedIndexChanged
- End Sub
- Private Sub chklEmpresas_EnabledChanged(sender As Object, e As EventArgs) Handles chklEmpresas.EnabledChanged
- End Sub
- Private Sub chklEmpresas_MouseCaptureChanged(sender As Object, e As EventArgs) Handles chklEmpresas.MouseCaptureChanged
- End Sub
- Private Sub chklEmpresas_Click(sender As Object, e As EventArgs) Handles chklEmpresas.Click
- End Sub
- Private Sub chklEmpresas_RegionChanged(sender As Object, e As EventArgs) Handles chklEmpresas.RegionChanged
- End Sub
- Private Sub chklEmpresas_SelectedValueChanged(sender As Object, e As EventArgs) Handles chklEmpresas.SelectedValueChanged
- End Sub
- Private Sub chklEmpresas_CausesValidationChanged(sender As Object, e As EventArgs) Handles chklEmpresas.CausesValidationChanged
- End Sub
- Private Sub chklEmpresas_BackColorChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub chklEmpresas_BindingContextChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub chklEmpresas_FormattingEnabledChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub chklEmpresas_TabIndexChanged(sender As Object, e As EventArgs) Handles chklEmpresas.TabIndexChanged
- End Sub
- Private Sub chklInstrumentos_ItemCheck(sender As Object, e As ItemCheckEventArgs) Handles chklInstrumentos.ItemCheck
- If ContinuarInstrumento Then
- ContinuarInstrumento = False
- If FinCargado Then
- QuitarInstrumento(chklInstrumentos.SelectedValue.ToString, chklInstrumentos.SelectedIndex, e)
- End If
- Cargar(Tipo, chklInstrumentos.SelectedValue.ToString, chklInstrumentos.SelectedIndex, e)
- ContinuarInstrumento = True
- End If
- End Sub
- Private Sub txtRendimientoPromedio_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoPromedio.TextChanged
- End Sub
- End Class
|