| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257 |
- Public Class frmRendimientoFiltro
- Private Rendimiento As New Rendimientos
- Dim Operaciones As New Operaciones
- Dim MontoACC As String = String.Empty
- Dim MontoLET As String = String.Empty
- Dim MontoCET As String = String.Empty
- Dim MontoPBUR As String = String.Empty
- Dim MontoVCN As String = String.Empty
- Dim MontoBON As String = String.Empty
- Dim MontoCINV As String = String.Empty
- Dim MontoEURB As String = String.Empty
- Dim MontoTIT As String = String.Empty
- Dim MontoDAP As String = String.Empty
- Dim MontoFUT As String = String.Empty
- Dim MontoOPC As String = String.Empty
- Dim MontoPPER As String = String.Empty
- Dim MontoPEMP As String = String.Empty
- Dim MontoREP As String = String.Empty
- Dim Lista As String = String.Empty
- Dim ListaEmpresa As String = String.Empty
- Dim ListaInstrumentos As String = String.Empty
- Dim ListaNacionalidad As String = String.Empty
- Dim ListaEstado As String = String.Empty
- Dim ListaVigencia As String = String.Empty
- Dim ListaTipoRenta As String = String.Empty
- Dim ListaAgrupada As String = String.Empty
- Private TipoFecha As String = "N"
- Private SoloFecha As Date = Date.Now.Date
- Private FechaInicial As Date = Date.Now.Date
- Private FechaFinal As Date = Date.Now.Date
- Private Portafolio As String = "Activo"
- Private chk_PortafolioSinRenta As String = "Activo"
- Private rdb_VerRendimiento As String = "Todos"
- Private NuevoCheckEmpresa As Boolean = True
- Private Sub lblTitulo_Click(sender As Object, e As EventArgs) Handles lblTitulo.Click
- End Sub
- Private Sub CheckBox6_CheckedChanged(sender As Object, e As EventArgs) Handles chkPortafolioSinRenta.CheckedChanged
- If chkPortafolioSinRenta.Checked Then
- chk_PortafolioSinRenta = "Activo"
- Else
- chk_PortafolioSinRenta = "Desactivo"
- End If
- End Sub
- Sub CargarDatos()
- Dim dt As New DataTable
- ActualizarListas()
- dt = Rendimiento.TraerRendimientos(TipoFecha, FechaInicial, FechaFinal, ListaEmpresa, ListaInstrumentos, ListaTipoRenta, ListaNacionalidad, ListaVigencia, ListaEstado, SoloFecha, Lista)
- CalcularCamposGenerales(dt)
- AgregarPorcentajeRendGeneral(dt)
- dgvRendimientos.DataSource = dt
- OcultarColumnas()
- End Sub
- Sub AgregarPorcentajeRendGeneral(ByRef dt As DataTable)
- For Each rows As DataRow In dt.Rows
- If Not dt.Columns("Rendimientos") Is Nothing Then
- rows("Rendimientos") = (Operaciones.ConvertirDecimal(rows("Rendimientos").ToString) * 100).ToString + " %"
- End If
- If Not dt.Columns("Peso") Is Nothing Then
- rows("Peso") = (Operaciones.ConvertirDecimal(rows("Peso").ToString) * 100).ToString + " %"
- End If
- If Not dt.Columns("RendimientoActual") Is Nothing Then
- rows("RendimientoActual") = (Operaciones.ConvertirDecimal(rows("RendimientoActual").ToString) * 100).ToString + " %"
- End If
- Next
- End Sub
- Sub CalcularCamposGenerales(ByRef dt As DataTable)
- Dim MontoInversion As Double = 0
- Dim Rendimiento As Double = 0
- Dim Peso As Double = 0
- Dim RendimientoSumaProducto As Double = 0
- Dim SumaProducto As Double = 0
- For Each rows As DataRow In dt.Rows
- MontoInversion += Operaciones.ConvertirDecimal(rows("Monto").ToString)
- Rendimiento += Operaciones.ConvertirDecimal(rows("Rendimientos").ToString)
- RendimientoSumaProducto = Operaciones.ConvertirDecimal(rows("Rendimientos").ToString)
- Peso = Operaciones.ConvertirDecimal(rows("Peso").ToString)
- SumaProducto += RendimientoSumaProducto * Peso
- Next
- txtPortTotal.Text = MontoInversion
- txtRendimientos.Text = (Rendimiento * 100).ToString + " %"
- txtRendSumaProducto.Text = (SumaProducto * 100).ToString + " %"
- End Sub
- Function EmpresaSeleccionada(ByVal NombreEmpresa As String)
- Dim xCheckBox As New Control
- Dim Activa As Boolean = False
- For Each xCheckBox In Me.flpEmpresa.Controls
- If TypeOf xCheckBox Is CheckBox Then
- If xCheckBox.Name = NombreEmpresa Then
- If xCheckBox.BackColor.Name.ToString = "ffeaeae8" Then
- Activa = True
- Else
- Activa = False
- End If
- End If
- End If
- Next
- Return Activa
- End Function
- Function InstrumentosSeleccionados(ByVal NombreInstrumentos As String)
- Dim xCheckBox As New Control
- Dim Activa As Boolean = False
- For Each xCheckBox In Me.flpInstrumento.Controls
- If TypeOf xCheckBox Is CheckBox Then
- If xCheckBox.Name = NombreInstrumentos Then
- If xCheckBox.BackColor.Name.ToString = "ffeaeae8" Then
- Activa = True
- Else
- Activa = False
- End If
- End If
- End If
- Next
- Return Activa
- End Function
- Function EstadoInternacionales(ByRef NombrePais As String)
- Dim Paises As String = "Todos"
- Dim Activo As Boolean = False
- If rdbInternacionales.Checked Then
- Paises = "Intl"
- ElseIf rdbNacionales.Checked Then
- Paises = "SV"
- Else
- Paises = "Todos"
- End If
- If Paises = "Intl" Then
- If NombrePais = "SV" Then
- Activo = False
- Else
- Activo = True
- End If
- ElseIf Paises = "SV" Then
- If NombrePais = "SV" Then
- Activo = True
- Else
- Activo = False
- End If
- ElseIf Paises = "Todos" Then
- Activo = True
- End If
- Return Activo
- End Function
- Function CalculoActivo(ByVal MontoValor As Double)
- Dim MontoTotal As Double = 0
- Dim ValidarMonto As Double = 0
- Dim Total As Double = 0
- If String.IsNullOrEmpty(txtPortTotal.Text) Then
- MontoTotal = txtPortTotal.Text
- End If
- If String.IsNullOrEmpty(MontoValor) Then
- ValidarMonto = MontoValor
- End If
- Total = MontoTotal + ValidarMonto
- Return Total
- End Function
- Private Sub frmRendimientoTotal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- TipoRendimiento()
- AgregarCheckboxEmpresa()
- AgregarCheckboxInstrumento()
- CargarDatos()
- End Sub
- Sub AgregarCheckboxEmpresa()
- Dim diccionario As New Dictionary(Of String, String)
- diccionario = Rendimiento.Empresas
- For Each Empresa In diccionario
- Dim Empre As New CheckBox
- Dim Existe As Boolean = False
- Dim NombreEmpresa = Empresa.Value
- For Each item As CheckBox In flpEmpresa.Controls
- If item.Text.ToString = NombreEmpresa.ToString Then
- Existe = True
- End If
- Next
- If Not Existe Then
- Empre.Name = Empresa.Key
- Empre.Checked = True
- Empre.Width = 250
- Empre.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Empre.Text = NombreEmpresa
- flpEmpresa.Controls.Add(Empre)
- AddHandler Empre.Click, AddressOf eventoEmpresa
- AddHandler Empre.CheckedChanged, AddressOf ColoreventoEmpresa
- End If
- Existe = False
- Next
- Dim Empres As New CheckBox
- Empres.Name = "TodosEmpresa"
- Empres.Checked = True
- Empres.Width = 250
- Empres.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Empres.Text = "Todos las Empresas"
- flpEmpresa.Controls.Add(Empres)
- AddHandler Empres.Click, AddressOf eventoEmpresa
- AddHandler Empres.CheckedChanged, AddressOf ColoreventoEmpresa
- End Sub
- Sub AgregarCheckboxInstrumento()
- Dim diccionario As New Dictionary(Of String, String)
- diccionario = Rendimiento.Instrumentos
- For Each Instrumento In diccionario
- Dim Ins As New CheckBox
- Dim Existe As Boolean = False
- Dim NombreInstrumento = Instrumento.Value
- For Each item As CheckBox In flpInstrumento.Controls
- If item.Text.ToString = NombreInstrumento.ToString Then
- Existe = True
- End If
- Next
- If Not Existe Then
- Ins.Name = Instrumento.Key
- Ins.Checked = True
- Ins.Width = 250
- Ins.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Ins.Text = NombreInstrumento
- flpInstrumento.Controls.Add(Ins)
- AddHandler Ins.Click, AddressOf eventoInstrumento
- AddHandler Ins.CheckedChanged, AddressOf ColoreventoInstrumento
- End If
- Existe = False
- Next
- Dim Insi As New CheckBox
- Insi.Name = "TodosInstrumentos"
- Insi.Checked = True
- Insi.Width = 250
- Insi.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Insi.Text = "Todos los Instrumentos"
- flpInstrumento.Controls.Add(Insi)
- AddHandler Insi.Click, AddressOf eventoInstrumento
- AddHandler Insi.CheckedChanged, AddressOf ColoreventoInstrumento
- End Sub
- Sub eventoEmpresa(sender As Object, e As EventArgs)
- If sender.name = "TodosEmpresa" Then
- CambioCheckTodosEmpresa()
- Else
- TodosCheckEmpresa(sender, e)
- End If
- End Sub
- Sub eventoInstrumento(sender As Object, e As EventArgs)
- If sender.name = "TodosInstrumentos" Then
- CambioCheckTodosinstrumentos()
- Else
- TodosCheckInstrumentos(sender, e)
- End If
- End Sub
- Sub ColoreventoEmpresa(sender As Object, e As EventArgs)
- If (sender.checked) Then
- sender.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Else
- sender.BackColor = ColorTranslator.FromHtml("Transparent")
- End If
- End Sub
- Sub ColoreventoInstrumento(sender As Object, e As EventArgs)
- If (sender.checked) Then
- sender.BackColor = ColorTranslator.FromHtml("#EAEAE8")
- Else
- sender.BackColor = ColorTranslator.FromHtml("Transparent")
- End If
- End Sub
- Sub CambioCheckTodosEmpresa()
- Dim ContadorPrimario As Integer = Me.flpEmpresa.Controls.Count - 1
- Dim UltimoCheck As Boolean = True
- For Each xCheckBox In Me.flpEmpresa.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- If xCheckBox.TabIndex = ContadorPrimario Then
- If Not yCheckBox.Checked Then
- UltimoCheck = False
- End If
- End If
- End If
- Next
- If UltimoCheck Then
- For Each xCheckBox In Me.flpEmpresa.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- yCheckBox.Checked = True
- End If
- Next
- ElseIf Not UltimoCheck Then
- For Each xCheckBox In Me.flpEmpresa.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- yCheckBox.Checked = False
- End If
- Next
- End If
- End Sub
- Sub TodosCheckEmpresa(sender As Object, e As EventArgs)
- Dim ContadorPrimario As Integer = Me.flpEmpresa.Controls.Count - 1
- Dim TodosCheck As Boolean = True
- If Not sender.name = "TodosEmpresa" Then
- For Each xCheckBox In Me.flpEmpresa.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- If Not yCheckBox.TabIndex = ContadorPrimario Then
- If Not yCheckBox.Checked Then
- TodosCheck = False
- End If
- End If
- If yCheckBox.TabIndex = ContadorPrimario Then
- If Not TodosCheck Then
- yCheckBox.Checked = False
- Else
- yCheckBox.Checked = True
- End If
- End If
- End If
- Next
- End If
- End Sub
- ''''''''Instrumentos ''''''''''
- Sub CambioCheckTodosinstrumentos()
- Dim ContadorPrimario As Integer = Me.flpInstrumento.Controls.Count - 1
- Dim UltimoCheck As Boolean = True
- For Each xCheckBox In Me.flpInstrumento.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- If xCheckBox.TabIndex = ContadorPrimario Then
- If Not yCheckBox.Checked Then
- UltimoCheck = False
- End If
- End If
- End If
- Next
- If UltimoCheck Then
- For Each xCheckBox In Me.flpInstrumento.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- yCheckBox.Checked = True
- End If
- Next
- ElseIf Not UltimoCheck Then
- For Each xCheckBox In Me.flpInstrumento.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- yCheckBox.Checked = False
- End If
- Next
- End If
- End Sub
- Sub TodosCheckInstrumentos(sender As Object, e As EventArgs)
- Dim ContadorPrimario As Integer = Me.flpInstrumento.Controls.Count - 1
- Dim TodosCheck As Boolean = True
- If Not sender.name = "TodosInstrumentos" Then
- For Each xCheckBox In Me.flpInstrumento.Controls
- If TypeOf xCheckBox Is CheckBox Then
- Dim yCheckBox As New CheckBox
- yCheckBox = xCheckBox
- If Not yCheckBox.TabIndex = ContadorPrimario Then
- If Not yCheckBox.Checked Then
- TodosCheck = False
- End If
- End If
- If yCheckBox.TabIndex = ContadorPrimario Then
- If Not TodosCheck Then
- yCheckBox.Checked = False
- Else
- yCheckBox.Checked = True
- End If
- End If
- End If
- Next
- End If
- End Sub
- Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles rdbAmbosRenta.CheckedChanged
- End Sub
- Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub rdbFecha_CheckedChanged(sender As Object, e As EventArgs) Handles rdbFecha.CheckedChanged
- If rdbFecha.Checked Then
- SoloFecha = dtpFecha.Value
- TipoFecha = "F"
- Else
- TipoFecha = "N"
- End If
- End Sub
- Private Sub rdbRangoFechas_CheckedChanged(sender As Object, e As EventArgs) Handles rdbRangoFechas.CheckedChanged
- If rdbRangoFechas.Checked Then
- TipoFecha = "FR"
- FechaInicial = dtpFechaInicial.Value
- FechaFinal = dtpFechaFinal.Value
- Else
- TipoFecha = "N"
- End If
- End Sub
- Private Sub rdbDeshabilitarFecha_CheckedChanged(sender As Object, e As EventArgs) Handles rdbDeshabilitarFecha.CheckedChanged
- If rdbDeshabilitarFecha.Checked Then
- TipoFecha = "N"
- End If
- End Sub
- Private Sub flpInstrumento_Paint(sender As Object, e As PaintEventArgs) Handles flpInstrumento.Paint
- End Sub
- Private Sub chkPortafolio_CheckedChanged(sender As Object, e As EventArgs) Handles chkPortafolio.CheckedChanged
- If chkPortafolio.Checked Then
- Portafolio = "Activo"
- Else
- Portafolio = "Desactivo"
- End If
- End Sub
- Private Sub chkPortafolioSinLiquidez_CheckedChanged(sender As Object, e As EventArgs) Handles chkPortafolioSinLiquidez.CheckedChanged
- End Sub
- Private Sub rdbVariable_CheckedChanged(sender As Object, e As EventArgs) Handles rdbVariable.CheckedChanged
- End Sub
- Private Sub rdbFija_CheckedChanged(sender As Object, e As EventArgs) Handles rdbFija.CheckedChanged
- End Sub
- Private Sub chkInternacional_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub chkVigentes_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub rdbPendientes_CheckedChanged(sender As Object, e As EventArgs) Handles rdbPendientes.CheckedChanged
- End Sub
- Private Sub rdbAprobado_CheckedChanged(sender As Object, e As EventArgs) Handles rdbAprobado.CheckedChanged
- End Sub
- Private Sub rdbRechazado_CheckedChanged(sender As Object, e As EventArgs) Handles rdbRechazado.CheckedChanged
- End Sub
- Private Sub rdbPAR_CheckedChanged(sender As Object, e As EventArgs) Handles rdbTodosEstado.CheckedChanged
- End Sub
- Private Sub rdbEmpresas_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub rdbInstrumento_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub rdbTiempo_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub rdbTEI_CheckedChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvRendimientos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvRendimientos.CellContentClick
- End Sub
- Private Sub TbRendimientos_Click(sender As Object, e As EventArgs) Handles TbRendimientoGeneral.Click
- End Sub
- Private Sub TbcRendimiento_TabIndexChanged(sender As Object, e As EventArgs) Handles TbcRendimiento.TabIndexChanged
- End Sub
- Private Sub TbcRendimiento_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TbcRendimiento.SelectedIndexChanged
- If rdbRendimientoGeneral.Checked Then
- If TbcRendimiento.SelectedIndex = 1 Then
- BloqueoPortafolio()
- CargarDatos()
- End If
- Else
- If TbcRendimiento.SelectedIndex = 1 Then
- BloqueoPortafolio()
- RendimientoMensual()
- End If
- End If
- End Sub
- Private Sub BloqueoPortafolio()
- If Portafolio = "Desactivo" Then
- lblPortTotal.Visible = False
- txtPortTotal.Visible = False
- Else
- lblPortTotal.Visible = True
- txtPortTotal.Visible = True
- End If
- End Sub
- Sub RendimientoMensual()
- Dim dt As New DataTable
- Dim TipoRendimiento As String = "Mensual"
- Dim Fecha1 As Date = dtpFechaInicialDiario.Value
- Dim Fecha2 As Date = dtpFechaFinalDiario.Value
- Dim Agrupado As String = String.Empty
- ActualizarListas()
- If String.IsNullOrEmpty(ListaAgrupada) Then
- Agrupado = "NO"
- Else
- Agrupado = "SI"
- End If
- dt = Rendimiento.CargarRendimientoDiario(Fecha1, Fecha2, TipoRendimiento, ListaEmpresa, ListaInstrumentos, ListaNacionalidad, ListaEstado,
- ListaVigencia, ListaTipoRenta, ListaAgrupada, Agrupado)
- AgregarPorcentajeRend(dt)
- dgvRendimientoMensual.DataSource = dt
- End Sub
- Sub AgregarPorcentajeRend(ByRef dt As DataTable)
- For Each rows As DataRow In dt.Rows
- rows("RendimientoTotal") = (Operaciones.ConvertirDecimal(rows("RendimientoTotal").ToString) * 100).ToString + " %"
- Next
- End Sub
- Sub AgregarPorcentajeRendDetalles(ByRef dt As DataTable)
- For Each rows As DataRow In dt.Rows
- If Not dt.Columns("Rendimiento") Is Nothing Then
- rows("Rendimiento") = (Operaciones.ConvertirDecimal(rows("Rendimiento").ToString) * 100).ToString + " %"
- End If
- If Not dt.Columns("RendimientoTotal") Is Nothing Then
- rows("RendimientoTotal") = (Operaciones.ConvertirDecimal(rows("RendimientoTotal").ToString) * 100).ToString + " %"
- End If
- If Not dt.Columns("Peso") Is Nothing Then
- rows("Peso") = (Operaciones.ConvertirDecimal(rows("Peso").ToString) * 100).ToString + " %"
- End If
- If Not dt.Columns("RendimientoPeso") Is Nothing Then
- rows("RendimientoPeso") = (Operaciones.ConvertirDecimal(rows("RendimientoPeso").ToString) * 100).ToString + " %"
- End If
- If Not dt.Columns("RendimientoGrupo") Is Nothing Then
- rows("RendimientoGrupo") = (Operaciones.ConvertirDecimal(rows("RendimientoGrupo").ToString) * 100).ToString + " %"
- End If
- Next
- End Sub
- Sub RendimientoDetalles()
- Dim dt As New DataTable
- Dim TipoRendimiento As String = "Detalles"
- ActualizarListas()
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- Dim FechaAux As Date = Date.Now.Date
- Dim Agrupado As String = String.Empty
- Dim FechaInicial As Date = dtpFechaInicialDiario.Value
- Dim FechaFinal As Date = dtpFechaFinalDiario.Value
- If String.IsNullOrEmpty(ListaAgrupada) Then
- Agrupado = "NO"
- Else
- Agrupado = "SI"
- End If
- If rdbRendMensual.Checked Then
- If Not dgvRendimientoMensual.CurrentRow Is Nothing Then
- If String.IsNullOrEmpty(ListaAgrupada) Then
- Agrupado = "NO"
- Else
- Agrupado = "SI"
- End If
- If Not dgvRendimientoMensual.CurrentRow Is Nothing Then
- FechaAux = dgvRendimientoMensual.CurrentRow.Cells("FechaUltima").Value
- If FechaInicial.Month = FechaAux.Month And FechaInicial.Year = FechaAux.Year Then
- Fecha1 = FechaInicial
- Else
- Fecha1 = CDate("1/" + FechaAux.Month.ToString + "/" + FechaAux.Year.ToString)
- End If
- If FechaFinal.Month = FechaAux.Month And FechaFinal.Year = FechaAux.Year Then
- Fecha2 = FechaFinal
- Else
- Fecha2 = FechaAux
- End If
- End If
- dt = Rendimiento.CargarRendimientoDiario(Fecha1, Fecha2, TipoRendimiento, ListaEmpresa, ListaInstrumentos, ListaNacionalidad, ListaEstado,
- ListaVigencia, ListaTipoRenta, ListaAgrupada, Agrupado)
- AgregarPorcentajeRendDetalles(dt)
- dgvRendimientoDetalles.DataSource = dt
- Else
- MsgBox("Error al Cargar Registros")
- End If
- Else
- If Not dgvRendimientoDiario.CurrentRow Is Nothing Then
- FechaAux = dgvRendimientoDiario.CurrentRow.Cells("FechaIterada").Value
- Fecha1 = FechaAux
- Fecha2 = FechaAux
- dt = Rendimiento.CargarRendimientoDiario(Fecha1, Fecha2, TipoRendimiento, ListaEmpresa, ListaInstrumentos, ListaNacionalidad, ListaEstado,
- ListaVigencia, ListaTipoRenta, ListaAgrupada, Agrupado)
- AgregarPorcentajeRendDetalles(dt)
- dgvRendimientoDetalles.DataSource = dt
- Else
- MsgBox("Error al Cargar Registros")
- End If
- End If
- End Sub
- Sub RendimientoDiario()
- Dim dt As New DataTable
- Dim TipoRendimiento As String = "Diario"
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- Dim FechaAux As Date = Date.Now.Date
- Dim Agrupado As String = String.Empty
- Dim FechaInicial As Date = dtpFechaInicialDiario.Value
- Dim FechaFinal As Date = dtpFechaFinalDiario.Value
- If String.IsNullOrEmpty(ListaAgrupada) Then
- Agrupado = "NO"
- Else
- Agrupado = "SI"
- End If
- If Not dgvRendimientoMensual.CurrentRow Is Nothing Then
- FechaAux = dgvRendimientoMensual.CurrentRow.Cells("FechaUltima").Value
- If FechaInicial.Month = FechaAux.Month And FechaInicial.Year = FechaAux.Year Then
- Fecha1 = FechaInicial
- Else
- Fecha1 = CDate("1/" + FechaAux.Month.ToString + "/" + FechaAux.Year.ToString)
- End If
- If FechaFinal.Month = FechaAux.Month And FechaFinal.Year = FechaAux.Year Then
- Fecha2 = FechaFinal
- Else
- Fecha2 = FechaAux
- End If
- dt = Rendimiento.CargarRendimientoDiario(Fecha1, Fecha2, TipoRendimiento, ListaEmpresa, ListaInstrumentos, ListaNacionalidad, ListaEstado,
- ListaVigencia, ListaTipoRenta, ListaAgrupada, Agrupado)
- AgregarPorcentajeRend(dt)
- dgvRendimientoDiario.DataSource = dt
- Else
- MsgBox("Error al Cargar Registros")
- End If
- End Sub
- Private Sub dtpFechaInicial_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaInicial.ValueChanged
- FechaInicial = dtpFechaInicial.Value
- FechaFinal = dtpFechaFinal.Value
- End Sub
- Private Sub dtpFechaFinal_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaFinal.ValueChanged
- FechaInicial = dtpFechaInicial.Value
- FechaFinal = dtpFechaFinal.Value
- End Sub
- Private Sub dtpFecha_ValueChanged(sender As Object, e As EventArgs) Handles dtpFecha.ValueChanged
- SoloFecha = dtpFecha.Value
- End Sub
- Private Sub rdbInternacionales_CheckedChanged(sender As Object, e As EventArgs) Handles rdbInternacionales.CheckedChanged
- End Sub
- Private Sub rdbVigente_CheckedChanged(sender As Object, e As EventArgs) Handles rdbVigente.CheckedChanged
- End Sub
- Private Sub rdbVencido_CheckedChanged(sender As Object, e As EventArgs) Handles rdbVencido.CheckedChanged
- End Sub
- Private Sub rdbVencidoAmbos_CheckedChanged(sender As Object, e As EventArgs) Handles rdbVencidoAmbos.CheckedChanged
- End Sub
- Private Sub rdbAmbosPais_CheckedChanged(sender As Object, e As EventArgs) Handles rdbAmbosPais.CheckedChanged
- End Sub
- Private Sub rdbNacionales_CheckedChanged(sender As Object, e As EventArgs) Handles rdbNacionales.CheckedChanged
- End Sub
- Private Sub txtPortTotal_TextChanged(sender As Object, e As EventArgs) Handles txtPortTotal.TextChanged
- End Sub
- Private Sub txtRendimientos_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientos.TextChanged
- End Sub
- Private Sub rdbRevision_CheckedChanged(sender As Object, e As EventArgs) Handles rdbRevision.CheckedChanged
- End Sub
- Private Sub rdbCancelada_CheckedChanged(sender As Object, e As EventArgs) Handles rdbCancelada.CheckedChanged
- End Sub
- Sub AgruparSeleccionado()
- Dim ListaAgrupada As String = String.Empty
- For Each check As CheckBox In grpAgrupamiento.Controls
- Dim Valor As String = String.Empty
- If check.Checked Then
- If check.Text = "Empresa" Then
- Valor = "Empresa"
- ElseIf check.Text = "Instrumento" Then
- Valor = "Instrumento"
- ElseIf check.Text = "Nacionalidad" Then
- Valor = "Nacionalidad"
- ElseIf check.Text = "Estado" Then
- Valor = "Estado"
- ElseIf check.Text = "Fecha" Then
- Valor = "Fecha"
- ElseIf check.Text = "TipoRenta" Then
- Valor = "TipoRenta"
- ElseIf check.Text = "Vigencia" Then
- Valor = "Vigencia"
- End If
- If String.IsNullOrEmpty(ListaAgrupada) Then
- ListaAgrupada = Valor
- Else
- ListaAgrupada += "," + Valor
- End If
- End If
- Next
- Lista = ListaAgrupada
- End Sub
- Private Sub chkEmpresa_CheckedChanged(sender As Object, e As EventArgs) Handles chkEmpresa.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Private Sub chkInstrumento_CheckedChanged(sender As Object, e As EventArgs) Handles chkInstrumento.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Private Sub chkNacionalidad_CheckedChanged(sender As Object, e As EventArgs) Handles chkNacionalidad.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Private Sub chkEstado_CheckedChanged(sender As Object, e As EventArgs) Handles chkEstado.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Private Sub chkFecha_CheckedChanged(sender As Object, e As EventArgs) Handles chkFecha.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Private Sub chkVigencia_CheckedChanged(sender As Object, e As EventArgs) Handles chkVigencia.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Private Sub chkTipoRenta_CheckedChanged(sender As Object, e As EventArgs) Handles chkTipoRenta.CheckedChanged
- AgruparSeleccionado()
- CargarDatos()
- End Sub
- Sub TipoRendimiento()
- If rdbRendimientoGeneral.Checked Then
- grpFechas.Enabled = True
- grpVigente.Enabled = True
- grpMostrarTotales.Enabled = True
- TbRendimientoDiario.Parent = Nothing
- TbRendimientoGeneral.Parent = TbcRendimiento
- Else
- grpFechas.Enabled = False
- grpVigente.Enabled = False
- grpMostrarTotales.Enabled = False
- TbRendimientoGeneral.Parent = Nothing
- TbRendimientoDiario.Parent = TbcRendimiento
- End If
- End Sub
- Private Sub rdbRendimientoGeneral_CheckedChanged(sender As Object, e As EventArgs) Handles rdbRendimientoGeneral.CheckedChanged
- TipoRendimiento()
- End Sub
- Private Sub rdbRendimientoDiario_CheckedChanged(sender As Object, e As EventArgs) Handles rdbRendimientoDiario.CheckedChanged
- TipoRendimiento()
- End Sub
- Sub OcultarColumnasRendimientoGenerar()
- If Not dgvRendimientoDetalles.Columns("CodigoEmpresa") Is Nothing Then
- dgvRendimientoDetalles.Columns("CodigoEmpresa").Visible = False
- End If
- If Not dgvRendimientoDetalles.Columns("CodigoInstrumento") Is Nothing Then
- dgvRendimientoDetalles.Columns("CodigoInstrumento").Visible = False
- End If
- If Not dgvRendimientoDetalles.Columns("Pais") Is Nothing Then
- dgvRendimientoDetalles.Columns("Pais").Visible = False
- End If
- End Sub
- Sub TipoRendimientoFecha()
- If rdbFecha.Checked Then
- TipoFecha = "F"
- ElseIf rdbRangoFechas.Checked Then
- TipoFecha = "FR"
- Else
- TipoFecha = "N"
- End If
- End Sub
- Sub ActualizarListas()
- EmpresaRendimientoDiario()
- InstrumentoRendimientoDiario()
- NacionalidadRendimientoDiario()
- EstadoRendimientoDiario()
- VigenciaRendimientoDiario()
- TipoRentaRendimientoDiario()
- AgruparRendimientoDiario()
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- RendimientoDetalles()
- OcultarColumnasRendimientoGenerar()
- End Sub
- Private Sub btnVer_Click(sender As Object, e As EventArgs) Handles btnVer.Click
- RendimientoDiario()
- End Sub
- Sub EmpresaRendimientoDiario()
- Dim ListaAgrupada As String = String.Empty
- For Each check As CheckBox In flpEmpresa.Controls
- Dim Valor As String = String.Empty
- If check.Checked Then
- If Not check.Name.ToString = "TodosEmpresa" Then
- Valor = check.Name.ToString
- If String.IsNullOrEmpty(ListaAgrupada) Then
- ListaAgrupada = Valor
- Else
- ListaAgrupada += "," + Valor
- End If
- End If
- End If
- Next
- ListaEmpresa = ListaAgrupada
- End Sub
- Sub InstrumentoRendimientoDiario()
- Dim ListaAgrupada As String = String.Empty
- For Each check As CheckBox In flpInstrumento.Controls
- Dim Valor As String = String.Empty
- If check.Checked Then
- If Not check.Name.ToString = "TodosInstrumentos" Then
- Valor = check.Name.ToString
- If String.IsNullOrEmpty(ListaAgrupada) Then
- ListaAgrupada = Valor
- Else
- ListaAgrupada += "," + Valor
- End If
- End If
- End If
- Next
- ListaInstrumentos = ListaAgrupada
- End Sub
- Sub NacionalidadRendimientoDiario()
- If rdbNacionales.Checked Then
- ListaNacionalidad = "Nacional"
- ElseIf rdbInternacionales.Checked Then
- ListaNacionalidad = "Internacional"
- ElseIf rdbAmbosPais.Checked Then
- ListaNacionalidad = "Todos"
- End If
- End Sub
- Sub EstadoRendimientoDiario()
- If rdbVigente.Checked Then
- ListaEstado = "A"
- ElseIf rdbVencido.Checked Then
- ListaEstado = "C"
- ElseIf rdbVencidoAmbos.Checked Then
- ListaEstado = "A,C"
- End If
- End Sub
- Sub VigenciaRendimientoDiario()
- If rdbPendientes.Checked Then
- ListaVigencia = "P"
- ElseIf rdbRevision.Checked Then
- ListaVigencia = "V"
- ElseIf rdbAprobado.Checked Then
- ListaVigencia = "A"
- ElseIf rdbCancelada.Checked Then
- ListaVigencia = "C"
- ElseIf rdbRechazado.Checked Then
- ListaVigencia = "R"
- ElseIf rdbTodosEstado.Checked Then
- ListaVigencia = "P,C,V,A,R"
- End If
- End Sub
- Sub TipoRentaRendimientoDiario()
- If rdbVariable.Checked Then
- ListaTipoRenta = "V"
- ElseIf rdbFija.Checked Then
- ListaTipoRenta = "F"
- ElseIf rdbAmbosRenta.Checked Then
- ListaTipoRenta = "V,F"
- End If
- End Sub
- Sub AgruparRendimientoDiario()
- Dim ListaAgrupada As String = String.Empty
- For Each check As CheckBox In grpAgruparRendDiario.Controls
- Dim Valor As String = String.Empty
- If check.Checked Then
- If check.Text = "Empresa" Then
- Valor = "Empresa"
- ElseIf check.Text = "Instrumento" Then
- Valor = "Instrumento"
- ElseIf check.Text = "Nacionalidad" Then
- Valor = "Nacionalidad"
- ElseIf check.Text = "Estado" Then
- Valor = "Estado"
- ElseIf check.Text = "Fecha" Then
- Valor = "Fecha"
- ElseIf check.Text = "TipoRenta" Then
- Valor = "TipoRenta"
- ElseIf check.Text = "Vigencia" Then
- Valor = "Vigencia"
- End If
- If String.IsNullOrEmpty(ListaAgrupada) Then
- ListaAgrupada = Valor
- Else
- ListaAgrupada += "," + Valor
- End If
- End If
- Next
- Me.ListaAgrupada = ListaAgrupada
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnActualizar.Click
- ActualizarLimpiar()
- End Sub
- Private Sub TbRendimientoDiario_Click(sender As Object, e As EventArgs) Handles TbRendimientoDiario.Click
- End Sub
- Sub ActualizarLimpiar()
- dgvRendimientoDetalles.Columns.Clear()
- dgvRendimientoDiario.Columns.Clear()
- RendimientoMensual()
- End Sub
- Sub OcultarColumnas()
- If Not dgvRendimientos.Columns("CodigoEmpresa") Is Nothing Then
- dgvRendimientos.Columns("CodigoEmpresa").Visible = False
- End If
- If Not dgvRendimientos.Columns("CodigoInstrumento") Is Nothing Then
- dgvRendimientos.Columns("CodigoInstrumento").Visible = False
- End If
- If Not dgvRendimientos.Columns("CodigoPais") Is Nothing Then
- dgvRendimientos.Columns("CodigoPais").Visible = False
- End If
- End Sub
- End Class
|