| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436 |
- Public Class frmCertificadosDeInversion
- Dim oCEPrincipal As New CertificadoDeInversionCE
- Dim oDAOPrincipal As New CertificadosDeInversionDAO
- Dim oDAOGeneral As New DAOGeneral
- Dim Bonos As New BonosCE
- Dim TotalValorCupones As Double
- Dim Index
- Dim BonoCalculo As New FormulasBonoCE
- Dim Cargar As Boolean = True
- Dim BonosConsulta As New BonosDAO
- Dim Operaciones As New Operaciones
- Dim ModificarRenta As Boolean = True
- Dim TipoDeCalculoDeFecha As Integer = 0
- Dim IndexBaseC As Integer = 0
- Dim IndexBaseV As Integer = 0
- Dim PeriodoC As Integer = 0
- Dim PeriodoV As Integer = 0
- Private _IdDocumento As Integer
- Private _TipoDocumento As String
- Private _CodigoInversion As String
- Private _TipoTransaccion As String 'N=Nuevo, A=Actualizar, C=Consulta
- Private TipoPeriodicidad As Integer = 0
- Public InstanciaAmortizacion As New DataGridView
- Public InstanciaIngresos As New DataGridView
- Private TipoOperacion As String
- Public Sub New()
- InitializeComponent()
- End Sub
- Public Sub New(TipoOper As String)
- Me.New
- TipoOperacion = TipoOper
- End Sub
- Sub CargarBase()
- If cboAnioBaseC.Items.Count = 0 Or cboAnioBaseC.Items.Count = 1 Then
- Me.cboAnioBaseC.DataSource = oDAOGeneral.ListaBase
- Me.cboAnioBaseC.DisplayMember = "Descripcion"
- Me.cboAnioBaseC.ValueMember = "Codigo"
- Me.cboAnioBaseC.SelectedIndex = 0
- End If
- If cboAnioBaseV.Items.Count = 0 Or cboAnioBaseV.Items.Count = 1 Then
- Me.cboAnioBaseV.DataSource = oDAOGeneral.ListaBase
- Me.cboAnioBaseV.DisplayMember = "Descripcion"
- Me.cboAnioBaseV.ValueMember = "Codigo"
- Me.cboAnioBaseV.SelectedIndex = 0
- End If
- End Sub
- Public Property TipoTransaccion As String
- Get
- Return _TipoTransaccion
- End Get
- Set(value As String)
- _TipoTransaccion = value
- End Set
- End Property
- Private Property IdDocumento As Integer
- Get
- Return _IdDocumento
- End Get
- Set(value As Integer)
- _IdDocumento = value
- End Set
- End Property
- Private Property TipoDocumento As String
- Get
- Return _TipoDocumento
- End Get
- Set(value As String)
- _TipoDocumento = value
- End Set
- End Property
- Private Property CodigoInversion As String
- Get
- Return _CodigoInversion
- End Get
- Set(value As String)
- _CodigoInversion = value
- End Set
- End Property
- Function FechaCupon(ByVal liquidacion As Date, ByVal Vencimiento As Date, ByVal frecuencia As Integer)
- Dim periodos As Integer = 0
- If frecuencia = 1 Then
- periodos = -12
- ElseIf frecuencia = 2 Then
- periodos = -6
- ElseIf frecuencia = 4 Then
- periodos = -3
- ElseIf frecuencia = 12 Then
- periodos = -1
- End If
- If (Not periodos = 0) Then
- While Vencimiento > liquidacion
- Vencimiento = Vencimiento.AddMonths(periodos)
- End While
- Else
- Return liquidacion
- End If
- Return Vencimiento
- End Function
- Sub ValidarExistencia()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Dim Ins As String = Instrumento()
- If (Ins = "TIT") Then
- Tabla = "TIT"
- ElseIf (Ins = "EURB") Then
- Tabla = "EURB0"
- ElseIf (Ins = "BONO") Then
- Tabla = "BON0"
- ElseIf (Ins = "CINV") Then
- Tabla = "CIN0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If Tabla = "TIT" Then
- If (Existe) Then
- navNuevo.Enabled = False
- navModificar.Enabled = True
- navEliminar.Enabled = True
- btnIngresos.Enabled = True
- Else
- navNuevo.Enabled = True
- navModificar.Enabled = False
- navEliminar.Enabled = False
- btnIngresos.Enabled = False
- End If
- Else
- If (Existe) Then
- navNuevo.Enabled = False
- navModificar.Enabled = True
- navEliminar.Enabled = True
- btnIngresos.Enabled = True
- Else
- navNuevo.Enabled = True
- navModificar.Enabled = False
- navEliminar.Enabled = False
- btnIngresos.Enabled = False
- End If
- 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
- Dim Ins As String = Instrumento()
- If (Ins = "TIT") Then
- Tabla = "TIT"
- ElseIf (Ins = "EURB") Then
- Tabla = "EURB0"
- ElseIf (Ins = "BONO") Then
- Tabla = "BON0"
- ElseIf (Ins = "CINV") Then
- Tabla = "CIN0"
- End If
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- Return Existe
- End Function
- Private Sub frmBonos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Dim VExisteInversion As Boolean = False
- If Variables.TipoOperacionCMVTA = "C" Then
- GrpVenta.Enabled = False
- GrpCompra.Enabled = True
- Else
- GrpVenta.Enabled = True
- GrpCompra.Enabled = False
- End If
- VExisteInversion = ExisteInversion()
- ValidarExistencia()
- Dim Ins As String = Instrumento()
- CargarBase()
- AsignacionPeriodicidad()
- If (Not Ins = "TIT") Then
- btnIngresos.Visible = False
- End If
- If (Ins = "TIT") Then
- btnIngresos.Visible = True
- lblBono.Text = "Titularizacion"
- ConfTitularizacion()
- ElseIf (Ins = "EURB") Then
- lblBono.Text = "Euro Bonos"
- ElseIf (Ins = "BONO") Then
- lblBono.Text = "Bonos"
- End If
- Bono()
- TipoDeCalculoDeFecha = 1
- Call CargarPeriodos()
- PrepararTablaIngresos()
- If Me.TipoTransaccion Is Nothing Then
- Me.TipoTransaccion = "N"
- End If
- CargarIngresos()
- RefrescarValorControles()
- Cargar = False
- BotonQuitar()
- CamposTiempo()
- CargarTransladoNuevo()
- ConfiguracionCMVTA(VExisteInversion)
- End Sub
- Sub ConfiguracionCMVTA(ByRef VExisteInversion As Boolean)
- Dim Codigo As String = Variables.Codigo
- Dim ExisteCMVTA As Boolean = oDAOGeneral.ExisteCMVTA(Codigo)
- If Not ExisteCMVTA And Variables.InvocadorProInv = "frmINV" Then
- btnVenderTitulo.Visible = True
- End If
- If CantFormAbierto = False And Not VExisteInversion Then
- If Not Variables.TrasladarCMVTA Is Nothing Then
- cboAnioBaseC.SelectedIndex = Variables.TrasladarCMVTA.BaseCINV
- txtPorcentajeCuponCompra.Text = Variables.TrasladarCMVTA.CuponCINV
- dtpFechaLiquidacionCompra.Value = Variables.TrasladarCMVTA.FechaLiquidacionCINV
- dtpFechaVencimientoCompra.Value = Variables.TrasladarCMVTA.FechaVencimientoCINV
- cboPeriodosC.SelectedValue = Variables.TrasladarCMVTA.PeriodicidadCINV
- txtComisionPorBolsaCompra.Text = Variables.TrasladarCMVTA.PorcentajeComisionBolsaCINV
- txtComisionPorCompraCasa.Text = Variables.TrasladarCMVTA.PorcentajeComisionCasaCINV
- txtPrecioCompra.Text = Variables.TrasladarCMVTA.PrecioCompraCINV
- txtPrecioAlVencimientoCompra.Text = Variables.TrasladarCMVTA.PrecioVencimientoCINV
- dtpUltimaFechaCuponCompra.Value = Variables.TrasladarCMVTA.UltimaFechaCuponCINV
- txtValorNominalCompra.Text = Variables.TrasladarCMVTA.ValorNominalCINV
- txtYTMAlVencimientoCompra.Text = Variables.TrasladarCMVTA.YTMVencimientoCINV
- End If
- End If
- End Sub
- Sub CamposTiempo()
- If Not TypeOf cboPeriodosC.SelectedValue Is DataRowView Then
- Variables.PeriodicidadTIT = cboPeriodosC.SelectedValue
- End If
- Variables.BaseTIT = cboAnioBaseC.SelectedIndex
- End Sub
- Sub ConfTitularizacion()
- dgvIngresos.Dispose()
- TbIngresos.Parent = Nothing
- Dim TbAmortizacion As New TabPage
- Dim frmTitularizacion As New frmResultadoTitularizacion()
- TbAmortizacion.Name = "tbAmortizacion"
- TbAmortizacion.Text = "Amortizacion"
- If TabCampos.TabCount = 2 Then
- frmTitularizacion.Dock = DockStyle.Fill
- frmTitularizacion.TopLevel = False
- frmTitularizacion.Parent = TbAmortizacion
- TabCampos.Controls.Add(TbAmortizacion)
- frmTitularizacion.Show()
- 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 Bono()
- dtpSiguienteFechaCuponCompra.Enabled = False
- dtpSiguienteFechaCuponVenta.Enabled = False
- dtpUltimaFechaCuponCompra.Enabled = True
- dtpUltimaFechaCuponVenta.Enabled = True
- End Sub
- Private Function Parametros()
- Dim Coleccion As New Collection
- Dim PeriodoCompra = cboPeriodosC.SelectedValue
- Dim ValorNominalCompra = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- Dim UltCuponCompra = Operaciones.ConvertirFecha(dtpUltimaFechaCuponCompra.Value.ToString)
- Dim SigFechaCuponCompra = Operaciones.ConvertirFecha(dtpSiguienteFechaCuponCompra.Value.ToString)
- Dim FechaLiqCompra = Operaciones.ConvertirFecha(dtpFechaLiquidacionCompra.Value.ToString)
- Dim FechaVenCompra = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
- Dim PorcentajeCuponCompra = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString) / 100
- Dim PrecioVenciCompra = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoCompra.Text.ToString)
- Dim PrecioCompra = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
- Dim DiasBase = IndexBaseC
- Dim CostoTransCompra = Operaciones.ConvertirDecimal(txtCostoTransferenciaCompra.Text.ToString)
- Dim PorcCupC = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString) / 100
- Dim PeriodoVenta = cboPeriodosV.SelectedValue
- Dim ValorNominalVenta = Operaciones.ConvertirDecimal(txtValorNominalVenta.Text.ToString)
- Dim UltCuponVenta = Operaciones.ConvertirFecha(dtpUltimaFechaCuponVenta.Value.ToString)
- Dim SigFechaCuponVenta = Operaciones.ConvertirFecha(dtpSiguienteFechaCuponVenta.Value.ToString)
- Dim FechaLiqVenta = Operaciones.ConvertirFecha(dtpFechaLiquidacionVenta.Value.ToString)
- Dim FechaVenVenta = Operaciones.ConvertirFecha(dtpFechaVencimientoVenta.Value.ToString)
- Dim PorcentajeCuponVenta = Operaciones.ConvertirDecimal(txtPorcentajeCuponVenta.Text.ToString) / 100
- Dim PrecioVenciVenta = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoVenta.Text.ToString)
- Dim PrecioVenta = Operaciones.ConvertirDecimal(txtPrecioVenta.Text.ToString)
- Dim DiasBaseV = IndexBaseV
- Dim CostoTransVenta = Operaciones.ConvertirDecimal(txtCuponesRecibidos.Text.ToString)
- Dim PorcCupV = Operaciones.ConvertirDecimal(txtPorcentajeCuponVenta.Text.ToString) / 100
- Dim ComisionPorCompraCasa = Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString) / 100
- Dim ComisionPorCompraBolsa = Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString) / 100
- Dim ComisionPorVentaCasa = Operaciones.ConvertirDecimal(txtComisionPorVentaCasa.Text.ToString) / 100
- Dim ComisionPorVentaBolsa = Operaciones.ConvertirDecimal(txtComisionPorBolsaVenta.Text.ToString) / 100
- Dim YTMCompra = Operaciones.ConvertirDecimal(txtYTMAlVencimientoComisionCompra.Text.ToString) / 100
- Dim YTMVenta = Operaciones.ConvertirDecimal(txtYTMAlVencimientoComisionVenta.Text.ToString) / 100
- Dim DiasVenC, DiasVenV, DiasAcuC, DiasAcuV, YTMVenC, YTMVenV, IntAcuC, IntAcuV, IntPorAcuC, IntPorAcuV, PrecSucioC, PrecSucioV
- Dim ComisionCasaC, ComisionCasaV, ComisionBolsaC, ComisionBolsaV, ValTransC, ValTransV, MontoPagar, MontoRecibir, CostTrans, CupRecibidos
- DiasVenC = Operaciones.ConvertirEntero(txtDiasAlVencimientoCompra.Text.ToString)
- DiasVenV = Operaciones.ConvertirEntero(txtDiasAlVencimientoVenta.Text.ToString)
- DiasAcuC = Operaciones.ConvertirEntero(txtDiasAcumuladosCompra.Text.ToString)
- DiasAcuV = Operaciones.ConvertirEntero(txtDiasAcumuladosVenta.Text.ToString)
- YTMVenC = Operaciones.ConvertirDecimal(txtYTMAlVencimientoCompra.Text.ToString) / 100
- YTMVenV = Operaciones.ConvertirDecimal(txtYTMAlVencimientoVenta.Text.ToString) / 100
- IntAcuC = Operaciones.ConvertirDecimal(txtInteresAcumuladoCompra.Text.ToString)
- IntAcuV = Operaciones.ConvertirDecimal(txtInteresAcumuladoVenta.Text.ToString)
- IntPorAcuC = Operaciones.ConvertirDecimal(txtPorcentajeInteresAcumuladoCompra.Text.ToString) / 100
- IntPorAcuV = Operaciones.ConvertirDecimal(txtPorcentajeInteresAcumuladoVenta.Text.ToString) / 100
- PrecSucioC = Operaciones.ConvertirDecimal(txtPrecioSucioCompra.Text.ToString) / 100
- PrecSucioV = Operaciones.ConvertirDecimal(txtPrecioSucioVenta.Text.ToString) / 100
- ComisionCasaC = Operaciones.ConvertirDecimal(txtComisionCompraCasa.Text.ToString)
- ComisionCasaV = Operaciones.ConvertirDecimal(txtComisionVentaCasa.Text.ToString)
- ComisionBolsaC = Operaciones.ConvertirDecimal(txtComisionCompraBolsa.Text.ToString)
- ComisionBolsaV = Operaciones.ConvertirDecimal(txtComisionVentaBolsa.Text.ToString)
- ValTransC = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- ValTransV = Operaciones.ConvertirDecimal(txtValorTransadoVenta.Text.ToString)
- MontoPagar = Operaciones.ConvertirDecimal(txtMontoAPagar.Text.ToString)
- MontoRecibir = Operaciones.ConvertirDecimal(txtMontoARecibir.Text.ToString)
- CostTrans = Operaciones.ConvertirDecimal(txtCostoTransferenciaCompra.Text.ToString)
- CupRecibidos = Operaciones.ConvertirEntero(txtCuponesRecibidos.Text.ToString)
- Dim Codigo = Variables.Codigo
- Coleccion.Add(PeriodoCompra)
- Coleccion.Add(ValorNominalCompra)
- Coleccion.Add(UltCuponCompra)
- Coleccion.Add(SigFechaCuponCompra)
- Coleccion.Add(FechaLiqCompra)
- Coleccion.Add(FechaVenCompra)
- Coleccion.Add(PorcentajeCuponCompra)
- Coleccion.Add(PrecioVenciCompra)
- Coleccion.Add(PrecioCompra)
- Coleccion.Add(DiasBase)
- Coleccion.Add(CostoTransCompra)
- Coleccion.Add(PeriodoVenta)
- Coleccion.Add(ValorNominalVenta)
- Coleccion.Add(UltCuponVenta)
- Coleccion.Add(SigFechaCuponVenta)
- Coleccion.Add(FechaLiqVenta)
- Coleccion.Add(FechaVenVenta)
- Coleccion.Add(PorcentajeCuponVenta)
- Coleccion.Add(PrecioVenciVenta)
- Coleccion.Add(PrecioVenta)
- Coleccion.Add(DiasBaseV)
- Coleccion.Add(CostoTransVenta)
- Coleccion.Add(Codigo)
- Coleccion.Add(PorcCupC)
- Coleccion.Add(PorcCupV)
- Coleccion.Add(ComisionPorCompraCasa)
- Coleccion.Add(ComisionPorCompraBolsa)
- Coleccion.Add(ComisionPorVentaCasa)
- Coleccion.Add(ComisionPorVentaBolsa)
- Coleccion.Add(YTMCompra)
- Coleccion.Add(YTMVenta)
- Coleccion.Add(DiasVenC)
- Coleccion.Add(DiasVenV)
- Coleccion.Add(DiasAcuC)
- Coleccion.Add(DiasAcuV)
- Coleccion.Add(YTMVenC)
- Coleccion.Add(YTMVenV)
- Coleccion.Add(IntAcuC)
- Coleccion.Add(IntAcuV)
- Coleccion.Add(IntPorAcuC)
- Coleccion.Add(IntPorAcuV)
- Coleccion.Add(PrecSucioC)
- Coleccion.Add(PrecSucioV)
- Coleccion.Add(ComisionCasaC)
- Coleccion.Add(ComisionCasaV)
- Coleccion.Add(ComisionBolsaC)
- Coleccion.Add(ComisionBolsaV)
- Coleccion.Add(ValTransC)
- Coleccion.Add(ValTransV)
- Coleccion.Add(MontoPagar)
- Coleccion.Add(MontoRecibir)
- Coleccion.Add(CostTrans)
- Coleccion.Add(CupRecibidos)
- Return Coleccion
- End Function
- Private Sub LimpiarElementos()
- Dim Fecha = DateTime.Today
- dgvIngresos.Rows.Clear()
- cboPeriodosC.SelectedIndex = -1
- txtValorNominalCompra.Text = String.Empty
- dtpUltimaFechaCuponCompra.Value = Fecha
- dtpSiguienteFechaCuponCompra.Value = Fecha
- dtpFechaLiquidacionCompra.Value = Fecha
- dtpFechaVencimientoCompra.Value = Fecha
- txtPorcentajeCuponCompra.Text = String.Empty
- txtPrecioAlVencimientoCompra.Text = String.Empty
- txtPrecioCompra.Text = String.Empty
- cboAnioBaseC.SelectedIndex = 0
- txtCostoTransferenciaCompra.Text = String.Empty
- txtYTMAlVencimientoCompra.Text = String.Empty
- txtYTMAlVencimientoComisionCompra.Text = String.Empty
- txtComisionCompraCasa.Text = String.Empty
- txtComisionCompraBolsa.Text = String.Empty
- cboPeriodosV.SelectedIndex = -1
- txtValorNominalVenta.Text = String.Empty
- dtpUltimaFechaCuponVenta.Value = Fecha
- dtpSiguienteFechaCuponVenta.Value = Fecha
- dtpFechaLiquidacionVenta.Value = Fecha
- dtpFechaVencimientoVenta.Value = Fecha
- txtPorcentajeCuponVenta.Text = String.Empty
- txtPrecioAlVencimientoVenta.Text = String.Empty
- txtPrecioVenta.Text = String.Empty
- cboAnioBaseV.SelectedIndex = 0
- txtCuponesRecibidos.Text = String.Empty
- txtYTMAlVencimientoVenta.Text = String.Empty
- txtYTMAlVencimientoComisionVenta.Text = String.Empty
- txtComisionVentaCasa.Text = String.Empty
- txtComisionVentaBolsa.Text = String.Empty
- End Sub
- Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
- Dim Codigo = Variables.Codigo
- If TipoTransaccion = "N" Then
- oDAOPrincipal.Nuevo(Parametros, Instrumento)
- ElseIf Not ExisteValidacion() Then
- Variables.ColeccionCINV = Parametros()
- Me.Close()
- End If
- If TipoTransaccion = "M" Then
- Dim Diccionario As New Dictionary(Of Integer, Collection)
- Diccionario = ModificarIngreso()
- oDAOPrincipal.ProcesoDatos(Parametros, Diccionario, Instrumento)
- End If
- If TipoTransaccion = "B" Then
- oDAOPrincipal.
- Eliminar(Codigo, Instrumento)
- LimpiarElementos()
- End If
- ValidarExistencia()
- End Sub
- Public Sub CargarRegistro(ByVal CodInversion As String)
- TipoTransaccion = "C"
- CodigoInversion = CodInversion
- End Sub
- Private Sub dtpUltimaFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponCompra.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpSiguienteFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponCompra.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionCompra.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaVencimientoCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPorcentajeCuponCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtCostoTransferenciaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaVencimientoVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub cboAnioBaseC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseC.SelectedIndexChanged
- Formato()
- Calculos()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Private Sub cboAnioBaseV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseV.SelectedIndexChanged
- Formato()
- Calculos()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Sub CargarPeriodos()
- If cboPeriodosC.Items.Count = 0 Or cboPeriodosC.Items.Count = 1 Then
- Me.cboPeriodosC.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodosC.ValueMember = "Codigo"
- Me.cboPeriodosC.DisplayMember = "Descripcion"
- Me.cboPeriodosC.SelectedIndex = 0
- End If
- If cboPeriodosV.Items.Count = 0 Or cboPeriodosV.Items.Count = 1 Then
- Me.cboPeriodosV.DataSource = oDAOGeneral.ListaPeriodicidad
- Me.cboPeriodosV.ValueMember = "Codigo"
- Me.cboPeriodosV.DisplayMember = "Descripcion"
- Me.cboPeriodosV.SelectedIndex = 0
- End If
- End Sub
- Private Sub cboPeriodosC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosC.SelectedIndexChanged
- Formato()
- Calculos()
- ControlPeriodosCompra()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Private Sub cboPeriodosV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosV.SelectedIndexChanged
- Formato()
- Calculos()
- ValidacionErrores()
- CamposTiempo()
- End Sub
- Private Sub RefrescarValorControles()
- Dim codigo = Variables.Codigo
- Dim coleccion = oDAOPrincipal.CargarRegistro(codigo, Instrumento)
- If (Not coleccion.Count = 1) Then
- Dim Operaciones As New Operaciones
- IndexBaseC = Operaciones.ConvertirEntero(coleccion(10).ToString)
- IndexBaseV = Operaciones.ConvertirEntero(coleccion(21).ToString)
- cboPeriodosC.SelectedValue = coleccion(1).ToString
- txtValorNominalCompra.Text = Operaciones.ConvertirDecimal(coleccion(2).ToString)
- dtpUltimaFechaCuponCompra.Value = Operaciones.ConvertirFecha(coleccion(3).ToString)
- dtpSiguienteFechaCuponCompra.Value = Operaciones.ConvertirFecha(coleccion(4).ToString)
- dtpFechaLiquidacionCompra.Value = Operaciones.ConvertirFecha(coleccion(5).ToString)
- dtpFechaVencimientoCompra.Value = Operaciones.ConvertirFecha(coleccion(6).ToString)
- txtPrecioAlVencimientoCompra.Text = Operaciones.ConvertirDecimal(coleccion(8).ToString)
- txtPrecioCompra.Text = Operaciones.ConvertirDecimal(coleccion(9).ToString)
- cboAnioBaseC.SelectedIndex = IndexBaseC
- txtCostoTransferenciaCompra.Text = Operaciones.ConvertirDecimal(coleccion(11).ToString)
- txtPorcentajeInteresAcumuladoCompra.Text = Operaciones.ConvertirDecimal(txtPorcentajeInteresAcumuladoCompra.Text.ToString)
- txtPorcentajeCuponCompra.Text = Operaciones.ConvertirDecimal(coleccion(23).ToString) * 100
- txtComisionPorCompraCasa.Text = Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString)
- txtValorTransadoCompra.Text = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- txtComisionPorBolsaCompra.Text = Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString)
- txtComisionCompraCasa.Text = Operaciones.Comisiones(Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString) / 100, Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString).ToString)
- txtComisionCompraBolsa.Text = Operaciones.Comisiones(Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString) / 100, Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString).ToString)
- txtYTMAlVencimientoCompra.Text = Operaciones.ConvertirDecimal(txtYTMAlVencimientoCompra.Text.ToString)
- cboPeriodosV.SelectedValue = coleccion(12).ToString
- txtValorNominalVenta.Text = Operaciones.ConvertirDecimal(coleccion(13).ToString)
- dtpUltimaFechaCuponVenta.Value = Operaciones.ConvertirFecha(coleccion(14).ToString)
- dtpSiguienteFechaCuponVenta.Value = Operaciones.ConvertirFecha(coleccion(15).ToString)
- dtpFechaLiquidacionVenta.Value = Operaciones.ConvertirFecha(coleccion(16).ToString)
- dtpFechaVencimientoVenta.Value = Operaciones.ConvertirFecha(coleccion(17).ToString)
- txtPorcentajeCuponVenta.Text = Operaciones.ConvertirDecimal(coleccion(24).ToString) * 100
- txtPrecioAlVencimientoVenta.Text = Operaciones.ConvertirDecimal(coleccion(19).ToString)
- txtPrecioVenta.Text = Operaciones.ConvertirDecimal(coleccion(20).ToString)
- cboAnioBaseV.SelectedIndex = IndexBaseV
- txtCuponesRecibidos.Text = Operaciones.ConvertirEntero(coleccion(22).ToString)
- txtComisionPorVentaCasa.Text = Operaciones.ConvertirDecimal(txtComisionPorVentaCasa.Text.ToString)
- txtComisionPorBolsaVenta.Text = Operaciones.ConvertirDecimal(txtComisionPorBolsaVenta.Text.ToString)
- txtYTMAlVencimientoVenta.Text = Operaciones.ConvertirDecimal(txtYTMAlVencimientoVenta.Text.ToString)
- txtComisionPorCompraCasa.Text = Operaciones.ConvertirDecimal(coleccion(25).ToString) * 100
- txtComisionPorBolsaCompra.Text = Operaciones.ConvertirDecimal(coleccion(26).ToString) * 100
- txtComisionPorVentaCasa.Text = Operaciones.ConvertirDecimal(coleccion(27).ToString) * 100
- txtComisionPorBolsaVenta.Text = Operaciones.ConvertirDecimal(coleccion(28).ToString) * 100
- txtYTMAlVencimientoComisionCompra.Text = Operaciones.ConvertirDecimal(coleccion(29).ToString) * 100
- txtYTMAlVencimientoComisionVenta.Text = Operaciones.ConvertirDecimal(coleccion(30).ToString) * 100
- 'Campos Extras'
- txtDiasAlVencimientoCompra.Text = Operaciones.ConvertirEntero(coleccion(31).ToString)
- txtDiasAlVencimientoVenta.Text = Operaciones.ConvertirEntero(coleccion(32).ToString)
- txtDiasAcumuladosCompra.Text = Operaciones.ConvertirEntero(coleccion(33).ToString)
- txtDiasAcumuladosVenta.Text = Operaciones.ConvertirEntero(coleccion(34).ToString)
- txtYTMAlVencimientoCompra.Text = (Operaciones.ConvertirDecimal(coleccion(35).ToString) * 100).ToString + "%"
- txtYTMAlVencimientoVenta.Text = (Operaciones.ConvertirDecimal(coleccion(36).ToString) * 100).ToString + "%"
- txtPorcentajeInteresAcumuladoCompra.Text = (Operaciones.ConvertirDecimal(coleccion(37).ToString) * 100).ToString + "%"
- txtPorcentajeInteresAcumuladoVenta.Text = (Operaciones.ConvertirDecimal(coleccion(38).ToString) * 100).ToString + "%"
- txtInteresAcumuladoCompra.Text = Operaciones.ConvertirDecimal(coleccion(39).ToString)
- txtInteresAcumuladoVenta.Text = Operaciones.ConvertirDecimal(coleccion(40).ToString)
- txtPrecioSucioCompra.Text = Operaciones.ConvertirDecimal(coleccion(41).ToString) * 100
- txtPrecioSucioVenta.Text = Operaciones.ConvertirDecimal(coleccion(42).ToString) * 100
- txtComisionCompraCasa.Text = Operaciones.ConvertirDecimal(coleccion(43).ToString)
- txtComisionVentaCasa.Text = Operaciones.ConvertirDecimal(coleccion(44).ToString)
- txtComisionCompraBolsa.Text = Operaciones.ConvertirDecimal(coleccion(45).ToString)
- txtComisionVentaBolsa.Text = Operaciones.ConvertirDecimal(coleccion(46).ToString)
- txtValorTransadoCompra.Text = Operaciones.ConvertirDecimal(coleccion(47).ToString)
- txtValorTransadoVenta.Text = Operaciones.ConvertirDecimal(coleccion(48).ToString)
- txtMontoAPagar.Text = Operaciones.ConvertirDecimal(coleccion(49).ToString)
- txtMontoARecibir.Text = Operaciones.ConvertirDecimal(coleccion(50).ToString)
- txtCuponesRecibidos.Text = Operaciones.ConvertirEntero(coleccion(51).ToString)
- End If
- End Sub
- Sub Formato()
- If cboPeriodosC.SelectedIndex = -1 Then
- If cboPeriodosC.Items.Count > 0 Then
- cboPeriodosC.SelectedIndex = 0
- End If
- End If
- If cboPeriodosV.SelectedIndex = -1 Then
- If cboPeriodosV.Items.Count > 0 Then
- cboPeriodosV.SelectedIndex = 0
- End If
- End If
- If cboAnioBaseC.SelectedIndex = -1 Then
- If cboAnioBaseC.Items.Count > 0 Then
- cboAnioBaseC.SelectedIndex = 0
- End If
- End If
- If cboAnioBaseV.SelectedIndex = -1 Then
- If cboAnioBaseV.Items.Count > 0 Then
- cboAnioBaseV.SelectedIndex = 0
- End If
- End If
- If IsNumeric(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
- End If
- End If
- If IsNumeric(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
- End If
- End If
- If IsNumeric(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- txtPrecioSucioCompra.Text = "0.0%"
- End If
- End If
- If IsNumeric(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- txtPrecioSucioVenta.Text = "0.0%"
- End If
- End If
- If (String.IsNullOrEmpty(txtValorNominalCompra.Text.ToString)) Then
- txtValorNominalCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAlVencimientoCompra.Text)) Then
- txtDiasAlVencimientoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAcumuladosCompra.Text)) Then
- txtDiasAcumuladosCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text)) Then
- txtPorcentajeCuponCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoComisionCompra.Text)) Then
- txtYTMAlVencimientoComisionCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text)) Then
- txtYTMAlVencimientoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text)) Then
- txtPrecioAlVencimientoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioCompra.Text)) Then
- txtPrecioCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtInteresAcumuladoCompra.Text)) Then
- txtInteresAcumuladoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoCompra.Text)) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioSucioCompra.Text)) Then
- txtPrecioSucioCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorCompraCasa.Text)) Then
- txtComisionPorCompraCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionCompraCasa.Text)) Then
- txtComisionCompraCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text)) Then
- txtComisionPorBolsaCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionCompraBolsa.Text)) Then
- txtComisionCompraBolsa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
- txtValorTransadoCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtMontoAPagar.Text)) Then
- txtMontoAPagar.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text)) Then
- txtCostoTransferenciaCompra.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorNominalVenta.Text)) Then
- txtValorNominalVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAlVencimientoVenta.Text)) Then
- txtDiasAlVencimientoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtDiasAcumuladosVenta.Text)) Then
- txtDiasAcumuladosVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text)) Then
- txtPorcentajeCuponVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoComisionVenta.Text)) Then
- txtYTMAlVencimientoComisionVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text)) Then
- txtYTMAlVencimientoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text)) Then
- txtPrecioAlVencimientoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioVenta.Text)) Then
- txtPrecioVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtInteresAcumuladoVenta.Text)) Then
- txtInteresAcumuladoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoVenta.Text)) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPrecioSucioVenta.Text)) Then
- txtPrecioSucioVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorVentaCasa.Text)) Then
- txtComisionPorVentaCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionVentaCasa.Text)) Then
- txtComisionVentaCasa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text)) Then
- txtComisionPorBolsaVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtComisionVentaBolsa.Text)) Then
- txtComisionVentaBolsa.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
- txtValorTransadoVenta.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtMontoARecibir.Text)) Then
- txtMontoARecibir.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtCuponesRecibidos.Text)) Then
- txtCuponesRecibidos.Text = "0.0"
- End If
- If (txtPorcentajeCuponCompra.ToString.IndexOf("%") = -1) Then
- txtPorcentajeCuponCompra.Text += "%"
- End If
- If (txtYTMAlVencimientoCompra.ToString.IndexOf("%") = -1) Then
- txtYTMAlVencimientoCompra.Text += "%"
- End If
- If (txtPorcentajeCuponVenta.ToString.IndexOf("%") = -1) Then
- txtPorcentajeCuponVenta.Text += "%"
- End If
- If (txtYTMAlVencimientoVenta.ToString.IndexOf("%") = -1) Then
- txtYTMAlVencimientoVenta.Text += "%"
- End If
- If (txtComisionPorCompraCasa.ToString.IndexOf("%") = -1) Then
- txtComisionPorCompraCasa.Text += "%"
- End If
- If (txtComisionPorBolsaCompra.ToString.IndexOf("%") = -1) Then
- txtComisionPorBolsaCompra.Text += "%"
- End If
- If (txtComisionPorVentaCasa.ToString.IndexOf("%") = -1) Then
- txtComisionPorVentaCasa.Text += "%"
- End If
- If (txtComisionPorBolsaVenta.ToString.IndexOf("%") = -1) Then
- txtComisionPorBolsaVenta.Text += "%"
- End If
- End Sub
- Sub Calculos()
- If (Not Cargar) Then
- Dim V_dtpSiguienteFechaCuponCompra = Date.Now.Date, V_dtpFechaVencimientoCompra = Date.Now.Date, V_dtpFechaLiquidacionCompra = Date.Now.Date, V_dtpUltimaFechaCuponCompra = Date.Now.Date
- Dim V_txtValorNominalCompra = 0.0, V_txtPorcentajeCuponCompra = 0.0, V_txtDiasAcumuladosCompra = 0, V_txtInteresAcumuladoCompra = 0.0
- Dim V_txtPorcentajeInteresAcumuladoCompra = 0.0, V_txtComisionPorCompraCasa = 0.0, V_txtValorTransadoCompra = 0.0
- Dim V_txtComisionPorBolsaCompra = 0.0, V_txtComisionCompraCasa = 0.0, V_txtComisionCompraBolsa = 0.0
- Dim V_txtYTMAlVencimientoCompra = 0.0, V_txtYTMAlVencimientoComisionCompra = 0.0, V_txtMontoAPagar = 0.0, V_txtPrecioCompra = 0.0
- Dim V_txtPrecioAlVencimientoCompra = 0.0, V_txtCostoTransferenciaCompra = 0.0, V_txtPrecioSucioCompra = 0.0
- Dim V_txtDiasAlVencimientoCompra = 0
- Dim TipoPeriodoCompra As Integer = 0
- Dim V_dtpSiguienteFechaCuponVenta = Date.Now.Date, V_dtpFechaVencimientoVenta = Date.Now.Date, V_dtpFechaLiquidacionVenta = Date.Now.Date, V_dtpUltimaFechaCuponVenta = Date.Now.Date
- Dim V_txtValorNominalVenta = 0.0, V_txtPorcentajeCuponVenta = 0.0, V_txtDiasAcumuladosVenta = 0, V_txtInteresAcumuladoVenta = 0.0
- Dim V_txtPorcentajeInteresAcumuladoVenta = 0.0, V_txtComisionPorVentaCasa = 0.0, V_txtValorTransadoVenta = 0.0
- Dim V_txtComisionPorBolsaVenta = 0.0, V_txtComisionVentaCasa = 0.0, V_txtComisionVentaBolsa = 0.0
- Dim V_txtYTMAlVencimientoVenta = 0.0, V_txtYTMAlVencimientoComisionVenta = 0.0, V_txtPrecioVenta = 0.0
- Dim V_txtPrecioAlVencimientoVenta = 0.0, V_txtCostoTransferenciaVenta = 0.0, V_txtPrecioSucioVenta = 0.0
- Dim V_txtDiasAlVencimientoVenta = 0.0, V_txtMontoARecibir = 0.0, V_txtCuponesRecibidos = 0.0
- Dim TipoPeriodoVenta As Integer = 0
- V_dtpSiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
- V_dtpSiguienteFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
- V_dtpUltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value
- V_dtpUltimaFechaCuponVenta = dtpUltimaFechaCuponVenta.Value
- V_dtpFechaVencimientoCompra = dtpFechaVencimientoCompra.Value
- V_dtpFechaVencimientoVenta = dtpFechaVencimientoVenta.Value
- V_dtpFechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value
- V_dtpFechaLiquidacionVenta = dtpFechaLiquidacionVenta.Value
- V_txtValorNominalCompra = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- V_txtValorNominalVenta = Operaciones.ConvertirDecimal(txtValorNominalVenta.Text.ToString)
- V_txtPorcentajeCuponCompra = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString) / 100
- V_txtPorcentajeCuponVenta = Operaciones.ConvertirDecimal(txtPorcentajeCuponVenta.Text.ToString) / 100
- V_txtYTMAlVencimientoCompra = Operaciones.ConvertirDecimal(txtYTMAlVencimientoCompra.Text.ToString) / 100
- V_txtYTMAlVencimientoVenta = Operaciones.ConvertirDecimal(txtYTMAlVencimientoVenta.Text.ToString) / 100
- V_txtPrecioCompra = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
- V_txtPrecioVenta = Operaciones.ConvertirDecimal(txtPrecioVenta.Text.ToString)
- V_txtPrecioAlVencimientoCompra = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoCompra.Text.ToString)
- V_txtPrecioAlVencimientoVenta = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoVenta.Text.ToString)
- V_txtComisionPorCompraCasa = Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString) / 100
- V_txtComisionPorVentaCasa = Operaciones.ConvertirDecimal(txtComisionPorVentaCasa.Text.ToString) / 100
- V_txtComisionCompraCasa = Operaciones.ConvertirDecimal(txtComisionCompraCasa.Text.ToString)
- V_txtComisionVentaCasa = Operaciones.ConvertirDecimal(txtComisionVentaCasa.Text.ToString)
- V_txtComisionPorBolsaCompra = Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString) / 100
- V_txtComisionPorBolsaVenta = Operaciones.ConvertirDecimal(txtComisionPorBolsaVenta.Text.ToString) / 100
- V_txtComisionCompraBolsa = Operaciones.ConvertirDecimal(txtComisionCompraBolsa.Text.ToString)
- V_txtComisionVentaBolsa = Operaciones.ConvertirDecimal(txtComisionVentaBolsa.Text.ToString)
- V_txtCostoTransferenciaCompra = Operaciones.ConvertirDecimal(txtCostoTransferenciaCompra.Text.ToString)
- If (cboPeriodosC.SelectedValue = "M") Then
- TipoPeriodoCompra = 12
- PeriodoC = 1
- ElseIf (cboPeriodosC.SelectedValue = "T") Then
- TipoPeriodoCompra = 4
- PeriodoC = 3
- ElseIf (cboPeriodosC.SelectedValue = "S") Then
- TipoPeriodoCompra = 2
- PeriodoC = 6
- ElseIf (cboPeriodosC.SelectedValue = "A") Then
- TipoPeriodoCompra = 1
- PeriodoC = 12
- End If
- If (cboPeriodosV.SelectedValue = "M") Then
- TipoPeriodoVenta = 12
- PeriodoV = 1
- ElseIf (cboPeriodosV.SelectedValue = "T") Then
- TipoPeriodoVenta = 4
- PeriodoV = 3
- ElseIf (cboPeriodosV.SelectedValue = "S") Then
- TipoPeriodoVenta = 2
- PeriodoV = 6
- ElseIf (cboPeriodosV.SelectedValue = "A") Then
- TipoPeriodoVenta = 1
- PeriodoV = 12
- End If
- If cboAnioBaseC.SelectedIndex = 0 Then
- IndexBaseC = 0
- ElseIf cboAnioBaseC.SelectedIndex = 1 Then
- IndexBaseC = 1
- ElseIf cboAnioBaseC.SelectedIndex = 2 Then
- IndexBaseC = 2
- Else
- IndexBaseC = 3
- End If
- If cboAnioBaseV.SelectedIndex = 0 Then
- IndexBaseV = 0
- ElseIf cboAnioBaseV.SelectedIndex = 1 Then
- IndexBaseV = 1
- ElseIf cboAnioBaseV.SelectedIndex = 2 Then
- IndexBaseV = 2
- Else
- IndexBaseV = 3
- End If
- If (TipoDeCalculoDeFecha = 0) Then
- dtpUltimaFechaCuponCompra.Value = FechaCupon(V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, TipoPeriodoCompra)
- dtpUltimaFechaCuponVenta.Value = FechaCupon(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, TipoPeriodoVenta)
- Else
- dtpSiguienteFechaCuponCompra.Value = FechaTipo(V_dtpUltimaFechaCuponCompra, TipoPeriodoCompra)
- dtpSiguienteFechaCuponVenta.Value = FechaTipo(V_dtpUltimaFechaCuponVenta, TipoPeriodoVenta)
- End If
- V_dtpSiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value
- V_dtpSiguienteFechaCuponVenta = dtpSiguienteFechaCuponVenta.Value
- V_dtpUltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value
- V_dtpUltimaFechaCuponVenta = dtpUltimaFechaCuponVenta.Value
- V_dtpFechaVencimientoCompra = dtpFechaVencimientoCompra.Value
- V_dtpFechaVencimientoVenta = dtpFechaVencimientoVenta.Value
- V_dtpFechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value
- V_dtpFechaLiquidacionVenta = dtpFechaLiquidacionVenta.Value
- 'Valores de Compra
- V_txtDiasAlVencimientoCompra = BonoCalculo.DiasVencimiento(V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, IndexBaseC)
- V_txtDiasAcumuladosCompra = Operaciones.DiasAcumulados(V_dtpUltimaFechaCuponCompra, V_dtpFechaLiquidacionCompra, IndexBaseC)
- V_txtInteresAcumuladoCompra = BonoCalculo.InteresAcumulado(V_txtValorNominalCompra, V_txtPorcentajeCuponCompra, V_dtpUltimaFechaCuponCompra, V_dtpFechaLiquidacionCompra, V_txtDiasAcumuladosCompra, IndexBaseC)
- V_txtPorcentajeInteresAcumuladoCompra = BonoCalculo.InteresAcumuladoPor(V_txtInteresAcumuladoCompra, V_txtValorNominalCompra, PeriodoC, IndexBaseC) * 100
- V_txtPrecioSucioCompra = BonoCalculo.PrecioSucio(V_txtPrecioCompra, V_txtPorcentajeInteresAcumuladoCompra / 100)
- V_txtValorTransadoCompra = BonoCalculo.ValorTrasado(V_txtPrecioCompra, V_txtValorNominalCompra)
- V_txtComisionCompraCasa = CalcularComision(V_txtComisionPorCompraCasa, V_txtValorTransadoCompra)
- V_txtComisionCompraBolsa = CalcularComision(V_txtComisionPorBolsaCompra, V_txtValorTransadoCompra)
- V_txtYTMAlVencimientoComisionCompra = Bonos.CalcularYTMComision(V_txtYTMAlVencimientoCompra, V_txtComisionPorCompraCasa, V_txtDiasAlVencimientoCompra, V_txtComisionPorBolsaCompra, V_dtpFechaLiquidacionCompra, V_dtpFechaVencimientoCompra, IndexBaseC)
- V_txtMontoAPagar = BonoCalculo.MontoPagar(V_txtValorTransadoCompra, V_txtComisionCompraBolsa, V_txtComisionCompraCasa, V_txtInteresAcumuladoCompra, V_txtCostoTransferenciaCompra)
- 'Valores de Venta
- V_txtDiasAlVencimientoVenta = BonoCalculo.DiasVencimiento(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, IndexBaseV)
- V_txtDiasAcumuladosVenta = Operaciones.DiasAcumulados(V_dtpUltimaFechaCuponVenta, V_dtpFechaLiquidacionVenta, IndexBaseV)
- V_txtInteresAcumuladoVenta = BonoCalculo.InteresAcumulado(V_txtValorNominalVenta, V_txtPorcentajeCuponVenta, V_dtpUltimaFechaCuponVenta, V_dtpFechaLiquidacionVenta, V_txtDiasAcumuladosVenta, IndexBaseV)
- V_txtPorcentajeInteresAcumuladoVenta = BonoCalculo.InteresAcumuladoPor(V_txtInteresAcumuladoVenta, V_txtValorNominalVenta, PeriodoV, IndexBaseV) * 100
- V_txtPrecioSucioVenta = BonoCalculo.PrecioSucio(V_txtPrecioVenta, V_txtPorcentajeInteresAcumuladoVenta / 100)
- V_txtValorTransadoVenta = BonoCalculo.ValorTrasado(V_txtPrecioVenta, V_txtValorNominalVenta)
- V_txtComisionVentaCasa = CalcularComision(V_txtComisionPorVentaCasa, V_txtValorTransadoVenta)
- V_txtComisionVentaBolsa = CalcularComision(V_txtComisionPorBolsaVenta, V_txtValorTransadoVenta)
- V_txtYTMAlVencimientoComisionVenta = Bonos.CalcularYTMComision(V_txtYTMAlVencimientoVenta, V_txtComisionPorVentaCasa, V_txtDiasAlVencimientoVenta, V_txtComisionPorBolsaVenta, V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, IndexBaseV)
- V_txtMontoARecibir = BonoCalculo.MontoRecibir(V_txtValorTransadoVenta, V_txtComisionVentaBolsa, V_txtComisionVentaCasa, V_txtInteresAcumuladoVenta)
- V_txtCuponesRecibidos = Recibido()
- 'Valores de Compra
- txtDiasAlVencimientoCompra.Text = Format(V_txtDiasAlVencimientoCompra, "0.0000")
- txtDiasAcumuladosCompra.Text = Format(V_txtDiasAcumuladosCompra, "0.0000")
- txtInteresAcumuladoCompra.Text = Format(V_txtInteresAcumuladoCompra, "0.0000")
- txtPorcentajeInteresAcumuladoCompra.Text = CStr(Format(V_txtPorcentajeInteresAcumuladoCompra, "0.000")) + "%"
- txtPrecioSucioCompra.Text = Format(V_txtPrecioSucioCompra, "0.0000")
- txtValorTransadoCompra.Text = Format(V_txtValorTransadoCompra, "0.0000")
- txtComisionCompraCasa.Text = Format(V_txtComisionCompraCasa, "0.0000")
- txtComisionCompraBolsa.Text = Format(V_txtComisionCompraBolsa, "0.0000")
- txtYTMAlVencimientoComisionCompra.Text = CStr(Format(V_txtYTMAlVencimientoComisionCompra, "0.0000") * 100) + "%"
- txtMontoAPagar.Text = Format(V_txtMontoAPagar, "0.0000")
- txtComisionCompraCasa.Text = Format(V_txtComisionCompraCasa, "0.0000")
- txtComisionCompraBolsa.Text = Format(V_txtComisionCompraBolsa, "0.0000")
- 'Valores de Venta
- FechaCupon(V_dtpFechaLiquidacionVenta, V_dtpFechaVencimientoVenta, TipoPeriodoVenta)
- txtDiasAlVencimientoVenta.Text = Format(V_txtDiasAlVencimientoVenta, "0.0000")
- txtDiasAcumuladosVenta.Text = Format(V_txtDiasAcumuladosVenta, "0.0000")
- txtInteresAcumuladoVenta.Text = Format(V_txtInteresAcumuladoVenta, "0.0000")
- txtPorcentajeInteresAcumuladoVenta.Text = CStr(Format(V_txtPorcentajeInteresAcumuladoVenta, "0.0000")) + "%"
- txtPrecioSucioVenta.Text = Format(V_txtPrecioSucioVenta, "0.0000")
- txtValorTransadoVenta.Text = Format(V_txtValorTransadoVenta, "0.0000")
- txtComisionVentaCasa.Text = Format(V_txtComisionVentaCasa, "0.0000")
- txtComisionVentaBolsa.Text = Format(V_txtComisionVentaBolsa, "0.0000")
- txtYTMAlVencimientoComisionVenta.Text = CStr(Format(V_txtYTMAlVencimientoComisionVenta, "0.0000") * 100) + "%"
- txtMontoARecibir.Text = Format(V_txtMontoARecibir, "0.0000")
- txtCuponesRecibidos.Text = Format(V_txtCuponesRecibidos, "0.0000")
- txtComisionVentaCasa.Text = Format(V_txtComisionVentaCasa, "0.0000")
- txtComisionVentaBolsa.Text = Format(V_txtComisionVentaBolsa, "0.0000")
- End If
- CorrelativoSinBD()
- End Sub
- Function CalcularComision(ByVal Porcentaje As Double, ByVal VTransado As Double)
- Return Porcentaje * VTransado
- End Function
- Private Sub RefrescarClaseEntidad()
- ControlUltimaFechaCuponCompra()
- ControlSiguienteFechaCuponCompra()
- ControlFechaLiquidacionCompra()
- ControlFechaVencimientoCompra()
- ControlAnioBaseCompra()
- ControlUltimaFechaCuponCompra()
- ControlSiguienteFechaCuponCompra()
- ControlFechaLiquidacionCompra()
- ControlFechaVencimientoCompra()
- ControlAnioBaseCompra()
- End Sub
- Private Sub ControlPeriodosCompra()
- Dim valor As String
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- If Me.cboPeriodosC.SelectedIndex = -1 Then
- valor = ""
- Else
- If (String.IsNullOrEmpty(Me.cboPeriodosC.SelectedValue)) Then
- valor = String.Empty
- Else
- valor = Me.cboPeriodosC.SelectedValue
- End If
- End If
- oCEPrincipal.PeriodicidadCompra = valor
- End If
- End Sub
- Function FechaTipo(ByVal ultimafecha As DateTime, ByVal frecuencia As Integer)
- Dim periodos As Integer = 0
- Dim Fecha As Date
- If frecuencia = 1 Then
- periodos = 12
- ElseIf frecuencia = 2 Then
- periodos = 6
- ElseIf frecuencia = 4 Then
- periodos = 3
- ElseIf frecuencia = 12 Then
- periodos = 1
- End If
- Fecha = ultimafecha.AddMonths(periodos)
- Return Fecha
- End Function
- Private Sub ControlUltimaFechaCuponCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.UltimaFechaCuponCompra = dtpUltimaFechaCuponCompra.Value.Date
- End If
- End Sub
- Private Sub ControlSiguienteFechaCuponCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.SiguienteFechaCuponCompra = dtpSiguienteFechaCuponCompra.Value.Date
- End If
- End Sub
- Private Sub ControlFechaLiquidacionCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.FechaLiquidacionCompra = dtpFechaLiquidacionCompra.Value.Date
- End If
- End Sub
- Private Sub ControlFechaVencimientoCompra()
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- Me.oCEPrincipal.FechaVencimientoCompra = dtpFechaVencimientoCompra.Value.Date
- End If
- End Sub
- Private Sub ControlAnioBaseCompra()
- Dim valor As Integer
- If Me.TipoTransaccion = "N" Or Me.TipoTransaccion = "A" Then
- valor = cboAnioBaseC.SelectedItem
- Me.oCEPrincipal.DiasBaseCompra = valor
- End If
- End Sub
- Private Sub txtValorNominalCompra_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalCompra.LostFocus
- End Sub
- Private Sub txtPorcentajeCuponCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.LostFocus
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.LostFocus
- End Sub
- Private Sub txtPrecioCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioCompra.LostFocus
- End Sub
- Private Sub txtCostoTransferenciaCompra_LostFocus(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.LostFocus
- End Sub
- Private Sub dtpSiguienteFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtCostoTransferenciaVenta_TextChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub dgvImpuestosYComisiones_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
- End Sub
- Private Sub dgvImpuestosYComisiones_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellContentClick
- Formato()
- End Sub
- Private Sub dgvImpuestosYComisiones_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs)
- oCEPrincipal.ImpuestosYComisiones.AcceptChanges()
- End Sub
- Private Sub PrepararTablaIngresos()
- Dim CantidadColumnas As Integer = dgvIngresos.ColumnCount
- If CantidadColumnas = 0 Then
- Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "CodInv"
- oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
- oDataGridViewTextBoxColumn.HeaderText = "Código Inversión"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "NumCupon"
- oDataGridViewTextBoxColumn.DataPropertyName = "NumCupon"
- oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- oDataGridViewTextBoxColumn.Visible = False
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Correlativo"
- oDataGridViewTextBoxColumn.DataPropertyName = "Correlativo"
- oDataGridViewTextBoxColumn.HeaderText = "No. Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "FechaCupon"
- oDataGridViewTextBoxColumn.DataPropertyName = "FechaCupon"
- oDataGridViewTextBoxColumn.HeaderText = "Fecha Cupón"
- oDataGridViewTextBoxColumn.ValueType = GetType(Date)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Dias"
- oDataGridViewTextBoxColumn.DataPropertyName = "Dias"
- oDataGridViewTextBoxColumn.HeaderText = "Dias "
- oDataGridViewTextBoxColumn.ValueType = GetType(Integer)
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Ingreso"
- oDataGridViewTextBoxColumn.DataPropertyName = "Ingreso"
- oDataGridViewTextBoxColumn.HeaderText = "Ingreso"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "PorcentajeImpuesto"
- oDataGridViewTextBoxColumn.DataPropertyName = "PorcImpuesto"
- oDataGridViewTextBoxColumn.HeaderText = "% Impuesto"
- oDataGridViewTextBoxColumn.ValueType = GetType(String)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "MontoImpuesto"
- oDataGridViewTextBoxColumn.DataPropertyName = "MontoImpuesto"
- oDataGridViewTextBoxColumn.HeaderText = "Impuesto"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
- oDataGridViewTextBoxColumn.Name = "Liquido"
- oDataGridViewTextBoxColumn.DataPropertyName = "Liquido"
- oDataGridViewTextBoxColumn.HeaderText = "Liquido"
- oDataGridViewTextBoxColumn.ValueType = GetType(Double)
- oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
- Me.dgvIngresos.Columns.Add(oDataGridViewTextBoxColumn)
- End If
- End Sub
- Private Sub txtValorNominalVenta_LostFocus(sender As Object, e As EventArgs) Handles txtValorNominalVenta.LostFocus
- End Sub
- Private Sub txtPorcentajeCuponVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.LostFocus
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.LostFocus
- End Sub
- Private Sub txtPrecioVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioVenta.LostFocus
- End Sub
- Private Sub dgvIngresos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
- End Sub
- Private Sub dgvIngresos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvIngresos.CellBeginEdit
- End Sub
- Private Sub dgvIngresos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellEndEdit
- Dim Tabla As String = Instrumento()
- If Not Tabla = "TIT" Then
- CalculoIngresosBONO()
- End If
- End Sub
- Private Sub dgvIngresos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvIngresos.UserDeletedRow
- oCEPrincipal.Ingresos.AcceptChanges()
- End Sub
- Private Sub txtValorNominal_Op_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal_Op.TextChanged
- End Sub
- Private Sub LLenarResultadosOperacion()
- Dim FechaCompra = dtpFechaLiquidacionCompra.Value
- Dim FechaVenta = dtpFechaLiquidacionVenta.Value
- Dim Dias As Integer = Operaciones.Dias(FechaCompra, FechaVenta, IndexBaseC)
- txtValorNominal_Op.Text = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- txtPlazo_Op.Text = Operaciones.ConvertirDecimal(PlazoOperacion().ToString)
- txtPrecioCompra_Op.Text = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
- txtPrecioVenta_Op.Text = Operaciones.ConvertirDecimal(txtPrecioVenta.Text.ToString)
- txtGananciaPerdidaCapital_Op.Text = Operaciones.ConvertirDecimal(GananciaPerdida().ToString)
- txtIngresosPorIntereses_Op.Text = Operaciones.ConvertirDecimal(IngresosInteres().ToString)
- txtCostosTotales_Op.Text = Operaciones.ConvertirDecimal(CostosTotales().ToString)
- txtGananciaPerdidaTotal_Op.Text = Operaciones.ConvertirDecimal(MontoGananciaPerdida().ToString)
- txtRendimientoGananciaPerdida_Op.Text = Operaciones.ConvertirDecimal(RendimientoGananciaPerdida(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- txtRendimientoIntereses_Op.Text = Operaciones.ConvertirDecimal(RendimientoInteres(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- txtRendimientoAntesISR_Op.Text = Operaciones.ConvertirDecimal(RendimientoNeto(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- txtRendimientoDespuesISR_Op.Text = Operaciones.ConvertirDecimal(RendimientoNetoDespues(Dias, FechaCompra, FechaVenta, IndexBaseC).ToString)
- End Sub
- Private Function PlazoOperacion()
- Dim FechaVenta As Date = dtpFechaLiquidacionVenta.Value
- Dim FechaCompra As Date = dtpFechaLiquidacionCompra.Value
- Dim Dias = Operaciones.Dias(FechaCompra, FechaVenta, IndexBaseC)
- Return Dias
- End Function
- Private Function GananciaPerdida()
- Dim ValorTrasadoVenta As Double = Operaciones.ConvertirDecimal(txtValorTransadoVenta.Text.ToString)
- Dim ValorTrasadoCompra As Double = Operaciones.ConvertirDecimal(txtValorTransadoCompra.Text.ToString)
- Dim Total = ValorTrasadoVenta - ValorTrasadoCompra
- Return Total
- End Function
- Private Function IngresosInteres()
- Dim Registros = dgvIngresos.Rows.Count
- Dim Suma As Double = 0.0
- Registros = Registros - 2
- For i As Integer = 0 To Registros
- Suma = Suma + Double.Parse(dgvIngresos.Item(4, i).Value)
- Next
- Dim InteresAcumulado As Double = Operaciones.ConvertirDecimal(txtInteresAcumuladoVenta.Text.ToString)
- Return (Suma + InteresAcumulado)
- End Function
- Private Function CostosTotales()
- Dim ComisionCompraCasa As Double = Operaciones.ConvertirDecimal(txtComisionCompraCasa.Text.ToString)
- Dim ComisionVentaCasa As Double = Operaciones.ConvertirDecimal(txtComisionVentaCasa.Text.ToString)
- Dim ComisionCompraBolsa = Operaciones.ConvertirDecimal(txtComisionCompraBolsa.Text.ToString)
- Dim ComisionVentaBolsa = Operaciones.ConvertirDecimal(txtComisionVentaBolsa.Text.ToString)
- Dim CostoTransferenciaCompra = Operaciones.ConvertirDecimal(txtCostoTransferenciaCompra.Text.ToString)
- If (Double.TryParse(ComisionCompraCasa, Nothing) And Double.TryParse(ComisionCompraBolsa, Nothing) And Double.TryParse(CostoTransferenciaCompra, Nothing) And Double.TryParse(ComisionCompraBolsa, Nothing) And Double.TryParse(ComisionVentaBolsa, Nothing)) Then
- Dim Total = (CDec(ComisionCompraCasa) + CDec(ComisionCompraBolsa) + CDec(CostoTransferenciaCompra) + CDec(ComisionVentaCasa) + CDec(ComisionVentaBolsa)) * -1
- Return Total
- End If
- Return "0"
- End Function
- Private Function MontoGananciaPerdida()
- Dim GananciaPerdida As Double = Operaciones.ConvertirDecimal(txtGananciaPerdidaCapital_Op.Text.ToString)
- Dim CostosTotales As Double = Operaciones.ConvertirDecimal(txtCostosTotales_Op.Text.ToString)
- Dim IngresoInteres As Double = Operaciones.ConvertirDecimal(txtIngresosPorIntereses_Op.Text.ToString)
- Dim Total = GananciaPerdida + CostosTotales + IngresoInteres
- Return Total
- End Function
- Private Function RendimientoGananciaPerdida(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim GananciaCapital As Double = Operaciones.ConvertirDecimal(txtGananciaPerdidaCapital_Op.Text.ToString)
- Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal_Op.Text.ToString)
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = GananciaCapital / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = GananciaCapital / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = GananciaCapital / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = GananciaCapital / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- Return (Valor * 100).ToString() + "%"
- End Function
- Private Function RendimientoInteres(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim IngresosInteres As Double = Operaciones.ConvertirDecimal(txtIngresosPorIntereses_Op.Text.ToString)
- Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal_Op.Text.ToString)
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = IngresosInteres / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = IngresosInteres / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = IngresosInteres / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = IngresosInteres / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- End Function
- Private Function RendimientoNeto(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim MontoGananciaPerdidaTotal As Double = Operaciones.ConvertirDecimal(txtGananciaPerdidaTotal_Op.Text.ToString)
- Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal_Op.Text.ToString)
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = MontoGananciaPerdidaTotal / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- End Function
- Private Function Recibido()
- Dim Registros = dgvIngresos.Rows.Count
- Dim Suma As Double = 0.0
- Registros = Registros - 1
- For i As Integer = 0 To Registros
- Suma = Suma + Operaciones.ConvertirDecimal(dgvIngresos.Rows(i).Cells("Ingreso").Value)
- Next
- Return Suma
- End Function
- Private Function RendimientoNetoDespues(ByVal Dias As Integer, ByVal Fecha1 As Date, ByVal Fecha2 As Date, ByVal IndexBase As Integer)
- Dim Registros = dgvIngresos.Rows.Count
- Dim Suma As Double = 0.0
- Registros = Registros - 1
- For i As Integer = 0 To Registros
- Suma = Suma + Operaciones.ConvertirDecimal(dgvIngresos.Rows(i).Cells("MontoImpuesto").Value)
- Next
- Dim MontoGananciaTotal As Double = Operaciones.ConvertirDecimal(txtGananciaPerdidaTotal_Op.Text.ToString)
- Dim Impuesto As Double = Suma
- Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal_Op.Text.ToString)
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / Dias
- Return (Valor * 100).ToString() + "%"
- 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 366 / DiasPrimeraFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 365 / DiasSegundaFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- 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 = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasPrimeraFecha
- PrOpc2 = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasSegundaFecha
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasSegundaFecha
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = (MontoGananciaTotal - Impuesto) / ValorNominal * 360 / DiasPrimeraFecha
- Else
- Valor = 0
- End If
- Return (Valor * 100).ToString() + "%"
- End If
- End Function
- Private Sub TabPage4_Click(sender As Object, e As EventArgs) Handles TabPage4.Click
- End Sub
- Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TabPage1.Click
- End Sub
- Private Sub TabPage2_Click(sender As Object, e As EventArgs) Handles TbIngresos.Click
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- TipoTransaccion = "M"
- btnAceptar.Text = "Modificar"
- 'btnAccionComisiones.Text = "Modificar"
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- TipoTransaccion = "N"
- btnAceptar.Text = "Nuevo"
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- TipoTransaccion = "B"
- btnAceptar.Text = "Eliminar"
- End Sub
- Private Sub txtYTMAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPorcentajeInteresAcumuladoVenta_TextChanged(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtYTMAlVencimientoComisionCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoComisionCompra.TextChanged
- End Sub
- Private Sub txtValorNominalVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPorcentajeCuponVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtValorNominalCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtPrecioSucioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioCompra.TextChanged
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- RefrescarValorControles()
- End Sub
- Private Sub txtPrecioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub btnAccionIngreso_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub TabControl1_TabIndexChanged(sender As Object, e As EventArgs) Handles TabCampos.TabIndexChanged
- Formato()
- Formato()
- End Sub
- Private Sub dgvIngresos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellClick
- Index = e.RowIndex
- PrepararCalculos()
- Formato()
- End Sub
- Private Sub txtDiasAcumuladosCompra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosCompra.TextChanged
- End Sub
- Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabCampos.SelectedIndexChanged
- ValidacionErrores()
- BotonQuitar()
- If (dgvIngresos.Rows.Count < 2) Then
- End If
- If (TabCampos.SelectedIndex = 2) Or (TabCampos.SelectedIndex = 1) Then
- LLenarResultadosOperacion()
- End If
- End Sub
- Private Sub dtpUltimaFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionVenta.ValueChanged
- Formato()
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtYTMAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub btnAmortizacion_Click(sender As Object, e As EventArgs)
- frmResultadoTitularizacion.Show()
- End Sub
- Function ColeccionIngresos(ByRef index As Integer)
- Dim coleccion As New Collection
- Dim NoCupon, Fecha, Ingreso, PorcImpuesto, Impuesto, Dias, Liquido As String
- NoCupon = dgvIngresos.Rows(index).Cells("NumCupon").Value
- Fecha = dgvIngresos.Rows(index).Cells("FechaCupon").Value
- Dias = dgvIngresos.Rows(index).Cells("Dias").Value
- Ingreso = dgvIngresos.Rows(index).Cells("Ingreso").Value
- PorcImpuesto = dgvIngresos.Rows(index).Cells("PorcentajeImpuesto").Value
- If Not PorcImpuesto Is Nothing Then
- PorcImpuesto = CDec((PorcImpuesto.ToString().Trim("%")) / 100)
- End If
- Impuesto = dgvIngresos.Rows(index).Cells("MontoImpuesto").Value
- Liquido = dgvIngresos.Rows(index).Cells("Liquido").Value
- coleccion.Add(NoCupon)
- coleccion.Add(Fecha)
- coleccion.Add(Dias)
- coleccion.Add(Ingreso)
- coleccion.Add(PorcImpuesto)
- coleccion.Add(Impuesto)
- coleccion.Add(Liquido)
- Return coleccion
- End Function
- Function Instrumento()
- Dim codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- If codigo.IndexOf("TIT") > -1 Then
- Tabla = "TIT"
- ElseIf codigo.IndexOf("EURB") > -1 Then
- Tabla = "EURB"
- ElseIf codigo.IndexOf("BONO") > -1 Then
- Tabla = "BONO"
- ElseIf codigo.IndexOf("CINV") > -1 Then
- Tabla = "CINV"
- End If
- Return Tabla
- End Function
- Function ModificarIngreso()
- Dim i As Integer = 0
- Dim Cantidad As Integer = dgvIngresos.Rows.Count - 2
- Dim Diccionario As New Dictionary(Of Integer, Collection)
- While i <= Cantidad
- Dim coleccion = ColeccionIngresos(i)
- Diccionario.Add(i, coleccion)
- i += 1
- End While
- Return Diccionario
- End Function
- Sub CargarIngresos()
- Dim codigo As String = Variables.Codigo
- Dim dr = BonosConsulta.CargarIngreso(codigo, Instrumento)
- While dr.Read
- Dim Porc = dr("PorcImpuesto")
- If String.IsNullOrEmpty(Porc.ToString) Then
- Porc = "0.0%"
- Else
- Porc = (Porc * 100).ToString + "%"
- End If
- dgvIngresos.Rows.Add("", dr("NumCupon"), "", dr("FechaCupon"), dr("Dias"), dr("Ingreso"), Porc, dr("MontoImpuesto"), dr("Liquido"))
- End While
- End Sub
- Private Sub txtComisionPorCompraCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorCompraCasa.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtComisionPorBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorBolsaCompra.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtComisionPorVentaCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorVentaCasa.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtComisionPorBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorBolsaVenta.TextChanged
- Calculos()
- ValidacionErrores()
- End Sub
- Private Sub txtMontoARecibir_TextChanged(sender As Object, e As EventArgs) Handles txtMontoARecibir.TextChanged
- Calculos()
- End Sub
- Private Sub txtCostosTotales_Op_TextChanged(sender As Object, e As EventArgs) Handles txtCostosTotales_Op.TextChanged
- End Sub
- Private Sub txtRendimientoDespuesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoDespuesISR_Op.TextChanged
- End Sub
- Private Sub txtPrecioSucioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioVenta.TextChanged
- End Sub
- Private Sub txtGananciaPerdidaCapital_Op_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaPerdidaCapital_Op.TextChanged
- End Sub
- Private Sub txtValorNominalCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalCompra.KeyPress
- If String.IsNullOrEmpty(txtValorNominalCompra.Text) Then
- If e.KeyChar = "." Then
- txtValorNominalCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtValorNominalCompra.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 txtValorNominalVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominalVenta.KeyPress
- If String.IsNullOrEmpty(txtValorNominalVenta.Text) Then
- If e.KeyChar = "." Then
- txtValorNominalVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtValorNominalVenta.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 txtPorcentajeCuponCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponCompra.KeyPress
- If String.IsNullOrEmpty(txtPorcentajeCuponCompra.Text) Then
- If e.KeyChar = "." Then
- txtPorcentajeCuponCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPorcentajeCuponCompra.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 txtPorcentajeCuponVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeCuponVenta.KeyPress
- If String.IsNullOrEmpty(txtPorcentajeCuponVenta.Text) Then
- If e.KeyChar = "." Then
- txtPorcentajeCuponVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPorcentajeCuponVenta.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 txtYTMAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtYTMAlVencimientoCompra.KeyPress
- If String.IsNullOrEmpty(txtYTMAlVencimientoCompra.Text) Then
- If e.KeyChar = "." Then
- txtYTMAlVencimientoCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtYTMAlVencimientoCompra.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 txtYTMAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtYTMAlVencimientoVenta.KeyPress
- If String.IsNullOrEmpty(txtYTMAlVencimientoVenta.Text) Then
- If e.KeyChar = "." Then
- txtYTMAlVencimientoVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtYTMAlVencimientoVenta.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 txtPrecioAlVencimientoCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoCompra.KeyPress
- If String.IsNullOrEmpty(txtPrecioAlVencimientoCompra.Text) Then
- If e.KeyChar = "." Then
- txtPrecioAlVencimientoCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioAlVencimientoCompra.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 txtPrecioAlVencimientoVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioAlVencimientoVenta.KeyPress
- If String.IsNullOrEmpty(txtPrecioAlVencimientoVenta.Text) Then
- If e.KeyChar = "." Then
- txtPrecioAlVencimientoVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioAlVencimientoVenta.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 txtPrecioCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioCompra.KeyPress
- If String.IsNullOrEmpty(txtPrecioCompra.Text) Then
- If e.KeyChar = "." Then
- txtPrecioCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioCompra.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 txtPrecioVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioVenta.KeyPress
- If String.IsNullOrEmpty(txtPrecioVenta.Text) Then
- If e.KeyChar = "." Then
- txtPrecioVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPrecioVenta.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 txtComisionPorCompraCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorCompraCasa.KeyPress
- If String.IsNullOrEmpty(txtComisionPorCompraCasa.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorCompraCasa.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorCompraCasa.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 txtComisionPorVentaCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorVentaCasa.KeyPress
- If String.IsNullOrEmpty(txtComisionPorVentaCasa.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorVentaCasa.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorVentaCasa.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 txtComisionPorBolsaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorBolsaCompra.KeyPress
- If String.IsNullOrEmpty(txtComisionPorBolsaCompra.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorBolsaCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorBolsaCompra.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 txtComisionPorBolsaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorBolsaVenta.KeyPress
- If String.IsNullOrEmpty(txtComisionPorBolsaVenta.Text) Then
- If e.KeyChar = "." Then
- txtComisionPorBolsaVenta.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtComisionPorBolsaVenta.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 txtCostoTransferenciaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCostoTransferenciaCompra.KeyPress
- If String.IsNullOrEmpty(txtCostoTransferenciaCompra.Text) Then
- If e.KeyChar = "." Then
- txtCostoTransferenciaCompra.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtCostoTransferenciaCompra.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 txtMontoARecibir_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMontoARecibir.KeyPress
- If String.IsNullOrEmpty(txtMontoARecibir.Text) Then
- If e.KeyChar = "." Then
- txtMontoARecibir.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtMontoARecibir.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 txtPrecioCompra_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra_Op.TextChanged
- End Sub
- Private Sub txtPrecioVenta_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta_Op.TextChanged
- End Sub
- Private Sub txtInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumuladoCompra.TextChanged
- End Sub
- Sub AsignacionPeriodicidad()
- Dim Periodicidad As String = cboPeriodosC.SelectedValue
- If (Periodicidad = "M") Then
- TipoPeriodicidad = 1
- ElseIf (Periodicidad = "T") Then
- TipoPeriodicidad = 3
- ElseIf (Periodicidad = "S") Then
- TipoPeriodicidad = 6
- ElseIf (Periodicidad = "A") Then
- TipoPeriodicidad = 12
- End If
- End Sub
- Sub PrepararCalculos()
- AsignacionPeriodicidad()
- Dim Index = dgvIngresos.CurrentRow.Index
- Dim IndexAnterior = Index - 1
- Dim Respaldo As String = Format(dtpSiguienteFechaCuponCompra.Value, "dd/MM/yyyy")
- Dim FechaSig = Operaciones.ConvertirFecha(Respaldo.ToString)
- Dim Fechaliq = dtpFechaLiquidacionCompra.Value
- Dim FechaCupon, Dias, Ingreso, PorcentajeImpuesto, MontoImpuesto, Liquido
- FechaCupon = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("FechaCupon").Value)
- Dias = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("Dias").Value)
- Ingreso = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Ingreso").Value)
- PorcentajeImpuesto = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value) / 100
- MontoImpuesto = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("MontoImpuesto").Value)
- Liquido = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Liquido").Value)
- If (String.IsNullOrEmpty(FechaCupon)) Then
- If (Index = 0) Then
- FechaCupon = FechaSig
- Else
- Dim FechaAnterior As Date = Operaciones.ConvertirFecha(dgvIngresos.Rows(IndexAnterior).Cells("FechaCupon").Value)
- FechaCupon = Operaciones.Meses(TipoPeriodicidad, FechaAnterior, FechaSig)
- End If
- dgvIngresos.Rows(Index).Cells("FechaCupon").Value = FechaCupon
- End If
- If (String.IsNullOrEmpty(Dias)) Then
- Dim Dia As Integer = 0
- If (Index = 0) Then
- Dia = Operaciones.DiasAcumulados(Fechaliq, FechaSig, IndexBaseC)
- Else
- Dim DiaAnterior As Date = Operaciones.ConvertirFecha(dgvIngresos.Rows(IndexAnterior).Cells("FechaCupon").Value)
- Dim DiaActual As Date = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("FechaCupon").Value)
- Dia = Operaciones.DiasAcumulados(DiaAnterior, DiaActual, IndexBaseC)
- End If
- dgvIngresos.Rows(Index).Cells("Dias").Value = Dia
- End If
- If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("NumCupon").Value)) Then
- dgvIngresos.Rows(Index).Cells("NumCupon").Value = Correlativo()
- End If
- dgvIngresos.Rows(Index).Cells("Ingreso").Value = Ingreso
- If (Index = 0) Then
- If (String.IsNullOrEmpty(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value)) Then
- dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = "0.0%"
- End If
- Else
- dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = dgvIngresos.Rows(IndexAnterior).Cells("PorcentajeImpuesto").Value
- End If
- If dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString.IndexOf("%") = -1 Then
- dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value = dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString + "%"
- End If
- If (String.IsNullOrEmpty(MontoImpuesto)) Then
- dgvIngresos.Rows(Index).Cells("MontoImpuesto").Value = 0
- End If
- If (String.IsNullOrEmpty(Liquido)) Then
- dgvIngresos.Rows(Index).Cells("Liquido").Value = 0
- End If
- CorrelativoSinBD()
- End Sub
- Function Correlativo()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvIngresos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- Dim Numero As Integer = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("NumCupon").Value)
- If Numero > NumeroMayor Then
- NumeroMayor = Numero
- End If
- Index += 1
- End While
- Return NumeroMayor + 1
- End Function
- Sub CorrelativoSinBD()
- Dim Index As Integer = 0
- Dim IndexCantidad As Integer = dgvIngresos.Rows.Count - 2
- Dim NumeroMayor As Integer = 0
- While Index <= IndexCantidad
- dgvIngresos.Rows(Index).Cells("Correlativo").Value = Index + 1
- Index += 1
- End While
- End Sub
- Function PeriodoGracia()
- Dim FechaEmision As Date = Variables.FechaEmisionTIT
- Dim FechaPeriodoGracia As Date = FechaEmision
- Dim CantidadPeriodoGracia As Integer = 0
- Dim TipoPeriodoGracia As String = Variables.TipoPeriodoGracia
- Dim CantidadPeriodo As String = Variables.CantidadPeriodo
- If String.IsNullOrEmpty(CantidadPeriodo) Or CantidadPeriodo = "0" Then
- Return False
- Else
- CantidadPeriodoGracia = CantidadPeriodo
- End If
- If TipoPeriodoGracia = "D" Or TipoPeriodoGracia = "M" Or TipoPeriodoGracia = "A" Then
- If TipoPeriodoGracia = "D" Then
- FechaPeriodoGracia = FechaEmision.AddDays(CantidadPeriodoGracia)
- ElseIf TipoPeriodoGracia = "M" Then
- FechaPeriodoGracia = FechaEmision.AddMonths(CantidadPeriodoGracia)
- Else
- FechaPeriodoGracia = FechaEmision.AddYears(CantidadPeriodoGracia)
- End If
- Return FechaPeriodoGracia
- Else
- Return False
- End If
- End Function
- Function IngresosIntereses(ByVal ValorNominal As Double, ByVal PorcCupon As Double, ByVal Dias As Integer, ByVal Fecha1 As Date, Fecha2 As Date, ByVal IndexBase As Integer)
- Dim Valor As Double = 0
- If (IndexBase = 0) Then
- Valor = ValorNominal * PorcCupon * Dias / 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * 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 = ValorNominal * PorcCupon * DiasPrimeraFecha / 360
- PrOpc2 = ValorNominal * PorcCupon * DiasSegundaFecha / 360
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasSegundaFecha / 360
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorNominal * PorcCupon * DiasPrimeraFecha / 360
- Else
- Valor = 0
- End If
- Return Valor
- End If
- Return Valor
- End Function
- Function IngresosInteresesTIT(ByVal ValorSaldo As Double, ByVal PorcCupon As Double, ByVal Dias As Integer, ByVal PrimerosDias As Integer, ByVal RestantesDias As Integer, ByVal IndexBase As Integer)
- Dim Valor As Double = 0
- Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- DiasPrimeraFecha = PrimerosDias
- DiasSegundaFecha = RestantesDias
- If (IndexBase = 0) Then
- Valor = ValorSaldo * PorcCupon * Dias / 360
- Return Valor
- ElseIf (IndexBase = 1) Then
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- Else
- Valor = 0
- End If
- Return Valor
- ElseIf (IndexBase = 2) Then
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 365
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 366
- Else
- Valor = 0
- End If
- Return Valor
- Else
- Dim PrOpc1 = 0.0, PrOpc2 = 0.0
- If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- PrOpc1 = ValorSaldo * PorcCupon * DiasPrimeraFecha / 360
- PrOpc2 = ValorSaldo * PorcCupon * DiasSegundaFecha / 360
- Valor = PrOpc1 + PrOpc2
- ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasSegundaFecha / 360
- ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
- Valor = ValorSaldo * PorcCupon * DiasPrimeraFecha / 360
- Else
- Valor = 0
- End If
- Return Valor
- End If
- Return Valor
- End Function
- Function Impuestos(ByVal Ingresos As Double, PorcentajeRenta As Double)
- Dim Total As Double
- Total = Ingresos * PorcentajeRenta
- Return Total
- End Function
- Function Liquido(ByVal Ingreso As Double, ByVal Renta As Double)
- Dim Total As Double
- Total = Ingreso - Renta
- Return Total
- End Function
- Sub CalculoIngresosBONO()
- Dim Ingreso As Double = 0
- Dim ValorNominal = 0.0, PorcCupon = 0.0, Ingresos = 0.0, PorcentajeRenta = 0.0
- Dim IngresosInt = 0.0, Impuestos = 0.0, Liquido = 0.0
- ValorNominal = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- PorcCupon = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString) / 100
- Dim Index As Integer = dgvIngresos.CurrentRow.Index
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- Dim Dias As Integer = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("Dias").Value)
- If (Index = 0) Then
- Dim RespaldoFecha As String = Format(dtpFechaLiquidacionCompra.Value, "yyyy/MM/dd")
- Fecha1 = RespaldoFecha
- Fecha2 = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("FechaCupon").Value)
- Else
- Fecha1 = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index - 1).Cells("FechaCupon").Value)
- Fecha2 = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("FechaCupon").Value)
- End If
- If (Not dgvIngresos.CurrentRow.Cells("PorcentajeImpuesto").Value Is Nothing) Then
- PorcentajeRenta = CDec(dgvIngresos.Rows(Index).Cells("PorcentajeImpuesto").Value.ToString.Trim("%")) / 100
- Else
- PorcentajeRenta = 0
- End If
- IngresosInt = IngresosIntereses(ValorNominal, PorcCupon, Dias, Fecha1, Fecha2, IndexBaseC)
- Ingresos = Me.Impuestos(IngresosInt, PorcentajeRenta)
- Liquido = Me.Liquido(IngresosInt, Ingresos)
- dgvIngresos.CurrentRow.Cells("Ingreso").Value = IngresosInt
- dgvIngresos.CurrentRow.Cells("MontoImpuesto").Value = Ingresos
- dgvIngresos.CurrentRow.Cells("Liquido").Value = Liquido
- End Sub
- Sub PrepararIngresosTIT(ByVal Index As Integer, ByRef Amortizacion As DataGridView)
- AsignacionPeriodicidad()
- Dim IndexAnterior = Index - 1
- Dim Respaldo As String = Format(dtpSiguienteFechaCuponCompra.Value, "dd/MM/yyyy")
- Dim Dias, Ingreso, PorcentajeImpuesto, MontoImpuesto, Liquido, PorcentajeImpuestoAnterior
- Dias = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("Dias").Value)
- Ingreso = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Ingreso").Value)
- PorcentajeImpuesto = 10
- MontoImpuesto = 0
- Liquido = 0
- If (Index = 0) Then
- PorcentajeImpuestoAnterior = "10.0%"
- Else
- PorcentajeImpuestoAnterior = Operaciones.ConvertirDecimal(dgvIngresos.Rows(IndexAnterior).Cells("PorcentajeImpuesto").Value)
- End If
- Dim Dia As Integer = 0
- Dim Fecha As Date = Date.Now.Date
- Dia = Operaciones.ConvertirEntero(Amortizacion.Rows(Index).Cells("Dias").Value)
- Fecha = Operaciones.ConvertirFecha(Amortizacion.Rows(Index).Cells("Fecha").Value)
- dgvIngresos.Rows.Add(0, 0, 0, Fecha, Dia, 0, PorcentajeImpuestoAnterior, 0, 0)
- End Sub
- Sub CalculoIngresosTIT()
- Dim FechaPeriodoGracia = PeriodoGracia()
- Dim CantidadAmortizacion As Integer = Variables.dgvAmortizacion.Rows.Count - 1
- Dim Amortizacion = Variables.dgvAmortizacion
- Dim Index As Integer = 0
- Dim j As Integer = 0
- While Index <= CantidadAmortizacion
- PrepararIngresosTIT(Index, Amortizacion)
- Index += 1
- End While
- While j <= CantidadAmortizacion
- Dim PrimerosDias As Double = Operaciones.ConvertirDecimal(Amortizacion.Rows(j).Cells("PrimerosDias").Value)
- Dim RestantesDias As Double = Operaciones.ConvertirDecimal(Amortizacion.Rows(j).Cells("RestantesDias").Value)
- Dim FechaActualCupon = Operaciones.ConvertirFecha(dgvIngresos.Rows(j).Cells("FechaCupon").Value)
- Dim Ingreso As Double = 0
- Dim ValorSaldo = 0.0, PorcCupon = 0.0, Ingresos = 0.0, PorcentajeRenta = 0.0
- Dim IngresosInt = 0.0, Impuestos = 0.0, Liquido = 0.0
- Dim SaldoPendiente As Double = 0
- 'If TypeOf FechaPeriodoGracia Is Boolean Then
- If j = 0 Then
- ValorSaldo = Variables.MontoCompraTIT
- Else
- ValorSaldo = Operaciones.ConvertirDecimal(Amortizacion.Rows(j - 1).Cells("Saldos").Value)
- End If
- PorcCupon = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString) / 100
- Dim Fecha1 As Date = Date.Now.Date
- Dim Fecha2 As Date = Date.Now.Date
- Dim Dias As Integer = Operaciones.ConvertirEntero(dgvIngresos.Rows(j).Cells("Dias").Value)
- If (j = 0) Then
- Dim RespaldoFecha As String = Format(dtpFechaLiquidacionCompra.Value, "yyyy/MM/dd")
- Fecha1 = RespaldoFecha
- Fecha2 = Operaciones.ConvertirFecha(dgvIngresos.Rows(j).Cells("FechaCupon").Value)
- Else
- Fecha1 = Operaciones.ConvertirFecha(dgvIngresos.Rows(j - 1).Cells("FechaCupon").Value)
- Fecha2 = Operaciones.ConvertirFecha(dgvIngresos.Rows(j).Cells("FechaCupon").Value)
- End If
- If (Not dgvIngresos.Rows(j).Cells("PorcentajeImpuesto").Value Is Nothing) Then
- PorcentajeRenta = Operaciones.ConvertirDecimal(dgvIngresos.Rows(j).Cells("PorcentajeImpuesto").Value.ToString) / 100
- Else
- PorcentajeRenta = 0
- End If
- IngresosInt = IngresosInteresesTIT(ValorSaldo, PorcCupon, Dias, PrimerosDias, RestantesDias, IndexBaseC)
- Ingresos = Me.Impuestos(IngresosInt, PorcentajeRenta)
- Liquido = Me.Liquido(IngresosInt, Ingresos)
- dgvIngresos.Rows(j).Cells("Ingreso").Value = IngresosInt
- dgvIngresos.Rows(j).Cells("MontoImpuesto").Value = Ingresos
- dgvIngresos.Rows(j).Cells("Liquido").Value = Liquido
- j += 1
- End While
- End Sub
- Private Sub txtPorcentajeInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeInteresAcumuladoCompra.TextChanged
- End Sub
- Private Sub btnQuitar_Click(sender As Object, e As EventArgs) Handles btnQuitar.Click
- QuitarFila()
- Calculos()
- End Sub
- Sub QuitarFila()
- Dim CantidadFilas As Integer = dgvIngresos.Rows.Count - 1
- If CantidadFilas > 0 Then
- Dim result As Integer = MsgBox("¿Está seguro que desea eliminar la fila?", MsgBoxStyle.OkCancel)
- ' Test result.
- Dim codigo As String = Variables.Codigo
- Dim Numero As Integer = dgvIngresos.CurrentRow.Cells("NumCupon").Value
- If result = MsgBoxResult.Ok Then
- Try
- dgvIngresos.Rows.Remove(dgvIngresos.CurrentRow)
- BonosConsulta.EliminarIngreso(codigo, Numero, Instrumento)
- Catch ex As Exception
- MsgBox("No ha seleccionado una fila")
- End Try
- End If
- Else
- MsgBox("Actualmente no tiene registros")
- End If
- End Sub
- Private Sub txtCuponesRecibidos_TextChanged(sender As Object, e As EventArgs) Handles txtCuponesRecibidos.TextChanged
- End Sub
- Private Sub txtIngresosPorIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtIngresosPorIntereses_Op.TextChanged
- End Sub
- Private Sub txtRendimientoGananciaPerdida_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoGananciaPerdida_Op.TextChanged
- End Sub
- Private Sub txtRendimientoIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoIntereses_Op.TextChanged
- End Sub
- Private Sub txtRendimientoAntesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoAntesISR_Op.TextChanged
- End Sub
- Private Sub txtPlazo_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPlazo_Op.TextChanged
- End Sub
- Private Sub txtDiasAcumuladosVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosVenta.TextChanged
- End Sub
- Private Sub pnlPie_Paint(sender As Object, e As PaintEventArgs) Handles pnlPie.Paint
- End Sub
- Private Sub txtValorNominalCompra_Leave(sender As Object, e As EventArgs) Handles txtValorNominalCompra.Leave
- Formato()
- End Sub
- Private Sub txtPorcentajeCuponCompra_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.Leave
- Formato()
- End Sub
- Private Sub txtYTMAlVencimientoCompra_Leave(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.Leave
- Formato()
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.Leave
- Formato()
- End Sub
- Private Sub txtPrecioCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioCompra.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorCompraCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionPorCompraCasa.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorBolsaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorBolsaCompra.Leave
- Formato()
- End Sub
- Private Sub txtCostoTransferenciaCompra_Leave(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.Leave
- Formato()
- End Sub
- Private Sub txtValorNominalVenta_Leave(sender As Object, e As EventArgs) Handles txtValorNominalVenta.Leave
- Formato()
- End Sub
- Private Sub txtPorcentajeCuponVenta_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.Leave
- Formato()
- End Sub
- Private Sub txtYTMAlVencimientoVenta_Leave(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.Leave
- Formato()
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.Leave
- Formato()
- End Sub
- Private Sub txtPrecioVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioVenta.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorVentaCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionPorVentaCasa.Leave
- Formato()
- End Sub
- Private Sub txtComisionPorBolsaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorBolsaVenta.Leave
- Formato()
- End Sub
- Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles btnIngresos.Click
- CalculoIngresosTIT()
- End Sub
- Private Sub txtValorNominalCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominalCompra.KeyUp
- If txtValorNominalCompra.Text = "." Then
- txtValorNominalCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPorcentajeCuponCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeCuponCompra.KeyUp
- If txtPorcentajeCuponCompra.Text = "." Then
- txtPorcentajeCuponCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtYTMAlVencimientoCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtYTMAlVencimientoCompra.KeyUp
- If txtYTMAlVencimientoCompra.Text = "." Then
- txtYTMAlVencimientoCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioAlVencimientoCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioAlVencimientoCompra.KeyUp
- If txtPrecioAlVencimientoCompra.Text = "." Then
- txtPrecioAlVencimientoCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioCompra.KeyUp
- If txtPrecioCompra.Text = "." Then
- txtPrecioCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorCompraCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorCompraCasa.KeyUp
- If txtComisionPorCompraCasa.Text = "." Then
- txtComisionPorCompraCasa.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorBolsaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorBolsaCompra.KeyUp
- If txtComisionPorBolsaCompra.Text = "." Then
- txtComisionPorBolsaCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtCostoTransferenciaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCostoTransferenciaCompra.KeyUp
- If txtCostoTransferenciaCompra.Text = "." Then
- txtCostoTransferenciaCompra.Text = ".0"
- End If
- End Sub
- Private Sub txtValorNominalVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominalVenta.KeyUp
- If txtValorNominalVenta.Text = "." Then
- txtValorNominalVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtPorcentajeCuponVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeCuponVenta.KeyUp
- If txtPorcentajeCuponVenta.Text = "." Then
- txtPorcentajeCuponVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtYTMAlVencimientoVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtYTMAlVencimientoVenta.KeyUp
- If txtYTMAlVencimientoVenta.Text = "." Then
- txtYTMAlVencimientoVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioAlVencimientoVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioAlVencimientoVenta.KeyUp
- If txtPrecioAlVencimientoVenta.Text = "." Then
- txtPrecioAlVencimientoVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtPrecioVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioVenta.KeyUp
- If txtPrecioVenta.Text = "." Then
- txtPrecioVenta.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorVentaCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorVentaCasa.KeyUp
- If txtComisionPorVentaCasa.Text = "." Then
- txtComisionPorVentaCasa.Text = ".0"
- End If
- End Sub
- Private Sub txtComisionPorBolsaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorBolsaVenta.KeyUp
- If txtComisionPorBolsaVenta.Text = "." Then
- txtComisionPorBolsaVenta.Text = ".0"
- End If
- End Sub
- Private Sub dgvIngresos_KeyPress(sender As Object, e As KeyPressEventArgs) Handles dgvIngresos.KeyPress
- Formato()
- End Sub
- Private Sub dgvIngresos_Leave(sender As Object, e As EventArgs) Handles dgvIngresos.Leave
- End Sub
- Private Sub dgvIngresos_Click(sender As Object, e As EventArgs) Handles dgvIngresos.Click
- Formato()
- End Sub
- Private Sub dgvIngresos_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellLeave
- Formato()
- End Sub
- Sub ValidacionErrores()
- If Not String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPorcentajeInteresAcumuladoCompra.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoCompra.Text = "0.0%"
- End If
- End If
- If Not String.IsNullOrEmpty(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPorcentajeInteresAcumuladoVenta.Text.ToString.Trim("%")) Then
- txtPorcentajeInteresAcumuladoVenta.Text = "0.0%"
- End If
- End If
- If Not String.IsNullOrEmpty(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- txtPrecioSucioCompra.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPrecioSucioCompra.Text.ToString.Trim("%")) Then
- txtPrecioSucioCompra.Text = "0.0%"
- End If
- End If
- If Not String.IsNullOrEmpty(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- If Double.IsNaN(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- txtPrecioSucioVenta.Text = "0.0%"
- End If
- If Double.IsInfinity(txtPrecioSucioVenta.Text.ToString.Trim("%")) Then
- txtPrecioSucioVenta.Text = "0.0%"
- End If
- End If
- End Sub
- Sub BotonQuitar()
- If TabCampos.SelectedIndex = 1 Then
- btnQuitar.Visible = True
- btnQuitar.Enabled = True
- Else
- btnQuitar.Visible = False
- btnQuitar.Enabled = False
- End If
- End Sub
- Private Sub lblRedencion_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtValorTransadoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoVenta.TextChanged
- End Sub
- Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
- End Sub
- Private Sub Button1_Click_1(sender As Object, e As EventArgs)
- End Sub
- Sub CargarTransladoNuevo()
- Dim Existe As Boolean = ExisteInversion()
- If CantFormAbierto = False Then
- If Not RetCodigoInversionExiste And Not Existe Then
- Dim TipoTransaccionCompraVenta As String = Variables.TipoTransaccionCompraVenta
- If TipoTransaccionCompraVenta = "C" Then
- txtValorNominalCompra.Text = Variables.RetMonto
- txtPrecioCompra.Text = Variables.RetPrecio
- txtPorcentajeCuponCompra.Text = Variables.RetRendimiento
- ElseIf TipoTransaccionCompraVenta = "V" Then
- txtValorNominalVenta.Text = Variables.RetMonto
- txtPrecioVenta.Text = Variables.RetPrecio
- txtPorcentajeCuponVenta.Text = Variables.RetRendimiento
- End If
- End If
- End If
- End Sub
- Private Sub btnVenderTitulo_Click(sender As Object, e As EventArgs) Handles btnVenderTitulo.Click
- If Variables.InvocadorProInv = "frmINV" Then
- Dim TrasladarDatos As New TrasladarDatosCMVTA
- Dim General As New DAOGeneral
- Dim Codigo = Variables.Codigo
- Dim Tabla As String = "INV0"
- TrasladarDatos = RellenarDatosCMVTA()
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If Existe Then
- Dim CodigoInversion As String = Variables.Codigo
- Dim frmPINVCMVTA As New frmPIN("V", CodigoInversion, TrasladarDatos)
- frmINV.Close()
- Me.Close()
- frmPINVCMVTA.ShowDialog()
- End If
- End If
- End Sub
- Function RellenarDatosCMVTA()
- Dim TrasladarDatos As New TrasladarDatosCMVTA
- TrasladarDatos.BaseCINV = Operaciones.ConvertirEntero(cboAnioBaseC.SelectedIndex.ToString)
- TrasladarDatos.CuponCINV = Operaciones.ConvertirDecimal(txtPorcentajeCuponCompra.Text.ToString)
- TrasladarDatos.FechaLiquidacionCINV = Operaciones.ConvertirFecha(dtpFechaLiquidacionCompra.Value.ToString)
- TrasladarDatos.FechaVencimientoCINV = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
- TrasladarDatos.PeriodicidadCINV = cboPeriodosC.SelectedValue.ToString
- TrasladarDatos.PorcentajeComisionBolsaCINV = Operaciones.ConvertirDecimal(txtComisionPorBolsaCompra.Text.ToString)
- TrasladarDatos.PorcentajeComisionCasaCINV = Operaciones.ConvertirDecimal(txtComisionPorCompraCasa.Text.ToString)
- TrasladarDatos.PrecioCompraCINV = Operaciones.ConvertirDecimal(txtPrecioCompra.Text.ToString)
- TrasladarDatos.PrecioVencimientoCINV = Operaciones.ConvertirDecimal(txtPrecioAlVencimientoCompra.Text.ToString)
- TrasladarDatos.UltimaFechaCuponCINV = Operaciones.ConvertirFecha(dtpUltimaFechaCuponCompra.Value)
- TrasladarDatos.ValorNominalCINV = Operaciones.ConvertirDecimal(txtValorNominalCompra.Text.ToString)
- TrasladarDatos.YTMVencimientoCINV = Operaciones.ConvertirDecimal(txtYTMAlVencimientoCompra.Text.ToString)
- TrasladarDatos.NombreInstrumento = "CINV"
- TrasladarDatos.AgregarCMVTA = True
- Return TrasladarDatos
- End Function
- End Class
|