frmLetes.vb 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425
  1. Imports System.Globalization
  2. Public Class frmLetes
  3. Dim oCELetes As LETESCE
  4. Dim oDAOLetes As New LETESDAO
  5. Dim oDAOGeneral As New DAOGeneral
  6. Dim IndexBase As Integer = 0
  7. Dim TipoTransaccion = "OK"
  8. Dim Operaciones As New Operaciones
  9. Dim V_txtPrecio = 0.0, V_txtValorTransado = 0.0, V_txtComisionCasa = 0.0, V_txtComisionBolsa = 0.0, V_txtIngresoBruto = 0.0, V_txtTotalAPagar = 0.0, V_txtIngresoNeto = 0.0, V_txtRendimientoNeto = 0.0, V_txtDiasAcumulados = 0.0
  10. Dim DecimalesRedondeo As Integer = 4
  11. Private CodigoInversion As String
  12. Dim Instrumento As String
  13. Private _Modo As String
  14. Private _IdDocumento As Integer
  15. Private _TipoDocumento As String
  16. Private _ValorNominal As Double
  17. Private _ValorTransado As Double
  18. Private _Precio As Double
  19. Private _PorcentajeCasa As Double
  20. Private _ComisionCasa As Double
  21. Private _PorcentajeBolsa As Double
  22. Private _ComisionBolsa As Double
  23. Private _TotalAPagar As Double
  24. Private _FechaOperacion As Date
  25. Private _FechaLiquidacion As Date
  26. Private _FechaVencimiento As Date
  27. Private _RendimientoBruto As Double
  28. Private _RendimientoNeto As Double
  29. Private _Periodicidad As String
  30. Private _Plazo As Integer
  31. Private _IngresoBruto As Double
  32. Private _IngresoNeto As Double
  33. Private PBUR As Double = False
  34. Private VCN As Double = False
  35. Private CET As Double = False
  36. Public Property Modo As String
  37. Get
  38. Return _Modo
  39. End Get
  40. Set(value As String)
  41. _Modo = value
  42. End Set
  43. End Property
  44. Private Property IdDocumento As Integer
  45. Get
  46. Return _IdDocumento
  47. End Get
  48. Set(value As Integer)
  49. _IdDocumento = value
  50. End Set
  51. End Property
  52. Private Property TipoDocumento As String
  53. Get
  54. Return _TipoDocumento
  55. End Get
  56. Set(value As String)
  57. _TipoDocumento = value
  58. End Set
  59. End Property
  60. 'GETS
  61. Function GetFechaOperacion() As Date
  62. Dim valor As Date
  63. valor = dtpFechaOperacion.Value
  64. Return valor
  65. End Function
  66. Function GetFechaLiquidacion() As Date
  67. Dim valor As Date
  68. valor = dtpFechaLiquidacion.Value
  69. Return valor
  70. End Function
  71. Function GetPlazoInversion() As Integer
  72. Dim valor As Integer
  73. If Me.txtPlazoInversion.Text.Length = 0 Then
  74. valor = 0
  75. Else
  76. valor = Me.txtPlazoInversion.Text
  77. End If
  78. Return valor
  79. End Function
  80. Function GetValorNominal() As Double
  81. Dim valor As Double
  82. If Me.txtValorNominal.Text.Length = 0 Then
  83. valor = 0
  84. Else
  85. valor = Me.txtValorNominal.Text
  86. End If
  87. Return valor
  88. End Function
  89. Function GetPrecio() As Double
  90. Dim valor As Double
  91. If Me.txtPrecio.Text.Length = 0 Then
  92. valor = 0
  93. Else
  94. Try
  95. valor = Me.txtPrecio.Text
  96. valor = valor / 100
  97. Catch ex As Exception
  98. valor = 0
  99. End Try
  100. End If
  101. Return valor
  102. End Function
  103. Function GetValorTransado() As Double
  104. Dim valor As Double
  105. If Me.txtValorTransado.Text.Length = 0 Then
  106. valor = 0
  107. Else
  108. valor = Me.txtValorTransado.Text
  109. End If
  110. Return valor
  111. End Function
  112. Function GetComisionBolsa() As Double
  113. Dim valor As Double
  114. If Me.txtComisionBolsa.Text.Length = 0 Then
  115. valor = 0
  116. Else
  117. valor = Me.txtComisionBolsa.Text
  118. End If
  119. Return valor
  120. End Function
  121. Function GetComisionCasa() As Double
  122. Dim valor As Double
  123. If Me.txtComisionCasa.Text.Length = 0 Then
  124. valor = 0
  125. Else
  126. valor = Me.txtComisionCasa.Text
  127. End If
  128. Return valor
  129. End Function
  130. Function GetTotalAPagar() As Double
  131. Dim valor As Double
  132. If Me.txtTotalAPagar.Text.Length = 0 Then
  133. valor = 0
  134. Else
  135. valor = Me.txtTotalAPagar.Text
  136. End If
  137. Return valor
  138. End Function
  139. Function GetPeriodicidad() As String
  140. Dim valor As String
  141. Try
  142. valor = Me.cboPeriodicidad.SelectedValue
  143. Catch ex As Exception
  144. valor = ""
  145. End Try
  146. Return valor
  147. End Function
  148. Function GetCasa() As String
  149. Dim valor As String
  150. valor = Me.cboCasasCorredoras.SelectedValue
  151. Return valor
  152. End Function
  153. 'CALCULOS
  154. Function CalcularFechaLiquidacion() As Date
  155. Dim valor As Date
  156. valor = GetFechaOperacion()
  157. Return valor
  158. End Function
  159. Function CalcularFechaVencimiento() As Date
  160. Dim valor As Date
  161. valor = GetFechaLiquidacion()
  162. Return valor
  163. End Function
  164. Function CalcularValorTransado() As Double
  165. Dim valor As Double
  166. valor = GetValorNominal() * GetPrecio()
  167. valor = Math.Round(valor, DecimalesRedondeo)
  168. Return valor
  169. End Function
  170. Function CalcularValorApagar() As Double
  171. Dim valor As Double
  172. valor = GetValorTransado() + GetComisionBolsa() + GetComisionCasa()
  173. valor = Math.Round(valor, DecimalesRedondeo)
  174. Return valor
  175. End Function
  176. Function CalcularIngresoBruto() As Double
  177. Dim valor As Double
  178. valor = GetValorNominal() - GetValorTransado()
  179. valor = Math.Round(valor, DecimalesRedondeo)
  180. Return valor
  181. End Function
  182. Function CalcularIngresoNeto() As Double
  183. Dim valor As Double
  184. valor = GetValorNominal() - GetTotalAPagar()
  185. valor = Math.Round(valor, DecimalesRedondeo)
  186. Return valor
  187. End Function
  188. 'AUTO
  189. Sub RefrescarPlazoInversion()
  190. Me.txtPlazoInversion.Text = 0
  191. End Sub
  192. Sub RefrescarPrecio()
  193. Me.txtPrecio.Text = 0
  194. End Sub
  195. Sub RefrescarTotalAPagar()
  196. Me.txtTotalAPagar.Text = CalcularValorApagar()
  197. End Sub
  198. 'EVENTOS
  199. Private Sub Button1_Click(sender As Object, e As EventArgs)
  200. RefrescarPlazoInversion()
  201. End Sub
  202. Private Sub txtRendimientoBruto_TextChanged(sender As Object, e As EventArgs)
  203. If Modo = "N" Then
  204. RefrescarPrecio()
  205. End If
  206. End Sub
  207. Private Sub txtPlazoInversion_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.TextChanged, txtPlazoInversion.TextChanged
  208. RellenarDatos()
  209. End Sub
  210. Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged
  211. End Sub
  212. Private Sub dtpFechaLiquidacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacion.ValueChanged
  213. RellenarDatos()
  214. End Sub
  215. Private Sub dtpFechaOperacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacion.ValueChanged
  216. RellenarDatos()
  217. AgregarDiasExtra()
  218. End Sub
  219. Private Sub txtValorNominal_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal.TextChanged
  220. RellenarDatos()
  221. End Sub
  222. Private Sub txtPrecio_TextChanged(sender As Object, e As EventArgs) Handles txtPrecio.TextChanged
  223. End Sub
  224. Private Sub txtPorcentajeComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.TextChanged
  225. RellenarDatos()
  226. End Sub
  227. Private Sub txtPorcentajeComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.TextChanged
  228. RellenarDatos()
  229. End Sub
  230. Private Sub txtValorTransado_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransado.TextChanged
  231. End Sub
  232. Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
  233. If Modo = "N" Then
  234. RefrescarTotalAPagar()
  235. End If
  236. End Sub
  237. Private Sub txtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
  238. If Modo = "N" Then
  239. RefrescarTotalAPagar()
  240. End If
  241. End Sub
  242. Private Sub txtTotalAPagar_TextChanged(sender As Object, e As EventArgs) Handles txtTotalAPagar.TextChanged
  243. End Sub
  244. Sub ValidarExistencia()
  245. Dim General As New DAOGeneral
  246. Dim Codigo As String = Variables.Codigo
  247. Dim Tabla As String = String.Empty
  248. If PBUR Then
  249. Tabla = "PBUR"
  250. ElseIf VCN Then
  251. Tabla = "VCN"
  252. ElseIf CET Then
  253. Tabla = "CET0"
  254. Else
  255. Tabla = "LET0"
  256. End If
  257. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  258. If (Existe) Then
  259. navNuevo.Enabled = False
  260. navModificar.Enabled = True
  261. navEliminar.Enabled = True
  262. Else
  263. navNuevo.Enabled = True
  264. navModificar.Enabled = False
  265. navEliminar.Enabled = False
  266. End If
  267. TipoTransaccion = String.Empty
  268. btnAceptar.Text = "Aceptar"
  269. End Sub
  270. Function ExisteValidacion()
  271. Dim General As New DAOGeneral
  272. Dim Codigo As String = Variables.Codigo
  273. Dim Tabla As String = String.Empty
  274. If PBUR Then
  275. Tabla = "PBUR"
  276. ElseIf VCN Then
  277. Tabla = "VCN"
  278. ElseIf CET Then
  279. Tabla = "CET0"
  280. Else
  281. Tabla = "LET0"
  282. End If
  283. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  284. Return Existe
  285. End Function
  286. Private Sub frmLetes_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  287. TipInstrumento()
  288. Me.ActiveControl = Me.txtValorNominal
  289. Call CargarCasasCorredoras()
  290. Call CargarBase()
  291. Call CargarPeriodicidad()
  292. If Variables.Codigo.IndexOf("LETE") > -1 Then
  293. Instrumento = "LETE"
  294. ElseIf Variables.Codigo.IndexOf("PBUR") > -1 Then
  295. Instrumento = "PBUR"
  296. lblBono.Text = "PAPEL BURSATIL"
  297. Me.Text = "PAPEL BURSATIL"
  298. lblInteresAcumulado.Visible = True
  299. lblDiasAcumulados.Visible = True
  300. dtpUltimaFecha.Visible = True
  301. txtInteresAcumulado.Visible = True
  302. chbValorPar.Visible = True
  303. ElseIf Variables.Codigo.IndexOf("CETE") > -1 Then
  304. Instrumento = "CETE"
  305. lblBono.Text = "CETES"
  306. Me.Text = "CETE"
  307. lblInteresAcumulado.Visible = True
  308. lblDiasAcumulados.Visible = True
  309. dtpUltimaFecha.Visible = True
  310. txtInteresAcumulado.Visible = True
  311. ConfiguracionCETE()
  312. ElseIf Variables.Codigo.IndexOf("VCN") > -1 Then
  313. Instrumento = "VCN"
  314. lblBono.Text = "VALORES COMERCIALES"
  315. Me.Text = "VALORES COMERCIALES"
  316. lblInteresAcumulado.Visible = True
  317. lblDiasAcumulados.Visible = True
  318. lblOtrosCostos.Visible = True
  319. dtpUltimaFecha.Visible = True
  320. txtInteresAcumulado.Visible = True
  321. txtOtrosCostos.Visible = True
  322. chbValorPar.Visible = True
  323. Else
  324. Instrumento = "NADA"
  325. End If
  326. CargarReg(Instrumento)
  327. Call CargarRegistroBD()
  328. SetPeriodicidad()
  329. AgregarPorcentaje()
  330. Rellenar()
  331. ExisteInversion()
  332. ValidarExistencia()
  333. CargarTransladoNuevo()
  334. End Sub
  335. Sub TipInstrumento()
  336. If Variables.Codigo.IndexOf("PBUR") > -1 Then
  337. PBUR = True
  338. End If
  339. If Variables.Codigo.IndexOf("VCN") > -1 Then
  340. VCN = True
  341. End If
  342. If Variables.Codigo.IndexOf("CETE") > -1 Then
  343. CET = True
  344. End If
  345. End Sub
  346. Sub SetPeriodicidad()
  347. If String.IsNullOrEmpty(Variables.Periodicidad) Then
  348. cboPeriodicidad.SelectedValue = "M"
  349. Else
  350. cboPeriodicidad.SelectedValue = Variables.Periodicidad
  351. End If
  352. End Sub
  353. Function ExisteInversion()
  354. Dim Codigo As String = Variables.Codigo
  355. Dim TablaINV As String = "INV0"
  356. Dim TablaPINV As String = "PIN0"
  357. Dim General As New DAOGeneral
  358. Dim InvPro = Variables.InvPro
  359. If InvPro = "I" Then
  360. Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
  361. If INV0 Then
  362. navNuevo.Visible = True
  363. Return True
  364. Else
  365. navNuevo.Visible = False
  366. Return False
  367. End If
  368. End If
  369. If InvPro = "P" Then
  370. Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
  371. If PINV0 Then
  372. navNuevo.Visible = True
  373. Return True
  374. Else
  375. navNuevo.Visible = False
  376. Return False
  377. End If
  378. End If
  379. Return False
  380. End Function
  381. Sub ConfiguracionCETE()
  382. txtPrecio.Text = "100%"
  383. End Sub
  384. Private Sub CargarReg(Instrumento)
  385. Dim Letes As New LETESDAO
  386. Dim Base As Integer = 0
  387. Dim dat = Letes.Cargar(Variables.Codigo, Instrumento)
  388. If (Not dat(1).ToString = "False") Then
  389. txtValorNominal.Text = dat(1)
  390. dtpFechaOperacion.Value = dat(2)
  391. dtpFechaLiquidacion.Value = dat(3)
  392. txtPlazoInversion.Text = dat(4)
  393. If (String.IsNullOrEmpty(txtRendimientoBruto.Text)) Then
  394. txtRendimientoBruto.Text = 0
  395. txtRendimientoBruto.Text = CStr(Format((txtRendimientoBruto.Text), "0.00")) + "%"
  396. Else
  397. txtRendimientoBruto.Text = CStr(dat(5) * 100) + "%"
  398. End If
  399. cboCasasCorredoras.SelectedValue = dat(6)
  400. cboPeriodicidad.SelectedValue = dat(7)
  401. If (dat(8) = 0) Then
  402. Base = 0
  403. ElseIf (dat(8) = 1) Then
  404. Base = 1
  405. ElseIf (dat(8) = 2) Then
  406. Base = 2
  407. ElseIf (dat(8) = 3) Then
  408. Base = 3
  409. End If
  410. cboBase.SelectedIndex = Base
  411. If (String.IsNullOrEmpty(dat(9).ToString)) Then
  412. txtPorcentajeComisionCasa.Text = 0
  413. txtPorcentajeComisionCasa.Text = Format(((txtPorcentajeComisionCasa.Text.Trim("%")) * 100), "0.00").ToString + "%"
  414. Else
  415. txtPorcentajeComisionCasa.Text = CStr(dat(9) * 100) + "%"
  416. End If
  417. If (String.IsNullOrEmpty(dat(10).ToString)) Then
  418. txtPorcentajeComisionBolsa.Text = "0.0"
  419. txtPorcentajeComisionBolsa.Text = Format((txtPorcentajeComisionBolsa.Text.Trim("%")) * 100, "0.00").ToString + "%"
  420. Else
  421. txtPorcentajeComisionBolsa.Text = CStr(dat(10) * 100) + "%"
  422. End If
  423. If (Not String.IsNullOrEmpty(dat(12).ToString)) Then
  424. cboCasasCorredoras.SelectedValue = dat(12)
  425. End If
  426. If (PBUR Or VCN) Then
  427. If (Not String.IsNullOrEmpty(dat(13).ToString)) Then
  428. chbValorPar.Checked = CBool(dat(13))
  429. End If
  430. If (Not String.IsNullOrEmpty(dat(14).ToString)) Then
  431. dtpUltimaFecha.Value = CDate(dat(14))
  432. End If
  433. ElseIf CET Then
  434. If (Not String.IsNullOrEmpty(dat(13).ToString)) Then
  435. dtpUltimaFecha.Value = CDate(dat(13))
  436. End If
  437. End If
  438. If VCN Then
  439. If (String.IsNullOrEmpty(dat(15).ToString)) Then
  440. txtOtrosCostos.Text = "0.0"
  441. Else
  442. txtOtrosCostos.Text = CDec(dat(15))
  443. End If
  444. End If
  445. End If
  446. End Sub
  447. Private Sub Modificar(ByVal Instrumento As String)
  448. Dim ValNom = txtValorNominal.Text
  449. Dim FOpe = dtpFechaOperacion.Value
  450. Dim FLiq = dtpFechaLiquidacion.Value
  451. Dim RendBruto = txtRendimientoBruto.Text.Trim("%") / 100
  452. Dim Plazo = txtPlazoInversion.Text
  453. Dim PorcentajeComisionCasa = txtPorcentajeComisionCasa.Text.Trim("%") / 100
  454. Dim PorcentajeComisionBolsa = txtPorcentajeComisionBolsa.Text.Trim("%") / 100
  455. Dim ValTrans As Double = txtValorTransado.Text
  456. Dim Precio As Double = CDec(txtPrecio.Text.ToString.Trim("%") / 100)
  457. Dim TotPagar As Double = txtTotalAPagar.Text
  458. Dim RendNeto As Double = CDec(txtRendimientoNeto.Text.ToString.Trim("%")) / 100
  459. Dim IngrBruto As Double = txtIngresoBruto.Text
  460. Dim IngrNeto As Double = txtIngresoNeto.Text
  461. Dim ComisionCasaValor As Double = txtComisionCasa.Text
  462. Dim ComisionBolsaValor As Double = txtComisionBolsa.Text
  463. Dim FUlt As Date = dtpUltimaFecha.Value
  464. Dim FRed As Date = dtpRedencion.Value
  465. Dim FVenc As Date = dtpFechaVencimiento.Value
  466. Dim IntAcumulado As Double = CDec(txtInteresAcumulado.Text.ToString.Trim("%") / 100)
  467. Dim OtrosCostos As Double = txtOtrosCostos.Text
  468. Dim periodo
  469. If Not cboPeriodicidad.SelectedIndex = -1 Then
  470. periodo = cboPeriodicidad.SelectedValue
  471. Else
  472. periodo = DBNull.Value
  473. End If
  474. Dim Casas
  475. If Not cboCasasCorredoras.SelectedIndex = -1 Then
  476. Casas = cboCasasCorredoras.SelectedValue
  477. Else
  478. Casas = DBNull.Value
  479. End If
  480. Dim ValorPar As Boolean = chbValorPar.Checked
  481. Dim Base As Integer
  482. Dim FechaUltima As Date = dtpUltimaFecha.Value
  483. If (cboBase.SelectedIndex = 0) Then
  484. Base = 0
  485. ElseIf (cboBase.SelectedIndex = 1) Then
  486. Base = 1
  487. ElseIf (cboBase.SelectedIndex = 2) Then
  488. Base = 2
  489. Else
  490. Base = 3
  491. End If
  492. Dim coleccion As New Collection
  493. coleccion.Add(ValNom)
  494. coleccion.Add(FOpe)
  495. coleccion.Add(FLiq)
  496. coleccion.Add(RendBruto)
  497. coleccion.Add(Plazo)
  498. coleccion.Add(Variables.Codigo)
  499. coleccion.Add(PorcentajeComisionCasa)
  500. coleccion.Add(PorcentajeComisionBolsa)
  501. coleccion.Add(periodo)
  502. coleccion.Add(Base)
  503. coleccion.Add(Casas)
  504. If (PBUR Or VCN) Then
  505. coleccion.Add(ValorPar)
  506. coleccion.Add(FechaUltima)
  507. ElseIf CET Then
  508. coleccion.Add(FechaUltima)
  509. End If
  510. If VCN Then
  511. coleccion.Add(OtrosCostos)
  512. End If
  513. coleccion.Add(ValTrans)
  514. coleccion.Add(Precio)
  515. coleccion.Add(TotPagar)
  516. coleccion.Add(RendNeto)
  517. coleccion.Add(IngrBruto)
  518. coleccion.Add(IngrNeto)
  519. coleccion.Add(ComisionCasaValor)
  520. coleccion.Add(ComisionBolsaValor)
  521. coleccion.Add(FUlt)
  522. coleccion.Add(FRed)
  523. coleccion.Add(FVenc)
  524. If CET Or PBUR Or VCN Then
  525. coleccion.Add(IntAcumulado)
  526. End If
  527. oDAOLetes.ActualizarLETE(coleccion, Instrumento)
  528. End Sub
  529. Public Function Nuevo(ByVal Instrumento As String)
  530. Dim ValNom = txtValorNominal.Text
  531. Dim FOpe = dtpFechaOperacion.Value
  532. Dim FLiq = dtpFechaLiquidacion.Value
  533. Dim RendBruto = txtRendimientoBruto.Text.Trim("%") / 100
  534. Dim Plazo = txtPlazoInversion.Text
  535. Dim PorcentajeComisionCasa = txtPorcentajeComisionCasa.Text.Trim("%") / 100
  536. Dim PorcentajeComisionBolsa = txtPorcentajeComisionBolsa.Text.Trim("%") / 100
  537. Dim ValTrans As Double = txtValorTransado.Text
  538. Dim Precio As Double = CDec(txtPrecio.Text.ToString.Trim("%") / 100)
  539. Dim TotPagar As Double = txtTotalAPagar.Text
  540. Dim RendNeto As Double = CDec(txtRendimientoNeto.Text.ToString.Trim("%")) / 100
  541. Dim IngrBruto As Double = txtIngresoBruto.Text
  542. Dim IngrNeto As Double = txtIngresoNeto.Text
  543. Dim ComisionCasaValor As Double = txtComisionCasa.Text
  544. Dim ComisionBolsaValor As Double = txtComisionBolsa.Text
  545. Dim FUlt As Date = dtpUltimaFecha.Value
  546. Dim FRed As Date = dtpRedencion.Value
  547. Dim FVenc As Date = dtpFechaVencimiento.Value
  548. Dim IntAcumulado As Double = CDec(txtInteresAcumulado.Text.ToString.Trim("%") / 100)
  549. Dim periodo
  550. If Not cboPeriodicidad.SelectedIndex = -1 Then
  551. periodo = cboPeriodicidad.SelectedValue
  552. Else
  553. periodo = DBNull.Value
  554. End If
  555. Dim Casas
  556. If Not cboCasasCorredoras.SelectedIndex = -1 Then
  557. Casas = cboCasasCorredoras.SelectedValue
  558. Else
  559. Casas = DBNull.Value
  560. End If
  561. Dim ValorPar As Boolean = chbValorPar.Checked
  562. Dim Base As Integer
  563. Dim FechaUltima As Date = dtpUltimaFecha.Value
  564. Dim OtrosCostos = txtOtrosCostos.Text
  565. If (cboBase.SelectedIndex = 0) Then
  566. Base = 0
  567. ElseIf (cboBase.SelectedIndex = 1) Then
  568. Base = 1
  569. ElseIf (cboBase.SelectedIndex = 2) Then
  570. Base = 2
  571. Else
  572. Base = 3
  573. End If
  574. Dim coleccion As New Collection
  575. coleccion.Add(ValNom)
  576. coleccion.Add(FOpe)
  577. coleccion.Add(FLiq)
  578. coleccion.Add(RendBruto)
  579. coleccion.Add(Plazo)
  580. coleccion.Add(Variables.Codigo)
  581. coleccion.Add(PorcentajeComisionCasa)
  582. coleccion.Add(PorcentajeComisionBolsa)
  583. coleccion.Add(periodo)
  584. coleccion.Add(Base)
  585. coleccion.Add(Casas)
  586. If (PBUR Or VCN) Then
  587. coleccion.Add(ValorPar)
  588. coleccion.Add(FechaUltima)
  589. ElseIf CET Then
  590. coleccion.Add(FechaUltima)
  591. End If
  592. If VCN Then
  593. coleccion.Add(OtrosCostos)
  594. End If
  595. coleccion.Add(ValTrans)
  596. coleccion.Add(Precio)
  597. coleccion.Add(TotPagar)
  598. coleccion.Add(RendNeto)
  599. coleccion.Add(IngrBruto)
  600. coleccion.Add(IngrNeto)
  601. coleccion.Add(ComisionCasaValor)
  602. coleccion.Add(ComisionBolsaValor)
  603. coleccion.Add(FUlt)
  604. coleccion.Add(FRed)
  605. coleccion.Add(FVenc)
  606. If CET Or PBUR Or VCN Then
  607. coleccion.Add(IntAcumulado)
  608. End If
  609. Return coleccion
  610. End Function
  611. Sub NuevoRegistro(ByVal Instrumento As String)
  612. Dim Coleccion As New Collection
  613. Coleccion = Nuevo(Instrumento)
  614. If Coleccion.Count > 0 Then
  615. oDAOLetes.NuevoIngreso(Coleccion, Instrumento)
  616. Coleccion.Clear()
  617. End If
  618. End Sub
  619. Private Sub Eliminar(ByVal Instrumento As String)
  620. oDAOLetes.Eliminar(Variables.Codigo, Instrumento)
  621. End Sub
  622. Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
  623. If (TipoTransaccion = "M") Then
  624. Modificar(Instrumento)
  625. ValidarExistencia()
  626. ElseIf (TipoTransaccion = "N") Then
  627. NuevoRegistro(Instrumento)
  628. ValidarExistencia()
  629. ElseIf (TipoTransaccion = "B") Then
  630. Eliminar(Instrumento)
  631. ValidarExistencia()
  632. ElseIf Not ExisteValidacion() Then
  633. Variables.ColeccionLETE = Nuevo(Instrumento)
  634. Close()
  635. End If
  636. End Sub
  637. Function RetornarObjeto()
  638. Return oCELetes
  639. End Function
  640. Sub CargarCasasCorredoras()
  641. If Me.cboCasasCorredoras.Items.Count = 0 Or Me.cboCasasCorredoras.Items.Count = 1 Then
  642. Me.cboCasasCorredoras.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
  643. Me.cboCasasCorredoras.DisplayMember = "Descripcion"
  644. Me.cboCasasCorredoras.ValueMember = "Codigo"
  645. Me.cboCasasCorredoras.SelectedIndex = 0
  646. End If
  647. End Sub
  648. Sub CargarPeriodicidad()
  649. If cboPeriodicidad.Items.Count = 0 Or cboPeriodicidad.Items.Count = 1 Then
  650. Me.cboPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad
  651. Me.cboPeriodicidad.DisplayMember = "Descripcion"
  652. Me.cboPeriodicidad.ValueMember = "Codigo"
  653. Me.cboPeriodicidad.SelectedIndex = 0
  654. End If
  655. End Sub
  656. Sub CargarBase()
  657. If Me.cboBase.Items.Count = 0 Or Me.cboBase.Items.Count = 1 Then
  658. Me.cboBase.DataSource = oDAOGeneral.ListaBase
  659. Me.cboBase.DisplayMember = "Descripcion"
  660. Me.cboBase.ValueMember = "Codigo"
  661. Me.cboBase.SelectedIndex = 0
  662. End If
  663. End Sub
  664. Private Sub CargarRegistroBD()
  665. Dim oCELetes As LETESCE
  666. CodigoInversion = Variables.Codigo
  667. If Not oCELetes Is Nothing Then
  668. Dim vValorNominal As Double = oCELetes.ValorNominal
  669. Dim vFechaOperacion As Date = oCELetes.FechaOperacion
  670. Dim vFechaLiquidacion As Date = oCELetes.FechaLiquidacion
  671. Dim vFechaVencimiento As Date = oCELetes.FechaVencimiento
  672. Dim vPlazoInversion As Integer = oCELetes.Plazo
  673. Dim vCodigoCasa As String = oCELetes.CodigoCasa
  674. Dim vPeriodicidad As String = oCELetes.Periodicidad
  675. Dim vRendimientoBruto As Double = oCELetes.RendimientoBruto
  676. Dim vRendimientoNeto As Double = oCELetes.RendimientoNeto
  677. Dim vIngresoBruto As Double = oCELetes.IngresoBruto
  678. Dim vIngresoNeto As Double = oCELetes.IngresoNeto
  679. Dim vValorTransado As Double = oCELetes.ValorNominal
  680. Dim vPrecio As Double = oCELetes.Precio
  681. Dim vTotalAPagar As Double = oCELetes.TotalaPagar
  682. vRendimientoBruto = vRendimientoBruto * 100
  683. vRendimientoNeto = vRendimientoNeto * 100
  684. vPrecio = vPrecio * 100
  685. End If
  686. End Sub
  687. Public Sub CargarRegistro(vId As Integer, vTipo As String)
  688. Modo = "C"
  689. IdDocumento = vId
  690. TipoDocumento = vTipo
  691. End Sub
  692. Private Sub txtRendimientoBruto_MouseCaptureChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.MouseCaptureChanged
  693. End Sub
  694. Function ValorTrasado()
  695. If (Double.TryParse(txtValorNominal.Text, Nothing) And Double.TryParse(V_txtPrecio.TrimEnd("%"), Nothing)) Then
  696. Return CDec(txtValorNominal.Text) * CDec((V_txtPrecio.TrimEnd("%")) / 100)
  697. End If
  698. Return 0
  699. End Function
  700. Function Precio()
  701. If (Double.TryParse(txtRendimientoBruto.Text.TrimEnd("%"), Nothing) And Double.TryParse(txtPlazoInversion.Text.TrimEnd("%"), Nothing)) Then
  702. Dim Rendimiento = CDec(txtRendimientoBruto.Text.TrimEnd("%"))
  703. Dim Plazo = CDec((txtPlazoInversion.Text))
  704. Dim Pr = 0.0
  705. If (IndexBase = 0) Then
  706. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
  707. Return Pr
  708. ElseIf (IndexBase = 1) Then
  709. Dim FechaInicial = dtpFechaLiquidacion.Value
  710. Dim FechaFinal = dtpFechaVencimiento.Value
  711. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  712. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  713. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  714. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  715. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  716. If (Not CambioDeFecha = 0) Then
  717. If CambioDeFecha = 1 Then
  718. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  719. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  720. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
  721. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
  722. ElseIf CambioDeFecha = 2 Then
  723. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  724. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  725. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
  726. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
  727. End If
  728. Pr = (1 - (PrOpc1 + PrOpc2)) * 100
  729. Else
  730. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  731. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
  732. End If
  733. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  734. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
  735. End If
  736. End If
  737. Return Pr
  738. ElseIf (IndexBase = 2) Then
  739. ''''''''''''''''''
  740. Dim FechaInicial = dtpFechaLiquidacion.Value
  741. Dim FechaFinal = dtpFechaVencimiento.Value
  742. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  743. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  744. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  745. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  746. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  747. If (Not CambioDeFecha = 0) Then
  748. If CambioDeFecha = 1 Then
  749. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  750. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  751. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
  752. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
  753. ElseIf CambioDeFecha = 2 Then
  754. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  755. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  756. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
  757. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
  758. End If
  759. Pr = (1 - (PrOpc1 + PrOpc2)) * 100
  760. Else
  761. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  762. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
  763. End If
  764. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  765. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
  766. End If
  767. End If
  768. Return Pr
  769. Else
  770. Dim FechaInicial = dtpFechaLiquidacion.Value
  771. Dim FechaFinal = dtpFechaVencimiento.Value
  772. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  773. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  774. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  775. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  776. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  777. If (Not CambioDeFecha = 0) Then
  778. If CambioDeFecha = 1 Then
  779. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  780. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  781. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
  782. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
  783. ElseIf CambioDeFecha = 2 Then
  784. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  785. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  786. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
  787. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
  788. End If
  789. Pr = (1 - (PrOpc1 + PrOpc2)) * 100
  790. Else
  791. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
  792. End If
  793. Return Pr
  794. End If
  795. End If
  796. Return 0
  797. End Function
  798. Function ComisionCasa()
  799. Dim ValorTras = ValorTrasado()
  800. Dim ComisionDeCasa = txtPorcentajeComisionCasa.Text.TrimEnd("%")
  801. Dim PlazoInversion = txtPlazoInversion.Text
  802. Dim Comision = 0.0
  803. If (Double.TryParse(ValorTras, Nothing) And Double.TryParse(ComisionDeCasa, Nothing) And Double.TryParse(PlazoInversion, Nothing)) Then
  804. If (IndexBase = 0) Then
  805. Comision = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(PlazoInversion) / 360)
  806. Return Comision
  807. ElseIf IndexBase = 1 Then
  808. Dim FechaInicial = dtpFechaLiquidacion.Value
  809. Dim FechaFinal = dtpFechaVencimiento.Value
  810. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  811. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  812. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  813. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  814. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  815. If (Not CambioDeFecha = 0) Then
  816. If CambioDeFecha = 1 Then
  817. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  818. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  819. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasPrimeraFecha) / 366)
  820. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasSegundaFecha) / 365)
  821. ElseIf CambioDeFecha = 2 Then
  822. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  823. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  824. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasPrimeraFecha) / 365)
  825. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasSegundaFecha) / 366)
  826. End If
  827. Comision = ComisionOpc1 + ComisionOpc2
  828. Else
  829. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  830. Comision = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(PlazoInversion) / 365)
  831. End If
  832. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  833. Comision = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(PlazoInversion) / 366)
  834. End If
  835. End If
  836. Return Comision
  837. ElseIf IndexBase = 2 Then
  838. Dim FechaInicial = dtpFechaLiquidacion.Value
  839. Dim FechaFinal = dtpFechaVencimiento.Value
  840. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  841. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  842. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  843. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  844. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  845. If (Not CambioDeFecha = 0) Then
  846. If CambioDeFecha = 1 Then
  847. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  848. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  849. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasPrimeraFecha) / 366)
  850. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasSegundaFecha) / 365)
  851. ElseIf CambioDeFecha = 2 Then
  852. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  853. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  854. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasPrimeraFecha) / 365)
  855. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(DiasSegundaFecha) / 366)
  856. End If
  857. Comision = ComisionOpc1 + ComisionOpc2
  858. Else
  859. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  860. Comision = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(PlazoInversion) / 365)
  861. End If
  862. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  863. Comision = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(PlazoInversion) / 366)
  864. End If
  865. End If
  866. Return Comision
  867. Else
  868. Comision = (CDec(ValorTras) * (CDec(ComisionDeCasa)) / 100) * (CDec(PlazoInversion) / 360)
  869. Return Comision
  870. End If
  871. End If
  872. Return 0
  873. End Function
  874. Function ComisionBolsa()
  875. Dim ValorTras = ValorTrasado()
  876. Dim ComisionDeBolsa = txtPorcentajeComisionBolsa.Text.TrimEnd("%")
  877. Dim PlazoInversion = txtPlazoInversion.Text
  878. Dim Comision = 0.0
  879. If (Double.TryParse(ValorTras, Nothing) And Double.TryParse(ComisionDeBolsa, Nothing) And Double.TryParse(PlazoInversion, Nothing)) Then
  880. If (IndexBase = 0) Then
  881. Comision = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(PlazoInversion) / 360)
  882. Return Comision
  883. ElseIf (IndexBase = 1) Then
  884. Dim FechaInicial = dtpFechaLiquidacion.Value
  885. Dim FechaFinal = dtpFechaVencimiento.Value
  886. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  887. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  888. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  889. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  890. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  891. If (Not CambioDeFecha = 0) Then
  892. If CambioDeFecha = 1 Then
  893. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  894. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  895. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasPrimeraFecha) / 366)
  896. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasSegundaFecha) / 365)
  897. ElseIf CambioDeFecha = 2 Then
  898. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  899. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  900. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasPrimeraFecha) / 365)
  901. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasSegundaFecha) / 366)
  902. End If
  903. Comision = ComisionOpc1 + ComisionOpc2
  904. Else
  905. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  906. Comision = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(PlazoInversion) / 365)
  907. End If
  908. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  909. Comision = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(PlazoInversion) / 366)
  910. End If
  911. End If
  912. Return Comision
  913. ElseIf (IndexBase = 2) Then
  914. Dim FechaInicial = dtpFechaLiquidacion.Value
  915. Dim FechaFinal = dtpFechaVencimiento.Value
  916. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  917. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  918. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  919. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  920. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  921. If (Not CambioDeFecha = 0) Then
  922. If CambioDeFecha = 1 Then
  923. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  924. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  925. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasPrimeraFecha) / 366)
  926. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasSegundaFecha) / 365)
  927. ElseIf CambioDeFecha = 2 Then
  928. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  929. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  930. ComisionOpc1 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasPrimeraFecha) / 365)
  931. ComisionOpc2 = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(DiasSegundaFecha) / 366)
  932. End If
  933. Comision = ComisionOpc1 + ComisionOpc2
  934. Else
  935. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  936. Comision = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(PlazoInversion) / 365)
  937. End If
  938. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  939. Comision = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(PlazoInversion) / 366)
  940. End If
  941. End If
  942. Return Comision
  943. Else
  944. Comision = (CDec(ValorTras) * (CDec(ComisionDeBolsa)) / 100) * (CDec(PlazoInversion) / 360)
  945. Return Comision
  946. End If
  947. End If
  948. Return 0
  949. End Function
  950. Function RendimientoNeto()
  951. Dim ValorNominal = txtValorNominal.Text
  952. Dim TotalPagar = V_txtTotalAPagar
  953. Dim PlazoInversion As Integer = 0
  954. If Not String.IsNullOrEmpty(txtPlazoInversion.Text) Then
  955. PlazoInversion = txtPlazoInversion.Text
  956. End If
  957. Dim RendBruto As Double = 0
  958. Dim ComisionCasa As Double = 0
  959. Dim ComisionBolsa As Double = 0
  960. If Not String.IsNullOrEmpty(txtRendimientoBruto.Text.ToString.Trim("%")) Then
  961. RendBruto = txtRendimientoBruto.Text.ToString.Trim("%")
  962. End If
  963. If Not String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%")) Then
  964. ComisionCasa = txtPorcentajeComisionCasa.Text.ToString.Trim("%")
  965. End If
  966. If Not String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%")) Then
  967. ComisionBolsa = txtPorcentajeComisionBolsa.Text.ToString.Trim("%")
  968. End If
  969. If (CDec(TotalPagar) = 0 Or CDec(PlazoInversion) = 0) Then
  970. Return 0
  971. End If
  972. If (Double.TryParse(RendBruto, Nothing) And Double.TryParse(RendBruto, Nothing) And Double.TryParse(CDec(ValorNominal), Nothing) And Double.TryParse(CDec(TotalPagar), Nothing) And Double.TryParse(CDec(PlazoInversion), Nothing)) Then
  973. Dim RendimientoNet As Double = 0
  974. If ((chbValorPar.Checked And (VCN Or PBUR))) Then
  975. RendimientoNet = (RendBruto - ComisionCasa - ComisionBolsa) * 0.9
  976. Return RendimientoNet
  977. ElseIf CET Then
  978. RendimientoNet = (RendBruto - ComisionCasa - ComisionBolsa)
  979. Return RendimientoNet
  980. Else
  981. If (IndexBase = 0) Then
  982. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (360 / CDec(PlazoInversion))) * 100)
  983. Return RendimientoNet
  984. ElseIf IndexBase = 1 Then
  985. Dim FechaInicial = dtpFechaLiquidacion.Value
  986. Dim FechaFinal = dtpFechaVencimiento.Value
  987. Dim RendimientoNetOpc1 = 0.0, RendimientoNetOpc2 = 0.0
  988. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  989. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  990. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  991. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  992. If (Not CambioDeFecha = 0) Then
  993. If CambioDeFecha = 1 Then
  994. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  995. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  996. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasPrimeraFecha))) * 100)
  997. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasSegundaFecha))) * 100)
  998. ElseIf CambioDeFecha = 2 Then
  999. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  1000. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  1001. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasPrimeraFecha))) * 100)
  1002. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasSegundaFecha))) * 100)
  1003. End If
  1004. RendimientoNet = RendimientoNetOpc1 + RendimientoNetOpc2
  1005. Else
  1006. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  1007. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(PlazoInversion))) * 100)
  1008. End If
  1009. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  1010. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(PlazoInversion))) * 100)
  1011. End If
  1012. End If
  1013. Return RendimientoNet
  1014. ElseIf IndexBase = 2 Then
  1015. Dim FechaInicial = dtpFechaLiquidacion.Value
  1016. Dim FechaFinal = dtpFechaVencimiento.Value
  1017. Dim RendimientoNetOpc1 = 0.0, RendimientoNetOpc2 = 0.0
  1018. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  1019. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  1020. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  1021. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1022. If (Not CambioDeFecha = 0) Then
  1023. If CambioDeFecha = 1 Then
  1024. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  1025. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  1026. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasPrimeraFecha))) * 100)
  1027. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasSegundaFecha))) * 100)
  1028. ElseIf CambioDeFecha = 2 Then
  1029. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  1030. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  1031. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasPrimeraFecha))) * 100)
  1032. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasSegundaFecha))) * 100)
  1033. End If
  1034. RendimientoNet = RendimientoNetOpc1 + RendimientoNetOpc2
  1035. Else
  1036. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  1037. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(PlazoInversion))) * 100)
  1038. End If
  1039. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  1040. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(PlazoInversion))) * 100)
  1041. End If
  1042. End If
  1043. Return RendimientoNet
  1044. Else
  1045. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (360 / CDec(PlazoInversion))) * 100)
  1046. Return RendimientoNet
  1047. End If
  1048. End If
  1049. End If
  1050. Return 0
  1051. End Function
  1052. Function IngresoBruto()
  1053. Dim ValorNominal As Double = 0
  1054. Dim ValorTrasado As Double = 0
  1055. If Not String.IsNullOrEmpty(txtValorNominal.Text) Then
  1056. ValorNominal = txtValorNominal.Text
  1057. End If
  1058. If Not String.IsNullOrEmpty(V_txtValorTransado) Then
  1059. ValorTrasado = V_txtValorTransado
  1060. End If
  1061. Dim TasaPeriodo = txtRendimientoBruto.Text.ToString.Trim("%")
  1062. If String.IsNullOrEmpty(TasaPeriodo) Then
  1063. TasaPeriodo = 0
  1064. Else
  1065. TasaPeriodo = CDec(txtRendimientoBruto.Text.ToString.Trim("%")) / 100
  1066. End If
  1067. Dim Base As Integer = 365
  1068. Dim Bruto As Double = 0
  1069. Dim Plazo As Integer = 0
  1070. If Not String.IsNullOrEmpty(txtPlazoInversion.Text) Then
  1071. Plazo = txtPlazoInversion.Text
  1072. End If
  1073. If (chbValorPar.Checked Or CET) Then
  1074. Dim PlazoDias As Integer = 0
  1075. Dim Fecha1 = dtpFechaLiquidacion.Value
  1076. Dim Fecha2 = dtpFechaVencimiento.Value
  1077. IndexBase = cboBase.SelectedIndex
  1078. Dim Valor As Double = 0
  1079. If (IndexBase = 0) Then
  1080. Valor = CDec(ValorNominal * TasaPeriodo * Plazo) / 360
  1081. Return Valor
  1082. ElseIf (IndexBase = 1) Then
  1083. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  1084. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1085. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
  1086. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
  1087. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1088. PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1089. PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1090. Valor = PrOpc1 + PrOpc2
  1091. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1092. Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1093. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  1094. Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1095. Else
  1096. Valor = 0
  1097. End If
  1098. Return Valor
  1099. ElseIf (IndexBase = 2) Then
  1100. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  1101. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1102. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
  1103. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
  1104. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1105. PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1106. PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1107. Valor = PrOpc1 + PrOpc2
  1108. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1109. Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1110. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  1111. Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1112. Else
  1113. Valor = 0
  1114. End If
  1115. Return Valor
  1116. Else
  1117. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  1118. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1119. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
  1120. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
  1121. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1122. PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 360
  1123. PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 360
  1124. Valor = PrOpc1 + PrOpc2
  1125. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1126. Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 360
  1127. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  1128. Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 360
  1129. Else
  1130. Valor = 0
  1131. End If
  1132. Return Valor
  1133. End If
  1134. Else
  1135. If (Double.TryParse(ValorNominal, Nothing) And Double.TryParse(ValorTrasado, Nothing)) Then
  1136. Bruto = CDec(ValorNominal) - CDec(ValorTrasado)
  1137. Return Bruto
  1138. End If
  1139. End If
  1140. Return 0
  1141. End Function
  1142. Function IngresoNeto()
  1143. Dim ValorNominal = txtValorNominal.Text
  1144. Dim TotalPagar = V_txtTotalAPagar
  1145. Dim Neto As Double = 0
  1146. If chbValorPar.Checked Or CET Then
  1147. Dim IngBruto = txtIngresoBruto.Text
  1148. Dim Descuentos = (CDec(txtComisionBolsa.Text) + CDec(txtComisionCasa.Text))
  1149. Neto = (IngBruto * 0.9) - Descuentos
  1150. Return Neto
  1151. End If
  1152. If (Double.TryParse(ValorNominal, Nothing) And Double.TryParse(TotalPagar, Nothing)) Then
  1153. Neto = CDec(ValorNominal) - CDec(TotalPagar)
  1154. Return Neto
  1155. End If
  1156. Return 0
  1157. End Function
  1158. Function TotalPagar()
  1159. Dim ValorTrasado = V_txtValorTransado
  1160. Dim ComisionCasa = V_txtComisionCasa.TrimEnd("%")
  1161. Dim ComisionBolsa = V_txtComisionBolsa.TrimEnd("%")
  1162. Dim OtrCost As Double = 0.0
  1163. If (Not String.IsNullOrEmpty(txtOtrosCostos.Text.ToString)) Then
  1164. OtrCost = CDec(txtOtrosCostos.Text)
  1165. End If
  1166. If (String.IsNullOrEmpty(txtInteresAcumulado.Text.ToString)) Then
  1167. txtInteresAcumulado.Text = 0
  1168. End If
  1169. Dim InteresAcumulado = CDec(txtInteresAcumulado.Text.ToString.Trim("%"))
  1170. If (PBUR Or CET) Then
  1171. If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
  1172. Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa) + InteresAcumulado
  1173. Return Total
  1174. End If
  1175. ElseIf VCN Then
  1176. If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
  1177. Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa) + InteresAcumulado + OtrCost
  1178. Return Total
  1179. End If
  1180. Else
  1181. If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
  1182. Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa)
  1183. Return Total
  1184. End If
  1185. End If
  1186. Return 0
  1187. End Function
  1188. Sub Rellenar()
  1189. If (String.IsNullOrEmpty(txtOtrosCostos.Text.ToString)) Then
  1190. txtOtrosCostos.Text = "0.0"
  1191. End If
  1192. If (String.IsNullOrEmpty(txtPlazoInversion.Text.ToString)) Then
  1193. txtPlazoInversion.Text = "0.0"
  1194. End If
  1195. If (String.IsNullOrEmpty(txtValorNominal.Text.ToString.Trim("%"))) Then
  1196. txtValorNominal.Text = 0
  1197. txtValorNominal.Text = Format(txtValorNominal.Text, "0.0")
  1198. End If
  1199. If (String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%"))) Then
  1200. txtPorcentajeComisionCasa.Text = 0
  1201. txtPorcentajeComisionCasa.Text = Format(txtPorcentajeComisionCasa.Text, "0.0")
  1202. End If
  1203. If (String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%"))) Then
  1204. txtPorcentajeComisionBolsa.Text = 0
  1205. txtPorcentajeComisionBolsa.Text = Format(txtPorcentajeComisionBolsa.Text, "0.0")
  1206. End If
  1207. If (String.IsNullOrEmpty(txtRendimientoBruto.Text.ToString.Trim("%"))) Then
  1208. txtRendimientoBruto.Text = 0
  1209. txtRendimientoBruto.Text = Format(txtRendimientoBruto.Text, "0.0")
  1210. End If
  1211. If (String.IsNullOrEmpty(txtInteresAcumulado.Text.ToString.Trim("%"))) Then
  1212. txtInteresAcumulado.Text = "0.0%"
  1213. End If
  1214. If (txtPorcentajeComisionCasa.Text.ToString.IndexOf("%") = -1) Then
  1215. txtPorcentajeComisionCasa.Text += "%"
  1216. End If
  1217. If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
  1218. txtPorcentajeComisionBolsa.Text += "%"
  1219. End If
  1220. If (txtRendimientoBruto.ToString.IndexOf("%") = -1) Then
  1221. txtRendimientoBruto.Text += "%"
  1222. End If
  1223. End Sub
  1224. Sub RellenarDatos()
  1225. If (cboBase.SelectedIndex = 0) Then
  1226. IndexBase = 0
  1227. ElseIf (cboBase.SelectedIndex = 1) Then
  1228. IndexBase = 1
  1229. ElseIf (cboBase.SelectedIndex = 2) Then
  1230. IndexBase = 2
  1231. ElseIf (cboBase.SelectedIndex = 3) Then
  1232. IndexBase = 3
  1233. End If
  1234. Dim FechaOperacion = Date.Now.Date, FechaLiquidacion = Date.Now.Date
  1235. AgregarDias()
  1236. If (CET) Then
  1237. V_txtPrecio = "100"
  1238. Else
  1239. If (chbValorPar.Checked) Then
  1240. V_txtPrecio = "100"
  1241. txtPrecio.Text = "100%"
  1242. Else
  1243. txtPrecio.Text = Format(Precio(), "0.0000")
  1244. V_txtPrecio = Format(Precio(), "0.000000000")
  1245. End If
  1246. End If
  1247. txtValorTransado.Text = Format(ValorTrasado(), "0.0000")
  1248. V_txtValorTransado = Format(ValorTrasado(), "0.000000000")
  1249. txtComisionCasa.Text = Format(ComisionCasa(), "0.0000")
  1250. V_txtComisionCasa = Format(ComisionCasa(), "0.000000000")
  1251. txtComisionBolsa.Text = Format(ComisionBolsa(), "0.0000")
  1252. V_txtComisionBolsa = Format(ComisionBolsa(), "0.000000000")
  1253. txtIngresoBruto.Text = Format(IngresoBruto(), "0.0000")
  1254. V_txtIngresoBruto = Format(IngresoBruto(), "0.000000000")
  1255. FechaOperacion = dtpFechaOperacion.Value
  1256. FechaLiquidacion = dtpFechaLiquidacion.Value
  1257. 'txtDiasAcumulados.Text = Operaciones.DiasAcumulados(FechaOperacion, FechaLiquidacion, 1).ToString()
  1258. Dim Dias = 0
  1259. Dim Fecha As String = Format(dtpUltimaFecha.Value, "yyyy/MM/dd")
  1260. dtpUltimaFecha.Value = Fecha
  1261. Dim FechaLiq As String = Format(dtpFechaLiquidacion.Value, "yyyy/MM/dd")
  1262. dtpFechaLiquidacion.Value = FechaLiq
  1263. If (IndexBase = 0 Or IndexBase = 2) Then
  1264. Dias = Operaciones.Base360(dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)
  1265. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  1266. Dias = Operaciones.Base365(dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)
  1267. End If
  1268. V_txtDiasAcumulados = Dias
  1269. Dim ValorNominal, RendBruto
  1270. ValorNominal = txtValorNominal.Text
  1271. If String.IsNullOrEmpty(ValorNominal.ToString) Then
  1272. ValorNominal = 0
  1273. End If
  1274. RendBruto = txtRendimientoBruto.Text
  1275. If String.IsNullOrEmpty(RendBruto.ToString.Trim("%")) Then
  1276. RendBruto = 0
  1277. Else
  1278. RendBruto = txtRendimientoBruto.Text.TrimEnd("%") / 100
  1279. End If
  1280. txtInteresAcumulado.Text = Format(CDec(Operaciones.InteresAcumuladoPBUR(ValorNominal, RendBruto, V_txtDiasAcumulados, IndexBase, dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)), "0.0000").ToString + "%"
  1281. txtTotalAPagar.Text = Format(TotalPagar(), "0.0000")
  1282. V_txtTotalAPagar = Format(TotalPagar(), "0.000000000")
  1283. txtIngresoNeto.Text = Format(IngresoNeto(), "0.0000")
  1284. V_txtIngresoNeto = Format(IngresoNeto(), "0.000000000")
  1285. txtRendimientoNeto.Text = Format(RendimientoNeto(), "0.0000")
  1286. V_txtRendimientoNeto = Format(RendimientoNeto(), "0.000000000")
  1287. AgregarPorcentaje()
  1288. End Sub
  1289. Private Sub Button1_Click_1(sender As Object, e As EventArgs)
  1290. End Sub
  1291. Sub AgregarDias()
  1292. Dim Dias As Integer = 0
  1293. If Not String.IsNullOrEmpty(txtPlazoInversion.Text) Then
  1294. Dias = txtPlazoInversion.Text
  1295. End If
  1296. Dim Fechaliquidacion = dtpFechaLiquidacion.Value
  1297. If (IndexBase = 0 Or IndexBase = 2) Then
  1298. dtpFechaVencimiento.Value = Operaciones.FechaDias360(Fechaliquidacion, Dias)
  1299. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  1300. dtpFechaVencimiento.Value = dtpFechaLiquidacion.Value.AddDays(Dias)
  1301. End If
  1302. End Sub
  1303. Sub AgregarPorcentaje()
  1304. If (txtRendimientoBruto.ToString.IndexOf("%") = -1) Then
  1305. txtRendimientoBruto.Text += "%"
  1306. End If
  1307. If (txtPorcentajeComisionCasa.Text.ToString.IndexOf("%") = -1) Then
  1308. txtPorcentajeComisionCasa.Text += "%"
  1309. End If
  1310. If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
  1311. txtPorcentajeComisionBolsa.Text += "%"
  1312. End If
  1313. If (txtRendimientoNeto.ToString.IndexOf("%") = -1) Then
  1314. txtRendimientoNeto.Text += "%"
  1315. End If
  1316. If (txtPrecio.ToString.IndexOf("%") = -1) Then
  1317. txtPrecio.Text += "%"
  1318. End If
  1319. End Sub
  1320. Private Sub txtRendimientoBruto_Leave(sender As Object, e As EventArgs) Handles txtRendimientoBruto.Leave
  1321. Rellenar()
  1322. End Sub
  1323. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  1324. TipoTransaccion = "M"
  1325. btnAceptar.Text = "Modificar"
  1326. End Sub
  1327. Private Sub txtValorNominal_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominal.KeyPress
  1328. If String.IsNullOrEmpty(txtValorNominal.Text) Then
  1329. If e.KeyChar = "." Then
  1330. txtValorNominal.Text = "0"
  1331. Exit Sub
  1332. End If
  1333. End If
  1334. If (Not txtValorNominal.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1335. Operaciones.ValidarEntrada(sender, e, True)
  1336. Else
  1337. Operaciones.ValidarEntrada(sender, e, False)
  1338. End If
  1339. End Sub
  1340. Private Sub txtPlazoInversion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPlazoInversion.KeyPress
  1341. If String.IsNullOrEmpty(txtPlazoInversion.Text) Then
  1342. If e.KeyChar = "." Then
  1343. txtPlazoInversion.Text = "0"
  1344. Exit Sub
  1345. End If
  1346. End If
  1347. If (Not txtPlazoInversion.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1348. Operaciones.ValidarEntrada(sender, e, True)
  1349. Else
  1350. Operaciones.ValidarEntrada(sender, e, False)
  1351. End If
  1352. End Sub
  1353. Private Sub txtPorcentajeComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionCasa.KeyPress
  1354. If String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text) Then
  1355. If e.KeyChar = "." Then
  1356. txtPorcentajeComisionCasa.Text = "0"
  1357. Exit Sub
  1358. End If
  1359. End If
  1360. If (Not txtPorcentajeComisionCasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1361. Operaciones.ValidarEntrada(sender, e, True)
  1362. Else
  1363. Operaciones.ValidarEntrada(sender, e, False)
  1364. End If
  1365. End Sub
  1366. Private Sub txtPorcentajeComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionBolsa.KeyPress
  1367. If String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text) Then
  1368. If e.KeyChar = "." Then
  1369. txtPorcentajeComisionBolsa.Text = "0"
  1370. Exit Sub
  1371. End If
  1372. End If
  1373. If (Not txtPorcentajeComisionBolsa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1374. Operaciones.ValidarEntrada(sender, e, True)
  1375. Else
  1376. Operaciones.ValidarEntrada(sender, e, False)
  1377. End If
  1378. End Sub
  1379. Private Sub txtRendimientoBruto_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRendimientoBruto.KeyPress
  1380. If String.IsNullOrEmpty(txtRendimientoBruto.Text) Then
  1381. If e.KeyChar = "." Then
  1382. txtRendimientoBruto.Text = "0"
  1383. Exit Sub
  1384. End If
  1385. End If
  1386. If (Not txtRendimientoBruto.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1387. Operaciones.ValidarEntrada(sender, e, True)
  1388. Else
  1389. Operaciones.ValidarEntrada(sender, e, False)
  1390. End If
  1391. End Sub
  1392. Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
  1393. TipoTransaccion = "N"
  1394. btnAceptar.Text = "Agregar"
  1395. End Sub
  1396. Private Sub chbValorPar_CheckedChanged(sender As Object, e As EventArgs) Handles chbValorPar.CheckedChanged
  1397. RellenarDatos()
  1398. End Sub
  1399. Private Sub txtRendimientoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNeto.TextChanged
  1400. End Sub
  1401. Private Sub txtInteresAcumulado_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumulado.TextChanged
  1402. End Sub
  1403. Private Sub txtIngresoBruto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoBruto.TextChanged
  1404. End Sub
  1405. Private Sub dtpUltimaFecha_ValueChanged(sender As Object, e As EventArgs)
  1406. RellenarDatos()
  1407. End Sub
  1408. Private Sub Label14_Click(sender As Object, e As EventArgs) Handles Label14.Click
  1409. End Sub
  1410. Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodicidad.SelectedIndexChanged
  1411. RellenarDatos()
  1412. End Sub
  1413. Private Sub cboCasasCorredoras_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasasCorredoras.SelectedIndexChanged
  1414. RellenarDatos()
  1415. End Sub
  1416. Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
  1417. End Sub
  1418. Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
  1419. End Sub
  1420. Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
  1421. End Sub
  1422. Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
  1423. End Sub
  1424. Private Sub Label10_Click(sender As Object, e As EventArgs) Handles Label10.Click
  1425. End Sub
  1426. Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click
  1427. End Sub
  1428. Private Sub Label11_Click(sender As Object, e As EventArgs) Handles Label11.Click
  1429. End Sub
  1430. Private Sub txtIngresoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoNeto.TextChanged
  1431. End Sub
  1432. Private Sub Label12_Click(sender As Object, e As EventArgs) Handles Label12.Click
  1433. End Sub
  1434. Private Sub Label13_Click(sender As Object, e As EventArgs) Handles Label13.Click
  1435. End Sub
  1436. Private Sub Label15_Click(sender As Object, e As EventArgs) Handles Label15.Click
  1437. End Sub
  1438. Private Sub Label16_Click(sender As Object, e As EventArgs) Handles Label16.Click
  1439. End Sub
  1440. Private Sub Label17_Click(sender As Object, e As EventArgs) Handles Label17.Click
  1441. End Sub
  1442. Private Sub Label6_Click(sender As Object, e As EventArgs) Handles Label6.Click
  1443. End Sub
  1444. Private Sub lblInteresAcumulado_Click(sender As Object, e As EventArgs) Handles lblInteresAcumulado.Click
  1445. End Sub
  1446. Private Sub dtpUltimaFecha_ValueChanged_1(sender As Object, e As EventArgs) Handles dtpUltimaFecha.ValueChanged
  1447. RellenarDatos()
  1448. End Sub
  1449. Private Sub txtOtrosCostos_TextChanged(sender As Object, e As EventArgs) Handles txtOtrosCostos.TextChanged
  1450. RellenarDatos()
  1451. End Sub
  1452. Private Sub txtOtrosCostos_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtOtrosCostos.KeyPress
  1453. If String.IsNullOrEmpty(txtOtrosCostos.Text) Then
  1454. If e.KeyChar = "." Then
  1455. txtOtrosCostos.Text = "0"
  1456. Exit Sub
  1457. End If
  1458. End If
  1459. If (Not txtOtrosCostos.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1460. Operaciones.ValidarEntrada(sender, e, True)
  1461. Else
  1462. Operaciones.ValidarEntrada(sender, e, False)
  1463. End If
  1464. End Sub
  1465. Private Sub btnRedencion_Click(sender As Object, e As EventArgs) Handles btnRedencion.Click
  1466. If (btnRedencion.Text = "Redención") Then
  1467. lblRedencion.Visible = True
  1468. dtpRedencion.Visible = True
  1469. btnRedencion.Text = "Cancelar"
  1470. Else
  1471. lblRedencion.Visible = False
  1472. dtpRedencion.Visible = False
  1473. btnRedencion.Text = "Redención"
  1474. End If
  1475. End Sub
  1476. Private Sub txtDiasAcumulados_TextChanged(sender As Object, e As EventArgs)
  1477. RellenarDatos()
  1478. End Sub
  1479. Private Sub txtValorNominal_Leave(sender As Object, e As EventArgs) Handles txtValorNominal.Leave
  1480. Rellenar()
  1481. End Sub
  1482. Private Sub txtPlazoInversion_Leave(sender As Object, e As EventArgs) Handles txtPlazoInversion.Leave
  1483. Rellenar()
  1484. End Sub
  1485. Private Sub txtOtrosCostos_Leave(sender As Object, e As EventArgs) Handles txtOtrosCostos.Leave
  1486. Rellenar()
  1487. End Sub
  1488. Private Sub txtValorNominal_ModifiedChanged(sender As Object, e As EventArgs) Handles txtValorNominal.ModifiedChanged
  1489. End Sub
  1490. Private Sub txtValorNominal_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominal.KeyUp
  1491. If txtValorNominal.Text = "." Then
  1492. txtValorNominal.Text = ".0"
  1493. End If
  1494. End Sub
  1495. Private Sub txtPlazoInversion_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPlazoInversion.KeyUp
  1496. If txtPlazoInversion.Text = "." Then
  1497. txtPlazoInversion.Text = ".0"
  1498. End If
  1499. End Sub
  1500. Private Sub txtPorcentajeComisionCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeComisionCasa.KeyUp
  1501. If txtPorcentajeComisionCasa.Text = "." Then
  1502. txtPorcentajeComisionCasa.Text = ".0"
  1503. End If
  1504. End Sub
  1505. Private Sub txtPorcentajeComisionBolsa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeComisionBolsa.KeyUp
  1506. If txtPorcentajeComisionBolsa.Text = "." Then
  1507. txtPorcentajeComisionBolsa.Text = ".0"
  1508. End If
  1509. End Sub
  1510. Private Sub txtRendimientoBruto_KeyUp(sender As Object, e As KeyEventArgs) Handles txtRendimientoBruto.KeyUp
  1511. If txtRendimientoBruto.Text = "." Then
  1512. txtRendimientoBruto.Text = ".0"
  1513. End If
  1514. End Sub
  1515. Private Sub txtOtrosCostos_KeyUp(sender As Object, e As KeyEventArgs) Handles txtOtrosCostos.KeyUp
  1516. If txtOtrosCostos.Text = "." Then
  1517. txtOtrosCostos.Text = ".0"
  1518. End If
  1519. End Sub
  1520. Private Sub dtpRedencion_ValueChanged(sender As Object, e As EventArgs) Handles dtpRedencion.ValueChanged
  1521. End Sub
  1522. Private Sub btnReporto_Click(sender As Object, e As EventArgs)
  1523. End Sub
  1524. Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
  1525. TipoTransaccion = "B"
  1526. btnAceptar.Text = "Eliminar"
  1527. End Sub
  1528. Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
  1529. Me.Close()
  1530. End Sub
  1531. Private Sub cboBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboBase.SelectedIndexChanged
  1532. RellenarDatos()
  1533. End Sub
  1534. Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
  1535. End Sub
  1536. Private Sub txtPorcentajeComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.Leave
  1537. Rellenar()
  1538. End Sub
  1539. Private Sub txtPorcentajeComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.Leave
  1540. Rellenar()
  1541. End Sub
  1542. Sub AgregarDiasExtra()
  1543. dtpFechaLiquidacion.Value = dtpFechaOperacion.Value.AddDays(2)
  1544. End Sub
  1545. Sub CargarTransladoNuevo()
  1546. Dim Existe As Boolean = ExisteInversion()
  1547. If Not RetCodigoInversionExiste And Not Existe Then
  1548. txtValorNominal.Text = Variables.RetMonto
  1549. txtRendimientoBruto.Text = Variables.RetRendimiento
  1550. End If
  1551. End Sub
  1552. End Class