Public Class frmReporto
    Dim oDAOGeneral As New DAOGeneral
    Dim Aniobase As Integer = 365
    Dim PorcentajeComisionCasa As Double = 0.2825
    Dim PorcentajeComisionBolsa As Double = 0.2825
    Dim PorcentajeComisionIOF As Double = 0.25
    Dim PorcentajeISR As Double = 10
    Dim oCEReporto As ReportosCE
    Dim oDAOReportos As ReportosDAO

    Private CodigoInversion As String

    Private _Modo As String
    Private _IdDocumento As Integer
    Private _TipoDocumento As String

    Public Property Modo As String
        Get
            Return _Modo
        End Get
        Set(value As String)
            _Modo = value
        End Set
    End Property
    Private Property IdDocumento As Integer
        Get
            Return _IdDocumento
        End Get
        Set(value As Integer)
            _IdDocumento = value
        End Set
    End Property
    Private Property TipoDocumento As String
        Get
            Return _TipoDocumento
        End Get
        Set(value As String)
            _TipoDocumento = value
        End Set
    End Property


    Private Sub frmReporto_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Call CargarCasaCorredoras()
        ValoresPredefinidos()

        If Modo = "C" Then
            Call CargarRegistroBD()
        End If

    End Sub



    'GETS
    Function GetFechaCompra() As Date
        Dim valor As Date

        valor = dtpFechaCompra.Value

        Return valor
    End Function

    Function GetDias() As Integer
        Dim valor As Integer

        If Me.txtDias.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtDias.Text
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetPorcentajeBolsa() As Double
        Dim valor As Double

        If Me.txtPorcentajeBolsa.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtPorcentajeBolsa.Text
                valor = valor / 100
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetPorcentajeCasa() As Double
        Dim valor As Double

        If Me.txtPorcentajeCasa.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtPorcentajeCasa.Text
                valor = valor / 100
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function


    Function GetValorTransado() As Double
        Dim valor As Double

        If Me.txtValorTransado.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtValorTransado.Text
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetComisionCasa() As Double
        Dim valor As Double

        If Me.txtComisionCasa.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtComisionCasa.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function

    Function GetComisionBolsa() As Double
        Dim valor As Double

        If Me.txtComisionBolsa.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtComisionBolsa.Text
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetPorcentajeIOF() As Double
        Dim valor As Double

        If Me.txtPorcentajeIOF.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtPorcentajeIOF.Text
                valor = valor / 100
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetIOF() As Double
        Dim valor As Double

        If Me.txtIOF.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtIOF.Text
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetOtrosCostos() As Double
        Dim valor As Double

        If Me.txtOtrosCostos.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtOtrosCostos.Text
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function


    Function GetTotalCostos() As Double
        Dim valor As Double

        If Me.txtTotalCostos.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtTotalCostos.Text
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetRendimiento() As Double
        Dim valor As Double

        If Me.txtRendimiento.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtRendimiento.Text
                valor = valor / 100
            Catch ex As Exception
                valor = 0
            End Try

        End If

        Return valor
    End Function

    Function GetInteresesAGenerar() As Double
        Dim valor As Double

        If Me.txtInteresesAGenerar.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtInteresesAGenerar.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetPorcentajeISR() As Double
        Dim valor As Double

        Try
            valor = PorcentajeISR / 100
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function
    Function GetISR() As Double
        Dim valor As Double

        If Me.txtISR.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtISR.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetIngresoNeto() As Double
        Dim valor As Double

        If Me.txtIngresoNeto.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtIngresoNeto.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetCostoDeTransferencia() As Double
        Dim valor As Double

        If Me.txtCostoDeTransferencia.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtCostoDeTransferencia.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetCasa() As String
        Dim valor As String

        If Me.cboCasaCorredora.SelectedIndex = -1 Then
            valor = ""
        Else
            valor = Me.cboCasaCorredora.SelectedValue
        End If

        Return valor
    End Function
    Function GetCodigoTitulo() As String
        Dim valor As String

        If Me.txtCodigoTitulo.Text.Length = 0 Then
            valor = ""
        Else
            Try
                valor = Me.txtCodigoTitulo.Text
            Catch ex As Exception
                valor = ""
            End Try

        End If

        Return valor
    End Function
    Function GetFechaVencimiento() As Date
        Dim valor As Date

        valor = Me.dtpFechaVencimiento.Value

        Return valor
    End Function
    Function GetMontoALiquidar() As Double
        Dim valor As Double

        If Me.txtMontoALiquidar.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtMontoALiquidar.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetRendimientoNetoAntesDeImpuestos() As Double
        Dim valor As Double

        If Me.txtRendimientoNetoAntesISR.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtRendimientoNetoAntesISR.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetValorRecompra() As Double
        Dim valor As Double

        If Me.txtValorReCompra.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtValorReCompra.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetValorNeto() As Double
        Dim valor As Double

        If Me.txtValorNeto.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtValorNeto.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function
    Function GetRendimientoNetoDespuesDeImpuestos() As Double
        Dim valor As Double

        If Me.txtRendimientoNetoDespuesISR.Text.Length = 0 Then
            valor = 0
        Else
            Try
                valor = Me.txtRendimientoNetoDespuesISR.Text
            Catch ex As Exception
                valor = 0
            End Try
        End If

        Return valor
    End Function



    'CALCULOS
    Function CalcularFechaVencimiento() As Date
        Dim valor As Date
        Dim FechaCompra As Date = Me.dtpFechaCompra.Value
        Dim Dias As Integer = GetDias()

        valor = FechaCompra
        valor = valor.AddDays(Dias)

        Return valor
    End Function

    Function CalcularComisionCasa() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vDias As Integer = GetDias()
        Dim vPorcentajeCasa As Double = GetPorcentajeCasa()
        Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)

        Try
            valor = vValorTransado * vDias * vPorcentajeCasa / vAnioBase
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularComisionBolsa() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vDias As Integer = GetDias()
        Dim vPorcentajeBolsa As Double = GetPorcentajeBolsa()
        Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)

        Try
            valor = vValorTransado * vDias * vPorcentajeBolsa / vAnioBase
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularIOF() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vComisionCasa As Double = GetComisionCasa()
        Dim vComisionBolsa As Double = GetComisionBolsa()
        Dim vDias As Integer = GetDias()
        Dim vPorcentajeIOF As Double = GetPorcentajeIOF()
        Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)

        Try
            valor = (vValorTransado + vComisionCasa + vComisionBolsa) * vDias * vPorcentajeIOF / vAnioBase
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularOtrosCostos() As Double
        Dim valor As Double

        valor = 0

        Return valor
    End Function

    Function CalcularTotalCostos() As Double
        Dim valor As Double
        Dim vComisionCasa As Double = GetComisionCasa()
        Dim vComisionBolsa As Double = GetComisionBolsa()
        Dim vIOF As Double = GetIOF()
        Dim vOtrosCostos As Double = GetOtrosCostos()

        Try
            valor = vComisionCasa + vComisionBolsa + vIOF + vOtrosCostos
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularMontoALiquidar() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vTotalCostos As Double = GetTotalCostos()

        Try
            valor = vValorTransado + vTotalCostos
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularInteresAGenerar() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vRendimiento As Double = GetRendimiento()
        Dim vDias As Integer = GetDias()
        Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)

        Try
            valor = vValorTransado * vRendimiento * vDias / vAnioBase
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularRendimientoNetoAntesISR() As Double
        Dim valor As Double
        Dim vInteresesAgenerar As Double = GetInteresesAGenerar()
        Dim vTotalCostos As Double = GetTotalCostos()
        Dim vValorTransado As Double = GetValorTransado()
        Dim vDias As Integer = GetDias()
        Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)

        Try
            valor = ((vInteresesAgenerar - vTotalCostos) / vValorTransado) * (vAnioBase / vDias)
            valor = valor * 100
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function

    Function CalcularValorRecompra() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vInteresesAGenerar As Double = GetInteresesAGenerar()

        Try
            valor = vValorTransado - vInteresesAGenerar
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function
    Function CalcularISR() As Double
        Dim valor As Double
        Dim vInteresesAGenerar As Double = GetInteresesAGenerar()
        Dim vPorcentajeISR As Double = GetPorcentajeISR()

        Try
            valor = vInteresesAGenerar * vPorcentajeISR
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function
    Function CalcularIngresoNeto() As Double
        Dim valor As Double
        Dim vInteresesAgenerar As Double = GetInteresesAGenerar()
        Dim vISR As Double = GetISR()

        Try
            valor = vInteresesAgenerar - vISR
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function
    Function CalcularValorNeto() As Double
        Dim valor As Double
        Dim vValorTransado As Double = GetValorTransado()
        Dim vIngresoNeto As Double = GetIngresoNeto()
        Dim vCostoDeTransferencia As Double = GetCostoDeTransferencia()

        Try
            valor = vValorTransado + vIngresoNeto - vCostoDeTransferencia
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function
    Function CalcularRendimientoNetoDespuesISR() As Double
        Dim valor As Double
        Dim vIngresoNeto As Double = GetIngresoNeto()
        Dim vTotalCostos As Double = GetTotalCostos()
        Dim vValorTransado As Double = GetValorTransado()
        Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
        Dim vDias As Integer = GetDias()

        Try
            valor = (vIngresoNeto - vTotalCostos) / vValorTransado * vAnioBase / vDias
            valor = valor * 100
        Catch ex As Exception
            valor = 0
        End Try

        Return valor
    End Function



    'AUTOMATICO
    Sub ValoresPredefinidos()
        Me.txtPorcentajeCasa.Text = PorcentajeComisionCasa
        Me.txtPorcentajeBolsa.Text = PorcentajeComisionBolsa
        Me.txtPorcentajeIOF.Text = PorcentajeComisionIOF
    End Sub


    Sub RefrescarFechaVencimiento()
        Me.dtpFechaVencimiento.Value = CalcularFechaVencimiento()
    End Sub

    Sub RefrescarComisionCasa()
        Me.txtComisionCasa.Text = CalcularComisionCasa()
    End Sub

    Sub RefrescarComisionBolsa()
        Me.txtComisionBolsa.Text = CalcularComisionBolsa()
    End Sub
    Sub RefrescarIOF()
        Me.txtIOF.Text = CalcularIOF()
    End Sub

    Sub RefrescarOtrosCostos()
        Me.txtOtrosCostos.Text = CalcularOtrosCostos()
    End Sub

    Sub RefrescarTotalCostos()
        Me.txtTotalCostos.Text = CalcularTotalCostos()
    End Sub
    Sub RefrescarMontoALiquidar()
        Me.txtMontoALiquidar.Text = CalcularMontoALiquidar()
    End Sub

    Sub RefrescarInteresAGenerar()
        Me.txtInteresesAGenerar.Text = CalcularInteresAGenerar()
    End Sub

    Sub RefrescarRendimientoNetoAntesISR()
        Me.txtRendimientoNetoAntesISR.Text = CalcularRendimientoNetoAntesISR()
    End Sub
    Sub RefrescarValorDeRecompra()
        Me.txtValorReCompra.Text = CalcularValorRecompra()
    End Sub

    Sub RefrescarValorRecompra()
        Me.txtValorReCompra.Text = CalcularValorRecompra()
    End Sub
    Sub RefrescarISR()
        Me.txtISR.Text = CalcularISR()
    End Sub
    Sub RefrescarIngresoNeto()
        Me.txtIngresoNeto.Text = CalcularIngresoNeto()
    End Sub
    Sub RefrescarValorNeto()
        Me.txtValorNeto.Text = CalcularValorNeto()
    End Sub
    Sub RefrescarRendimientoNetoDespuesISR()
        Me.txtRendimientoNetoDespuesISR.Text = CalcularRendimientoNetoDespuesISR()
    End Sub



    'EVENTOS
    Private Sub txtPorcentajeCasa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCasa.TextChanged
        If Modo = "N" Then
            RefrescarComisionCasa()
        End If
    End Sub
    Private Sub txtPorcentajeBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeBolsa.TextChanged
        If Modo = "N" Then
            RefrescarComisionBolsa()
        End If
    End Sub

    Private Sub txtPorcentajeIOF_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeIOF.TextChanged
        If Modo = "N" Then
            RefrescarIOF()
        End If
    End Sub

    Private Sub txtDias_TextChanged(sender As Object, e As EventArgs) Handles txtDias.TextChanged
        If Modo = "N" Then
            RefrescarFechaVencimiento()
            RefrescarComisionCasa()
            RefrescarComisionBolsa()
            RefrescarInteresAGenerar()
            RefrescarRendimientoNetoAntesISR()
            RefrescarRendimientoNetoDespuesISR()
        End If
    End Sub

    Private Sub dtpFechaCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaCompra.ValueChanged
        If Modo = "N" Then
            RefrescarFechaVencimiento()
        End If
    End Sub

    Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
        If Modo = "N" Then
            RefrescarIOF()
            RefrescarTotalCostos()
        End If
    End Sub

    Private Sub TxtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
        If Modo = "N" Then
            RefrescarIOF()
            RefrescarTotalCostos()
        End If
    End Sub

    Private Sub txtIOF_TextChanged(sender As Object, e As EventArgs) Handles txtIOF.TextChanged
        If Modo = "N" Then
            RefrescarTotalCostos()
        End If
    End Sub

    Private Sub txtOtrosCostos_TextChanged(sender As Object, e As EventArgs) Handles txtOtrosCostos.TextChanged
        If Modo = "N" Then
            RefrescarTotalCostos()
        End If
    End Sub

    Private Sub txtValorTransado_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransado.TextChanged
        If Modo = "N" Then
            RefrescarComisionCasa()
            RefrescarComisionBolsa()
            RefrescarIOF()
            RefrescarMontoALiquidar()
            RefrescarInteresAGenerar()
            RefrescarRendimientoNetoAntesISR()
            RefrescarValorDeRecompra()
            RefrescarValorNeto()
            RefrescarRendimientoNetoDespuesISR()
        End If
    End Sub

    Private Sub txtTotalCostos_TextChanged(sender As Object, e As EventArgs) Handles txtTotalCostos.TextChanged
        If Modo = "N" Then
            RefrescarMontoALiquidar()
            RefrescarRendimientoNetoAntesISR()
            RefrescarRendimientoNetoDespuesISR()
        End If
    End Sub

    Private Sub txtRendimiento_TextChanged(sender As Object, e As EventArgs) Handles txtRendimiento.TextChanged
        If Modo = "N" Then
            RefrescarInteresAGenerar()
        End If
    End Sub

    Private Sub txtInteresesAGenerar_TextChanged(sender As Object, e As EventArgs) Handles txtInteresesAGenerar.TextChanged
        If Modo = "N" Then
            RefrescarRendimientoNetoAntesISR()
            RefrescarValorDeRecompra()
            RefrescarISR()
            RefrescarIngresoNeto()
        End If
    End Sub

    Private Sub txtISR_TextChanged(sender As Object, e As EventArgs) Handles txtISR.TextChanged
        If Modo = "N" Then
            RefrescarIngresoNeto()
        End If
    End Sub

    Private Sub txtIngresoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoNeto.TextChanged
        If Modo = "N" Then
            RefrescarValorNeto()
            RefrescarRendimientoNetoDespuesISR()
        End If
    End Sub

    Private Sub txtCostoDeTransferencia_TextChanged(sender As Object, e As EventArgs) Handles txtCostoDeTransferencia.TextChanged
        If Modo = "N" Then
            RefrescarValorNeto()
        End If
    End Sub

    'CARGAR DATOS DE CONTROLES
    Sub CargarCasaCorredoras()
        Me.cboCasaCorredora.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
        Me.cboCasaCorredora.DisplayMember = "Descripciom"
        Me.cboCasaCorredora.ValueMember = "Codigo"
        Me.cboCasaCorredora.SelectedIndex = -1
    End Sub

    Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
        If Modo = "N" Then
            oCEReporto = New ReportosCE

            oCEReporto.CodigoCasa = Me.GetCasa
            oCEReporto.Nombre = Me.GetCodigoTitulo
            oCEReporto.FechaDeCompra = Me.GetFechaCompra
            oCEReporto.ValorTransado = Me.GetValorTransado
            oCEReporto.Dias = Me.GetDias
            oCEReporto.FechaVencimiento = Me.GetFechaVencimiento
            oCEReporto.Rendimiento = Me.GetRendimiento
            'oCEReporto.Impuestos As Double
            oCEReporto.OtrosCostos = Me.GetOtrosCostos
            'oCEReporto.TotalCostos = Me.GetTotalCostos
            oCEReporto.MontoALiquidar = Me.GetMontoALiquidar
            'oCEReporto.InteresAGenerar = Me.GetInteresesAGenerar
            oCEReporto.CostoDeTransferencia = Me.GetCostoDeTransferencia
            'oCEReporto.RendimientoNetoAntesDeImpuestos = Me.GetRendimientoNetoAntesDeImpuestos
            oCEReporto.ValorReCompra = Me.GetValorRecompra
            oCEReporto.ImpuestosLiquidacion = Me.GetISR
            'oCEReporto.IngresoNeto = Me.GetIngresoNeto
            oCEReporto.ValorNeto = Me.GetValorNeto
            'oCEReporto.RendimientoNetoDespuesDeImpuestos = Me.GetRendimientoNetoDespuesDeImpuestos
        Else
            Me.Close()
        End If

    End Sub


    Function RetornarObjeto()
        Return oCEReporto
    End Function
    Private Sub CargarRegistroBD()
        oCEReporto = New ReportosCE
        oDAOReportos = New ReportosDAO

        'oDAOReportos.CargarRegistro(oCEReporto, TipoDocumento, IdDocumento)

        oCEReporto = oDAOReportos.CargarRegistro(CodigoInversion)

        Dim vCodigoCasa As String = oCEReporto.CodigoCasa
        Dim vNombre As String = oCEReporto.Nombre
        Dim vFechaDeCompra As Date = oCEReporto.FechaDeCompra
        Dim vValorTransado As Double = oCEReporto.ValorTransado
        Dim vDias As Integer = oCEReporto.Dias
        Dim vFechaVencimiento As Date = oCEReporto.FechaVencimiento
        Dim vRendimiento As Double = oCEReporto.Rendimiento
        Dim vImpuestos As Double = oCEReporto.Impuestos
        Dim vOtrosCostos As Double = oCEReporto.OtrosCostos
        Dim vTotalCostos As Double = oCEReporto.TotalCostos
        Dim vMontoALiquidar As Double = oCEReporto.MontoALiquidar
        Dim vInteresAGenerar As Double = oCEReporto.InteresAGenerar
        Dim vCostoDeTransferencia As Double = oCEReporto.CostoDeTransferencia
        Dim vRendimientoNetoAntesDeImpuestos As Double = oCEReporto.RendimientoNetoAntesDeImpuestos
        Dim vValorReCompra As Double = oCEReporto.ValorReCompra
        Dim vImpuestosLiquidacion As Double = oCEReporto.ImpuestosLiquidacion
        Dim vIngresoNeto As Double = oCEReporto.IngresoNeto
        Dim vValorNeto As Double = oCEReporto.ValorNeto
        Dim vRendimientoNetoDespuesDeImpuestos As Double = oCEReporto.RendimientoNetoDespuesDeImpuestos

        'Me.cboCasaCorredora.SelectedValue = vCodigoCasa
        Me.txtCodigoTitulo.Text = vNombre
        Me.dtpFechaCompra.Value = vFechaDeCompra
        Me.txtValorTransado.Text = vValorTransado.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtDias.Text = vDias
        Me.dtpFechaVencimiento.Value = vFechaVencimiento
        Me.txtRendimiento.Text = (vRendimiento / 100).ToString(Configuraciones.CodigoTXTPorcentaje)

        'IMPUESTOS
        Me.txtOtrosCostos.Text = vOtrosCostos
        Me.txtTotalCostos.Text = vTotalCostos
        Me.txtMontoALiquidar.Text = vMontoALiquidar.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtInteresesAGenerar.Text = vInteresAGenerar.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtCostoDeTransferencia.Text = vCostoDeTransferencia.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtRendimientoNetoAntesISR.Text = (vRendimientoNetoAntesDeImpuestos / 100).ToString(Configuraciones.CodigoTXTPorcentaje)
        Me.txtValorReCompra.Text = vValorReCompra.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtISR.Text = vImpuestosLiquidacion.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtIngresoNeto.Text = vIngresoNeto.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtValorNeto.Text = vValorNeto.ToString(Configuraciones.CodigoTXTMontos)
        Me.txtRendimientoNetoDespuesISR.Text = (vRendimientoNetoDespuesDeImpuestos / 100).ToString(Configuraciones.CodigoTXTPorcentaje)



    End Sub
    Public Sub CargarRegistro(vId As Integer, vTipo As String)
        Modo = "C"
        IdDocumento = vId
        TipoDocumento = vTipo
    End Sub

    Private Sub cboCasaCorredora_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasaCorredora.SelectedIndexChanged

    End Sub

    Private Sub txtCodigoTitulo_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoTitulo.TextChanged

    End Sub
    Private Sub txtCodigoTitulo_LostFocus(sender As Object, e As EventArgs) Handles txtCodigoTitulo.LostFocus

    End Sub
    Private Sub Control_CodigoTitulo()
        Dim valor As String

    End Sub

    Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged

    End Sub

    Private Sub txtMontoALiquidar_TextChanged(sender As Object, e As EventArgs) Handles txtMontoALiquidar.TextChanged

    End Sub

    Private Sub txtRendimientoNetoAntesISR_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNetoAntesISR.TextChanged

    End Sub

    Private Sub txtValorReCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorReCompra.TextChanged

    End Sub

    Private Sub txtValorNeto_TextChanged(sender As Object, e As EventArgs) Handles txtValorNeto.TextChanged

    End Sub

    Private Sub txtRendimientoNetoDespuesISR_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNetoDespuesISR.TextChanged

    End Sub

    Public Sub CargarRegistro(ByVal vCodigoInversion As String)
        Modo = "C"
        Me.CodigoInversion = vCodigoInversion
    End Sub


End Class