| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209 |
- 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 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
- Private CodigoInversion As String
- Dim Instrumento As String
- Private _Modo As String
- Private _IdDocumento As Integer
- Private _TipoDocumento As String
- Private _ValorNominal As Double
- Private _ValorTransado As Double
- Private _Precio As Double
- Private _PorcentajeCasa As Double
- Private _ComisionCasa As Double
- Private _PorcentajeBolsa As Double
- Private _ComisionBolsa As Double
- Private _TotalAPagar As Double
- Private _FechaOperacion As Date
- Private _FechaLiquidacion As Date
- Private _FechaVencimiento As Date
- Private _RendimientoBruto As Double
- Private _RendimientoNeto As Double
- Private _Periodicidad As String
- Private _Plazo As Integer
- Private _IngresoBruto As Double
- Private _IngresoNeto As Double
- Private PBUR As Double = False
- Private VCN As Double = False
- Private CET As Double = False
- 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
- 'GETS
- Function GetFechaOperacion() As Date
- Dim valor As Date
- valor = dtpFechaOperacion.Value
- Return valor
- End Function
- Function GetFechaLiquidacion() As Date
- Dim valor As Date
- valor = dtpFechaLiquidacion.Value
- Return valor
- End Function
- Function GetValorNominal() As Double
- Dim valor As Double
- If Me.txtValorNominal.Text.Length = 0 Then
- valor = 0
- Else
- valor = Me.txtValorNominal.Text
- End If
- Return valor
- End Function
- Function GetPrecio() As Double
- Dim valor As Double
- If Me.txtPrecio.Text.Length = 0 Then
- valor = 0
- Else
- Try
- valor = Me.txtPrecio.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
- valor = Me.txtValorTransado.Text
- End If
- Return valor
- End Function
- Function GetComisionBolsa() As Double
- Dim valor As Double
- If Me.txtComisionBolsa.Text.Length = 0 Then
- valor = 0
- Else
- valor = Me.txtComisionBolsa.Text
- End If
- Return valor
- End Function
- Function GetComisionCasa() As Double
- Dim valor As Double
- If Me.txtComisionCasa.Text.Length = 0 Then
- valor = 0
- Else
- valor = Me.txtComisionCasa.Text
- End If
- Return valor
- End Function
- Function GetTotalAPagar() As Double
- Dim valor As Double
- If Me.txtTotalAPagar.Text.Length = 0 Then
- valor = 0
- Else
- valor = Me.txtTotalAPagar.Text
- End If
- Return valor
- End Function
- 'CALCULOS
- Function CalcularValorApagar() As Double
- Dim valor As Double
- valor = GetValorTransado() + GetComisionBolsa() + GetComisionCasa()
- valor = Math.Round(valor, DecimalesRedondeo)
- Return valor
- End Function
- 'AUTO
- Sub RefrescarPlazoInversion()
- Me.txtPlazoInversion.Text = 0
- End Sub
- Sub RefrescarPrecio()
- Me.txtPrecio.Text = 0
- End Sub
- Sub RefrescarTotalAPagar()
- Me.txtTotalAPagar.Text = CalcularValorApagar()
- End Sub
- 'EVENTOS
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- RefrescarPlazoInversion()
- End Sub
- Private Sub txtRendimientoBruto_TextChanged(sender As Object, e As EventArgs)
- If Modo = "N" Then
- RefrescarPrecio()
- End If
- End Sub
- Private Sub txtPlazoInversion_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.TextChanged, txtPlazoInversion.TextChanged
- RellenarDatos()
- End Sub
- Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged
- End Sub
- Private Sub dtpFechaLiquidacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacion.ValueChanged
- RellenarDatos()
- End Sub
- Private Sub dtpFechaOperacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacion.ValueChanged
- RellenarDatos()
- AgregarDiasExtra()
- End Sub
- Private Sub txtValorNominal_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal.TextChanged
- RellenarDatos()
- End Sub
- Private Sub txtPrecio_TextChanged(sender As Object, e As EventArgs) Handles txtPrecio.TextChanged
- End Sub
- Private Sub txtPorcentajeComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.TextChanged
- RellenarDatos()
- End Sub
- Private Sub txtPorcentajeComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.TextChanged
- RellenarDatos()
- End Sub
- Private Sub txtValorTransado_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransado.TextChanged
- End Sub
- Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
- If Modo = "N" Then
- RefrescarTotalAPagar()
- End If
- End Sub
- Private Sub txtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
- If Modo = "N" Then
- RefrescarTotalAPagar()
- End If
- End Sub
- Private Sub txtTotalAPagar_TextChanged(sender As Object, e As EventArgs) Handles txtTotalAPagar.TextChanged
- End Sub
- Sub ValidarExistencia()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- If PBUR Then
- Tabla = "PBUR"
- ElseIf VCN Then
- Tabla = "VCN"
- ElseIf CET Then
- Tabla = "CET0"
- Else
- Tabla = "LET0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If (Existe) Then
- navNuevo.Enabled = False
- navModificar.Enabled = True
- navEliminar.Enabled = True
- Else
- navNuevo.Enabled = True
- navModificar.Enabled = False
- navEliminar.Enabled = False
- End If
- TipoTransaccion = String.Empty
- btnAceptar.Text = "Aceptar"
- End Sub
- Function ExisteValidacion()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- If PBUR Then
- Tabla = "PBUR"
- ElseIf VCN Then
- Tabla = "VCN"
- ElseIf CET Then
- Tabla = "CET0"
- Else
- Tabla = "LET0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- Return Existe
- End Function
- Private Sub frmLetes_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- TipInstrumento()
- Me.ActiveControl = Me.txtValorNominal
- Call CargarCasasCorredoras()
- Call CargarBase()
- Call CargarPeriodicidad()
- If Variables.Codigo.IndexOf("LETE") > -1 Then
- Instrumento = "LETE"
- ElseIf Variables.Codigo.IndexOf("PBUR") > -1 Then
- Instrumento = "PBUR"
- lblBono.Text = "PAPEL BURSATIL"
- Me.Text = "PAPEL BURSATIL"
- lblInteresAcumulado.Visible = True
- lblDiasAcumulados.Visible = True
- dtpUltimaFecha.Visible = True
- txtInteresAcumulado.Visible = True
- chbValorPar.Visible = True
- ElseIf Variables.Codigo.IndexOf("CETE") > -1 Then
- Instrumento = "CETE"
- lblBono.Text = "CETES"
- Me.Text = "CETE"
- lblInteresAcumulado.Visible = True
- lblDiasAcumulados.Visible = True
- dtpUltimaFecha.Visible = True
- txtInteresAcumulado.Visible = True
- ConfiguracionCETE()
- ElseIf Variables.Codigo.IndexOf("VCN") > -1 Then
- Instrumento = "VCN"
- lblBono.Text = "VALORES COMERCIALES"
- Me.Text = "VALORES COMERCIALES"
- lblInteresAcumulado.Visible = True
- lblDiasAcumulados.Visible = True
- lblOtrosCostos.Visible = True
- dtpUltimaFecha.Visible = True
- txtInteresAcumulado.Visible = True
- txtOtrosCostos.Visible = True
- chbValorPar.Visible = True
- Else
- Instrumento = "NADA"
- End If
- CargarReg(Instrumento)
- Call CargarRegistroBD()
- SetPeriodicidad()
- AgregarPorcentaje()
- Rellenar()
- ExisteInversion()
- ValidarExistencia()
- CargarTransladoNuevo()
- End Sub
- Sub TipInstrumento()
- If Variables.Codigo.IndexOf("PBUR") > -1 Then
- PBUR = True
- End If
- If Variables.Codigo.IndexOf("VCN") > -1 Then
- VCN = True
- End If
- If Variables.Codigo.IndexOf("CETE") > -1 Then
- CET = True
- End If
- End Sub
- Sub SetPeriodicidad()
- If String.IsNullOrEmpty(Variables.Periodicidad) Then
- cboPeriodicidad.SelectedValue = "M"
- Else
- cboPeriodicidad.SelectedValue = Variables.Periodicidad
- End If
- End Sub
- Function ExisteInversion()
- Dim Codigo As String = Variables.Codigo
- Dim TablaINV As String = "INV0"
- Dim TablaPINV As String = "PIN0"
- Dim General As New DAOGeneral
- Dim InvPro = Variables.InvPro
- If InvPro = "I" Then
- Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
- If INV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- If InvPro = "P" Then
- Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
- If PINV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- Return False
- End Function
- Sub ConfiguracionCETE()
- txtPrecio.Text = "100%"
- End Sub
- Private Sub CargarReg(Instrumento)
- Dim Letes As New LETESDAO
- Dim Base As Integer = 0
- Dim dat = Letes.Cargar(Variables.Codigo, Instrumento)
- If (Not dat(1).ToString = "False") Then
- txtValorNominal.Text = Operaciones.ConvertirDecimal(dat(1).ToString)
- dtpFechaOperacion.Value = Operaciones.ConvertirFecha(dat(2).ToString)
- dtpFechaLiquidacion.Value = Operaciones.ConvertirFecha(dat(3).ToString)
- txtPlazoInversion.Text = Operaciones.ConvertirEntero(dat(4).ToString)
- If (String.IsNullOrEmpty(txtRendimientoBruto.Text)) Then
- txtRendimientoBruto.Text = CStr(Format((txtRendimientoBruto.Text), "0.00")) + "%"
- Else
- txtRendimientoBruto.Text = CStr(Operaciones.ConvertirDecimal(dat(5).ToString) * 100) + "%"
- End If
- cboCasasCorredoras.SelectedValue = dat(6).ToString
- cboPeriodicidad.SelectedValue = dat(7).ToString
- Base = Operaciones.ConvertirEntero(dat(8).ToString)
- cboBase.SelectedIndex = Base
- If (String.IsNullOrEmpty(dat(9).ToString)) Then
- txtPorcentajeComisionCasa.Text = Format(((txtPorcentajeComisionCasa.Text.Trim("%")) * 100), "0.00").ToString + "%"
- Else
- txtPorcentajeComisionCasa.Text = CStr(Operaciones.ConvertirDecimal(dat(9).ToString) * 100) + "%"
- End If
- If (String.IsNullOrEmpty(dat(10).ToString)) Then
- txtPorcentajeComisionBolsa.Text = Format((txtPorcentajeComisionBolsa.Text.Trim("%")) * 100, "0.00").ToString + "%"
- Else
- txtPorcentajeComisionBolsa.Text = CStr(Operaciones.ConvertirDecimal(dat(10).ToString) * 100) + "%"
- End If
- cboCasasCorredoras.SelectedValue = dat(12).ToString
- If (PBUR Or VCN) Then
- If (Not String.IsNullOrEmpty(dat(13).ToString)) Then
- chbValorPar.Checked = CBool(dat(13))
- End If
- If (Not String.IsNullOrEmpty(dat(14).ToString)) Then
- dtpUltimaFecha.Value = Operaciones.ConvertirFecha(dat(14).ToString)
- End If
- ElseIf CET Then
- If (Not String.IsNullOrEmpty(dat(13).ToString)) Then
- dtpUltimaFecha.Value = Operaciones.ConvertirFecha(dat(13).ToString)
- End If
- End If
- If VCN Then
- txtOtrosCostos.Text = Operaciones.ConvertirDecimal(dat(15).ToString)
- End If
- End If
- End Sub
- Private Sub Modificar(ByVal Instrumento As String)
- Dim ValNom As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
- Dim FOpe As Date = Operaciones.ConvertirFecha(dtpFechaOperacion.Value.ToString)
- Dim FLiq As Date = Operaciones.ConvertirFecha(dtpFechaLiquidacion.Value.ToString)
- Dim RendBruto As Double = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString) / 100
- Dim Plazo As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
- Dim PorcentajeComisionCasa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionCasa.Text.ToString) / 100
- Dim PorcentajeComisionBolsa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionBolsa.Text.ToString) / 100
- Dim ValTrans As Double = Operaciones.ConvertirDecimal(txtValorTransado.Text.ToString)
- Dim Precio As Double = Operaciones.ConvertirDecimal(txtPrecio.Text.ToString.ToString) / 100
- Dim TotPagar As Double = Operaciones.ConvertirDecimal(txtTotalAPagar.Text.ToString)
- Dim RendNeto As Double = Operaciones.ConvertirDecimal(txtRendimientoNeto.Text.ToString) / 100
- Dim IngrBruto As Double = Operaciones.ConvertirDecimal(txtIngresoBruto.Text.ToString)
- Dim IngrNeto As Double = Operaciones.ConvertirDecimal(txtIngresoNeto.Text.ToString)
- Dim ComisionCasaValor As Double = Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString)
- Dim ComisionBolsaValor As Double = Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString)
- Dim FUlt As Date = Operaciones.ConvertirFecha(dtpUltimaFecha.Value.ToString)
- Dim FRed As Date = Operaciones.ConvertirFecha(dtpRedencion.Value.ToString)
- Dim FVenc As Date = Operaciones.ConvertirFecha(dtpFechaVencimiento.Value.ToString)
- Dim IntAcumulado As Double = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString.ToString) / 100
- Dim OtrosCostos As Double = Operaciones.ConvertirDecimal(txtOtrosCostos.Text.ToString)
- Dim periodo As String = String.Empty
- If Not cboPeriodicidad.SelectedIndex = -1 Then
- periodo = cboPeriodicidad.SelectedValue
- End If
- Dim Casas As String = String.Empty
- If Not cboCasasCorredoras.SelectedIndex = -1 Then
- Casas = cboCasasCorredoras.SelectedValue
- End If
- Dim ValorPar As Boolean = chbValorPar.Checked
- Dim Base As Integer
- Dim FechaUltima As Date = dtpUltimaFecha.Value
- If (cboBase.SelectedIndex = 0) Then
- Base = 0
- ElseIf (cboBase.SelectedIndex = 1) Then
- Base = 1
- ElseIf (cboBase.SelectedIndex = 2) Then
- Base = 2
- Else
- Base = 3
- End If
- Dim coleccion As New Collection
- coleccion.Add(ValNom)
- coleccion.Add(FOpe)
- coleccion.Add(FLiq)
- coleccion.Add(RendBruto)
- coleccion.Add(Plazo)
- coleccion.Add(Variables.Codigo)
- coleccion.Add(PorcentajeComisionCasa)
- coleccion.Add(PorcentajeComisionBolsa)
- coleccion.Add(periodo)
- coleccion.Add(Base)
- coleccion.Add(Casas)
- If (PBUR Or VCN) Then
- coleccion.Add(ValorPar)
- coleccion.Add(FechaUltima)
- ElseIf CET Then
- coleccion.Add(FechaUltima)
- End If
- If VCN Then
- coleccion.Add(OtrosCostos)
- End If
- coleccion.Add(ValTrans)
- coleccion.Add(Precio)
- coleccion.Add(TotPagar)
- coleccion.Add(RendNeto)
- coleccion.Add(IngrBruto)
- coleccion.Add(IngrNeto)
- coleccion.Add(ComisionCasaValor)
- coleccion.Add(ComisionBolsaValor)
- coleccion.Add(FUlt)
- coleccion.Add(FRed)
- coleccion.Add(FVenc)
- If CET Or PBUR Or VCN Then
- coleccion.Add(IntAcumulado)
- End If
- oDAOLetes.ActualizarLETE(coleccion, Instrumento)
- End Sub
- Public Function Nuevo(ByVal Instrumento As String)
- Dim ValNom As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
- Dim FOpe As Date = Operaciones.ConvertirFecha(dtpFechaOperacion.Value.ToString)
- Dim FLiq As Date = Operaciones.ConvertirFecha(dtpFechaLiquidacion.Value.ToString)
- Dim RendBruto As Double = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString) / 100
- Dim Plazo As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
- Dim PorcentajeComisionCasa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionCasa.Text.ToString) / 100
- Dim PorcentajeComisionBolsa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionBolsa.Text.ToString) / 100
- Dim ValTrans As Double = Operaciones.ConvertirDecimal(txtValorTransado.Text.ToString)
- Dim Precio As Double = Operaciones.ConvertirDecimal(txtPrecio.Text.ToString.ToString) / 100
- Dim TotPagar As Double = Operaciones.ConvertirDecimal(txtTotalAPagar.Text.ToString)
- Dim RendNeto As Double = Operaciones.ConvertirDecimal(txtRendimientoNeto.Text.ToString) / 100
- Dim IngrBruto As Double = Operaciones.ConvertirDecimal(txtIngresoBruto.Text.ToString)
- Dim IngrNeto As Double = Operaciones.ConvertirDecimal(txtIngresoNeto.Text.ToString)
- Dim ComisionCasaValor As Double = Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString)
- Dim ComisionBolsaValor As Double = Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString)
- Dim FUlt As Date = Operaciones.ConvertirFecha(dtpUltimaFecha.Value.ToString)
- Dim FRed As Date = Operaciones.ConvertirFecha(dtpRedencion.Value.ToString)
- Dim FVenc As Date = Operaciones.ConvertirFecha(dtpFechaVencimiento.Value.ToString)
- Dim IntAcumulado As Double = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString.ToString) / 100
- Dim periodo As String = String.Empty
- If Not cboPeriodicidad.SelectedIndex = -1 Then
- periodo = cboPeriodicidad.SelectedValue
- End If
- Dim Casas As String = String.Empty
- If Not cboCasasCorredoras.SelectedIndex = -1 Then
- Casas = cboCasasCorredoras.SelectedValue
- End If
- Dim ValorPar As Boolean = chbValorPar.Checked
- Dim Base As Integer
- Dim FechaUltima As Date = dtpUltimaFecha.Value
- Dim OtrosCostos = txtOtrosCostos.Text
- If (cboBase.SelectedIndex = 0) Then
- Base = 0
- ElseIf (cboBase.SelectedIndex = 1) Then
- Base = 1
- ElseIf (cboBase.SelectedIndex = 2) Then
- Base = 2
- Else
- Base = 3
- End If
- Dim coleccion As New Collection
- coleccion.Add(ValNom)
- coleccion.Add(FOpe)
- coleccion.Add(FLiq)
- coleccion.Add(RendBruto)
- coleccion.Add(Plazo)
- coleccion.Add(Variables.Codigo)
- coleccion.Add(PorcentajeComisionCasa)
- coleccion.Add(PorcentajeComisionBolsa)
- coleccion.Add(periodo)
- coleccion.Add(Base)
- coleccion.Add(Casas)
- If (PBUR Or VCN) Then
- coleccion.Add(ValorPar)
- coleccion.Add(FechaUltima)
- ElseIf CET Then
- coleccion.Add(FechaUltima)
- End If
- If VCN Then
- coleccion.Add(OtrosCostos)
- End If
- coleccion.Add(ValTrans)
- coleccion.Add(Precio)
- coleccion.Add(TotPagar)
- coleccion.Add(RendNeto)
- coleccion.Add(IngrBruto)
- coleccion.Add(IngrNeto)
- coleccion.Add(ComisionCasaValor)
- coleccion.Add(ComisionBolsaValor)
- coleccion.Add(FUlt)
- coleccion.Add(FRed)
- coleccion.Add(FVenc)
- If CET Or PBUR Or VCN Then
- coleccion.Add(IntAcumulado)
- End If
- Return coleccion
- End Function
- Sub NuevoRegistro(ByVal Instrumento As String)
- Dim Coleccion As New Collection
- Coleccion = Nuevo(Instrumento)
- If Coleccion.Count > 0 Then
- oDAOLetes.NuevoIngreso(Coleccion, Instrumento)
- Coleccion.Clear()
- End If
- End Sub
- Private Sub Eliminar(ByVal Instrumento As String)
- oDAOLetes.Eliminar(Variables.Codigo, Instrumento)
- End Sub
- Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
- If (TipoTransaccion = "M") Then
- Modificar(Instrumento)
- ValidarExistencia()
- ElseIf (TipoTransaccion = "N") Then
- NuevoRegistro(Instrumento)
- ValidarExistencia()
- ElseIf (TipoTransaccion = "B") Then
- Eliminar(Instrumento)
- ValidarExistencia()
- ElseIf Not ExisteValidacion() Then
- Variables.ColeccionLETE = Nuevo(Instrumento)
- Close()
- End If
- End Sub
- Function RetornarObjeto()
- Return oCELetes
- End Function
- Sub CargarCasasCorredoras()
- If Me.cboCasasCorredoras.Items.Count = 0 Or Me.cboCasasCorredoras.Items.Count = 1 Then
- Me.cboCasasCorredoras.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
- Me.cboCasasCorredoras.DisplayMember = "Descripcion"
- Me.cboCasasCorredoras.ValueMember = "Codigo"
- Me.cboCasasCorredoras.SelectedIndex = 0
- End If
- End Sub
- Sub CargarPeriodicidad()
- If cboPeriodicidad.Items.Count = 0 Or cboPeriodicidad.Items.Count = 1 Then
- Me.cboPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodicidad.DisplayMember = "Descripcion"
- Me.cboPeriodicidad.ValueMember = "Codigo"
- Me.cboPeriodicidad.SelectedIndex = 0
- End If
- End Sub
- Sub CargarBase()
- If Me.cboBase.Items.Count = 0 Or Me.cboBase.Items.Count = 1 Then
- Me.cboBase.DataSource = oDAOGeneral.ListaBase
- Me.cboBase.DisplayMember = "Descripcion"
- Me.cboBase.ValueMember = "Codigo"
- Me.cboBase.SelectedIndex = 0
- End If
- End Sub
- Private Sub CargarRegistroBD()
- Dim oCELetes As LETESCE
- CodigoInversion = Variables.Codigo
- If Not oCELetes Is Nothing Then
- Dim vValorNominal As Double = oCELetes.ValorNominal
- Dim vFechaOperacion As Date = oCELetes.FechaOperacion
- Dim vFechaLiquidacion As Date = oCELetes.FechaLiquidacion
- Dim vFechaVencimiento As Date = oCELetes.FechaVencimiento
- Dim vPlazoInversion As Integer = oCELetes.Plazo
- Dim vCodigoCasa As String = oCELetes.CodigoCasa
- Dim vPeriodicidad As String = oCELetes.Periodicidad
- Dim vRendimientoBruto As Double = oCELetes.RendimientoBruto
- Dim vRendimientoNeto As Double = oCELetes.RendimientoNeto
- Dim vIngresoBruto As Double = oCELetes.IngresoBruto
- Dim vIngresoNeto As Double = oCELetes.IngresoNeto
- Dim vValorTransado As Double = oCELetes.ValorNominal
- Dim vPrecio As Double = oCELetes.Precio
- Dim vTotalAPagar As Double = oCELetes.TotalaPagar
- vRendimientoBruto = vRendimientoBruto * 100
- vRendimientoNeto = vRendimientoNeto * 100
- vPrecio = vPrecio * 100
- End If
- End Sub
- Public Sub CargarRegistro(vId As Integer, vTipo As String)
- Modo = "C"
- IdDocumento = vId
- TipoDocumento = vTipo
- End Sub
- Private Sub txtRendimientoBruto_MouseCaptureChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.MouseCaptureChanged
- End Sub
- Function ValorTrasado()
- Return Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString) *
- (Operaciones.ConvertirDecimal(V_txtPrecio.ToString) / 100)
- End Function
- Function Precio()
- Dim Rendimiento As Double = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString)
- Dim Plazo As Integer = Operaciones.ConvertirDecimal(txtPlazoInversion.Text.ToString)
- Dim Pr = 0.0
- If (IndexBase = 0) Then
- Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
- Return Pr
- ElseIf (IndexBase = 1) Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim PrOpc1 = 0.0, PrOpc2 = 0.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 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
- Pr = (1 - (PrOpc1 + PrOpc2)) * 100
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
- End If
- End If
- Return Pr
- ElseIf (IndexBase = 2) Then
- ''''''''''''''''''
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim PrOpc1 = 0.0, PrOpc2 = 0.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 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
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
- End If
- End If
- Return Pr
- Else
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim PrOpc1 = 0.0, PrOpc2 = 0.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 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
- Else
- Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
- End If
- Return Pr
- End If
- Return 0
- End Function
- Function ComisionCasa()
- Dim ValorTras As Double = ValorTrasado()
- Dim ComisionDeCasa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionCasa.Text.ToString)
- Dim PlazoInversion As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
- Dim Comision = 0.0
- If (IndexBase = 0) Then
- Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 360)
- Return Comision
- ElseIf IndexBase = 1 Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.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 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)
- ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 365)
- ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 366)
- End If
- Comision = ComisionOpc1 + ComisionOpc2
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 365)
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 366)
- End If
- End If
- Return Comision
- ElseIf IndexBase = 2 Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.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 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)
- ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 365)
- ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 366)
- End If
- Comision = ComisionOpc1 + ComisionOpc2
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 365)
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 366)
- End If
- End If
- Return Comision
- Else
- Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 360)
- Return Comision
- End If
- Return 0
- End Function
- Function ComisionBolsa()
- Dim ValorTras As Double = ValorTrasado()
- Dim ComisionDeBolsa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionBolsa.Text.ToString)
- Dim PlazoInversion As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
- Dim Comision As Double = 0.0
- If (IndexBase = 0) Then
- Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 360)
- Return Comision
- ElseIf IndexBase = 1 Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.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 CambioDeFecha = 1 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 366)
- ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 365)
- ElseIf CambioDeFecha = 2 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 365)
- ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 366)
- End If
- Comision = ComisionOpc1 + ComisionOpc2
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 365)
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 366)
- End If
- End If
- Return Comision
- ElseIf IndexBase = 2 Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.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 CambioDeFecha = 1 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 366)
- ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 365)
- ElseIf CambioDeFecha = 2 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 365)
- ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 366)
- End If
- Comision = ComisionOpc1 + ComisionOpc2
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 365)
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 366)
- End If
- End If
- Return Comision
- Else
- Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 360)
- Return Comision
- End If
- Return 0
- End Function
- Function RendimientoNeto()
- Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
- Dim TotalPagar As Double = Operaciones.ConvertirDecimal(V_txtTotalAPagar.ToString)
- Dim PlazoInversion As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
- Dim RendBruto As Double = 0
- Dim ComisionCasa As Double = 0
- Dim ComisionBolsa As Double = 0
- If Not String.IsNullOrEmpty(txtRendimientoBruto.Text.ToString.Trim("%")) Then
- RendBruto = txtRendimientoBruto.Text.ToString.Trim("%")
- End If
- If Not String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%")) Then
- ComisionCasa = txtPorcentajeComisionCasa.Text.ToString.Trim("%")
- End If
- If Not String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%")) Then
- ComisionBolsa = txtPorcentajeComisionBolsa.Text.ToString.Trim("%")
- End If
- If (CDec(TotalPagar) = 0 Or CDec(PlazoInversion) = 0) Then
- Return 0
- End If
- If (Double.TryParse(RendBruto, Nothing) And Double.TryParse(RendBruto, Nothing) And Double.TryParse(CDec(ValorNominal), Nothing) And Double.TryParse(CDec(TotalPagar), Nothing) And Double.TryParse(CDec(PlazoInversion), Nothing)) Then
- Dim RendimientoNet As Double = 0
- If ((chbValorPar.Checked And (VCN Or PBUR))) Then
- RendimientoNet = (RendBruto - ComisionCasa - ComisionBolsa) * 0.9
- Return RendimientoNet
- ElseIf CET Then
- RendimientoNet = (RendBruto - ComisionCasa - ComisionBolsa)
- Return RendimientoNet
- Else
- If (IndexBase = 0) Then
- RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (360 / CDec(PlazoInversion))) * 100)
- Return RendimientoNet
- ElseIf IndexBase = 1 Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim RendimientoNetOpc1 = 0.0, RendimientoNetOpc2 = 0.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 CambioDeFecha = 1 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasPrimeraFecha))) * 100)
- RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasSegundaFecha))) * 100)
- ElseIf CambioDeFecha = 2 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasPrimeraFecha))) * 100)
- RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasSegundaFecha))) * 100)
- End If
- RendimientoNet = RendimientoNetOpc1 + RendimientoNetOpc2
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(PlazoInversion))) * 100)
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(PlazoInversion))) * 100)
- End If
- End If
- Return RendimientoNet
- ElseIf IndexBase = 2 Then
- Dim FechaInicial = dtpFechaLiquidacion.Value
- Dim FechaFinal = dtpFechaVencimiento.Value
- Dim RendimientoNetOpc1 = 0.0, RendimientoNetOpc2 = 0.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 CambioDeFecha = 1 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasPrimeraFecha))) * 100)
- RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasSegundaFecha))) * 100)
- ElseIf CambioDeFecha = 2 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasPrimeraFecha))) * 100)
- RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasSegundaFecha))) * 100)
- End If
- RendimientoNet = RendimientoNetOpc1 + RendimientoNetOpc2
- Else
- If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
- RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(PlazoInversion))) * 100)
- End If
- If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
- RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(PlazoInversion))) * 100)
- End If
- End If
- Return RendimientoNet
- Else
- RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (360 / CDec(PlazoInversion))) * 100)
- Return RendimientoNet
- End If
- End If
- End If
- Return 0
- End Function
- Function IngresoBruto()
- Dim ValorNominal As Double = 0
- Dim ValorTrasado As Double = 0
- ValorNominal = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
- ValorTrasado = Operaciones.ConvertirDecimal(V_txtValorTransado.ToString)
- Dim TasaPeriodo = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString)
- TasaPeriodo = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString) / 100
- Dim Base As Integer = 365
- Dim Bruto As Double = 0
- Dim Plazo As Integer = 0
- Plazo = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
- If (chbValorPar.Checked Or CET) Then
- Dim PlazoDias As Integer = 0
- Dim Fecha1 = dtpFechaLiquidacion.Value
- Dim Fecha2 = dtpFechaVencimiento.Value
- IndexBase = cboBase.SelectedIndex
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * Plazo) / 360
- Return Valor
- ElseIf (IndexBase = 1) Then
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
- PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
- Else
- Valor = 0
- End If
- Return Valor
- ElseIf (IndexBase = 2) Then
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
- PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
- Else
- Valor = 0
- End If
- Return Valor
- Else
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 360
- PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 360
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 360
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 360
- Else
- Valor = 0
- End If
- Return Valor
- End If
- Else
- If (Double.TryParse(ValorNominal, Nothing) And Double.TryParse(ValorTrasado, Nothing)) Then
- Bruto = CDec(ValorNominal) - CDec(ValorTrasado)
- Return Bruto
- End If
- End If
- Return 0
- End Function
- Function IngresoNeto()
- Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
- Dim TotalPagar As Double = Operaciones.ConvertirDecimal(V_txtTotalAPagar.ToString)
- Dim Neto As Double = 0
- If chbValorPar.Checked Or CET Then
- Dim IngBruto = Operaciones.ConvertirDecimal(txtIngresoBruto.Text.ToString)
- Dim Descuentos = (Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString) + Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString))
- Neto = (IngBruto * 0.9) - Descuentos
- Return Neto
- End If
- If (Double.TryParse(ValorNominal, Nothing) And Double.TryParse(TotalPagar, Nothing)) Then
- Neto = CDec(ValorNominal) - CDec(TotalPagar)
- Return Neto
- End If
- Return 0
- End Function
- Function TotalPagar()
- Dim ValorTrasado As Double = Operaciones.ConvertirDecimal(V_txtValorTransado.ToString)
- Dim ComisionCasa As Double = Operaciones.ConvertirDecimal(V_txtComisionCasa.ToString)
- Dim ComisionBolsa As Double = Operaciones.ConvertirDecimal(V_txtComisionBolsa.ToString)
- Dim OtrCost As Double = Operaciones.ConvertirDecimal(txtOtrosCostos.Text.ToString)
- txtInteresAcumulado.Text = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString)
- Dim InteresAcumulado = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString)
- If (PBUR Or CET) Then
- If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
- Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa) + InteresAcumulado
- Return Total
- End If
- ElseIf VCN Then
- If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
- Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa) + InteresAcumulado + OtrCost
- Return Total
- End If
- Else
- If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
- Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa)
- Return Total
- End If
- End If
- Return 0
- End Function
- Sub Rellenar()
- If (String.IsNullOrEmpty(txtOtrosCostos.Text.ToString)) Then
- txtOtrosCostos.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPlazoInversion.Text.ToString)) Then
- txtPlazoInversion.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorNominal.Text.ToString.Trim("%"))) Then
- txtValorNominal.Text = 0
- txtValorNominal.Text = Format(txtValorNominal.Text, "0.0")
- End If
- If (String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%"))) Then
- txtPorcentajeComisionCasa.Text = 0
- txtPorcentajeComisionCasa.Text = Format(txtPorcentajeComisionCasa.Text, "0.0")
- End If
- If (String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%"))) Then
- txtPorcentajeComisionBolsa.Text = 0
- txtPorcentajeComisionBolsa.Text = Format(txtPorcentajeComisionBolsa.Text, "0.0")
- End If
- If (String.IsNullOrEmpty(txtRendimientoBruto.Text.ToString.Trim("%"))) Then
- txtRendimientoBruto.Text = 0
- txtRendimientoBruto.Text = Format(txtRendimientoBruto.Text, "0.0")
- End If
- If (String.IsNullOrEmpty(txtInteresAcumulado.Text.ToString.Trim("%"))) Then
- txtInteresAcumulado.Text = "0.0%"
- End If
- If (txtPorcentajeComisionCasa.Text.ToString.IndexOf("%") = -1) Then
- txtPorcentajeComisionCasa.Text += "%"
- End If
- If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
- txtPorcentajeComisionBolsa.Text += "%"
- End If
- If (txtRendimientoBruto.ToString.IndexOf("%") = -1) Then
- txtRendimientoBruto.Text += "%"
- End If
- End Sub
- Sub RellenarDatos()
- If (cboBase.SelectedIndex = 0) Then
- IndexBase = 0
- ElseIf (cboBase.SelectedIndex = 1) Then
- IndexBase = 1
- ElseIf (cboBase.SelectedIndex = 2) Then
- IndexBase = 2
- ElseIf (cboBase.SelectedIndex = 3) Then
- IndexBase = 3
- End If
- Dim FechaOperacion = Date.Now.Date, FechaLiquidacion = Date.Now.Date
- AgregarDias()
- If (CET) Then
- V_txtPrecio = "100"
- Else
- If (chbValorPar.Checked) Then
- V_txtPrecio = "100"
- txtPrecio.Text = "100%"
- Else
- txtPrecio.Text = Format(Precio(), "0.0000")
- V_txtPrecio = Format(Precio(), "0.000000000")
- End If
- End If
- txtValorTransado.Text = Format(ValorTrasado(), "0.0000")
- V_txtValorTransado = Format(ValorTrasado(), "0.000000000")
- txtComisionCasa.Text = Format(ComisionCasa(), "0.0000")
- V_txtComisionCasa = Format(ComisionCasa(), "0.000000000")
- txtComisionBolsa.Text = Format(ComisionBolsa(), "0.0000")
- V_txtComisionBolsa = Format(ComisionBolsa(), "0.000000000")
- txtIngresoBruto.Text = Format(IngresoBruto(), "0.0000")
- V_txtIngresoBruto = Format(IngresoBruto(), "0.000000000")
- FechaOperacion = dtpFechaOperacion.Value
- FechaLiquidacion = dtpFechaLiquidacion.Value
- 'txtDiasAcumulados.Text = Operaciones.DiasAcumulados(FechaOperacion, FechaLiquidacion, 1).ToString()
- Dim Dias = 0
- Dim Fecha As String = Format(dtpUltimaFecha.Value, "yyyy/MM/dd")
- dtpUltimaFecha.Value = Fecha
- Dim FechaLiq As String = Format(dtpFechaLiquidacion.Value, "yyyy/MM/dd")
- dtpFechaLiquidacion.Value = FechaLiq
- If (IndexBase = 0 Or IndexBase = 2) Then
- Dias = Operaciones.Base360(dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)
- ElseIf IndexBase = 1 Or IndexBase = 3 Then
- Dias = Operaciones.Base365(dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)
- End If
- V_txtDiasAcumulados = Dias
- Dim ValorNominal, RendBruto
- ValorNominal = txtValorNominal.Text
- If String.IsNullOrEmpty(ValorNominal.ToString) Then
- ValorNominal = 0
- End If
- RendBruto = txtRendimientoBruto.Text
- If String.IsNullOrEmpty(RendBruto.ToString.Trim("%")) Then
- RendBruto = 0
- Else
- RendBruto = txtRendimientoBruto.Text.TrimEnd("%") / 100
- End If
- txtInteresAcumulado.Text = Format(CDec(Operaciones.InteresAcumuladoPBUR(ValorNominal, RendBruto, V_txtDiasAcumulados, IndexBase, dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)), "0.0000").ToString + "%"
- txtTotalAPagar.Text = Format(TotalPagar(), "0.0000")
- V_txtTotalAPagar = Format(TotalPagar(), "0.000000000")
- txtIngresoNeto.Text = Format(IngresoNeto(), "0.0000")
- V_txtIngresoNeto = Format(IngresoNeto(), "0.000000000")
- txtRendimientoNeto.Text = Format(RendimientoNeto(), "0.0000")
- V_txtRendimientoNeto = Format(RendimientoNeto(), "0.000000000")
- AgregarPorcentaje()
- End Sub
- Private Sub Button1_Click_1(sender As Object, e As EventArgs)
- End Sub
- Sub AgregarDias()
- Dim Dias As Integer = 0
- If Not String.IsNullOrEmpty(txtPlazoInversion.Text) Then
- Dias = txtPlazoInversion.Text
- End If
- Dim Fechaliquidacion = dtpFechaLiquidacion.Value
- If (IndexBase = 0 Or IndexBase = 2) Then
- dtpFechaVencimiento.Value = Operaciones.FechaDias360(Fechaliquidacion, Dias)
- ElseIf IndexBase = 1 Or IndexBase = 3 Then
- dtpFechaVencimiento.Value = dtpFechaLiquidacion.Value.AddDays(Dias)
- End If
- End Sub
- Sub AgregarPorcentaje()
- If (txtRendimientoBruto.ToString.IndexOf("%") = -1) Then
- txtRendimientoBruto.Text += "%"
- End If
- If (txtPorcentajeComisionCasa.Text.ToString.IndexOf("%") = -1) Then
- txtPorcentajeComisionCasa.Text += "%"
- End If
- If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
- txtPorcentajeComisionBolsa.Text += "%"
- End If
- If (txtRendimientoNeto.ToString.IndexOf("%") = -1) Then
- txtRendimientoNeto.Text += "%"
- End If
- If (txtPrecio.ToString.IndexOf("%") = -1) Then
- txtPrecio.Text += "%"
- End If
- End Sub
- Private Sub txtRendimientoBruto_Leave(sender As Object, e As EventArgs) Handles txtRendimientoBruto.Leave
- Rellenar()
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- TipoTransaccion = "M"
- btnAceptar.Text = "Modificar"
- End Sub
- Private Sub txtValorNominal_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominal.KeyPress
- If String.IsNullOrEmpty(txtValorNominal.Text) Then
- If e.KeyChar = "." Then
- txtValorNominal.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtValorNominal.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtPlazoInversion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPlazoInversion.KeyPress
- If String.IsNullOrEmpty(txtPlazoInversion.Text) Then
- If e.KeyChar = "." Then
- txtPlazoInversion.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPlazoInversion.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtPorcentajeComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionCasa.KeyPress
- If String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text) Then
- If e.KeyChar = "." Then
- txtPorcentajeComisionCasa.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPorcentajeComisionCasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtPorcentajeComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionBolsa.KeyPress
- If String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text) Then
- If e.KeyChar = "." Then
- txtPorcentajeComisionBolsa.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPorcentajeComisionBolsa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtRendimientoBruto_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRendimientoBruto.KeyPress
- If String.IsNullOrEmpty(txtRendimientoBruto.Text) Then
- If e.KeyChar = "." Then
- txtRendimientoBruto.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtRendimientoBruto.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- TipoTransaccion = "N"
- btnAceptar.Text = "Agregar"
- End Sub
- Private Sub chbValorPar_CheckedChanged(sender As Object, e As EventArgs) Handles chbValorPar.CheckedChanged
- RellenarDatos()
- End Sub
- Private Sub txtRendimientoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNeto.TextChanged
- End Sub
- Private Sub txtInteresAcumulado_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumulado.TextChanged
- End Sub
- Private Sub txtIngresoBruto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoBruto.TextChanged
- End Sub
- Private Sub dtpUltimaFecha_ValueChanged(sender As Object, e As EventArgs)
- RellenarDatos()
- End Sub
- Private Sub Label14_Click(sender As Object, e As EventArgs) Handles Label14.Click
- End Sub
- Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodicidad.SelectedIndexChanged
- RellenarDatos()
- End Sub
- Private Sub cboCasasCorredoras_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasasCorredoras.SelectedIndexChanged
- RellenarDatos()
- End Sub
- Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
- End Sub
- Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
- End Sub
- Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
- End Sub
- Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
- End Sub
- Private Sub Label10_Click(sender As Object, e As EventArgs) Handles Label10.Click
- End Sub
- Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click
- End Sub
- Private Sub Label11_Click(sender As Object, e As EventArgs) Handles Label11.Click
- End Sub
- Private Sub txtIngresoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoNeto.TextChanged
- End Sub
- Private Sub Label12_Click(sender As Object, e As EventArgs) Handles Label12.Click
- End Sub
- Private Sub Label13_Click(sender As Object, e As EventArgs) Handles Label13.Click
- End Sub
- Private Sub Label15_Click(sender As Object, e As EventArgs) Handles Label15.Click
- End Sub
- Private Sub Label16_Click(sender As Object, e As EventArgs) Handles Label16.Click
- End Sub
- Private Sub Label17_Click(sender As Object, e As EventArgs) Handles Label17.Click
- End Sub
- Private Sub Label6_Click(sender As Object, e As EventArgs) Handles Label6.Click
- End Sub
- Private Sub lblInteresAcumulado_Click(sender As Object, e As EventArgs) Handles lblInteresAcumulado.Click
- End Sub
- Private Sub dtpUltimaFecha_ValueChanged_1(sender As Object, e As EventArgs) Handles dtpUltimaFecha.ValueChanged
- RellenarDatos()
- End Sub
- Private Sub txtOtrosCostos_TextChanged(sender As Object, e As EventArgs) Handles txtOtrosCostos.TextChanged
- RellenarDatos()
- End Sub
- Private Sub txtOtrosCostos_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtOtrosCostos.KeyPress
- If String.IsNullOrEmpty(txtOtrosCostos.Text) Then
- If e.KeyChar = "." Then
- txtOtrosCostos.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtOtrosCostos.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub btnRedencion_Click(sender As Object, e As EventArgs) Handles btnRedencion.Click
- If (btnRedencion.Text = "Redención") Then
- lblRedencion.Visible = True
- dtpRedencion.Visible = True
- btnRedencion.Text = "Cancelar"
- Else
- lblRedencion.Visible = False
- dtpRedencion.Visible = False
- btnRedencion.Text = "Redención"
- End If
- End Sub
- Private Sub txtDiasAcumulados_TextChanged(sender As Object, e As EventArgs)
- RellenarDatos()
- End Sub
- Private Sub txtValorNominal_Leave(sender As Object, e As EventArgs) Handles txtValorNominal.Leave
- Rellenar()
- End Sub
- Private Sub txtPlazoInversion_Leave(sender As Object, e As EventArgs) Handles txtPlazoInversion.Leave
- Rellenar()
- End Sub
- Private Sub txtOtrosCostos_Leave(sender As Object, e As EventArgs) Handles txtOtrosCostos.Leave
- Rellenar()
- End Sub
- Private Sub txtValorNominal_ModifiedChanged(sender As Object, e As EventArgs) Handles txtValorNominal.ModifiedChanged
- End Sub
- Private Sub txtValorNominal_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominal.KeyUp
- If txtValorNominal.Text = "." Then
- txtValorNominal.Text = ".0"
- End If
- End Sub
- Private Sub txtPlazoInversion_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPlazoInversion.KeyUp
- If txtPlazoInversion.Text = "." Then
- txtPlazoInversion.Text = ".0"
- End If
- End Sub
- Private Sub txtPorcentajeComisionCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeComisionCasa.KeyUp
- If txtPorcentajeComisionCasa.Text = "." Then
- txtPorcentajeComisionCasa.Text = ".0"
- End If
- End Sub
- Private Sub txtPorcentajeComisionBolsa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeComisionBolsa.KeyUp
- If txtPorcentajeComisionBolsa.Text = "." Then
- txtPorcentajeComisionBolsa.Text = ".0"
- End If
- End Sub
- Private Sub txtRendimientoBruto_KeyUp(sender As Object, e As KeyEventArgs) Handles txtRendimientoBruto.KeyUp
- If txtRendimientoBruto.Text = "." Then
- txtRendimientoBruto.Text = ".0"
- End If
- End Sub
- Private Sub txtOtrosCostos_KeyUp(sender As Object, e As KeyEventArgs) Handles txtOtrosCostos.KeyUp
- If txtOtrosCostos.Text = "." Then
- txtOtrosCostos.Text = ".0"
- End If
- End Sub
- Private Sub dtpRedencion_ValueChanged(sender As Object, e As EventArgs) Handles dtpRedencion.ValueChanged
- End Sub
- Private Sub btnReporto_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- TipoTransaccion = "B"
- btnAceptar.Text = "Eliminar"
- End Sub
- Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
- Me.Close()
- End Sub
- Private Sub cboBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboBase.SelectedIndexChanged
- RellenarDatos()
- End Sub
- Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
- End Sub
- Private Sub txtPorcentajeComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.Leave
- Rellenar()
- End Sub
- Private Sub txtPorcentajeComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.Leave
- Rellenar()
- End Sub
- Sub AgregarDiasExtra()
- dtpFechaLiquidacion.Value = dtpFechaOperacion.Value.AddDays(2)
- End Sub
- Sub CargarTransladoNuevo()
- Dim Existe As Boolean = ExisteInversion()
- If Not RetCodigoInversionExiste And Not Existe Then
- txtValorNominal.Text = Variables.RetMonto
- txtRendimientoBruto.Text = Variables.RetRendimiento
- End If
- End Sub
- End Class
|