Browse Source

Actualizacion

ahernandez 6 years ago
parent
commit
59141cc4e3
6 changed files with 315 additions and 149 deletions
  1. 1 1
      DAO/DAOGeneral.vb
  2. 68 0
      ENTI/CalculosDias.vb
  3. 43 2
      FRM/frmLetes.Designer.vb
  4. 18 17
      FRM/frmLetes.resx
  5. 184 129
      FRM/frmLetes.vb
  6. 1 0
      Inversiones.vbproj

+ 1 - 1
DAO/DAOGeneral.vb

@@ -399,7 +399,7 @@ Public Class DAOGeneral
         cmd.CommandType = CommandType.StoredProcedure
 
         cmd.Parameters.Add("@TipoFuncion", SqlDbType.VarChar).Value = TipoFuncion
-        cmd.Parameters.Add("@Version", SqlDbType.Int).Value = 2
+        cmd.Parameters.Add("@Version", SqlDbType.Int).Value = 9
         da = New SqlDataAdapter(cmd)
 
         da.Fill(ds)

+ 68 - 0
ENTI/CalculosDias.vb

@@ -0,0 +1,68 @@
+Public Class CalculosDias
+    Private Operaciones As New Operaciones
+    Sub AgregarFechaIngresos(ByRef dgvIngresos As DataGridView, ByRef dtpFechaLiquidacion As DateTimePicker,
+                             ByRef NombreCampoFecha As String, ByRef TipoBase As Integer)
+
+        Dim Index As Integer = dgvIngresos.CurrentRow.Index
+        Dim IndexAnterior As Integer = Index - 1
+        Dim FechaAnterior As Date = Date.Today.Date
+        Dim FechaActual As Date = Date.Today.Date
+        Dim FechaLiquidacion As Date = dtpFechaLiquidacion.Value
+        Dim DiaFijo As Integer = FechaLiquidacion.Day
+        If Index > 0 Then
+            FechaAnterior = Operaciones.ConvertirFecha(dgvIngresos.Rows(IndexAnterior).Cells(NombreCampoFecha).Value.ToString)
+            FechaActual = CalcularFecha(FechaAnterior, DiaFijo, "Mensual", "M", TipoBase)
+            dgvIngresos.Rows(Index).Cells(NombreCampoFecha).Value = Format((FechaActual), "dd/MM/yyyy").ToString
+
+        Else
+
+            FechaActual = CalcularFecha(Operaciones.ConvertirFecha(FechaLiquidacion), DiaFijo, "Mensual", "M", TipoBase)
+            dgvIngresos.Rows(Index).Cells(NombreCampoFecha).Value = Format(FechaActual, "dd/MM/yyyy").ToString
+        End If
+
+    End Sub
+
+
+
+
+
+
+    Function CalcularFecha(ByVal FechaInicial As Date, ByVal DiaFijo As Integer, ByRef FormaCalcularFechas As String,
+                           ByRef Periodicidad As String, ByRef TipoBase As Integer)
+        'Declaracion de Variables'
+        Dim BaseDias As Integer = 0
+        Dim FechaFinal As Date = Date.Today.Date
+
+
+
+
+
+
+        If (TipoBase = 0 Or TipoBase = 2) Then
+
+            BaseDias = 360
+
+
+            If FormaCalcularFechas = "FinMes" Then
+                FechaFinal = Operaciones.FechaFinMes(FechaInicial, Periodicidad, BaseDias)
+
+            ElseIf FormaCalcularFechas = "Mensual" Then
+
+                FechaFinal = Operaciones.FechaMensual(FechaInicial, Periodicidad, FormaCalcularFechas, 0, DiaFijo, BaseDias)
+            End If
+
+
+        ElseIf TipoBase = 1 Or TipoBase = 3 Then
+            BaseDias = 365
+
+            If FormaCalcularFechas = "FinMes" Then
+                FechaFinal = Operaciones.FechaFinMes(FechaInicial, Periodicidad, BaseDias)
+
+            ElseIf FormaCalcularFechas = "Mensual" Then
+
+                FechaFinal = Operaciones.FechaMensual(FechaInicial, Periodicidad, FormaCalcularFechas, 0, DiaFijo, BaseDias)
+            End If
+        End If
+        Return FechaFinal
+    End Function
+End Class

+ 43 - 2
FRM/frmLetes.Designer.vb

@@ -78,8 +78,13 @@ Partial Class frmLetes
         Me.btnRedencion = New System.Windows.Forms.Button()
         Me.lblRedencion = New System.Windows.Forms.Label()
         Me.dtpRedencion = New System.Windows.Forms.DateTimePicker()
+        Me.dgvIngresosVCN = New System.Windows.Forms.DataGridView()
+        Me.Label18 = New System.Windows.Forms.Label()
+        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
         CType(Me.BindingNavigator1, System.ComponentModel.ISupportInitialize).BeginInit()
         Me.BindingNavigator1.SuspendLayout()
+        CType(Me.dgvIngresosVCN, System.ComponentModel.ISupportInitialize).BeginInit()
+        Me.GroupBox1.SuspendLayout()
         Me.SuspendLayout()
         '
         'lblBono
@@ -431,7 +436,7 @@ Partial Class frmLetes
         Me.BindingNavigator1.MovePreviousItem = Nothing
         Me.BindingNavigator1.Name = "BindingNavigator1"
         Me.BindingNavigator1.PositionItem = Nothing
-        Me.BindingNavigator1.Size = New System.Drawing.Size(390, 25)
+        Me.BindingNavigator1.Size = New System.Drawing.Size(985, 25)
         Me.BindingNavigator1.TabIndex = 126
         Me.BindingNavigator1.Text = "BindingNavigator1"
         '
@@ -585,6 +590,35 @@ Partial Class frmLetes
         Me.dtpRedencion.TabIndex = 140
         Me.dtpRedencion.Visible = False
         '
+        'dgvIngresosVCN
+        '
+        Me.dgvIngresosVCN.BackgroundColor = System.Drawing.Color.White
+        Me.dgvIngresosVCN.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
+        Me.dgvIngresosVCN.Location = New System.Drawing.Point(6, 58)
+        Me.dgvIngresosVCN.Name = "dgvIngresosVCN"
+        Me.dgvIngresosVCN.Size = New System.Drawing.Size(574, 203)
+        Me.dgvIngresosVCN.TabIndex = 141
+        '
+        'Label18
+        '
+        Me.Label18.AutoSize = True
+        Me.Label18.Font = New System.Drawing.Font("Trebuchet MS", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+        Me.Label18.Location = New System.Drawing.Point(191, 21)
+        Me.Label18.Name = "Label18"
+        Me.Label18.Size = New System.Drawing.Size(188, 24)
+        Me.Label18.TabIndex = 142
+        Me.Label18.Text = "Detalles de Ingresos"
+        '
+        'GroupBox1
+        '
+        Me.GroupBox1.Controls.Add(Me.Label18)
+        Me.GroupBox1.Controls.Add(Me.dgvIngresosVCN)
+        Me.GroupBox1.Location = New System.Drawing.Point(387, 212)
+        Me.GroupBox1.Name = "GroupBox1"
+        Me.GroupBox1.Size = New System.Drawing.Size(586, 267)
+        Me.GroupBox1.TabIndex = 143
+        Me.GroupBox1.TabStop = False
+        '
         'frmLetes
         '
         Me.AcceptButton = Me.btnAceptar
@@ -593,7 +627,8 @@ Partial Class frmLetes
         Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink
         Me.BackColor = System.Drawing.Color.WhiteSmoke
         Me.CancelButton = Me.btnCancelar
-        Me.ClientSize = New System.Drawing.Size(390, 632)
+        Me.ClientSize = New System.Drawing.Size(985, 632)
+        Me.Controls.Add(Me.GroupBox1)
         Me.Controls.Add(Me.dtpRedencion)
         Me.Controls.Add(Me.lblRedencion)
         Me.Controls.Add(Me.btnRedencion)
@@ -650,6 +685,9 @@ Partial Class frmLetes
         CType(Me.BindingNavigator1, System.ComponentModel.ISupportInitialize).EndInit()
         Me.BindingNavigator1.ResumeLayout(False)
         Me.BindingNavigator1.PerformLayout()
+        CType(Me.dgvIngresosVCN, System.ComponentModel.ISupportInitialize).EndInit()
+        Me.GroupBox1.ResumeLayout(False)
+        Me.GroupBox1.PerformLayout()
         Me.ResumeLayout(False)
         Me.PerformLayout()
 
@@ -709,4 +747,7 @@ Partial Class frmLetes
     Friend WithEvents btnRedencion As Button
     Friend WithEvents lblRedencion As Label
     Friend WithEvents dtpRedencion As DateTimePicker
+    Friend WithEvents dgvIngresosVCN As DataGridView
+    Friend WithEvents Label18 As Label
+    Friend WithEvents GroupBox1 As GroupBox
 End Class

+ 18 - 17
FRM/frmLetes.resx

@@ -139,28 +139,29 @@
   <data name="navNuevo.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
-        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHbSURBVDhPnZE7TNtQFIbdDmVtYWFlha1zJ0CdgA5MwQmP
-        EGRiEEuY660IIYQqdSpLixoeASocIdGuSDyiIMzDhChJmwcoYIOTOE38UFAOvldJIBGuIn7p09Gxz/2u
-        fS+BkubmXif4+cY496UtfrbaxvOeV/hFPQmFPjdkTqbepIMzLVH/h0IuwPTTzgkfNUKJDjslDtdgN6AG
-        x5JWi30bCxK7s41yYLpL2+8E3d8DOtcHqiKBqv0zJZeXAUmw4NL3qSnjf6+sM+1F/XjsrbbXAdohCeFU
-        0RQkIUlKLAm+N2V5plU/6AVt5x2ovm4QBEHnIkn44V6GDdZbYXXtJxxHb6oF6MAE3tM8MuS40wwJu8Ve
-        oIGoVICIqEDYICKqFaKpQrWgnH7bsCKmZWC9m3ggeCHB1/lvsLDgrrC45IFQUjYXSNk8/lQ0ELvJAf/3
-        Ck7+VBO7VeoTBJI54CJXcGiAapnzaxOBrUZwlpDAvbhSOUAE6s8vMyYCa7UgfFuAoKA8YOwcvFbx87oE
-        R09cI+pPYzXXWI6VHEo9FiTkIiZeqo95UmCxjObThmDr12888D8UNQsDA+N8aSlBAMAL4xdYl+sjOEdd
-        QDsncTWDpmndRjq8DMO8LCmeG4K4B0elbBFu/9keAAAAAElFTkSuQmCC
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHbSURBVDhPnZFNTNpgGMe7Hbar08uuu86b553mspPTgydW
+        PhQxlbp4YWd727Isy2LiSS/ODFQ0xhIT59VEN4Kx6ioSwPGhQVotUAb9CAuPfd8AE0IN8Z/88uRpn/f3
+        tu9LoOS5r11pfr47xc32pk5We3ne/wi/6CTR6MzjwvHHJ/nI52eJ0FClFGbstHsqSI1TostJiWMtOA2o
+        kcmM1eLcwYL03pduOfxpQPv1CvTQIOjcW1AVCVTtrymlsgxIggUXwQ89hdBrZY15WdWPJvu0n/2gHZAQ
+        y1VNQRKSpMSa4FtPkWee6/vDoO2+ADX4BgRB0Ll4Br57l2GDDTRYXVuHo8RVswAdmMD7n46Puv5phoTd
+        Ys/RQEKqQFxUIGYQF9UGiVylWVCP3TamiHkZ2MAmHoicSzA3vwCLi94GviU/RDOyuUAqlvGnooHkVQn4
+        P5dwfNZM8lrpTBDOlICLX8KBAap1TrMmAluL4CQtgde30jhABOpPLwomAmuzIHZdgYig/MfYOZJV8fOO
+        BIdtrhH1v5Mt11iPlRzN3Rak5SomVau3aSuwWCbKeUOw9WMbD9yFohbB4XjH15YSBAA8MH6B9XimwT3h
+        Adr9HlczaJrWbaQrwDDMw5riviGIG0RhbBComwuwAAAAAElFTkSuQmCC
 </value>
   </data>
   <data name="navEliminar.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
-        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGxSURBVDhPlZM7S8NQGIbTpv0BLuLgFRxEcKp0k2q9bP4A
-        xUUUcXJwaNHFTVBx0BA6ObnooEOkWKEQdREEFwc3byApvdlb0nv7er7Q1GpbWz94SDic98n3nUO4SnUz
-        bAx7C/oZZkZd2dLpdFyW5VKxWEQjstksBEE4YHsbSuwUVlUVmqZVSSQSiMViCAaDuiQQCEAUxTqJiWGn
-        DZlMBrlcTn8SqVQK8XgcoVBIF7AuQR/xeDyGRK+qgMIGJKBAMplEOBz+MQ5BmUr2W1AoFKob6J3mNkaJ
-        RCJ6J4qiNBf8plZCndB5RKPR9gWEIaFx6ExIROttC4h8Pq+fC0kIWvuXgLp4OzvE3eIw/JNW3Mz3QbCb
-        xD8FFDJ4Pxfw6BpDxruP8pMP2sk6ZMdI6WrcstZSQO3fLgwizcI4nAXcHcD2AMK74/BO8C9NBbUSarv8
-        cI7aim11YctpKVcFkiSVG0mI67leqEdLAAtlXRw+Ge+rPHzT/AcJqEbZ9WjNfqbX0z3crwxBcQ8gtGHF
-        87IJfoeldDll3qzkuR7GKIOupiFHM52i5OQVavvCwQePx/gdjuO4LzjPg67qZHpoAAAAAElFTkSuQmCC
+        YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGySURBVDhPlZM7S8NQGIbTpv4AF3HwCg4iOLV0K631svkD
+        FBdRxMnBoaKLm6DioCF06uSig4UqRQUh6iIILg5uXgqS0pu9pk2vr+cLTa221frBQ8LhvE++7xzCVauH
+        YWZY/2CAYWQ0lDmbzSYkSSqXSiU0Q1VVCIKwz/Y2lVgpnMlkoChKjWQyiXg8jlAopEmCwSBEUWyQGBhW
+        2pDL5ZDP57UnkU6nkUgkEA6HNQHrEvQRt9utS7SqCSisQwIKpFIpRCKRb+MQlKlmvwTFYrG2gd5pbn2U
+        aDSqdSLLcmvBT+ol1AmdRywWa19A6BIah86ERLTetoAoFArauZCEoLV/CaiLt5MD3M2P4Gq8Azez/RCs
+        BvFXAYV0Al4Bjy4bcv49VJ4uoBytQrKPli8dppU/BdT+7dwQsiyMg2lgrRPYGkRkxwH/GP/SUlAvobYr
+        D17UV3yzG5tOU6Um8Pl8lWYS4nqmDxnPAsBCqovDByOwzONikn8nAZWFXY/S6md6Pd7F/dIw5LVBhNc7
+        8LxowJXdVD6fMG5U81wvw8Kgq2mKZ6pLPHXyMrV9ZudDhzZ+m+M47hM2pIOrSi+qCgAAAABJRU5ErkJg
+        gg==
 </value>
   </data>
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

+ 184 - 129
FRM/frmLetes.vb

@@ -1,11 +1,15 @@
 Imports System.Globalization
 Public Class frmLetes
+
     Dim oCELetes As LETESCE
     Dim oDAOLetes As New LETESDAO
     Dim oDAOGeneral As New DAOGeneral
     Dim IndexBase As Integer = 0
     Dim TipoTransaccion = "OK"
     Dim Operaciones As New Operaciones
+    Dim CalculosDias As New CalculosDias
+
+
 
     Dim V_txtPrecio = 0.0, V_txtValorTransado = 0.0, V_txtComisionCasa = 0.0, V_txtComisionBolsa = 0.0, V_txtIngresoBruto = 0.0, V_txtTotalAPagar = 0.0, V_txtIngresoNeto = 0.0, V_txtRendimientoNeto = 0.0, V_txtDiasAcumulados = 0.0
     Dim DecimalesRedondeo As Integer = 4
@@ -194,10 +198,56 @@ Public Class frmLetes
         Me.txtTotalAPagar.Text = CalcularValorApagar()
     End Sub
 
+    Sub CrearColumnasIngresosVCN()
+        Dim Correlativo, Plazo, Fecha, Monto, CostoCedeval, PorcentajeRenta,
+        CostoTransferencia, CostoBanco, TotalRecibir As New DataGridViewTextBoxColumn
+
+
+        Correlativo.Name = "Correlativo"
+        Plazo.Name = "Plazo"
+        Fecha.Name = "Fecha"
+        Monto.Name = "Monto"
+        CostoCedeval.Name = "CostoCedeval"
+        PorcentajeRenta.Name = "PorcentajeRenta"
+        CostoTransferencia.Name = "CostoTransferencia"
+        CostoBanco.Name = "CostoBanco"
+        TotalRecibir.Name = "TotalRecibir"
 
 
 
 
+        Correlativo.HeaderText = "Correlativo"
+        Plazo.HeaderText = "Plazo"
+        Fecha.HeaderText = "Fecha"
+        Monto.HeaderText = "Monto"
+        CostoCedeval.HeaderText = "Costo de Cedeval"
+        PorcentajeRenta.HeaderText = "Porcentaje de la Renta"
+        CostoTransferencia.HeaderText = "Costo de Transferencia"
+        CostoBanco.HeaderText = "Costo de Banco"
+        TotalRecibir.HeaderText = "Total a Recibir"
+
+        dgvIngresosVCN.Columns.Add(Correlativo)
+        dgvIngresosVCN.Columns.Add(Plazo)
+        dgvIngresosVCN.Columns.Add(Fecha)
+        dgvIngresosVCN.Columns.Add(Monto)
+        dgvIngresosVCN.Columns.Add(CostoCedeval)
+        dgvIngresosVCN.Columns.Add(PorcentajeRenta)
+        dgvIngresosVCN.Columns.Add(CostoTransferencia)
+        dgvIngresosVCN.Columns.Add(CostoBanco)
+        dgvIngresosVCN.Columns.Add(TotalRecibir)
+
+    End Sub
+
+
+    Sub CalculosIngresosVCN()
+        CalculosDias.AgregarFechaIngresos(dgvIngresosVCN, dtpFechaLiquidacion, "Fecha", DefinirBaseDias())
+    End Sub
+
+    Function DefinirBaseDias()
+        Dim TipoBase As Integer = Operaciones.ConvertirEntero(cboBase.SelectedIndex)
+        Return TipoBase
+    End Function
+
 
 
     'EVENTOS
@@ -378,6 +428,7 @@ Public Class frmLetes
             chbValorPar.Visible = True
             dtpFechaVencimiento.Enabled = True
             txtPlazoInversion.ReadOnly = True
+            CrearColumnasIngresosVCN()
         Else
             Instrumento = "NADA"
         End If
@@ -880,111 +931,110 @@ Public Class frmLetes
 
         If (IndexBase = 0) Then
 
-                Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
-                Return Pr
+            Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
+            Return Pr
 
-            ElseIf (IndexBase = 1) Then
+        ElseIf (IndexBase = 1) Then
 
 
-                Dim FechaInicial = dtpFechaLiquidacion.Value
-                Dim FechaFinal = dtpFechaVencimiento.Value
+            Dim FechaInicial = dtpFechaLiquidacion.Value
+            Dim FechaFinal = dtpFechaVencimiento.Value
 
-                Dim PrOpc1 = 0.0, PrOpc2 = 0.0
+            Dim PrOpc1 = 0.0, PrOpc2 = 0.0
 
-                Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
+            Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
 
-                Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
-                Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
-                Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
+            Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
+            Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
+            Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
 
 
-                If (Not CambioDeFecha = 0) Then
+            If (Not CambioDeFecha = 0) Then
 
 
-                    If CambioDeFecha = 1 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
-                        PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
-                        PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
+                If CambioDeFecha = 1 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
+                    PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
 
 
-                    ElseIf CambioDeFecha = 2 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
-                        PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
-                        PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
-                    End If
+                ElseIf CambioDeFecha = 2 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
+                    PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
+                End If
 
-                    Pr = (1 - (PrOpc1 + PrOpc2)) * 100
+                Pr = (1 - (PrOpc1 + PrOpc2)) * 100
 
-                Else
+            Else
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
+                If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
 
-                        Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
+                    Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
 
-                    End If
-
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
+                End If
 
-                        Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
-                    End If
+                If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
 
+                    Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
                 End If
-                Return Pr
 
-            ElseIf (IndexBase = 2) Then
-                ''''''''''''''''''
-                Dim FechaInicial = dtpFechaLiquidacion.Value
-                Dim FechaFinal = dtpFechaVencimiento.Value
+            End If
+            Return Pr
 
-                Dim PrOpc1 = 0.0, PrOpc2 = 0.0
+        ElseIf (IndexBase = 2) Then
+            ''''''''''''''''''
+            Dim FechaInicial = dtpFechaLiquidacion.Value
+            Dim FechaFinal = dtpFechaVencimiento.Value
 
-                Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
+            Dim PrOpc1 = 0.0, PrOpc2 = 0.0
 
-                Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
-                Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
-                Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
+            Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
 
+            Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
+            Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
+            Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
 
-                If (Not CambioDeFecha = 0) Then
 
+            If (Not CambioDeFecha = 0) Then
 
-                    If CambioDeFecha = 1 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
-                        PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
-                        PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
 
+                If CambioDeFecha = 1 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
+                    PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
 
-                    ElseIf CambioDeFecha = 2 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
-                        PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
-                        PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
-                    End If
 
-                    Pr = (1 - (PrOpc1 + PrOpc2)) * 100
+                ElseIf CambioDeFecha = 2 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
+                    PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
+                End If
 
-                Else
+                Pr = (1 - (PrOpc1 + PrOpc2)) * 100
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
+            Else
 
-                        Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
+                If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
 
-                    End If
+                    Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
+                End If
 
-                        Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
-                    End If
+                If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
 
+                    Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
                 End If
-                Return Pr
 
+            End If
+            Return Pr
 
-            Else
 
+        Else
 
 
 
@@ -998,47 +1048,48 @@ Public Class frmLetes
 
 
 
-                Dim FechaInicial = dtpFechaLiquidacion.Value
-                Dim FechaFinal = dtpFechaVencimiento.Value
 
-                Dim PrOpc1 = 0.0, PrOpc2 = 0.0
+            Dim FechaInicial = dtpFechaLiquidacion.Value
+            Dim FechaFinal = dtpFechaVencimiento.Value
 
-                Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
+            Dim PrOpc1 = 0.0, PrOpc2 = 0.0
 
-                Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
-                Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
-                Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
+            Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
 
+            Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
+            Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
+            Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
 
-                If (Not CambioDeFecha = 0) Then
 
+            If (Not CambioDeFecha = 0) Then
 
-                    If CambioDeFecha = 1 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
-                        PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
-                        PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
 
+                If CambioDeFecha = 1 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
+                    PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
 
-                    ElseIf CambioDeFecha = 2 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
-                        PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
-                        PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
-                    End If
 
-                    Pr = (1 - (PrOpc1 + PrOpc2)) * 100
+                ElseIf CambioDeFecha = 2 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
+                    PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
+                End If
 
-                Else
+                Pr = (1 - (PrOpc1 + PrOpc2)) * 100
 
+            Else
 
 
-                    Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
+
+                Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
 
 
-                End If
-                Return Pr
             End If
+            Return Pr
+        End If
 
 
         Return 0
@@ -1072,111 +1123,111 @@ Public Class frmLetes
             Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 360)
             Return Comision
 
-            ElseIf IndexBase = 1 Then
+        ElseIf IndexBase = 1 Then
 
 
-                Dim FechaInicial = dtpFechaLiquidacion.Value
-                Dim FechaFinal = dtpFechaVencimiento.Value
+            Dim FechaInicial = dtpFechaLiquidacion.Value
+            Dim FechaFinal = dtpFechaVencimiento.Value
 
-                Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
+            Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
 
-                Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
+            Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
 
-                Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
-                Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
-                Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
+            Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
+            Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
+            Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
 
 
-                If (Not CambioDeFecha = 0) Then
+            If (Not CambioDeFecha = 0) Then
 
 
-                    If CambioDeFecha = 1 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                If CambioDeFecha = 1 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
                     ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 366)
                     ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 365)
                 ElseIf CambioDeFecha = 2 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
                     ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 365)
                     ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 366)
                 End If
 
-                    Comision = ComisionOpc1 + ComisionOpc2
+                Comision = ComisionOpc1 + ComisionOpc2
 
-                Else
+            Else
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
+                If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
 
                     Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 365)
 
                 End If
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
+                If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
 
                     Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 366)
                 End If
 
-                End If
-                Return Comision
+            End If
+            Return Comision
 
-            ElseIf IndexBase = 2 Then
+        ElseIf IndexBase = 2 Then
 
 
 
 
 
 
-                Dim FechaInicial = dtpFechaLiquidacion.Value
-                Dim FechaFinal = dtpFechaVencimiento.Value
+            Dim FechaInicial = dtpFechaLiquidacion.Value
+            Dim FechaFinal = dtpFechaVencimiento.Value
 
-                Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
+            Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
 
-                Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
+            Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
 
-                Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
-                Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
-                Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
+            Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
+            Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
+            Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
 
 
-                If (Not CambioDeFecha = 0) Then
+            If (Not CambioDeFecha = 0) Then
 
 
-                    If CambioDeFecha = 1 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                If CambioDeFecha = 1 Then
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
                     ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 366)
                     ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 365)
                 ElseIf CambioDeFecha = 2 Then
-                        DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
-                        DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
+                    DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
+                    DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
                     ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 365)
                     ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 366)
                 End If
 
-                    Comision = ComisionOpc1 + ComisionOpc2
+                Comision = ComisionOpc1 + ComisionOpc2
 
-                Else
+            Else
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
+                If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
 
                     Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 365)
 
                 End If
 
-                    If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
+                If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
 
                     Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 366)
                 End If
 
-                End If
-                Return Comision
+            End If
+            Return Comision
 
 
-            Else
+        Else
             Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 360)
             Return Comision
-            End If
+        End If
 
         Return 0
 
@@ -2171,6 +2222,10 @@ Public Class frmLetes
 
     End Sub
 
+    Private Sub dgvIngresosVCN_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresosVCN.CellClick
+        CalculosIngresosVCN()
+    End Sub
+
     Private Sub btnReporto_Click(sender As Object, e As EventArgs)
 
     End Sub

+ 1 - 0
Inversiones.vbproj

@@ -319,6 +319,7 @@
       <DependentUpon>dsInversiones.xsd</DependentUpon>
     </Compile>
     <Compile Include="ENTI\AccionesCE.vb" />
+    <Compile Include="ENTI\CalculosDias.vb" />
     <Compile Include="ENTI\CambiarEstArbCE.vb" />
     <Compile Include="ENTI\Controldores.vb" />
     <Compile Include="ENTI\FondoInversionCE.vb" />