frmTitularizacion.vb 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501
  1. Public Class frmTitularizacion
  2. Dim oCEBonos As BonosCE
  3. Dim oDAOBonos As BonosDAO
  4. Dim oDAOGeneral As New DAOGeneral
  5. Dim TotalValorCupones As Double
  6. Private _Modo As String
  7. Private _IdDocumento As Integer
  8. Private _TipoDocumento As String
  9. 'PROPIEDADES EMISION DEL TITULO
  10. Private _EmisionTotal As Double
  11. Private _FechaEmision As Date
  12. Private _TasaEmision As Double
  13. Private _PeriodicidadEmision As Integer
  14. Private _NumeroPeriodosEmision As Integer = 0
  15. Private _MontoCompraEmision As Double
  16. Private _MontoCompraPrimario As Double
  17. Private _CesionFlujo1 As Double
  18. Public Property Modo As String
  19. Get
  20. Return _Modo
  21. End Get
  22. Set(value As String)
  23. _Modo = value
  24. End Set
  25. End Property
  26. Private Property IdDocumento As Integer
  27. Get
  28. Return _IdDocumento
  29. End Get
  30. Set(value As Integer)
  31. _IdDocumento = value
  32. End Set
  33. End Property
  34. Private Property TipoDocumento As String
  35. Get
  36. Return _TipoDocumento
  37. End Get
  38. Set(value As String)
  39. _TipoDocumento = value
  40. End Set
  41. End Property
  42. 'PROPIEDADES EMISION DEL TITULO
  43. Private Property EmisionTotal As Double
  44. Get
  45. Return _EmisionTotal
  46. End Get
  47. Set(value As Double)
  48. _EmisionTotal = value
  49. End Set
  50. End Property
  51. Private Property FechaEmision As Date
  52. Get
  53. Return _FechaEmision
  54. End Get
  55. Set(value As Date)
  56. _FechaEmision = value
  57. End Set
  58. End Property
  59. Private Property TasaEmision As Double
  60. Get
  61. Return _TasaEmision
  62. End Get
  63. Set(value As Double)
  64. _TasaEmision = value / 100
  65. End Set
  66. End Property
  67. Private Property PeriodicidadEmision As Integer
  68. Get
  69. Return _PeriodicidadEmision
  70. End Get
  71. Set(value As Integer)
  72. _PeriodicidadEmision = value
  73. End Set
  74. End Property
  75. Private Property NumeroPeriodosEmision As Integer
  76. Get
  77. Return _NumeroPeriodosEmision
  78. End Get
  79. Set(value As Integer)
  80. _NumeroPeriodosEmision = value
  81. End Set
  82. End Property
  83. Private Property MontoCompraEmision As Double
  84. Get
  85. Return _MontoCompraEmision
  86. End Get
  87. Set(value As Double)
  88. _MontoCompraEmision = value
  89. End Set
  90. End Property
  91. Private Property MontoCompraPrimario As Double
  92. Get
  93. Return _MontoCompraPrimario
  94. End Get
  95. Set(value As Double)
  96. _MontoCompraPrimario = value
  97. End Set
  98. End Property
  99. Private Property CesionFlujo1 As Double
  100. Get
  101. Return _CesionFlujo1
  102. End Get
  103. Set(value As Double)
  104. _CesionFlujo1 = value
  105. End Set
  106. End Property
  107. Private Sub frmBonos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  108. Call CargarCasas()
  109. Call CargarPeriodos()
  110. 'VARIOS
  111. FechaEmision = dtpFechaEmision.Value.Date
  112. End Sub
  113. 'GETS COMPRA
  114. Function GetValorNominalCompra() As Double
  115. Dim valor As Double
  116. If Me.txtValorNominalCompra.Text.Length = 0 Then
  117. valor = 0
  118. Else
  119. Try
  120. valor = Me.txtValorNominalCompra.Text
  121. Catch ex As Exception
  122. valor = 0
  123. End Try
  124. End If
  125. Return valor
  126. End Function
  127. Function GetUltimaFechaCuponCompra() As Date
  128. Dim valor As Date
  129. valor = Me.dtpUltimaFechaCuponCompra.Value.Date
  130. Return valor
  131. End Function
  132. Function GetSiguienteFechaCuponCompra() As Date
  133. Dim valor As Date
  134. valor = Me.dtpSiguienteFechaCuponCompra.Value.Date
  135. Return valor
  136. End Function
  137. Function GetFechaLiquidacionCompra() As Date
  138. Dim valor As Date
  139. valor = Me.dtpFechaLiquidacionCompra.Value.Date
  140. Return valor
  141. End Function
  142. Function GetFechaVencimientoCompra() As Date
  143. Dim valor As Date
  144. valor = Me.dtpFechaVencimientoCompra.Value.Date
  145. Return valor
  146. End Function
  147. Function GetPorcentajeCuponCompra() As Double
  148. Dim valor As Double
  149. If Me.txtPorcentajeCuponCompra.Text.Length = 0 Then
  150. valor = 0
  151. Else
  152. Try
  153. valor = Me.txtPorcentajeCuponCompra.Text
  154. valor = valor / 100
  155. Catch ex As Exception
  156. valor = 0
  157. End Try
  158. End If
  159. Return valor
  160. End Function
  161. Function GetYTMAlVencimientoCompra() As Double
  162. Dim valor As Double
  163. If Me.txtYTMAlVencimientoCompra.Text.Length = 0 Then
  164. valor = 0
  165. Else
  166. Try
  167. valor = Me.txtYTMAlVencimientoCompra.Text
  168. valor = valor / 100
  169. Catch ex As Exception
  170. valor = 0
  171. End Try
  172. End If
  173. Return valor
  174. End Function
  175. Function GetComisionCasaCompra() As Double
  176. Dim valor As Double
  177. If Me.txtComisionCasaCompra.Text.Length = 0 Then
  178. valor = 0
  179. Else
  180. Try
  181. valor = Me.txtComisionCasaCompra.Text
  182. Catch ex As Exception
  183. valor = 0
  184. End Try
  185. End If
  186. Return valor
  187. End Function
  188. Function GetDiasAlVencimientoCompra() As Double
  189. Dim valor As Double
  190. If Me.txtDiasAlVencimientoCompra.Text.Length = 0 Then
  191. valor = 0
  192. Else
  193. Try
  194. valor = Me.txtDiasAlVencimientoCompra.Text
  195. Catch ex As Exception
  196. valor = 0
  197. End Try
  198. End If
  199. Return valor
  200. End Function
  201. Function GetComisionBolsaCompra() As Double
  202. Dim valor As Double
  203. If Me.txtComisionBolsaCompra.Text.Length = 0 Then
  204. valor = 0
  205. Else
  206. Try
  207. valor = Me.txtComisionBolsaCompra.Text
  208. Catch ex As Exception
  209. valor = 0
  210. End Try
  211. End If
  212. Return valor
  213. End Function
  214. Function GetDiasAcumuladosCompra() As Integer
  215. Dim valor As Integer
  216. If Me.txtDiasAcumuladosCompra.Text.Length = 0 Then
  217. valor = 0
  218. Else
  219. Try
  220. valor = Me.txtDiasAcumuladosCompra.Text
  221. Catch ex As Exception
  222. valor = 0
  223. End Try
  224. End If
  225. Return valor
  226. End Function
  227. Function GetInteresAcumuladoCompra() As Double
  228. Dim valor As Double
  229. If Me.txtInteresAcumuladoCompra.Text.Length = 0 Then
  230. valor = 0
  231. Else
  232. Try
  233. valor = Me.txtInteresAcumuladoCompra.Text
  234. Catch ex As Exception
  235. valor = 0
  236. End Try
  237. End If
  238. Return valor
  239. End Function
  240. Function GetPrecioCompra() As Double
  241. Dim valor As Double
  242. If Me.txtPrecioCompra.Text.Length = 0 Then
  243. valor = 0
  244. Else
  245. Try
  246. valor = Me.txtPrecioCompra.Text
  247. Catch ex As Exception
  248. valor = 0
  249. End Try
  250. End If
  251. Return valor
  252. End Function
  253. Function GetPorcentajeInteresAcumuladoCompra() As Double
  254. Dim valor As Double
  255. If Me.txtPorcentajeInteresAcumuladoCompra.Text.Length = 0 Then
  256. valor = 0
  257. Else
  258. Try
  259. valor = Me.txtPorcentajeInteresAcumuladoCompra.Text
  260. valor = valor / 100
  261. Catch ex As Exception
  262. valor = 0
  263. End Try
  264. End If
  265. Return valor
  266. End Function
  267. Function GetPorcentajeComisionCasaCompra() As Double
  268. Dim valor As Double
  269. If Me.txtPorcentajeComisionCasaCompra.Text.Length = 0 Then
  270. valor = 0
  271. Else
  272. Try
  273. valor = Me.txtPorcentajeComisionCasaCompra.Text
  274. valor = valor / 100
  275. Catch ex As Exception
  276. valor = 0
  277. End Try
  278. End If
  279. Return valor
  280. End Function
  281. Function GetValorTransadoCompra() As Double
  282. Dim valor As Double
  283. If Me.txtValorTransadoCompra.Text.Length = 0 Then
  284. valor = 0
  285. Else
  286. Try
  287. valor = Me.txtValorTransadoCompra.Text
  288. Catch ex As Exception
  289. valor = 0
  290. End Try
  291. End If
  292. Return valor
  293. End Function
  294. Function GetPorcentajeComisionBolsaCompra() As Double
  295. Dim valor As Double
  296. If Me.txtPorcentajeComisionBolsaCompra.Text.Length = 0 Then
  297. valor = 0
  298. Else
  299. Try
  300. valor = Me.txtPorcentajeComisionBolsaCompra.Text
  301. valor = valor / 100
  302. Catch ex As Exception
  303. valor = 0
  304. End Try
  305. End If
  306. Return valor
  307. End Function
  308. Function GetCostoTransferenciaCompra() As Double
  309. Dim valor As Double
  310. If Me.txtCostoTransferenciaCompra.Text.Length = 0 Then
  311. valor = 0
  312. Else
  313. Try
  314. valor = Me.txtCostoTransferenciaCompra.Text
  315. Catch ex As Exception
  316. valor = 0
  317. End Try
  318. End If
  319. Return valor
  320. End Function
  321. Function GetCasaCompra() As String
  322. Dim valor As String
  323. If Me.cboCasa_C.SelectedIndex = -1 Then
  324. valor = ""
  325. Else
  326. valor = Me.cboCasa_C.SelectedValue
  327. End If
  328. Return valor
  329. End Function
  330. Function GetYTMAlVencimientoComisionCompra() As Double
  331. Dim valor As Double
  332. If Me.txtYTMAlVencimientoComisionCompra.Text.Length = 0 Then
  333. valor = 0
  334. Else
  335. Try
  336. valor = Me.txtYTMAlVencimientoComisionCompra.Text
  337. Catch ex As Exception
  338. valor = 0
  339. End Try
  340. End If
  341. Return valor
  342. End Function
  343. Function GetPrecioAlVencimientoCompra() As Double
  344. Dim valor As Double
  345. If Me.txtPrecioAlVencimientoCompra.Text.Length = 0 Then
  346. valor = 0
  347. Else
  348. Try
  349. valor = Me.txtPrecioAlVencimientoCompra.Text
  350. Catch ex As Exception
  351. valor = 0
  352. End Try
  353. End If
  354. Return valor
  355. End Function
  356. Function GetDiasBaseCompra() As Integer
  357. Dim valor As Integer
  358. If Me.cboAnioBaseC.SelectedIndex = -1 Then
  359. valor = 0
  360. Else
  361. Try
  362. valor = Me.cboAnioBaseC.SelectedItem
  363. Catch ex As Exception
  364. valor = 0
  365. End Try
  366. End If
  367. Return valor
  368. End Function
  369. Function GetPrecioSucioCompra() As Double
  370. Dim valor As Double
  371. If Me.txtPrecioSucioCompra.Text.Length = 0 Then
  372. valor = 0
  373. Else
  374. Try
  375. valor = Me.txtPrecioSucioCompra.Text
  376. valor = valor / 100
  377. Catch ex As Exception
  378. valor = 0
  379. End Try
  380. End If
  381. Return valor
  382. End Function
  383. Function GetMontoAPagarCompra() As Double
  384. Dim valor As Double
  385. If Me.txtMontoAPagar.Text.Length = 0 Then
  386. valor = 0
  387. Else
  388. Try
  389. valor = Me.txtMontoAPagar.Text
  390. Catch ex As Exception
  391. valor = 0
  392. End Try
  393. End If
  394. Return valor
  395. End Function
  396. Function GetPeriodicidadCompra() As String
  397. Dim valor As String
  398. If Me.cboPeriodosC.SelectedIndex = -1 Then
  399. valor = "NA"
  400. Else
  401. valor = Me.cboPeriodosC.SelectedValue.ToString
  402. End If
  403. Return valor
  404. End Function
  405. 'CALCULOS COMPRA
  406. Function CalcularSiguienteFechaCuponCompra() As Date
  407. Dim valor As Date
  408. Dim vUltimaFechCupon As Date = GetUltimaFechaCuponCompra()
  409. Dim vPeriodicidad As String = GetPeriodicidadCompra()
  410. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(vPeriodicidad)
  411. valor = vUltimaFechCupon.AddDays(vDiasPeriodo + 1)
  412. Return valor
  413. End Function
  414. Function CalcularYTMAlVencimientoCompra() As Double
  415. Dim valor As Double
  416. Return valor
  417. End Function
  418. Function CalcularYTMAlVencimientoComisionCompra() As Double
  419. Dim valor As Double
  420. Dim vYTMAlVencimiento As Double = GetYTMAlVencimientoCompra()
  421. Dim vComisionCasa As Double = GetPorcentajeComisionCasaCompra()
  422. Dim vAnioBase As Integer = GetDiasBaseCompra()
  423. Dim vDiasAlVencimiento As Integer = GetDiasAlVencimientoCompra()
  424. Dim vComisionBolsa As Double = GetPorcentajeComisionBolsaCompra()
  425. Try
  426. valor = vYTMAlVencimiento - (vComisionBolsa * vAnioBase / vDiasAlVencimiento) - (vComisionBolsa * vAnioBase / vDiasAlVencimiento)
  427. valor = valor * 100
  428. Catch ex As Exception
  429. valor = 0
  430. End Try
  431. Return valor
  432. End Function
  433. Function CalcularDiasAcumuladosCompra() As Integer
  434. Dim valor As Integer
  435. Dim vUltimaFechaCupon As DateTime = GetUltimaFechaCuponCompra()
  436. Dim vFechaLiquidacion As DateTime = GetFechaLiquidacionCompra()
  437. valor = Utilidades.Days360(vUltimaFechaCupon, vFechaLiquidacion)
  438. Return valor
  439. End Function
  440. Function CalcularDiasAlVencimientoCompra() As Integer
  441. Dim valor As Integer
  442. Dim vFechaVencimiento As DateTime = GetFechaVencimientoCompra()
  443. Dim vFechaLiquidacion As DateTime = GetFechaLiquidacionCompra()
  444. If GetDiasBaseCompra() = 360 Then
  445. valor = Utilidades.Days360(vFechaLiquidacion, vFechaVencimiento)
  446. Else
  447. valor = DateDiff(DateInterval.Day, vFechaLiquidacion, vFechaVencimiento)
  448. End If
  449. Return valor
  450. End Function
  451. Function CalcularInteresAcumuladoCompra() As Double
  452. Dim valor As Double
  453. Dim vValorNominal As Double = GetValorNominalCompra()
  454. Dim vPorcentajeCupon As Double = GetPorcentajeCuponCompra()
  455. Dim vDiasAcumulados As Integer = GetDiasAcumuladosCompra()
  456. Dim vAnioBase As Integer = GetDiasBaseCompra()
  457. Try
  458. valor = vValorNominal * vPorcentajeCupon * vDiasAcumulados / vAnioBase
  459. Catch ex As Exception
  460. valor = 0
  461. End Try
  462. Return valor
  463. End Function
  464. Function CalcularPorcentajeInteresAcumuladoCompra() As Double
  465. Dim valor As Double
  466. Dim vInteresAcumulado As Double = GetInteresAcumuladoCompra()
  467. Dim vValorNominal As Double = GetValorNominalCompra()
  468. Dim vAnioBase As Integer = GetDiasBaseCompra()
  469. Dim vPeriodididad As String = GetPeriodicidadCompra()
  470. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(vPeriodididad)
  471. Try
  472. valor = vInteresAcumulado / vValorNominal * vAnioBase / vDiasPeriodo
  473. valor = valor * 100
  474. Catch ex As Exception
  475. valor = 0
  476. End Try
  477. Return valor
  478. End Function
  479. Function CalcularPrecioSucioCompra() As Double
  480. Dim valor As Double
  481. Dim vPrecioCompra As Double = GetPrecioCompra()
  482. Dim vPorcentajeInteresAcumuladoCompra As Double = GetPorcentajeInteresAcumuladoCompra()
  483. Try
  484. valor = vPrecioCompra * 0.01 + vPorcentajeInteresAcumuladoCompra
  485. valor = valor * 100
  486. Catch ex As Exception
  487. valor = 0
  488. End Try
  489. Return valor
  490. End Function
  491. Function CalcularValorTransadoCompra() As Double
  492. Dim valor As Double
  493. Dim vPrecioCompra As Double = GetPrecioCompra()
  494. Dim vValorNominal As Double = GetValorNominalCompra()
  495. valor = (vPrecioCompra / 100) * vValorNominal
  496. Return valor
  497. End Function
  498. Function CalcularComisionCasaCompra() As Double
  499. Dim valor As Double
  500. Dim vPorcentajeComisionCasa As Double = GetPorcentajeComisionCasaCompra()
  501. Dim vValorTransado As Double = GetValorTransadoCompra()
  502. Try
  503. valor = vPorcentajeComisionCasa * vValorTransado
  504. Catch ex As Exception
  505. valor = 0
  506. End Try
  507. Return valor
  508. End Function
  509. Function CalcularComisionBolsaCompra() As Double
  510. Dim valor As Double
  511. Dim vPorcentajeComisionBolsa As Double = GetPorcentajeComisionBolsaCompra()
  512. Dim vValorTransado As Double = GetValorTransadoCompra()
  513. Try
  514. valor = vPorcentajeComisionBolsa * vValorTransado
  515. Catch ex As Exception
  516. valor = 0
  517. End Try
  518. Return valor
  519. End Function
  520. Function CalcularMontoAPagarCompra() As Double
  521. Dim valor As Double
  522. Dim vValorTransado As Double = GetValorTransadoCompra()
  523. Dim vComisionCasa As Double = GetComisionCasaCompra()
  524. Dim vComisionBolsa As Double = GetComisionBolsaCompra()
  525. Dim vInteresAcumulado As Double = GetInteresAcumuladoCompra()
  526. Dim vCostoTransferencia As Double = GetCostoTransferenciaCompra()
  527. Try
  528. valor = vValorTransado + vComisionCasa + vComisionBolsa + vInteresAcumulado + vCostoTransferencia
  529. Catch ex As Exception
  530. valor = 0
  531. End Try
  532. Return valor
  533. End Function
  534. 'GETS VENTA
  535. Function GetFechaLiquidacionVenta() As Date
  536. Dim valor As Date
  537. valor = dtpFechaLiquidacionVenta.Value.Date
  538. Return valor
  539. End Function
  540. Function GetFechaVencimientoVenta() As Date
  541. Dim valor As Date
  542. valor = Me.dtpFechaVencimientoVenta.Value.Date
  543. Return valor
  544. End Function
  545. Function GetUltimaFechaCuponVenta() As Date
  546. Dim valor As Date
  547. valor = Me.dtpUltimaFechaCuponVenta.Value.Date
  548. Return valor
  549. End Function
  550. Function GetYTMAlVencimientoVenta() As Double
  551. Dim valor As Double
  552. If Me.txtYTMAlVencimientoVenta.Text.Length = 0 Then
  553. valor = 0
  554. Else
  555. Try
  556. valor = Me.txtYTMAlVencimientoVenta.Text
  557. valor = valor / 100
  558. Catch ex As Exception
  559. valor = 0
  560. End Try
  561. End If
  562. Return valor
  563. End Function
  564. Function GetPorcentajeComisionCasaVenta() As Double
  565. Dim valor As Double
  566. If Me.txtPorcentajeComisionCasaVenta.Text.Length = 0 Then
  567. valor = 0
  568. Else
  569. Try
  570. valor = Me.txtPorcentajeComisionCasaVenta.Text
  571. valor = valor / 100
  572. Catch ex As Exception
  573. valor = 0
  574. End Try
  575. End If
  576. Return valor
  577. End Function
  578. Function GetDiasAlVencimientoVenta() As Integer
  579. Dim valor As Integer
  580. If Me.txtDiasAlVencimientoVenta.Text.Length = 0 Then
  581. valor = 0
  582. Else
  583. Try
  584. valor = Me.txtDiasAlVencimientoVenta.Text
  585. Catch ex As Exception
  586. valor = 0
  587. End Try
  588. End If
  589. Return valor
  590. End Function
  591. Function GetPorcentajeComisionBolsaVenta() As Double
  592. Dim valor As Double
  593. If Me.txtPorcentajeComisionBolsaVenta.Text.Length = 0 Then
  594. valor = 0
  595. Else
  596. Try
  597. valor = Me.txtPorcentajeComisionBolsaVenta.Text
  598. valor = valor / 100
  599. Catch ex As Exception
  600. valor = 0
  601. End Try
  602. End If
  603. Return valor
  604. End Function
  605. Function GetPorcentajeCuponVenta() As Double
  606. Dim valor As Double
  607. If Me.txtPorcentajeCuponVenta.Text.Length = 0 Then
  608. valor = 0
  609. Else
  610. Try
  611. valor = Me.txtPorcentajeCuponVenta.Text
  612. valor = valor / 100
  613. Catch ex As Exception
  614. valor = 0
  615. End Try
  616. End If
  617. Return valor
  618. End Function
  619. Function GetPrecioVenta() As Double
  620. Dim valor As Double
  621. If Me.txtPrecioVenta.Text.Length = 0 Then
  622. valor = 0
  623. Else
  624. Try
  625. valor = Me.txtPrecioVenta.Text
  626. Catch ex As Exception
  627. valor = 0
  628. End Try
  629. End If
  630. Return valor
  631. End Function
  632. Function GetPrecioAlVencimientoVenta() As Double
  633. Dim valor As Double
  634. If Me.txtPrecioAlVencimientoVenta.Text.Length = 0 Then
  635. valor = 0
  636. Else
  637. Try
  638. valor = Me.txtPrecioAlVencimientoVenta.Text
  639. Catch ex As Exception
  640. valor = 0
  641. End Try
  642. End If
  643. Return valor
  644. End Function
  645. Function GetValorNominalVenta() As Double
  646. Dim valor As Double
  647. If Me.txtValorNominalVenta.Text.Length = 0 Then
  648. valor = 0
  649. Else
  650. Try
  651. valor = Me.txtValorNominalVenta.Text
  652. Catch ex As Exception
  653. valor = 0
  654. End Try
  655. End If
  656. Return valor
  657. End Function
  658. Function GetSiguienteFechaCuponVenta() As Date
  659. Dim valor As Date
  660. valor = dtpSiguienteFechaCuponVenta.Value.Date
  661. Return valor
  662. End Function
  663. Function GetYTMAlVencimientoComisionVenta() As Double
  664. Dim valor As Double
  665. If Me.txtYTMAlVencimientoComisionVenta.Text.Length = 0 Then
  666. valor = 0
  667. Else
  668. Try
  669. valor = Me.txtYTMAlVencimientoComisionVenta.Text
  670. Catch ex As Exception
  671. valor = 0
  672. End Try
  673. End If
  674. Return valor
  675. End Function
  676. Function GetDiasBaseVenta() As Integer
  677. Dim valor As Integer
  678. If Me.cboAnioBaseV.SelectedIndex = -1 Then
  679. valor = 0
  680. Else
  681. Try
  682. valor = Me.cboAnioBaseV.SelectedItem
  683. Catch ex As Exception
  684. valor = 0
  685. End Try
  686. End If
  687. Return valor
  688. End Function
  689. Function GetDiasAcumuladosVenta() As Integer
  690. Dim valor As Integer
  691. If Me.txtDiasAcumuladosVenta.Text.Length = 0 Then
  692. valor = 0
  693. Else
  694. Try
  695. valor = Me.txtDiasAcumuladosVenta.Text
  696. Catch ex As Exception
  697. valor = 0
  698. End Try
  699. End If
  700. Return valor
  701. End Function
  702. Function GetPorcentajeInteresAcumuladoVenta() As Double
  703. Dim valor As Double
  704. If Me.txtPorcentajeInteresAcumuladoVenta.Text.Length = 0 Then
  705. valor = 0
  706. Else
  707. Try
  708. valor = Me.txtPorcentajeInteresAcumuladoVenta.Text
  709. valor = valor / 100
  710. Catch ex As Exception
  711. valor = 0
  712. End Try
  713. End If
  714. Return valor
  715. End Function
  716. Function GetInteresAcumuladoVenta() As Double
  717. Dim valor As Double
  718. If Me.txtInteresAcumuladoVenta.Text.Length = 0 Then
  719. valor = 0
  720. Else
  721. Try
  722. valor = Me.txtInteresAcumuladoVenta.Text
  723. Catch ex As Exception
  724. valor = 0
  725. End Try
  726. End If
  727. Return valor
  728. End Function
  729. Function GetPrecioSucioVenta() As Double
  730. Dim valor As Double
  731. If Me.txtPrecioSucioVenta.Text.Length = 0 Then
  732. valor = 0
  733. Else
  734. Try
  735. valor = Me.txtPrecioSucioVenta.Text
  736. Catch ex As Exception
  737. valor = 0
  738. End Try
  739. End If
  740. Return valor
  741. End Function
  742. Function GetValorTransadoVenta() As Double
  743. Dim valor As Double
  744. If Me.txtValorTransadoVenta.Text.Length = 0 Then
  745. valor = 0
  746. Else
  747. Try
  748. valor = Me.txtValorTransadoVenta.Text
  749. Catch ex As Exception
  750. valor = 0
  751. End Try
  752. End If
  753. Return valor
  754. End Function
  755. Function GetMontoAPagarVenta() As Double
  756. Dim valor As Double
  757. If Me.txtMontoARecibir.Text.Length = 0 Then
  758. valor = 0
  759. Else
  760. Try
  761. valor = Me.txtMontoARecibir.Text
  762. Catch ex As Exception
  763. valor = 0
  764. End Try
  765. End If
  766. Return valor
  767. End Function
  768. Function GetCostoTransferenciaVenta() As Double
  769. Dim valor As Double
  770. If Me.txtCostoTransferenciaVenta.Text.Length = 0 Then
  771. valor = 0
  772. Else
  773. Try
  774. valor = Me.txtCostoTransferenciaVenta.Text
  775. Catch ex As Exception
  776. valor = 0
  777. End Try
  778. End If
  779. Return valor
  780. End Function
  781. Function GetComisionBolsaVenta() As Double
  782. Dim valor As Double
  783. If Me.txtComisionBolsaVenta.Text.Length = 0 Then
  784. valor = 0
  785. Else
  786. Try
  787. valor = Me.txtComisionBolsaVenta.Text
  788. Catch ex As Exception
  789. valor = 0
  790. End Try
  791. End If
  792. Return valor
  793. End Function
  794. Function GetComisionCasaVenta() As Double
  795. Dim valor As Double
  796. If Me.txtComisionCasaVenta.Text.Length = 0 Then
  797. valor = 0
  798. Else
  799. Try
  800. valor = Me.txtComisionCasaVenta.Text
  801. Catch ex As Exception
  802. valor = 0
  803. End Try
  804. End If
  805. Return valor
  806. End Function
  807. Function GetPeriodicidadVenta() As String
  808. Dim valor As String
  809. If Me.cboPeriodosV.SelectedIndex = -1 Then
  810. valor = "NA"
  811. Else
  812. Try
  813. valor = Me.cboPeriodosV.SelectedValue
  814. Catch ex As Exception
  815. valor = ""
  816. End Try
  817. End If
  818. Return valor
  819. End Function
  820. 'GETS RO
  821. Function GetValorNominalRO() As Double
  822. Dim valor As Double
  823. If Me.txtValorNominal_Op.Text.Length = 0 Then
  824. valor = 0
  825. Else
  826. Try
  827. valor = Me.txtValorNominal_Op.Text
  828. Catch ex As Exception
  829. valor = 0
  830. End Try
  831. End If
  832. Return valor
  833. End Function
  834. Function GetPlazoRO() As Double
  835. Dim valor As Double
  836. If Me.txtPlazo_Op.Text.Length = 0 Then
  837. valor = 0
  838. Else
  839. Try
  840. valor = Me.txtPlazo_Op.Text
  841. Catch ex As Exception
  842. valor = 0
  843. End Try
  844. End If
  845. Return valor
  846. End Function
  847. Function GetPrecioCompraRO() As Double
  848. Dim valor As Double
  849. If Me.txtPrecioCompra_Op.Text.Length = 0 Then
  850. valor = 0
  851. Else
  852. Try
  853. valor = Me.txtPrecioCompra_Op.Text
  854. Catch ex As Exception
  855. valor = 0
  856. End Try
  857. End If
  858. Return valor
  859. End Function
  860. Function GetPrecioVentaRO() As Double
  861. Dim valor As Double
  862. If Me.txtPrecioVenta_Op.Text.Length = 0 Then
  863. valor = 0
  864. Else
  865. Try
  866. valor = Me.txtPrecioVenta_Op.Text
  867. Catch ex As Exception
  868. valor = 0
  869. End Try
  870. End If
  871. Return valor
  872. End Function
  873. Function GetGananciaPerdidaDeCapital() As Double
  874. Dim valor As Double
  875. If Me.txtGananciaPerdidaCapital_Op.Text.Length = 0 Then
  876. valor = 0
  877. Else
  878. Try
  879. valor = Me.txtGananciaPerdidaCapital_Op.Text
  880. Catch ex As Exception
  881. valor = 0
  882. End Try
  883. End If
  884. Return valor
  885. End Function
  886. Function GetIngresoPorInteres() As Double
  887. Dim valor As Double
  888. If Me.txtIngresosPorIntereses_Op.Text.Length = 0 Then
  889. valor = 0
  890. Else
  891. Try
  892. valor = Me.txtIngresosPorIntereses_Op.Text
  893. Catch ex As Exception
  894. valor = 0
  895. End Try
  896. End If
  897. Return valor
  898. End Function
  899. Function GetCostosTotales() As Double
  900. Dim valor As Double
  901. If Me.txtCostosTotales_Op.Text.Length = 0 Then
  902. valor = 0
  903. Else
  904. Try
  905. valor = Me.txtCostosTotales_Op.Text
  906. Catch ex As Exception
  907. valor = 0
  908. End Try
  909. End If
  910. Return valor
  911. End Function
  912. Function GetGananciaPerdidaTotal() As Double
  913. Dim valor As Double
  914. If Me.txtGananciaPerdidaTotal_Op.Text.Length = 0 Then
  915. valor = 0
  916. Else
  917. Try
  918. valor = Me.txtGananciaPerdidaTotal_Op.Text
  919. Catch ex As Exception
  920. valor = 0
  921. End Try
  922. End If
  923. Return valor
  924. End Function
  925. Function GetRendimientoGananciaPerdida() As Double
  926. Dim valor As Double
  927. If Me.txtRendimientoGananciaPerdida_Op.Text.Length = 0 Then
  928. valor = 0
  929. Else
  930. Try
  931. valor = Me.txtRendimientoGananciaPerdida_Op.Text
  932. Catch ex As Exception
  933. valor = 0
  934. End Try
  935. End If
  936. Return valor
  937. End Function
  938. Function GetRendimientoDeIntereses() As Double
  939. Dim valor As Double
  940. If Me.txtRendimientoIntereses_Op.Text.Length = 0 Then
  941. valor = 0
  942. Else
  943. Try
  944. valor = Me.txtRendimientoIntereses_Op.Text
  945. Catch ex As Exception
  946. valor = 0
  947. End Try
  948. End If
  949. Return valor
  950. End Function
  951. Function GetRendimientoAntesImpuestos() As Double
  952. Dim valor As Double
  953. If Me.txtRendimientoAntesISR_Op.Text.Length = 0 Then
  954. valor = 0
  955. Else
  956. Try
  957. valor = Me.txtRendimientoAntesISR_Op.Text
  958. Catch ex As Exception
  959. valor = 0
  960. End Try
  961. End If
  962. Return valor
  963. End Function
  964. Function GetRendimientoDespuesImpuestos() As Double
  965. Dim valor As Double
  966. If Me.txtRendimientoDespuesISR_Op.Text.Length = 0 Then
  967. valor = 0
  968. Else
  969. Try
  970. valor = Me.txtRendimientoDespuesISR_Op.Text
  971. Catch ex As Exception
  972. valor = 0
  973. End Try
  974. End If
  975. Return valor
  976. End Function
  977. 'CALCULOS VENTA
  978. Function CalcularPeriodicidadVenta() As String
  979. Dim valor As String
  980. If Me.cboPeriodosC.SelectedIndex = -1 Then
  981. valor = ""
  982. Else
  983. Try
  984. valor = cboPeriodosC.SelectedValue
  985. Catch ex As Exception
  986. valor = ""
  987. End Try
  988. End If
  989. Return valor
  990. End Function
  991. Function CalcularUltimaFechaCuponVenta() As Date
  992. Dim valor As Date
  993. Dim vSiguienteFechaCupon As Date = GetSiguienteFechaCuponCompra()
  994. Dim vPeriodicidad As String = GetPeriodicidadVenta()
  995. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(vPeriodicidad)
  996. Try
  997. vSiguienteFechaCupon.AddDays(vDiasPeriodo + 1)
  998. valor = vSiguienteFechaCupon
  999. Catch ex As Exception
  1000. valor = Date.Now.Date
  1001. End Try
  1002. Return valor
  1003. End Function
  1004. Function CalcularSiguienteFechaCuponVenta() As Date
  1005. Dim valor As Date
  1006. Dim vUltimaFechaCupon As DateTime = GetUltimaFechaCuponVenta()
  1007. Dim vPeriodicidad As String = GetPeriodicidadVenta()
  1008. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(vPeriodicidad)
  1009. valor = vUltimaFechaCupon.AddDays(vDiasPeriodo + 1)
  1010. Return valor
  1011. End Function
  1012. Function CalcularFechaLiquidacionVenta() As Date
  1013. Dim valor As Date
  1014. valor = DateTime.Now.Date + DateTime.Now.AddDays(3)
  1015. Return valor
  1016. End Function
  1017. Function CalcularYTMAlVencimientoComisionVenta() As Double
  1018. Dim valor As Double
  1019. Dim vYTMAlVencimiento As Double = GetYTMAlVencimientoVenta()
  1020. Dim vPorcentajeComisionCasa As Double = GetPorcentajeComisionCasaVenta()
  1021. Dim vAnioBase As Integer = GetDiasBaseVenta()
  1022. Dim vDiasAlVencimiento As Integer = GetDiasAlVencimientoVenta()
  1023. Dim vPorcentajeComisionBolsa As Double = GetPorcentajeComisionBolsaVenta()
  1024. Try
  1025. valor = vYTMAlVencimiento - (vPorcentajeComisionCasa * vAnioBase / vDiasAlVencimiento) - (vPorcentajeComisionBolsa * vAnioBase / vDiasAlVencimiento)
  1026. valor = valor * 100
  1027. Catch ex As Exception
  1028. valor = 0
  1029. End Try
  1030. Return valor
  1031. End Function
  1032. Function CalcularYTMAlVencimientoVenta() As Double
  1033. Dim valor As Double
  1034. Dim vFechaLiquidacion As DateTime = GetFechaLiquidacionVenta()
  1035. Dim vFechaVencimiento As DateTime = GetFechaVencimientoVenta()
  1036. Dim vPorcentajeCupon As Double = GetPorcentajeCuponVenta()
  1037. Dim vPrecioVenta As Double = GetPrecioVenta()
  1038. Dim vPrecioAlVencimiento As Double = GetPrecioAlVencimientoVenta()
  1039. 'FALTA CALCULO
  1040. valor = 0
  1041. Return valor
  1042. End Function
  1043. Function CalcularDiasAcumuladosVenta() As Integer
  1044. Dim valor As Integer
  1045. Dim vUltimaFechaCupon As Date
  1046. Dim vFechaLiquidacion As Date
  1047. Dim vAnioBase As Integer = GetDiasBaseVenta()
  1048. vUltimaFechaCupon = GetUltimaFechaCuponVenta()
  1049. vFechaLiquidacion = GetFechaLiquidacionVenta()
  1050. If vAnioBase = 360 Then
  1051. valor = Utilidades.Days360(vUltimaFechaCupon, vFechaLiquidacion)
  1052. Else
  1053. valor = DateDiff(DateInterval.Day, vUltimaFechaCupon, vFechaLiquidacion)
  1054. End If
  1055. Return valor
  1056. End Function
  1057. Function CalcularDiasAlVencimientoVenta() As Integer
  1058. Dim valor As Integer
  1059. Dim vFechaLiquidacion As Date
  1060. Dim vFechaVencimiento As Date
  1061. Dim vAnioBase As Integer = GetDiasBaseVenta()
  1062. vFechaLiquidacion = GetFechaLiquidacionVenta()
  1063. vFechaVencimiento = GetFechaVencimientoVenta()
  1064. If vAnioBase = 360 Then
  1065. valor = Utilidades.Days360(vFechaLiquidacion, vFechaVencimiento)
  1066. Else
  1067. valor = DateDiff(DateInterval.Day, vFechaLiquidacion, vFechaVencimiento)
  1068. End If
  1069. Return valor
  1070. End Function
  1071. Function CalcularInteresAcumuladoVenta() As Double
  1072. Dim valor As Double
  1073. Dim vValorNominal As Double
  1074. Dim vPorcentajeCupon As Double
  1075. Dim vDiasAcumulados As Integer
  1076. Dim vDiasBase As Integer = GetDiasBaseVenta()
  1077. vValorNominal = GetValorNominalVenta()
  1078. vPorcentajeCupon = GetPorcentajeCuponVenta()
  1079. vDiasAcumulados = GetDiasAcumuladosVenta()
  1080. Try
  1081. valor = vValorNominal * vPorcentajeCupon * vDiasAcumulados / vDiasBase
  1082. Catch ex As Exception
  1083. valor = 0
  1084. End Try
  1085. Return valor
  1086. End Function
  1087. Function CalcularInteresAcumuladoPorcentajeVenta() As Double
  1088. Dim valor As Double
  1089. Dim vInteresAcumulado As Double
  1090. Dim vValorNominal As Double
  1091. Dim vDiasBase As Integer = GetDiasBaseVenta()
  1092. Dim vPeriodicidad As String = GetPeriodicidadVenta()
  1093. Dim vDiasPeriodo As Integer = Utilidades.DiasDeUnPeriodo(vPeriodicidad)
  1094. vInteresAcumulado = GetInteresAcumuladoVenta()
  1095. vValorNominal = GetValorNominalVenta()
  1096. Try
  1097. valor = vInteresAcumulado / vValorNominal * vDiasBase / vDiasPeriodo
  1098. valor = valor * 100
  1099. Catch ex As Exception
  1100. valor = 0
  1101. End Try
  1102. Return valor
  1103. End Function
  1104. Function CalcularPrecioSucioVenta() As Double
  1105. Dim valor As Double
  1106. Dim vPrecioVenta As Double
  1107. Dim vNumero As Double
  1108. Dim vPorcentajeInteresAcumulado As Double
  1109. vPrecioVenta = GetPrecioVenta()
  1110. vNumero = 0.01
  1111. vPorcentajeInteresAcumulado = GetPorcentajeInteresAcumuladoVenta()
  1112. Try
  1113. valor = vPrecioVenta * vNumero + vPorcentajeInteresAcumulado
  1114. valor = valor * 100
  1115. Catch ex As Exception
  1116. valor = 0
  1117. End Try
  1118. Return valor
  1119. End Function
  1120. Function CalcularValorTransadoVenta() As Double
  1121. Dim valor As Double
  1122. Dim vPrecioVenta As Double
  1123. Dim vValorNominal As Double
  1124. vPrecioVenta = GetPrecioVenta()
  1125. vValorNominal = GetValorNominalVenta()
  1126. Try
  1127. valor = (vPrecioVenta / 100) * vValorNominal
  1128. Catch ex As Exception
  1129. valor = 0
  1130. End Try
  1131. Return valor
  1132. End Function
  1133. Function CalcularComisionCasaVenta() As Double
  1134. Dim valor As Double
  1135. Dim vPorcentajeComisionCasa As Double
  1136. Dim vValorTransado As Double
  1137. vPorcentajeComisionCasa = GetPorcentajeComisionCasaVenta()
  1138. vValorTransado = GetValorTransadoVenta()
  1139. Try
  1140. valor = vPorcentajeComisionCasa * vValorTransado
  1141. Catch ex As Exception
  1142. valor = 0
  1143. End Try
  1144. Return valor
  1145. End Function
  1146. Function CalcularComisionBolsaVenta() As Double
  1147. Dim valor As Double
  1148. Dim vPorcentajeComisionBolsa As Double
  1149. Dim vValorTransado As Double
  1150. vPorcentajeComisionBolsa = GetPorcentajeComisionBolsaVenta()
  1151. vValorTransado = GetValorTransadoVenta()
  1152. Try
  1153. valor = vPorcentajeComisionBolsa * vValorTransado
  1154. Catch ex As Exception
  1155. valor = 0
  1156. End Try
  1157. Return valor
  1158. End Function
  1159. Function CalcularMontoARecibirVenta() As Double
  1160. Dim valor As Double
  1161. Dim vValorTransado As Double
  1162. Dim vComisionBolsa As Double
  1163. Dim vComisionCasa As Double
  1164. Dim vInteresAcumulado As Double
  1165. vValorTransado = GetValorTransadoVenta()
  1166. vComisionBolsa = GetComisionBolsaVenta()
  1167. vComisionCasa = GetComisionCasaVenta()
  1168. vInteresAcumulado = GetInteresAcumuladoVenta()
  1169. Try
  1170. valor = vValorTransado - vComisionBolsa - vComisionCasa + vInteresAcumulado
  1171. Catch ex As Exception
  1172. valor = 0
  1173. End Try
  1174. Return valor
  1175. End Function
  1176. 'CALCULOS RO
  1177. Function CalcularDiasPlazoRO() As Integer
  1178. Dim valor As Integer
  1179. Dim vFechaLiquidacionCompra As Date = GetFechaLiquidacionCompra()
  1180. Dim vFechaLiquidacionVenta As Date = GetFechaLiquidacionVenta()
  1181. Dim vAnioBase As Integer = GetDiasBaseCompra()
  1182. If vAnioBase = 360 Then
  1183. valor = Utilidades.Days360(vFechaLiquidacionCompra, vFechaLiquidacionVenta)
  1184. Else
  1185. valor = DateDiff(DateInterval.Day, vFechaLiquidacionCompra, vFechaLiquidacionVenta)
  1186. End If
  1187. Return valor
  1188. End Function
  1189. Function CalcularGananciaDeCapital() As Double
  1190. Dim valor As Double
  1191. Dim vValorTransadoVenta As Double = GetValorTransadoVenta()
  1192. Dim vValorTransadoCompra As Double = GetValorTransadoCompra()
  1193. valor = vValorTransadoVenta - vValorTransadoCompra
  1194. Return valor
  1195. End Function
  1196. Function CalcularGananciaDeIntereses() As Double
  1197. Dim valor As Double
  1198. 'Dim vCuponesPagados As Double = 0 'FALTA VALOR
  1199. 'Dim vInteresAcumulado As Double = GetInteresAcumuladoCompra()
  1200. 'valor = vCuponesPagados + vInteresAcumulado
  1201. valor = TotalValorCupones
  1202. Return valor
  1203. End Function
  1204. Function CalcularGananciaTotal() As Double
  1205. Dim valor As Double
  1206. Dim vGananciaDeCapital As Double = GetGananciaPerdidaDeCapital()
  1207. Dim vGananciaDeIntereses As Double = GetIngresoPorInteres()
  1208. valor = vGananciaDeCapital + vGananciaDeIntereses
  1209. Return valor
  1210. End Function
  1211. Function CalcularRentabilidadPorGananciaDeCapital() As Double
  1212. Dim valor As Double
  1213. Dim vGananciaDeCapital As Double = GetGananciaPerdidaDeCapital()
  1214. Dim vValorTransadoCompra As Double = GetValorTransadoCompra()
  1215. Dim vDiasPLazo As Integer = GetPlazoRO()
  1216. Dim vAnioBase As Integer = GetDiasBaseCompra()
  1217. Try
  1218. valor = vGananciaDeCapital / vValorTransadoCompra * vAnioBase / vDiasPLazo
  1219. valor = valor * 100
  1220. Catch ex As Exception
  1221. valor = 0
  1222. End Try
  1223. Return valor
  1224. End Function
  1225. Function CalcularRentabilidadPorIntereses() As Double
  1226. Dim valor As Double
  1227. Dim vGananciaPorIntereses As Double = GetIngresoPorInteres()
  1228. Dim vValorTransadoCompra As Double = GetValorTransadoCompra()
  1229. Dim vAnioBase As Integer = GetDiasBaseCompra()
  1230. Dim vDiasPlazo As Integer = GetPlazoRO()
  1231. Try
  1232. valor = vGananciaPorIntereses / vValorTransadoCompra * vAnioBase / vDiasPlazo
  1233. valor = valor * 100
  1234. Catch ex As Exception
  1235. valor = 0
  1236. End Try
  1237. Return valor
  1238. End Function
  1239. Function CalcularRentabilidadTotal() As Double
  1240. Dim valor As Double
  1241. Dim vGAnanciaTotal As Double = GetGananciaPerdidaTotal()
  1242. Dim vValorTransadoCompra As Double = GetValorTransadoCompra()
  1243. Dim vAnioBase As Integer = GetDiasBaseCompra()
  1244. Dim vDiasPlazo As Integer = GetPlazoRO()
  1245. Try
  1246. valor = vGAnanciaTotal / vValorTransadoCompra * vAnioBase / vDiasPlazo
  1247. valor = valor * 100
  1248. Catch ex As Exception
  1249. valor = 0
  1250. End Try
  1251. Return valor
  1252. End Function
  1253. 'REFRESCAR
  1254. Sub RefrescarSiguienteFechaCuponCompra()
  1255. Me.dtpSiguienteFechaCuponCompra.Value = CalcularSiguienteFechaCuponCompra()
  1256. End Sub
  1257. Sub RefrescarYTMAlVencimientoComisionCompra()
  1258. Me.txtYTMAlVencimientoComisionCompra.Text = CalcularYTMAlVencimientoComisionCompra().ToString
  1259. End Sub
  1260. Sub RefrescarYTMAlVencimientoCompra()
  1261. 'Me.txtYTMAlVencimientoCompra.Text = CalcularYTMAlVencimientoCompra().ToString
  1262. 'ACTIVAR DESPUES DE ENCONTRAR FORMULA
  1263. End Sub
  1264. Sub RefrescarDiasAcumuladosCompra()
  1265. Me.txtDiasAcumuladosCompra.Text = CalcularDiasAcumuladosCompra().ToString
  1266. End Sub
  1267. Sub RefrescarDiasAlVencimientoCompra()
  1268. Me.txtDiasAlVencimientoCompra.Text = CalcularDiasAlVencimientoCompra().ToString
  1269. End Sub
  1270. Sub RefrescarInteresAcumuladoCompra()
  1271. Me.txtInteresAcumuladoCompra.Text = CalcularInteresAcumuladoCompra().ToString
  1272. End Sub
  1273. Sub RefrescarPorcentajeInteresAcumuladoCompra()
  1274. Me.txtPorcentajeInteresAcumuladoCompra.Text = CalcularPorcentajeInteresAcumuladoCompra().ToString
  1275. End Sub
  1276. Sub RefrescarPorcentajePrecioSucioCompra()
  1277. Me.txtPrecioSucioCompra.Text = CalcularPrecioSucioCompra().ToString
  1278. End Sub
  1279. Sub RefrescarValorTransadoCompra()
  1280. Me.txtValorTransadoCompra.Text = CalcularValorTransadoCompra().ToString
  1281. End Sub
  1282. Sub RefrescarComisionCasaCompra()
  1283. Me.txtComisionCasaCompra.Text = CalcularComisionCasaCompra().ToString
  1284. End Sub
  1285. Sub RefrescarComisionBolsaCompra()
  1286. Me.txtComisionBolsaCompra.Text = CalcularComisionBolsaCompra().ToString
  1287. End Sub
  1288. Sub RefrescarMontoAPagarCompra()
  1289. Me.txtMontoAPagar.Text = CalcularMontoAPagarCompra().ToString
  1290. End Sub
  1291. 'VENTA
  1292. Sub RefrescarPeriodicidadVenta()
  1293. Me.cboPeriodosV.SelectedValue = CalcularPeriodicidadVenta()
  1294. End Sub
  1295. Sub RefrescarUltimaFechaCuponVenta()
  1296. Me.dtpUltimaFechaCuponVenta.Value = CalcularUltimaFechaCuponVenta()
  1297. End Sub
  1298. Sub RefrescarSiguienteFechaCuponVenta()
  1299. Me.dtpSiguienteFechaCuponVenta.Value = CalcularSiguienteFechaCuponVenta()
  1300. End Sub
  1301. Sub RefrescarFechaLiquidacionVenta()
  1302. Me.dtpFechaLiquidacionVenta.Value = CalcularFechaLiquidacionVenta()
  1303. End Sub
  1304. Sub RefrescarFechaVencimientoVenta()
  1305. Me.dtpFechaVencimientoVenta.Value = Me.dtpFechaVencimientoCompra.Value
  1306. End Sub
  1307. Sub RefrescarPorcentajeCuponVenta()
  1308. Me.txtPorcentajeCuponVenta.Text = Me.txtPorcentajeCuponCompra.Text
  1309. End Sub
  1310. Sub RefrescarYTMAlVencimientoComisionVenta()
  1311. Me.txtYTMAlVencimientoComisionVenta.Text = CalcularYTMAlVencimientoComisionVenta().ToString
  1312. End Sub
  1313. Sub RefrescarYTMAlVencimientoVenta()
  1314. 'Me.txtYTMAlVencimientoVenta.Text = CalcularYTMAlVencimientoVenta().ToString
  1315. End Sub
  1316. Sub RefrescarDiasAcumuladosVenta()
  1317. Me.txtDiasAcumuladosVenta.Text = CalcularDiasAcumuladosVenta().ToString
  1318. End Sub
  1319. Sub RefrescarDiasAlVencimientoVenta()
  1320. Me.txtDiasAlVencimientoVenta.Text = CalcularDiasAlVencimientoVenta().ToString
  1321. End Sub
  1322. Sub RefrescarInteresAcumuladoVenta()
  1323. Me.txtInteresAcumuladoVenta.Text = CalcularInteresAcumuladoVenta().ToString
  1324. End Sub
  1325. Sub RefrescarPorcentajeInteresAcumuladoVenta()
  1326. Me.txtPorcentajeInteresAcumuladoVenta.Text = CalcularInteresAcumuladoPorcentajeVenta().ToString
  1327. End Sub
  1328. Sub RefrescarPrecioSucioVenta()
  1329. Me.txtPrecioSucioVenta.Text = CalcularPrecioSucioVenta().ToString
  1330. End Sub
  1331. Sub RefrescarValorTransadoVenta()
  1332. Me.txtValorTransadoVenta.Text = CalcularValorTransadoVenta().ToString
  1333. End Sub
  1334. Sub RefrescarComisionCasaVenta()
  1335. Me.txtComisionCasaVenta.Text = CalcularComisionCasaVenta().ToString
  1336. End Sub
  1337. Sub RefrescarComisionBolsaVenta()
  1338. Me.txtComisionBolsaVenta.Text = CalcularComisionBolsaVenta().ToString
  1339. End Sub
  1340. Sub RefrescarMontoARecibirVenta()
  1341. Me.txtMontoARecibir.Text = CalcularMontoARecibirVenta()
  1342. End Sub
  1343. Sub RefrescarValorNominalVenta()
  1344. Me.txtValorNominalVenta.Text = GetValorNominalCompra()
  1345. End Sub
  1346. Sub RefrescarPorcentajeComisionCasaVenta()
  1347. Me.txtPorcentajeComisionCasaVenta.Text = GetPorcentajeComisionCasaCompra().ToString
  1348. End Sub
  1349. Sub RefrescarPorcentajeComisionBolsaVenta()
  1350. Me.txtPorcentajeComisionBolsaVenta.Text = GetPorcentajeComisionBolsaCompra().ToString
  1351. End Sub
  1352. 'RO
  1353. Sub RefrescarValorNominalRO()
  1354. Me.txtValorNominal_Op.Text = GetValorNominalCompra.ToString
  1355. End Sub
  1356. Sub RefrescarPLazoRO()
  1357. Me.txtPlazo_Op.Text = CalcularDiasPlazoRO()
  1358. End Sub
  1359. Sub RefrescarPrecioCompraRO()
  1360. Me.txtPrecioCompra_Op.Text = GetPrecioCompra()
  1361. End Sub
  1362. Sub RefrescarPrecioVentaRO()
  1363. Me.txtPrecioVenta_Op.Text = GetPrecioVenta()
  1364. End Sub
  1365. Sub RefrescarGananciaDeCapital()
  1366. Me.txtGananciaPerdidaCapital_Op.Text = CalcularGananciaDeCapital()
  1367. End Sub
  1368. Sub RefrescarGananciaDeIntereses()
  1369. Me.txtIngresosPorIntereses_Op.Text = CalcularGananciaDeIntereses()
  1370. End Sub
  1371. Sub RefrescarGananciaTotal()
  1372. Me.txtGananciaPerdidaTotal_Op.Text = CalcularGananciaTotal()
  1373. End Sub
  1374. Sub RefrescarRentabilidadPorGananciaDeCapital()
  1375. Me.txtRendimientoGananciaPerdida_Op.Text = CalcularRentabilidadPorGananciaDeCapital()
  1376. End Sub
  1377. Sub RefrescarRentabilidadPorIntereses()
  1378. Me.txtRendimientoIntereses_Op.Text = CalcularRentabilidadPorIntereses()
  1379. End Sub
  1380. Sub RefrescarRentabilidadTotal()
  1381. Me.txtRendimientoDespuesISR_Op.Text = CalcularRentabilidadTotal()
  1382. End Sub
  1383. Sub CargarCasas()
  1384. Me.cboCasa_C.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
  1385. Me.cboCasa_C.DisplayMember = "Descripcion"
  1386. Me.cboCasa_C.ValueMember = "Codigo"
  1387. Me.cboCasa_C.SelectedValue = -1
  1388. Me.cboCasa_V.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
  1389. Me.cboCasa_V.DisplayMember = "Descripcion"
  1390. Me.cboCasa_V.ValueMember = "Codigo"
  1391. Me.cboCasa_V.SelectedValue = -1
  1392. End Sub
  1393. Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
  1394. oCEBonos = New BonosCE
  1395. 'oCEBonos.CodigoCasaCompra = Me.GetCasaCompra
  1396. oCEBonos.ValorNominalCompra = Me.GetValorNominalCompra
  1397. oCEBonos.UltimaFechaCuponCompra = Me.GetUltimaFechaCuponCompra
  1398. oCEBonos.SiguienteFechaCuponCompra = Me.GetSiguienteFechaCuponCompra
  1399. oCEBonos.FechaLiquidacionCompra = Me.GetFechaLiquidacionCompra
  1400. oCEBonos.FechaVencimientoCompra = Me.GetFechaVencimientoCompra
  1401. oCEBonos.PorcentajeCuponCompra = Me.GetPorcentajeCuponCompra
  1402. 'oCEBonos.YTMAlVencimientoComisionCompra = Me.GetYTMAlVencimientoComisionCompra
  1403. 'oCEBonos.YTMAlVencimientoCompra = GetYTMAlVencimientoCompra()
  1404. oCEBonos.PrecioAlVencimientoCompra = GetPrecioAlVencimientoCompra()
  1405. oCEBonos.PrecioCompra = GetPrecioCompra()
  1406. oCEBonos.DiasBaseCompra = GetDiasBaseCompra()
  1407. 'oCEBonos.DiasAcumuladosCompra = GetDiasAcumuladosCompra()
  1408. 'oCEBonos.DiasAlVencimientoCompra = GetDiasAlVencimientoCompra()
  1409. 'oCEBonos.PorcentajeInteresAcumuladoCompra = GetPorcentajeInteresAcumuladoCompra()
  1410. 'oCEBonos.InteresAcumuladoCompra = GetInteresAcumuladoCompra()
  1411. 'oCEBonos.PrecioSucioCompra = GetPrecioSucioCompra()
  1412. 'oCEBonos.ValorTransadoCompra = GetValorTransadoCompra()
  1413. 'oCEBonos.MontoAPagarCompra = GetMontoAPagarCompra()
  1414. oCEBonos.CostoDeTransferenciaCompra = GetCostoTransferenciaCompra()
  1415. oCEBonos.ValorNominalVenta = GetValorNominalVenta()
  1416. oCEBonos.UltimaFechaCuponVenta = GetUltimaFechaCuponVenta()
  1417. oCEBonos.SiguienteFechaCuponVenta = GetSiguienteFechaCuponVenta()
  1418. oCEBonos.FechaLiquidacionVenta = GetFechaLiquidacionVenta()
  1419. oCEBonos.FechaVencimientoVenta = GetFechaVencimientoVenta()
  1420. oCEBonos.PorcentajeCuponVenta = GetPorcentajeCuponVenta()
  1421. 'oCEBonos.YTMAlVencimientoComisionVenta = GetYTMAlVencimientoComisionVenta()
  1422. 'oCEBonos.YTMAlVencimientoVenta = GetYTMAlVencimientoVenta()
  1423. oCEBonos.PrecioAlVencimientoVenta = GetPrecioAlVencimientoVenta()
  1424. oCEBonos.PrecioVenta = GetPrecioVenta()
  1425. oCEBonos.DiasBaseVenta = GetDiasBaseVenta()
  1426. 'oCEBonos.DiasAcumuladosVenta = GetDiasAcumuladosVenta()
  1427. 'oCEBonos.DiasAlVencimientoVenta = GetDiasAlVencimientoVenta()
  1428. 'oCEBonos.PorcentajeInteresAcumuladoVenta = GetPorcentajeInteresAcumuladoVenta()
  1429. 'oCEBonos.InteresAcumuladoVenta = GetInteresAcumuladoVenta()
  1430. 'oCEBonos.PrecioSucioVenta = GetPrecioSucioVenta()
  1431. 'oCEBonos.ValorTransadoVenta = GetValorTransadoVenta()
  1432. 'oCEBonos.MontoAPagarVenta = GetMontoAPagarVenta()
  1433. oCEBonos.CostoDeTransferenciaVenta = GetCostoTransferenciaVenta()
  1434. 'oCEBonos.ValorNominalRO = GetValorNominalRO()
  1435. 'oCEBonos.PlazoRO = GetPlazoRO()
  1436. 'oCEBonos.PrecioCompraRO = GetPrecioCompraRO()
  1437. 'oCEBonos.PrecioVentaRO = GetPrecioVentaRO()
  1438. 'oCEBonos.GananciaPerdidaDeCapital = GetGananciaPerdidaDeCapital()
  1439. 'oCEBonos.IngresoPorInteres = GetIngresoPorInteres()
  1440. 'oCEBonos.CostosTotales = GetCostosTotales()
  1441. 'oCEBonos.GananciaPerdidaTotal = GetGananciaPerdidaTotal()
  1442. 'oCEBonos.RendimientoGananciaPerdida = GetRendimientoGananciaPerdida()
  1443. 'oCEBonos.RendimientoDeIntereses = GetRendimientoDeIntereses()
  1444. 'oCEBonos.RendimientoAntesImpuestos = GetRendimientoAntesImpuestos()
  1445. 'oCEBonos.RendimientoDespuesImpuestos = GetRendimientoDespuesImpuestos()
  1446. End Sub
  1447. Function RetornarObjeto()
  1448. Return oCEBonos
  1449. End Function
  1450. Public Sub CargarRegistro(vId As Integer, vTipo As String)
  1451. Modo = "C"
  1452. IdDocumento = vId
  1453. TipoDocumento = vTipo
  1454. End Sub
  1455. Private Sub CargarRegistroBD()
  1456. oCEBonos = New BonosCE
  1457. oDAOBonos = New BonosDAO
  1458. oDAOBonos.CargarRegistro(oCEBonos, TipoDocumento, IdDocumento)
  1459. 'Dim vCodigoCasaCompra As String = oCEBonos.CodigoCasaCompra
  1460. Dim vValorNominalCompra As Double = oCEBonos.ValorNominalCompra
  1461. Dim vUltimaFechaCuponCompra As Date = oCEBonos.UltimaFechaCuponCompra
  1462. Dim vSiguienteFechaCuponCompra As Date = oCEBonos.SiguienteFechaCuponCompra
  1463. Dim vFechaLiquidacionCompra As Date = oCEBonos.FechaLiquidacionCompra
  1464. Dim vFechaVencimientoCompra As Date = oCEBonos.FechaVencimientoCompra
  1465. Dim vPorcentajeCuponCompra As Double = oCEBonos.PorcentajeCuponCompra
  1466. Dim vYTMAlVencimientoComisionCompra As Double = oCEBonos.YTMAlVencimientoComisionCompra
  1467. Dim vYTMAlVencimientoCompra As Double = oCEBonos.YTMAlVencimientoCompra
  1468. Dim vPrecioAlVencimientoCompra As Double = oCEBonos.PrecioAlVencimientoCompra
  1469. Dim vPrecioCompra As Double = oCEBonos.PrecioCompra
  1470. Dim vDiasBaseCompra As Integer = oCEBonos.DiasBaseCompra
  1471. Dim vDiasAcumuladosCompra As Integer = oCEBonos.DiasAcumuladosCompra
  1472. Dim vDiasAlVencimientoCompra As Integer = oCEBonos.DiasAlVencimientoCompra
  1473. Dim vPorcentajeInteresAcumuladoCompra As Double = oCEBonos.PorcentajeInteresAcumuladoCompra
  1474. Dim vInteresAcumuladoCompra As Double = oCEBonos.InteresAcumuladoCompra
  1475. Dim vPrecioSucioCompra As Double = oCEBonos.PrecioSucioCompra
  1476. Dim vValorTransadoCompra As Double = oCEBonos.ValorTransadoCompra
  1477. Dim vMontoAPagarCompra As Double = oCEBonos.MontoAPagarCompra
  1478. Dim vCostoDeTransferenciaCompra As Double = oCEBonos.CostoDeTransferenciaCompra
  1479. 'Dim vCodigoCasaVenta As String = oCEBonos.CodigoCasaVenta
  1480. Dim vValorNominalVenta As Double = oCEBonos.ValorNominalVenta
  1481. Dim vUltimaFechaCuponVenta As Date = oCEBonos.UltimaFechaCuponVenta
  1482. Dim vSiguienteFechaCuponVenta As Date = oCEBonos.SiguienteFechaCuponVenta
  1483. Dim vFechaLiquidacionVenta As Date = oCEBonos.FechaLiquidacionVenta
  1484. Dim vFechaVencimientoVenta As Date = oCEBonos.FechaVencimientoVenta
  1485. Dim vPorcentajeCuponVenta As Double = oCEBonos.PorcentajeCuponVenta
  1486. Dim vYTMAlVencimientoComisionVenta As Double = oCEBonos.YTMAlVencimientoComisionVenta
  1487. Dim vYTMAlVencimientoVenta As Double = oCEBonos.YTMAlVencimientoVenta
  1488. Dim vPrecioAlVencimientoVenta As Double = oCEBonos.PrecioAlVencimientoVenta
  1489. Dim vPrecioVenta As Double = oCEBonos.PrecioVenta
  1490. Dim vDiasBaseVenta As Integer = oCEBonos.DiasBaseVenta
  1491. Dim vDiasAcumuladosVenta As Integer = oCEBonos.DiasAcumuladosVenta
  1492. Dim vDiasAlVencimientoVenta As Integer = oCEBonos.DiasAlVencimientoVenta
  1493. Dim vPorcentajeInteresAcumuladoVenta As Double = oCEBonos.InteresAcumuladoPorcentajeVenta
  1494. Dim vInteresAcumuladoVenta As Integer = oCEBonos.InteresAcumuladoVenta
  1495. Dim vPrecioSucioVenta As Double = oCEBonos.PrecioSucioVenta
  1496. Dim vValorTransadoVenta As Double = oCEBonos.ValorTransadoVenta
  1497. 'Dim vMontoAPagarVenta As Double = oCEBonos.MontoAPagarVenta
  1498. Dim vCostoDeTransferenciaVenta As Double = oCEBonos.CostoDeTransferenciaVenta
  1499. Dim vValorNominalRO As Double = oCEBonos.ValorNominalRO
  1500. 'Dim vPlazoRO As Double = oCEBonos.PlazoRO
  1501. Dim vPrecioCompraRO As Double = oCEBonos.PrecioCompraRO
  1502. Dim vPrecioVentaRO As Double = oCEBonos.PrecioVentaRO
  1503. Dim vGananciaPerdidaDeCapital As Double = oCEBonos.GananciaPerdidaDeCapital
  1504. Dim vIngresoPorInteres As Double = oCEBonos.IngresoPorInteres
  1505. Dim vCostosTotales As Double = oCEBonos.CostosTotales
  1506. Dim vGananciaPerdidaTotal As Double = oCEBonos.GananciaPerdidaTotal
  1507. Dim vRendimientoGananciaPerdida As Double = oCEBonos.RendimientoGananciaPerdida
  1508. Dim vRendimientoDeIntereses As Double = oCEBonos.RendimientoDeIntereses
  1509. Dim vRendimientoAntesImpuestos As Double = oCEBonos.RendimientoAntesImpuestos
  1510. Dim vRendimientoDespuesImpuestos As Double = oCEBonos.RendimientoDespuesImpuestos
  1511. 'Me.cboCasa_C.SelectedValue = vCodigoCasaCompra
  1512. Me.txtValorNominalCompra.Text = vValorNominalCompra
  1513. Me.dtpUltimaFechaCuponCompra.Value = vUltimaFechaCuponCompra
  1514. Me.dtpSiguienteFechaCuponCompra.Value = vSiguienteFechaCuponCompra
  1515. Me.dtpFechaLiquidacionCompra.Value = vFechaLiquidacionCompra
  1516. Me.dtpFechaVencimientoCompra.Value = vFechaVencimientoCompra
  1517. Me.txtPorcentajeCuponCompra.Text = vPorcentajeCuponCompra
  1518. Me.txtYTMAlVencimientoComisionCompra.Text = vYTMAlVencimientoComisionCompra
  1519. Me.txtYTMAlVencimientoCompra.Text = vYTMAlVencimientoCompra
  1520. Me.txtPrecioAlVencimientoCompra.Text = vPrecioAlVencimientoCompra
  1521. Me.txtPrecioCompra.Text = vPrecioCompra
  1522. Me.cboAnioBaseC.SelectedItem = vDiasBaseCompra
  1523. Me.txtDiasAcumuladosCompra.Text = vDiasAcumuladosCompra
  1524. Me.txtDiasAlVencimientoCompra.Text = vDiasAlVencimientoCompra
  1525. Me.txtPorcentajeInteresAcumuladoCompra.Text = vPorcentajeInteresAcumuladoCompra
  1526. Me.txtInteresAcumuladoCompra.Text = vInteresAcumuladoCompra
  1527. Me.txtPrecioSucioCompra.Text = vPrecioSucioCompra
  1528. Me.txtValorTransadoCompra.Text = vValorTransadoCompra
  1529. Me.txtMontoAPagar.Text = vMontoAPagarCompra
  1530. Me.txtCostoTransferenciaCompra.Text = vCostoDeTransferenciaCompra
  1531. 'Me.cboCasa_V.SelectedValue = vCodigoCasaVenta
  1532. Me.txtValorNominalVenta.Text = vValorNominalVenta
  1533. Me.dtpUltimaFechaCuponVenta.Value = vUltimaFechaCuponVenta
  1534. Me.dtpSiguienteFechaCuponVenta.Value = vSiguienteFechaCuponVenta
  1535. Me.dtpFechaLiquidacionVenta.Value = vFechaLiquidacionVenta
  1536. Me.dtpFechaVencimientoVenta.Value = vFechaVencimientoVenta
  1537. Me.txtPorcentajeCuponVenta.Text = vPorcentajeCuponVenta
  1538. Me.txtYTMAlVencimientoComisionVenta.Text = vYTMAlVencimientoComisionVenta
  1539. Me.txtYTMAlVencimientoVenta.Text = vYTMAlVencimientoVenta
  1540. Me.txtPrecioAlVencimientoVenta.Text = vPrecioAlVencimientoVenta
  1541. Me.txtPrecioVenta.Text = vPrecioVenta
  1542. Me.cboAnioBaseV.SelectedItem = vDiasBaseVenta
  1543. Me.txtDiasAcumuladosVenta.Text = vDiasAcumuladosVenta
  1544. Me.txtDiasAlVencimientoVenta.Text = vDiasAlVencimientoVenta
  1545. Me.txtPorcentajeInteresAcumuladoVenta.Text = vPorcentajeInteresAcumuladoVenta
  1546. Me.txtInteresAcumuladoVenta.Text = vInteresAcumuladoVenta
  1547. Me.txtPrecioSucioVenta.Text = vPrecioSucioVenta
  1548. Me.txtValorTransadoVenta.Text = vValorTransadoVenta
  1549. 'Me.txtMontoARecibir.Text = vMontoAPagarVenta
  1550. Me.txtCostoTransferenciaVenta.Text = vCostoDeTransferenciaVenta
  1551. Me.txtValorNominal_Op.Text = vValorNominalRO
  1552. 'Me.txtPlazo_Op.Text = vPlazoRO
  1553. Me.txtPrecioCompra_Op.Text = vPrecioCompraRO
  1554. Me.txtPrecioVenta_Op.Text = vPrecioVentaRO
  1555. Me.txtGananciaPerdidaCapital_Op.Text = vGananciaPerdidaDeCapital
  1556. Me.txtIngresosPorIntereses_Op.Text = vIngresoPorInteres
  1557. Me.txtCostosTotales_Op.Text = vCostosTotales
  1558. Me.txtGananciaPerdidaTotal_Op.Text = vGananciaPerdidaTotal
  1559. Me.txtRendimientoGananciaPerdida_Op.Text = vRendimientoGananciaPerdida
  1560. Me.txtRendimientoIntereses_Op.Text = vRendimientoDeIntereses
  1561. Me.txtRendimientoAntesISR_Op.Text = vRendimientoAntesImpuestos
  1562. Me.txtRendimientoDespuesISR_Op.Text = vRendimientoDespuesImpuestos
  1563. End Sub
  1564. Private Sub txtValorNominalCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalCompra.TextChanged
  1565. RefrescarInteresAcumuladoCompra()
  1566. RefrescarPorcentajeInteresAcumuladoCompra()
  1567. RefrescarValorTransadoCompra()
  1568. RefrescarValorNominalVenta()
  1569. RefrescarValorNominalRO()
  1570. RefrescarTablaIngresos()
  1571. End Sub
  1572. Private Sub dtpUltimaFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponCompra.ValueChanged
  1573. RefrescarSiguienteFechaCuponCompra()
  1574. End Sub
  1575. Private Sub dtpSiguienteFechaCuponCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpSiguienteFechaCuponCompra.ValueChanged
  1576. RefrescarDiasAcumuladosCompra()
  1577. RefrescarUltimaFechaCuponVenta()
  1578. RefrescarTablaIngresos()
  1579. End Sub
  1580. Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionCompra.ValueChanged
  1581. RefrescarYTMAlVencimientoCompra()
  1582. RefrescarDiasAcumuladosCompra()
  1583. RefrescarDiasAlVencimientoCompra()
  1584. RefrescarPLazoRO()
  1585. RefrescarTablaIngresos()
  1586. End Sub
  1587. Private Sub dtpFechaVencimientoCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
  1588. RefrescarYTMAlVencimientoCompra()
  1589. RefrescarDiasAlVencimientoCompra()
  1590. RefrescarFechaVencimientoVenta()
  1591. End Sub
  1592. Private Sub txtPorcentajeCuponCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponCompra.TextChanged
  1593. RefrescarYTMAlVencimientoCompra()
  1594. RefrescarInteresAcumuladoCompra()
  1595. RefrescarPorcentajeCuponVenta()
  1596. RefrescarTablaIngresos()
  1597. End Sub
  1598. Private Sub txtYTMAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoCompra.TextChanged
  1599. RefrescarYTMAlVencimientoComisionCompra()
  1600. End Sub
  1601. Private Sub txtPorcentajeComisionCasaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasaCompra.TextChanged
  1602. RefrescarYTMAlVencimientoComisionCompra()
  1603. RefrescarComisionCasaCompra()
  1604. RefrescarPorcentajeComisionCasaVenta()
  1605. End Sub
  1606. Private Sub txtDiasAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAlVencimientoCompra.TextChanged
  1607. RefrescarYTMAlVencimientoComisionCompra()
  1608. End Sub
  1609. Private Sub txtPrecioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra.TextChanged
  1610. RefrescarValorTransadoCompra()
  1611. RefrescarPorcentajePrecioSucioCompra()
  1612. RefrescarValorTransadoCompra()
  1613. RefrescarPrecioCompraRO()
  1614. End Sub
  1615. Private Sub txtPrecioAlVencimientoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoCompra.TextChanged
  1616. RefrescarYTMAlVencimientoCompra()
  1617. End Sub
  1618. Private Sub txtDiasAcumuladosCompra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosCompra.TextChanged
  1619. RefrescarInteresAcumuladoCompra()
  1620. End Sub
  1621. Private Sub txtInteresAcumuladoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumuladoCompra.TextChanged
  1622. RefrescarPorcentajeInteresAcumuladoCompra()
  1623. RefrescarPorcentajePrecioSucioCompra()
  1624. RefrescarMontoAPagarCompra()
  1625. RefrescarGananciaDeIntereses()
  1626. End Sub
  1627. Private Sub txtValorTransadoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoCompra.TextChanged
  1628. RefrescarComisionCasaCompra()
  1629. RefrescarComisionBolsaCompra()
  1630. RefrescarMontoAPagarCompra()
  1631. RefrescarGananciaDeCapital()
  1632. RefrescarRentabilidadPorGananciaDeCapital()
  1633. RefrescarRentabilidadPorIntereses()
  1634. RefrescarRentabilidadTotal()
  1635. End Sub
  1636. Private Sub txtPorcentajeComisionBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsaCompra.TextChanged
  1637. RefrescarComisionBolsaCompra()
  1638. RefrescarPorcentajeComisionBolsaVenta()
  1639. End Sub
  1640. Private Sub txtComisionBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsaCompra.TextChanged
  1641. RefrescarMontoAPagarCompra()
  1642. End Sub
  1643. Private Sub txtComisionCasaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasaCompra.TextChanged
  1644. RefrescarMontoAPagarCompra()
  1645. End Sub
  1646. Private Sub txtCostoTransferenciaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtCostoTransferenciaCompra.TextChanged
  1647. RefrescarMontoAPagarCompra()
  1648. End Sub
  1649. Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacionVenta.ValueChanged
  1650. 'RefrescarUltimaFechaCuponVenta()
  1651. RefrescarYTMAlVencimientoVenta()
  1652. RefrescarDiasAcumuladosVenta()
  1653. RefrescarDiasAlVencimientoVenta()
  1654. RefrescarPLazoRO()
  1655. RefrescarTablaIngresos()
  1656. End Sub
  1657. Private Sub dtpFechaVencimientoVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
  1658. 'RefrescarUltimaFechaCuponVenta()
  1659. RefrescarYTMAlVencimientoVenta()
  1660. RefrescarDiasAlVencimientoVenta()
  1661. End Sub
  1662. Private Sub dtpUltimaFechaCuponVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpUltimaFechaCuponVenta.ValueChanged
  1663. RefrescarSiguienteFechaCuponVenta()
  1664. RefrescarDiasAcumuladosVenta()
  1665. End Sub
  1666. Private Sub txtYTMAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtYTMAlVencimientoVenta.TextChanged
  1667. RefrescarYTMAlVencimientoComisionVenta()
  1668. End Sub
  1669. Private Sub txtPorcentajeComisionCasaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasaVenta.TextChanged
  1670. RefrescarYTMAlVencimientoComisionVenta()
  1671. RefrescarComisionCasaVenta()
  1672. End Sub
  1673. Private Sub txtDiasAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAlVencimientoVenta.TextChanged
  1674. RefrescarYTMAlVencimientoComisionVenta()
  1675. End Sub
  1676. Private Sub txtPorcentajeComisionBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsaVenta.TextChanged
  1677. RefrescarYTMAlVencimientoComisionVenta()
  1678. RefrescarComisionBolsaVenta()
  1679. End Sub
  1680. Private Sub txtPorcentajeCuponVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCuponVenta.TextChanged
  1681. RefrescarYTMAlVencimientoVenta()
  1682. RefrescarInteresAcumuladoVenta()
  1683. End Sub
  1684. Private Sub txtPrecioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta.TextChanged
  1685. RefrescarYTMAlVencimientoVenta()
  1686. RefrescarPrecioSucioVenta()
  1687. RefrescarValorTransadoVenta()
  1688. RefrescarPrecioVentaRO()
  1689. End Sub
  1690. Private Sub txtPrecioAlVencimientoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioAlVencimientoVenta.TextChanged
  1691. RefrescarYTMAlVencimientoVenta()
  1692. End Sub
  1693. Private Sub txtValorNominalVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominalVenta.TextChanged
  1694. RefrescarInteresAcumuladoVenta()
  1695. RefrescarPorcentajeInteresAcumuladoVenta()
  1696. RefrescarValorTransadoVenta()
  1697. End Sub
  1698. Private Sub txtDiasAcumuladosVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasAcumuladosVenta.TextChanged
  1699. RefrescarInteresAcumuladoVenta()
  1700. End Sub
  1701. Private Sub txtInteresAcumuladoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumuladoVenta.TextChanged
  1702. RefrescarPorcentajeInteresAcumuladoVenta()
  1703. RefrescarMontoARecibirVenta()
  1704. RefrescarGananciaDeIntereses()
  1705. End Sub
  1706. Private Sub txtPorcentajeInteresAcumuladoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeInteresAcumuladoVenta.TextChanged
  1707. RefrescarPrecioSucioVenta()
  1708. End Sub
  1709. Private Sub txtValorTransadoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoVenta.TextChanged
  1710. RefrescarComisionCasaVenta()
  1711. RefrescarComisionBolsaVenta()
  1712. RefrescarMontoARecibirVenta()
  1713. RefrescarGananciaDeCapital()
  1714. End Sub
  1715. Private Sub txtComisionBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsaVenta.TextChanged
  1716. RefrescarMontoARecibirVenta()
  1717. End Sub
  1718. Private Sub txtComisionCasaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasaVenta.TextChanged
  1719. RefrescarMontoARecibirVenta()
  1720. End Sub
  1721. Private Sub Label13_Click(sender As Object, e As EventArgs) Handles Label13.Click
  1722. End Sub
  1723. Private Sub cboAnioBaseC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseC.SelectedIndexChanged
  1724. RefrescarInteresAcumuladoCompra()
  1725. RefrescarDiasAlVencimientoCompra()
  1726. RefrescarDiasAcumuladosCompra()
  1727. RefrescarRentabilidadPorGananciaDeCapital()
  1728. RefrescarRentabilidadPorIntereses()
  1729. RefrescarRentabilidadTotal()
  1730. RefrescarTablaIngresos()
  1731. End Sub
  1732. Private Sub cboAnioBaseV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBaseV.SelectedIndexChanged
  1733. RefrescarInteresAcumuladoVenta()
  1734. RefrescarDiasAlVencimientoVenta()
  1735. RefrescarDiasAcumuladosVenta()
  1736. End Sub
  1737. Sub CargarPeriodos()
  1738. Me.cboPeriodosC.DataSource = oDAOGeneral.ListaPeriodicidad
  1739. Me.cboPeriodosC.ValueMember = "Codigo"
  1740. Me.cboPeriodosC.DisplayMember = "Descripcion"
  1741. Me.cboPeriodosC.SelectedIndex = -1
  1742. Me.cboPeriodosV.DataSource = oDAOGeneral.ListaPeriodicidad
  1743. Me.cboPeriodosV.ValueMember = "Codigo"
  1744. Me.cboPeriodosV.DisplayMember = "Descripcion"
  1745. Me.cboPeriodosV.SelectedIndex = -1
  1746. End Sub
  1747. Private Sub Label11_Click(sender As Object, e As EventArgs) Handles Label11.Click
  1748. End Sub
  1749. Private Sub cboPeriodosC_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosC.SelectedIndexChanged
  1750. RefrescarSiguienteFechaCuponCompra()
  1751. RefrescarPorcentajeInteresAcumuladoCompra()
  1752. RefrescarPeriodicidadVenta()
  1753. RefrescarTablaIngresos()
  1754. End Sub
  1755. Private Sub cboPeriodosV_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodosV.SelectedIndexChanged
  1756. RefrescarUltimaFechaCuponVenta()
  1757. RefrescarSiguienteFechaCuponVenta()
  1758. RefrescarPorcentajeInteresAcumuladoVenta()
  1759. End Sub
  1760. Private Sub txtPrecioCompra_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioCompra_Op.TextChanged
  1761. End Sub
  1762. Private Sub txtPrecioVenta_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioVenta_Op.TextChanged
  1763. End Sub
  1764. Private Sub txtGananciaPerdidaCapital_Op_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaPerdidaCapital_Op.TextChanged
  1765. RefrescarGananciaTotal()
  1766. RefrescarRentabilidadPorGananciaDeCapital()
  1767. End Sub
  1768. Private Sub txtIngresosPorIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtIngresosPorIntereses_Op.TextChanged
  1769. RefrescarGananciaTotal()
  1770. RefrescarRentabilidadPorIntereses()
  1771. End Sub
  1772. Private Sub txtGananciaPerdidaTotal_Op_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaPerdidaTotal_Op.TextChanged
  1773. RefrescarRentabilidadTotal()
  1774. End Sub
  1775. Private Sub txtPlazo_Op_TextChanged(sender As Object, e As EventArgs) Handles txtPlazo_Op.TextChanged
  1776. RefrescarRentabilidadPorGananciaDeCapital()
  1777. RefrescarRentabilidadPorIntereses()
  1778. RefrescarRentabilidadTotal()
  1779. End Sub
  1780. Function CalcularCupones() As DataTable
  1781. Dim dtCupones As New DataTable
  1782. Dim vFechaLiquidacionCompra As Date = GetFechaLiquidacionCompra()
  1783. Dim vFechaLiquidacionVenta As Date = GetFechaLiquidacionVenta()
  1784. Dim vSiguienteFechaCuponCompra As Date = GetSiguienteFechaCuponCompra()
  1785. Dim vPeriodicidad As String = GetPeriodicidadCompra()
  1786. Dim vValorNominalCompra As Double = GetValorNominalCompra()
  1787. Dim vPorcentajeCuponCompra As Double = GetPorcentajeCuponCompra()
  1788. Dim vAnioBaseCompra As Integer = GetDiasBaseCompra()
  1789. Dim vColumnas As DataColumn
  1790. Dim vFilas As DataRow
  1791. Dim vEstaFecha As Date
  1792. Dim vSiguienteFecha As Date
  1793. Dim vDias As Integer
  1794. Dim vValor As Double
  1795. 'CREAMOS COLUMNAS
  1796. vColumnas = New DataColumn
  1797. vColumnas.DataType = GetType(Date)
  1798. vColumnas.ColumnName = "FechaCupon"
  1799. vColumnas.Caption = "Fecha Cupon"
  1800. vColumnas.AllowDBNull = False
  1801. dtCupones.Columns.Add(vColumnas)
  1802. vColumnas = New DataColumn
  1803. vColumnas.DataType = GetType(Integer)
  1804. vColumnas.ColumnName = "Dias"
  1805. vColumnas.Caption = "Dias"
  1806. vColumnas.AllowDBNull = False
  1807. dtCupones.Columns.Add(vColumnas)
  1808. vColumnas = New DataColumn
  1809. vColumnas.DataType = GetType(Double)
  1810. vColumnas.ColumnName = "Valor"
  1811. vColumnas.Caption = "Valor Cupon"
  1812. vColumnas.AllowDBNull = False
  1813. dtCupones.Columns.Add(vColumnas)
  1814. vSiguienteFecha = vSiguienteFechaCuponCompra
  1815. vDias = DateDiff(DateInterval.Day, vFechaLiquidacionCompra, vSiguienteFechaCuponCompra)
  1816. Dim ControlBucle As Integer = 1
  1817. While vSiguienteFecha <= vFechaLiquidacionVenta
  1818. vEstaFecha = vSiguienteFecha
  1819. vFilas = dtCupones.NewRow
  1820. vFilas("FechaCupon") = vSiguienteFecha
  1821. vFilas("Dias") = vDias
  1822. Try
  1823. vValor = vValorNominalCompra * vPorcentajeCuponCompra * vDias / vAnioBaseCompra
  1824. Catch ex As Exception
  1825. vValor = 0
  1826. End Try
  1827. vFilas("Valor") = vValor
  1828. dtCupones.Rows.Add(vFilas)
  1829. If vPeriodicidad = "S" Then
  1830. vSiguienteFecha = vSiguienteFecha.AddMonths(6)
  1831. ElseIf vPeriodicidad = "M" Then
  1832. vSiguienteFecha = vSiguienteFecha.AddMonths(1)
  1833. Else
  1834. Exit While
  1835. End If
  1836. If vAnioBaseCompra = 360 Then
  1837. vDias = Utilidades.Days360(vEstaFecha, vSiguienteFecha)
  1838. Else
  1839. vDias = DateDiff(DateInterval.Day, vEstaFecha, vSiguienteFecha)
  1840. End If
  1841. End While
  1842. Try
  1843. TotalValorCupones = dtCupones.Compute("SUM(Valor)", "")
  1844. Catch ex As Exception
  1845. TotalValorCupones = 0
  1846. End Try
  1847. Me.txtTotalIngresoCupones.Text = TotalValorCupones.ToString
  1848. Return dtCupones
  1849. dtCupones.Dispose()
  1850. End Function
  1851. Private Sub btnRefrescarIngresos_Click(sender As Object, e As EventArgs) Handles btnRefrescarIngresos.Click
  1852. Me.dgvIngresos.DataSource = CalcularCupones()
  1853. End Sub
  1854. Sub RefrescarTablaIngresos()
  1855. Me.dgvIngresos.DataSource = CalcularCupones()
  1856. End Sub
  1857. Function AmortizacionDeCapital() As DataTable
  1858. Dim dtAmortizacionDeCapital As New DataTable
  1859. Dim vColumnas As DataColumn
  1860. Dim vFilas As DataRow
  1861. Dim vSiguienteFecha As Date
  1862. Dim vCesionDeFlujo As Double
  1863. 'AGREGO COLUMNAS
  1864. vColumnas = New DataColumn
  1865. vColumnas.DataType = GetType(Date)
  1866. vColumnas.ColumnName = "Fecha"
  1867. vColumnas.Caption = "Fecha"
  1868. vColumnas.AllowDBNull = False
  1869. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1870. vColumnas = New DataColumn
  1871. vColumnas.DataType = GetType(Double)
  1872. vColumnas.ColumnName = "CesionDeFlujo"
  1873. vColumnas.Caption = "Cesion De Flujo"
  1874. vColumnas.AllowDBNull = False
  1875. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1876. vColumnas = New DataColumn
  1877. vColumnas.DataType = GetType(Double)
  1878. vColumnas.ColumnName = "AmortDeCapEmis"
  1879. vColumnas.Caption = "Amortización de Capital Emision"
  1880. vColumnas.AllowDBNull = False
  1881. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1882. vColumnas = New DataColumn
  1883. vColumnas.DataType = GetType(Double)
  1884. vColumnas.ColumnName = "InteresEmis"
  1885. vColumnas.Caption = "Interes Emision"
  1886. vColumnas.AllowDBNull = False
  1887. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1888. vColumnas = New DataColumn
  1889. vColumnas.DataType = GetType(Double)
  1890. vColumnas.ColumnName = "PorcCapAmort"
  1891. vColumnas.Caption = "Porcentaje Cap. Amortizado"
  1892. vColumnas.AllowDBNull = False
  1893. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1894. vColumnas = New DataColumn
  1895. vColumnas.DataType = GetType(Double)
  1896. vColumnas.ColumnName = "SaldoEmis"
  1897. vColumnas.Caption = "Saldo Emision"
  1898. vColumnas.AllowDBNull = False
  1899. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1900. vColumnas = New DataColumn
  1901. vColumnas.DataType = GetType(Integer)
  1902. vColumnas.ColumnName = "Dias"
  1903. vColumnas.Caption = "Dias"
  1904. vColumnas.AllowDBNull = False
  1905. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1906. vColumnas = New DataColumn
  1907. vColumnas.DataType = GetType(Double)
  1908. vColumnas.ColumnName = "Cuota"
  1909. vColumnas.Caption = "Cuota"
  1910. vColumnas.AllowDBNull = False
  1911. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1912. vColumnas = New DataColumn
  1913. vColumnas.DataType = GetType(Double)
  1914. vColumnas.ColumnName = "AmortCap"
  1915. vColumnas.Caption = "Amortizacion de Capital"
  1916. vColumnas.AllowDBNull = False
  1917. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1918. vColumnas = New DataColumn
  1919. vColumnas.DataType = GetType(Double)
  1920. vColumnas.ColumnName = "InteresTit"
  1921. vColumnas.Caption = "Interes Titularizacion"
  1922. vColumnas.AllowDBNull = False
  1923. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1924. vColumnas = New DataColumn
  1925. vColumnas.DataType = GetType(Double)
  1926. vColumnas.ColumnName = "SaldoTit"
  1927. vColumnas.Caption = "Saldo Titularizacion"
  1928. vColumnas.AllowDBNull = False
  1929. dtAmortizacionDeCapital.Columns.Add(vColumnas)
  1930. vSiguienteFecha = FechaEmision.AddMonths(1)
  1931. vCesionDeFlujo = CesionFlujo1
  1932. For i As Integer = 1 To NumeroPeriodosEmision
  1933. vFilas = dtAmortizacionDeCapital.NewRow
  1934. vFilas("Fecha") = vSiguienteFecha
  1935. vFilas("CesionDeFlujo") = 1
  1936. vFilas("AmortDeCapEmis") = 2
  1937. vFilas("InteresEmis") = 3
  1938. vFilas("PorcCapAmort") = 4
  1939. vFilas("SaldoEmis") = 5
  1940. vFilas("Dias") = 6
  1941. vFilas("Cuota") = 7
  1942. vFilas("AmortCap") = 8
  1943. vFilas("InteresTit") = 9
  1944. vFilas("SaldoTit") = 10
  1945. dtAmortizacionDeCapital.Rows.Add(vFilas)
  1946. vSiguienteFecha = FechaEmision.AddMonths(1)
  1947. Next
  1948. Return dtAmortizacionDeCapital
  1949. dtAmortizacionDeCapital.Dispose()
  1950. End Function
  1951. Private Sub txtEmisionTotal_TextChanged(sender As Object, e As EventArgs) Handles txtEmisionTotal.TextChanged
  1952. Double.TryParse(txtEmisionTotal.Text, EmisionTotal)
  1953. End Sub
  1954. Private Sub txtEmisionTotal_LostFocus(sender As Object, e As EventArgs) Handles txtEmisionTotal.LostFocus
  1955. Double.TryParse(txtEmisionTotal.Text, EmisionTotal)
  1956. txtEmisionTotal.Text = EmisionTotal.ToString(Configuraciones.CodigoTXTMontos)
  1957. End Sub
  1958. Private Sub txtTasaEmision_TextChanged(sender As Object, e As EventArgs) Handles txtTasaEmision.TextChanged
  1959. Double.TryParse(txtTasaEmision.Text, TasaEmision)
  1960. End Sub
  1961. Private Sub txtTasaEmision_LostFocus(sender As Object, e As EventArgs) Handles txtTasaEmision.LostFocus
  1962. Double.TryParse(txtTasaEmision.Text, TasaEmision)
  1963. txtTasaEmision.Text = TasaEmision.ToString(Configuraciones.CodigoTXTPorcentaje)
  1964. End Sub
  1965. Private Sub txtPeriodicidadEmision_TextChanged(sender As Object, e As EventArgs) Handles txtPeriodicidadEmision.TextChanged
  1966. Integer.TryParse(Me.txtPeriodicidadEmision.Text, PeriodicidadEmision)
  1967. End Sub
  1968. Private Sub txtPeriodosEmision_TextChanged(sender As Object, e As EventArgs) Handles txtPeriodosEmision.TextChanged
  1969. Integer.TryParse(Me.txtPeriodosEmision.Text, NumeroPeriodosEmision)
  1970. End Sub
  1971. Private Sub txtMontoCompraEmision_TextChanged(sender As Object, e As EventArgs) Handles txtMontoCompraEmision.TextChanged
  1972. Double.TryParse(Me.txtMontoCompraEmision.Text, MontoCompraEmision)
  1973. End Sub
  1974. Private Sub txtMontoCompraPrimario_TextChanged(sender As Object, e As EventArgs) Handles txtMontoCompraPrimario.TextChanged
  1975. Double.TryParse(Me.txtMontoCompraPrimario.Text, MontoCompraPrimario)
  1976. End Sub
  1977. Private Sub txtCesionFlujo1_TextChanged(sender As Object, e As EventArgs) Handles txtCesionFlujo1.TextChanged
  1978. Double.TryParse(Me.txtCesionFlujo1.Text, CesionFlujo1)
  1979. End Sub
  1980. Private Sub txtPeriodicidadEmision_LostFocus(sender As Object, e As EventArgs) Handles txtPeriodicidadEmision.LostFocus
  1981. Integer.TryParse(Me.txtPeriodicidadEmision.Text, PeriodicidadEmision)
  1982. Me.txtPeriodicidadEmision.Text = PeriodicidadEmision.ToString
  1983. End Sub
  1984. Private Sub txtPeriodosEmision_LostFocus(sender As Object, e As EventArgs) Handles txtPeriodosEmision.LostFocus
  1985. Integer.TryParse(txtPeriodosEmision.Text, NumeroPeriodosEmision)
  1986. txtPeriodosEmision.Text = NumeroPeriodosEmision.ToString
  1987. End Sub
  1988. Private Sub txtMontoCompraEmision_LostFocus(sender As Object, e As EventArgs) Handles txtMontoCompraEmision.LostFocus
  1989. Double.TryParse(Me.txtMontoCompraEmision.Text, MontoCompraEmision)
  1990. Me.txtMontoCompraEmision.Text = MontoCompraEmision.ToString(Configuraciones.CodigoTXTMontos)
  1991. End Sub
  1992. Private Sub txtMontoCompraPrimario_LostFocus(sender As Object, e As EventArgs) Handles txtMontoCompraPrimario.LostFocus
  1993. Double.TryParse(txtMontoCompraPrimario.Text, MontoCompraPrimario)
  1994. txtMontoCompraPrimario.Text = MontoCompraPrimario.ToString(Configuraciones.CodigoTXTMontos)
  1995. End Sub
  1996. Private Sub txtCesionFlujo1_LostFocus(sender As Object, e As EventArgs) Handles txtCesionFlujo1.LostFocus
  1997. Double.TryParse(txtCesionFlujo1.Text, CesionFlujo1)
  1998. txtCesionFlujo1.Text = CesionFlujo1.ToString(Configuraciones.CodigoTXTMontos)
  1999. End Sub
  2000. Private Sub dtpFechaEmision_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaEmision.ValueChanged
  2001. FechaEmision = dtpFechaEmision.Value.Date
  2002. End Sub
  2003. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2004. dgvAmortizacionDeCapital.DataSource = AmortizacionDeCapital()
  2005. End Sub
  2006. Private Sub label27_Click(sender As Object, e As EventArgs) Handles label27.Click
  2007. End Sub
  2008. Private Sub Label23_Click(sender As Object, e As EventArgs) Handles Label23.Click
  2009. End Sub
  2010. Private Sub Label25_Click(sender As Object, e As EventArgs) Handles Label25.Click
  2011. End Sub
  2012. Private Sub Label35_Click(sender As Object, e As EventArgs) Handles Label35.Click
  2013. End Sub
  2014. Private Sub Label26_Click(sender As Object, e As EventArgs) Handles Label26.Click
  2015. End Sub
  2016. Private Sub lblIngresosPorIntereses_Op_Click(sender As Object, e As EventArgs) Handles lblIngresosPorIntereses_Op.Click
  2017. End Sub
  2018. Private Sub Label24_Click(sender As Object, e As EventArgs) Handles Label24.Click
  2019. End Sub
  2020. Private Sub lblCostosTotales_Op_Click(sender As Object, e As EventArgs) Handles lblCostosTotales_Op.Click
  2021. End Sub
  2022. Private Sub lblGananciaPerdidaTotal_Op_Click(sender As Object, e As EventArgs) Handles lblGananciaPerdidaTotal_Op.Click
  2023. End Sub
  2024. Private Sub lblRendimientoGananciaPerdida_Op_Click(sender As Object, e As EventArgs) Handles lblRendimientoGananciaPerdida_Op.Click
  2025. End Sub
  2026. Private Sub lblRendimientoIntereses_Op_Click(sender As Object, e As EventArgs) Handles lblRendimientoIntereses_Op.Click
  2027. End Sub
  2028. Private Sub lblRendimientoAntesISR_Op_Click(sender As Object, e As EventArgs) Handles lblRendimientoAntesISR_Op.Click
  2029. End Sub
  2030. Private Sub lblRendimientoDespuesISR_Op_Click(sender As Object, e As EventArgs) Handles lblRendimientoDespuesISR_Op.Click
  2031. End Sub
  2032. Private Sub txtRendimientoDespuesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoDespuesISR_Op.TextChanged
  2033. End Sub
  2034. Private Sub txtRendimientoAntesISR_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoAntesISR_Op.TextChanged
  2035. End Sub
  2036. Private Sub txtRendimientoIntereses_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoIntereses_Op.TextChanged
  2037. End Sub
  2038. Private Sub txtRendimientoGananciaPerdida_Op_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoGananciaPerdida_Op.TextChanged
  2039. End Sub
  2040. Private Sub txtCostosTotales_Op_TextChanged(sender As Object, e As EventArgs) Handles txtCostosTotales_Op.TextChanged
  2041. End Sub
  2042. Private Sub txtValorNominal_Op_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal_Op.TextChanged
  2043. End Sub
  2044. End Class