frmReporto.vb 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. Public Class frmReporto
  2. Dim oDAOGeneral As New DAOGeneral
  3. Dim Aniobase As Integer = 365
  4. Dim PorcentajeComisionCasa As Double = 0.2825
  5. Dim PorcentajeComisionBolsa As Double = 0.2825
  6. Dim PorcentajeComisionIOF As Double = 0.25
  7. Dim PorcentajeISR As Double = 10
  8. Dim oCEReporto As ReportosCE
  9. Dim oDAOReportos As ReportosDAO
  10. Private CodigoInversion As String
  11. Private _Modo As String
  12. Private _IdDocumento As Integer
  13. Private _TipoDocumento As String
  14. Public Property Modo As String
  15. Get
  16. Return _Modo
  17. End Get
  18. Set(value As String)
  19. _Modo = value
  20. End Set
  21. End Property
  22. Private Property IdDocumento As Integer
  23. Get
  24. Return _IdDocumento
  25. End Get
  26. Set(value As Integer)
  27. _IdDocumento = value
  28. End Set
  29. End Property
  30. Private Property TipoDocumento As String
  31. Get
  32. Return _TipoDocumento
  33. End Get
  34. Set(value As String)
  35. _TipoDocumento = value
  36. End Set
  37. End Property
  38. Private Sub frmReporto_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  39. Call CargarCasaCorredoras()
  40. ValoresPredefinidos()
  41. If Modo = "C" Then
  42. Call CargarRegistroBD()
  43. End If
  44. End Sub
  45. 'GETS
  46. Function GetFechaCompra() As Date
  47. Dim valor As Date
  48. valor = dtpFechaCompra.Value
  49. Return valor
  50. End Function
  51. Function GetDias() As Integer
  52. Dim valor As Integer
  53. If Me.txtDias.Text.Length = 0 Then
  54. valor = 0
  55. Else
  56. Try
  57. valor = Me.txtDias.Text
  58. Catch ex As Exception
  59. valor = 0
  60. End Try
  61. End If
  62. Return valor
  63. End Function
  64. Function GetPorcentajeBolsa() As Double
  65. Dim valor As Double
  66. If Me.txtPorcentajeBolsa.Text.Length = 0 Then
  67. valor = 0
  68. Else
  69. Try
  70. valor = Me.txtPorcentajeBolsa.Text
  71. valor = valor / 100
  72. Catch ex As Exception
  73. valor = 0
  74. End Try
  75. End If
  76. Return valor
  77. End Function
  78. Function GetPorcentajeCasa() As Double
  79. Dim valor As Double
  80. If Me.txtPorcentajeCasa.Text.Length = 0 Then
  81. valor = 0
  82. Else
  83. Try
  84. valor = Me.txtPorcentajeCasa.Text
  85. valor = valor / 100
  86. Catch ex As Exception
  87. valor = 0
  88. End Try
  89. End If
  90. Return valor
  91. End Function
  92. Function GetValorTransado() As Double
  93. Dim valor As Double
  94. If Me.txtValorTransado.Text.Length = 0 Then
  95. valor = 0
  96. Else
  97. Try
  98. valor = Me.txtValorTransado.Text
  99. Catch ex As Exception
  100. valor = 0
  101. End Try
  102. End If
  103. Return valor
  104. End Function
  105. Function GetComisionCasa() As Double
  106. Dim valor As Double
  107. If Me.txtComisionCasa.Text.Length = 0 Then
  108. valor = 0
  109. Else
  110. Try
  111. valor = Me.txtComisionCasa.Text
  112. Catch ex As Exception
  113. valor = 0
  114. End Try
  115. End If
  116. Return valor
  117. End Function
  118. Function GetComisionBolsa() As Double
  119. Dim valor As Double
  120. If Me.txtComisionBolsa.Text.Length = 0 Then
  121. valor = 0
  122. Else
  123. Try
  124. valor = Me.txtComisionBolsa.Text
  125. Catch ex As Exception
  126. valor = 0
  127. End Try
  128. End If
  129. Return valor
  130. End Function
  131. Function GetPorcentajeIOF() As Double
  132. Dim valor As Double
  133. If Me.txtPorcentajeIOF.Text.Length = 0 Then
  134. valor = 0
  135. Else
  136. Try
  137. valor = Me.txtPorcentajeIOF.Text
  138. valor = valor / 100
  139. Catch ex As Exception
  140. valor = 0
  141. End Try
  142. End If
  143. Return valor
  144. End Function
  145. Function GetIOF() As Double
  146. Dim valor As Double
  147. If Me.txtIOF.Text.Length = 0 Then
  148. valor = 0
  149. Else
  150. Try
  151. valor = Me.txtIOF.Text
  152. Catch ex As Exception
  153. valor = 0
  154. End Try
  155. End If
  156. Return valor
  157. End Function
  158. Function GetOtrosCostos() As Double
  159. Dim valor As Double
  160. If Me.txtOtrosCostos.Text.Length = 0 Then
  161. valor = 0
  162. Else
  163. Try
  164. valor = Me.txtOtrosCostos.Text
  165. Catch ex As Exception
  166. valor = 0
  167. End Try
  168. End If
  169. Return valor
  170. End Function
  171. Function GetTotalCostos() As Double
  172. Dim valor As Double
  173. If Me.txtTotalCostos.Text.Length = 0 Then
  174. valor = 0
  175. Else
  176. Try
  177. valor = Me.txtTotalCostos.Text
  178. Catch ex As Exception
  179. valor = 0
  180. End Try
  181. End If
  182. Return valor
  183. End Function
  184. Function GetRendimiento() As Double
  185. Dim valor As Double
  186. If Me.txtRendimiento.Text.Length = 0 Then
  187. valor = 0
  188. Else
  189. Try
  190. valor = Me.txtRendimiento.Text
  191. valor = valor / 100
  192. Catch ex As Exception
  193. valor = 0
  194. End Try
  195. End If
  196. Return valor
  197. End Function
  198. Function GetInteresesAGenerar() As Double
  199. Dim valor As Double
  200. If Me.txtInteresesAGenerar.Text.Length = 0 Then
  201. valor = 0
  202. Else
  203. Try
  204. valor = Me.txtInteresesAGenerar.Text
  205. Catch ex As Exception
  206. valor = 0
  207. End Try
  208. End If
  209. Return valor
  210. End Function
  211. Function GetPorcentajeISR() As Double
  212. Dim valor As Double
  213. Try
  214. valor = PorcentajeISR / 100
  215. Catch ex As Exception
  216. valor = 0
  217. End Try
  218. Return valor
  219. End Function
  220. Function GetISR() As Double
  221. Dim valor As Double
  222. If Me.txtISR.Text.Length = 0 Then
  223. valor = 0
  224. Else
  225. Try
  226. valor = Me.txtISR.Text
  227. Catch ex As Exception
  228. valor = 0
  229. End Try
  230. End If
  231. Return valor
  232. End Function
  233. Function GetIngresoNeto() As Double
  234. Dim valor As Double
  235. If Me.txtIngresoNeto.Text.Length = 0 Then
  236. valor = 0
  237. Else
  238. Try
  239. valor = Me.txtIngresoNeto.Text
  240. Catch ex As Exception
  241. valor = 0
  242. End Try
  243. End If
  244. Return valor
  245. End Function
  246. Function GetCostoDeTransferencia() As Double
  247. Dim valor As Double
  248. If Me.txtCostoDeTransferencia.Text.Length = 0 Then
  249. valor = 0
  250. Else
  251. Try
  252. valor = Me.txtCostoDeTransferencia.Text
  253. Catch ex As Exception
  254. valor = 0
  255. End Try
  256. End If
  257. Return valor
  258. End Function
  259. Function GetCasa() As String
  260. Dim valor As String
  261. If Me.cboCasaCorredora.SelectedIndex = -1 Then
  262. valor = ""
  263. Else
  264. valor = Me.cboCasaCorredora.SelectedValue
  265. End If
  266. Return valor
  267. End Function
  268. Function GetCodigoTitulo() As String
  269. Dim valor As String
  270. If Me.txtCodigoTitulo.Text.Length = 0 Then
  271. valor = ""
  272. Else
  273. Try
  274. valor = Me.txtCodigoTitulo.Text
  275. Catch ex As Exception
  276. valor = ""
  277. End Try
  278. End If
  279. Return valor
  280. End Function
  281. Function GetFechaVencimiento() As Date
  282. Dim valor As Date
  283. valor = Me.dtpFechaVencimiento.Value
  284. Return valor
  285. End Function
  286. Function GetMontoALiquidar() As Double
  287. Dim valor As Double
  288. If Me.txtMontoALiquidar.Text.Length = 0 Then
  289. valor = 0
  290. Else
  291. Try
  292. valor = Me.txtMontoALiquidar.Text
  293. Catch ex As Exception
  294. valor = 0
  295. End Try
  296. End If
  297. Return valor
  298. End Function
  299. Function GetRendimientoNetoAntesDeImpuestos() As Double
  300. Dim valor As Double
  301. If Me.txtRendimientoNetoAntesISR.Text.Length = 0 Then
  302. valor = 0
  303. Else
  304. Try
  305. valor = Me.txtRendimientoNetoAntesISR.Text
  306. Catch ex As Exception
  307. valor = 0
  308. End Try
  309. End If
  310. Return valor
  311. End Function
  312. Function GetValorRecompra() As Double
  313. Dim valor As Double
  314. If Me.txtValorReCompra.Text.Length = 0 Then
  315. valor = 0
  316. Else
  317. Try
  318. valor = Me.txtValorReCompra.Text
  319. Catch ex As Exception
  320. valor = 0
  321. End Try
  322. End If
  323. Return valor
  324. End Function
  325. Function GetValorNeto() As Double
  326. Dim valor As Double
  327. If Me.txtValorNeto.Text.Length = 0 Then
  328. valor = 0
  329. Else
  330. Try
  331. valor = Me.txtValorNeto.Text
  332. Catch ex As Exception
  333. valor = 0
  334. End Try
  335. End If
  336. Return valor
  337. End Function
  338. Function GetRendimientoNetoDespuesDeImpuestos() As Double
  339. Dim valor As Double
  340. If Me.txtRendimientoNetoDespuesISR.Text.Length = 0 Then
  341. valor = 0
  342. Else
  343. Try
  344. valor = Me.txtRendimientoNetoDespuesISR.Text
  345. Catch ex As Exception
  346. valor = 0
  347. End Try
  348. End If
  349. Return valor
  350. End Function
  351. 'CALCULOS
  352. Function CalcularFechaVencimiento() As Date
  353. Dim valor As Date
  354. Dim FechaCompra As Date = Me.dtpFechaCompra.Value
  355. Dim Dias As Integer = GetDias()
  356. valor = FechaCompra
  357. valor = valor.AddDays(Dias)
  358. Return valor
  359. End Function
  360. Function CalcularComisionCasa() As Double
  361. Dim valor As Double
  362. Dim vValorTransado As Double = GetValorTransado()
  363. Dim vDias As Integer = GetDias()
  364. Dim vPorcentajeCasa As Double = GetPorcentajeCasa()
  365. Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
  366. Try
  367. valor = vValorTransado * vDias * vPorcentajeCasa / vAnioBase
  368. Catch ex As Exception
  369. valor = 0
  370. End Try
  371. Return valor
  372. End Function
  373. Function CalcularComisionBolsa() As Double
  374. Dim valor As Double
  375. Dim vValorTransado As Double = GetValorTransado()
  376. Dim vDias As Integer = GetDias()
  377. Dim vPorcentajeBolsa As Double = GetPorcentajeBolsa()
  378. Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
  379. Try
  380. valor = vValorTransado * vDias * vPorcentajeBolsa / vAnioBase
  381. Catch ex As Exception
  382. valor = 0
  383. End Try
  384. Return valor
  385. End Function
  386. Function CalcularIOF() As Double
  387. Dim valor As Double
  388. Dim vValorTransado As Double = GetValorTransado()
  389. Dim vComisionCasa As Double = GetComisionCasa()
  390. Dim vComisionBolsa As Double = GetComisionBolsa()
  391. Dim vDias As Integer = GetDias()
  392. Dim vPorcentajeIOF As Double = GetPorcentajeIOF()
  393. Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
  394. Try
  395. valor = (vValorTransado + vComisionCasa + vComisionBolsa) * vDias * vPorcentajeIOF / vAnioBase
  396. Catch ex As Exception
  397. valor = 0
  398. End Try
  399. Return valor
  400. End Function
  401. Function CalcularOtrosCostos() As Double
  402. Dim valor As Double
  403. valor = 0
  404. Return valor
  405. End Function
  406. Function CalcularTotalCostos() As Double
  407. Dim valor As Double
  408. Dim vComisionCasa As Double = GetComisionCasa()
  409. Dim vComisionBolsa As Double = GetComisionBolsa()
  410. Dim vIOF As Double = GetIOF()
  411. Dim vOtrosCostos As Double = GetOtrosCostos()
  412. Try
  413. valor = vComisionCasa + vComisionBolsa + vIOF + vOtrosCostos
  414. Catch ex As Exception
  415. valor = 0
  416. End Try
  417. Return valor
  418. End Function
  419. Function CalcularMontoALiquidar() As Double
  420. Dim valor As Double
  421. Dim vValorTransado As Double = GetValorTransado()
  422. Dim vTotalCostos As Double = GetTotalCostos()
  423. Try
  424. valor = vValorTransado + vTotalCostos
  425. Catch ex As Exception
  426. valor = 0
  427. End Try
  428. Return valor
  429. End Function
  430. Function CalcularInteresAGenerar() As Double
  431. Dim valor As Double
  432. Dim vValorTransado As Double = GetValorTransado()
  433. Dim vRendimiento As Double = GetRendimiento()
  434. Dim vDias As Integer = GetDias()
  435. Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
  436. Try
  437. valor = vValorTransado * vRendimiento * vDias / vAnioBase
  438. Catch ex As Exception
  439. valor = 0
  440. End Try
  441. Return valor
  442. End Function
  443. Function CalcularRendimientoNetoAntesISR() As Double
  444. Dim valor As Double
  445. Dim vInteresesAgenerar As Double = GetInteresesAGenerar()
  446. Dim vTotalCostos As Double = GetTotalCostos()
  447. Dim vValorTransado As Double = GetValorTransado()
  448. Dim vDias As Integer = GetDias()
  449. Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
  450. Try
  451. valor = ((vInteresesAgenerar - vTotalCostos) / vValorTransado) * (vAnioBase / vDias)
  452. valor = valor * 100
  453. Catch ex As Exception
  454. valor = 0
  455. End Try
  456. Return valor
  457. End Function
  458. Function CalcularValorRecompra() As Double
  459. Dim valor As Double
  460. Dim vValorTransado As Double = GetValorTransado()
  461. Dim vInteresesAGenerar As Double = GetInteresesAGenerar()
  462. Try
  463. valor = vValorTransado - vInteresesAGenerar
  464. Catch ex As Exception
  465. valor = 0
  466. End Try
  467. Return valor
  468. End Function
  469. Function CalcularISR() As Double
  470. Dim valor As Double
  471. Dim vInteresesAGenerar As Double = GetInteresesAGenerar()
  472. Dim vPorcentajeISR As Double = GetPorcentajeISR()
  473. Try
  474. valor = vInteresesAGenerar * vPorcentajeISR
  475. Catch ex As Exception
  476. valor = 0
  477. End Try
  478. Return valor
  479. End Function
  480. Function CalcularIngresoNeto() As Double
  481. Dim valor As Double
  482. Dim vInteresesAgenerar As Double = GetInteresesAGenerar()
  483. Dim vISR As Double = GetISR()
  484. Try
  485. valor = vInteresesAgenerar - vISR
  486. Catch ex As Exception
  487. valor = 0
  488. End Try
  489. Return valor
  490. End Function
  491. Function CalcularValorNeto() As Double
  492. Dim valor As Double
  493. Dim vValorTransado As Double = GetValorTransado()
  494. Dim vIngresoNeto As Double = GetIngresoNeto()
  495. Dim vCostoDeTransferencia As Double = GetCostoDeTransferencia()
  496. Try
  497. valor = vValorTransado + vIngresoNeto - vCostoDeTransferencia
  498. Catch ex As Exception
  499. valor = 0
  500. End Try
  501. Return valor
  502. End Function
  503. Function CalcularRendimientoNetoDespuesISR() As Double
  504. Dim valor As Double
  505. Dim vIngresoNeto As Double = GetIngresoNeto()
  506. Dim vTotalCostos As Double = GetTotalCostos()
  507. Dim vValorTransado As Double = GetValorTransado()
  508. Dim vAnioBase As Integer = Utilidades.CalcularDiasDelAnio(GetFechaCompra)
  509. Dim vDias As Integer = GetDias()
  510. Try
  511. valor = (vIngresoNeto - vTotalCostos) / vValorTransado * vAnioBase / vDias
  512. valor = valor * 100
  513. Catch ex As Exception
  514. valor = 0
  515. End Try
  516. Return valor
  517. End Function
  518. 'AUTOMATICO
  519. Sub ValoresPredefinidos()
  520. Me.txtPorcentajeCasa.Text = PorcentajeComisionCasa
  521. Me.txtPorcentajeBolsa.Text = PorcentajeComisionBolsa
  522. Me.txtPorcentajeIOF.Text = PorcentajeComisionIOF
  523. End Sub
  524. Sub RefrescarFechaVencimiento()
  525. Me.dtpFechaVencimiento.Value = CalcularFechaVencimiento()
  526. End Sub
  527. Sub RefrescarComisionCasa()
  528. Me.txtComisionCasa.Text = CalcularComisionCasa()
  529. End Sub
  530. Sub RefrescarComisionBolsa()
  531. Me.txtComisionBolsa.Text = CalcularComisionBolsa()
  532. End Sub
  533. Sub RefrescarIOF()
  534. Me.txtIOF.Text = CalcularIOF()
  535. End Sub
  536. Sub RefrescarOtrosCostos()
  537. Me.txtOtrosCostos.Text = CalcularOtrosCostos()
  538. End Sub
  539. Sub RefrescarTotalCostos()
  540. Me.txtTotalCostos.Text = CalcularTotalCostos()
  541. End Sub
  542. Sub RefrescarMontoALiquidar()
  543. Me.txtMontoALiquidar.Text = CalcularMontoALiquidar()
  544. End Sub
  545. Sub RefrescarInteresAGenerar()
  546. Me.txtInteresesAGenerar.Text = CalcularInteresAGenerar()
  547. End Sub
  548. Sub RefrescarRendimientoNetoAntesISR()
  549. Me.txtRendimientoNetoAntesISR.Text = CalcularRendimientoNetoAntesISR()
  550. End Sub
  551. Sub RefrescarValorDeRecompra()
  552. Me.txtValorReCompra.Text = CalcularValorRecompra()
  553. End Sub
  554. Sub RefrescarValorRecompra()
  555. Me.txtValorReCompra.Text = CalcularValorRecompra()
  556. End Sub
  557. Sub RefrescarISR()
  558. Me.txtISR.Text = CalcularISR()
  559. End Sub
  560. Sub RefrescarIngresoNeto()
  561. Me.txtIngresoNeto.Text = CalcularIngresoNeto()
  562. End Sub
  563. Sub RefrescarValorNeto()
  564. Me.txtValorNeto.Text = CalcularValorNeto()
  565. End Sub
  566. Sub RefrescarRendimientoNetoDespuesISR()
  567. Me.txtRendimientoNetoDespuesISR.Text = CalcularRendimientoNetoDespuesISR()
  568. End Sub
  569. 'EVENTOS
  570. Private Sub txtPorcentajeCasa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeCasa.TextChanged
  571. If Modo = "N" Then
  572. RefrescarComisionCasa()
  573. End If
  574. End Sub
  575. Private Sub txtPorcentajeBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeBolsa.TextChanged
  576. If Modo = "N" Then
  577. RefrescarComisionBolsa()
  578. End If
  579. End Sub
  580. Private Sub txtPorcentajeIOF_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeIOF.TextChanged
  581. If Modo = "N" Then
  582. RefrescarIOF()
  583. End If
  584. End Sub
  585. Private Sub txtDias_TextChanged(sender As Object, e As EventArgs) Handles txtDias.TextChanged
  586. If Modo = "N" Then
  587. RefrescarFechaVencimiento()
  588. RefrescarComisionCasa()
  589. RefrescarComisionBolsa()
  590. RefrescarInteresAGenerar()
  591. RefrescarRendimientoNetoAntesISR()
  592. RefrescarRendimientoNetoDespuesISR()
  593. End If
  594. End Sub
  595. Private Sub dtpFechaCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaCompra.ValueChanged
  596. If Modo = "N" Then
  597. RefrescarFechaVencimiento()
  598. End If
  599. End Sub
  600. Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
  601. If Modo = "N" Then
  602. RefrescarIOF()
  603. RefrescarTotalCostos()
  604. End If
  605. End Sub
  606. Private Sub TxtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
  607. If Modo = "N" Then
  608. RefrescarIOF()
  609. RefrescarTotalCostos()
  610. End If
  611. End Sub
  612. Private Sub txtIOF_TextChanged(sender As Object, e As EventArgs) Handles txtIOF.TextChanged
  613. If Modo = "N" Then
  614. RefrescarTotalCostos()
  615. End If
  616. End Sub
  617. Private Sub txtOtrosCostos_TextChanged(sender As Object, e As EventArgs) Handles txtOtrosCostos.TextChanged
  618. If Modo = "N" Then
  619. RefrescarTotalCostos()
  620. End If
  621. End Sub
  622. Private Sub txtValorTransado_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransado.TextChanged
  623. If Modo = "N" Then
  624. RefrescarComisionCasa()
  625. RefrescarComisionBolsa()
  626. RefrescarIOF()
  627. RefrescarMontoALiquidar()
  628. RefrescarInteresAGenerar()
  629. RefrescarRendimientoNetoAntesISR()
  630. RefrescarValorDeRecompra()
  631. RefrescarValorNeto()
  632. RefrescarRendimientoNetoDespuesISR()
  633. End If
  634. End Sub
  635. Private Sub txtTotalCostos_TextChanged(sender As Object, e As EventArgs) Handles txtTotalCostos.TextChanged
  636. If Modo = "N" Then
  637. RefrescarMontoALiquidar()
  638. RefrescarRendimientoNetoAntesISR()
  639. RefrescarRendimientoNetoDespuesISR()
  640. End If
  641. End Sub
  642. Private Sub txtRendimiento_TextChanged(sender As Object, e As EventArgs) Handles txtRendimiento.TextChanged
  643. If Modo = "N" Then
  644. RefrescarInteresAGenerar()
  645. End If
  646. End Sub
  647. Private Sub txtInteresesAGenerar_TextChanged(sender As Object, e As EventArgs) Handles txtInteresesAGenerar.TextChanged
  648. If Modo = "N" Then
  649. RefrescarRendimientoNetoAntesISR()
  650. RefrescarValorDeRecompra()
  651. RefrescarISR()
  652. RefrescarIngresoNeto()
  653. End If
  654. End Sub
  655. Private Sub txtISR_TextChanged(sender As Object, e As EventArgs) Handles txtISR.TextChanged
  656. If Modo = "N" Then
  657. RefrescarIngresoNeto()
  658. End If
  659. End Sub
  660. Private Sub txtIngresoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoNeto.TextChanged
  661. If Modo = "N" Then
  662. RefrescarValorNeto()
  663. RefrescarRendimientoNetoDespuesISR()
  664. End If
  665. End Sub
  666. Private Sub txtCostoDeTransferencia_TextChanged(sender As Object, e As EventArgs) Handles txtCostoDeTransferencia.TextChanged
  667. If Modo = "N" Then
  668. RefrescarValorNeto()
  669. End If
  670. End Sub
  671. 'CARGAR DATOS DE CONTROLES
  672. Sub CargarCasaCorredoras()
  673. Me.cboCasaCorredora.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
  674. Me.cboCasaCorredora.DisplayMember = "Descripciom"
  675. Me.cboCasaCorredora.ValueMember = "Codigo"
  676. Me.cboCasaCorredora.SelectedIndex = -1
  677. End Sub
  678. Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
  679. If Modo = "N" Then
  680. oCEReporto = New ReportosCE
  681. oCEReporto.CodigoCasa = Me.GetCasa
  682. oCEReporto.Nombre = Me.GetCodigoTitulo
  683. oCEReporto.FechaDeCompra = Me.GetFechaCompra
  684. oCEReporto.ValorTransado = Me.GetValorTransado
  685. oCEReporto.Dias = Me.GetDias
  686. oCEReporto.FechaVencimiento = Me.GetFechaVencimiento
  687. oCEReporto.Rendimiento = Me.GetRendimiento
  688. 'oCEReporto.Impuestos As Double
  689. oCEReporto.OtrosCostos = Me.GetOtrosCostos
  690. 'oCEReporto.TotalCostos = Me.GetTotalCostos
  691. oCEReporto.MontoALiquidar = Me.GetMontoALiquidar
  692. 'oCEReporto.InteresAGenerar = Me.GetInteresesAGenerar
  693. oCEReporto.CostoDeTransferencia = Me.GetCostoDeTransferencia
  694. 'oCEReporto.RendimientoNetoAntesDeImpuestos = Me.GetRendimientoNetoAntesDeImpuestos
  695. oCEReporto.ValorReCompra = Me.GetValorRecompra
  696. oCEReporto.ImpuestosLiquidacion = Me.GetISR
  697. 'oCEReporto.IngresoNeto = Me.GetIngresoNeto
  698. oCEReporto.ValorNeto = Me.GetValorNeto
  699. 'oCEReporto.RendimientoNetoDespuesDeImpuestos = Me.GetRendimientoNetoDespuesDeImpuestos
  700. Else
  701. Me.Close()
  702. End If
  703. End Sub
  704. Function RetornarObjeto()
  705. Return oCEReporto
  706. End Function
  707. Private Sub CargarRegistroBD()
  708. oCEReporto = New ReportosCE
  709. oDAOReportos = New ReportosDAO
  710. 'oDAOReportos.CargarRegistro(oCEReporto, TipoDocumento, IdDocumento)
  711. oCEReporto = oDAOReportos.CargarRegistro(CodigoInversion)
  712. Dim vCodigoCasa As String = oCEReporto.CodigoCasa
  713. Dim vNombre As String = oCEReporto.Nombre
  714. Dim vFechaDeCompra As Date = oCEReporto.FechaDeCompra
  715. Dim vValorTransado As Double = oCEReporto.ValorTransado
  716. Dim vDias As Integer = oCEReporto.Dias
  717. Dim vFechaVencimiento As Date = oCEReporto.FechaVencimiento
  718. Dim vRendimiento As Double = oCEReporto.Rendimiento
  719. Dim vImpuestos As Double = oCEReporto.Impuestos
  720. Dim vOtrosCostos As Double = oCEReporto.OtrosCostos
  721. Dim vTotalCostos As Double = oCEReporto.TotalCostos
  722. Dim vMontoALiquidar As Double = oCEReporto.MontoALiquidar
  723. Dim vInteresAGenerar As Double = oCEReporto.InteresAGenerar
  724. Dim vCostoDeTransferencia As Double = oCEReporto.CostoDeTransferencia
  725. Dim vRendimientoNetoAntesDeImpuestos As Double = oCEReporto.RendimientoNetoAntesDeImpuestos
  726. Dim vValorReCompra As Double = oCEReporto.ValorReCompra
  727. Dim vImpuestosLiquidacion As Double = oCEReporto.ImpuestosLiquidacion
  728. Dim vIngresoNeto As Double = oCEReporto.IngresoNeto
  729. Dim vValorNeto As Double = oCEReporto.ValorNeto
  730. Dim vRendimientoNetoDespuesDeImpuestos As Double = oCEReporto.RendimientoNetoDespuesDeImpuestos
  731. 'Me.cboCasaCorredora.SelectedValue = vCodigoCasa
  732. Me.txtCodigoTitulo.Text = vNombre
  733. Me.dtpFechaCompra.Value = vFechaDeCompra
  734. Me.txtValorTransado.Text = vValorTransado.ToString(Configuraciones.CodigoTXTMontos)
  735. Me.txtDias.Text = vDias
  736. Me.dtpFechaVencimiento.Value = vFechaVencimiento
  737. Me.txtRendimiento.Text = (vRendimiento / 100).ToString(Configuraciones.CodigoTXTPorcentaje)
  738. 'IMPUESTOS
  739. Me.txtOtrosCostos.Text = vOtrosCostos
  740. Me.txtTotalCostos.Text = vTotalCostos
  741. Me.txtMontoALiquidar.Text = vMontoALiquidar.ToString(Configuraciones.CodigoTXTMontos)
  742. Me.txtInteresesAGenerar.Text = vInteresAGenerar.ToString(Configuraciones.CodigoTXTMontos)
  743. Me.txtCostoDeTransferencia.Text = vCostoDeTransferencia.ToString(Configuraciones.CodigoTXTMontos)
  744. Me.txtRendimientoNetoAntesISR.Text = (vRendimientoNetoAntesDeImpuestos / 100).ToString(Configuraciones.CodigoTXTPorcentaje)
  745. Me.txtValorReCompra.Text = vValorReCompra.ToString(Configuraciones.CodigoTXTMontos)
  746. Me.txtISR.Text = vImpuestosLiquidacion.ToString(Configuraciones.CodigoTXTMontos)
  747. Me.txtIngresoNeto.Text = vIngresoNeto.ToString(Configuraciones.CodigoTXTMontos)
  748. Me.txtValorNeto.Text = vValorNeto.ToString(Configuraciones.CodigoTXTMontos)
  749. Me.txtRendimientoNetoDespuesISR.Text = (vRendimientoNetoDespuesDeImpuestos / 100).ToString(Configuraciones.CodigoTXTPorcentaje)
  750. End Sub
  751. Public Sub CargarRegistro(vId As Integer, vTipo As String)
  752. Modo = "C"
  753. IdDocumento = vId
  754. TipoDocumento = vTipo
  755. End Sub
  756. Private Sub cboCasaCorredora_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasaCorredora.SelectedIndexChanged
  757. End Sub
  758. Private Sub txtCodigoTitulo_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoTitulo.TextChanged
  759. End Sub
  760. Private Sub txtCodigoTitulo_LostFocus(sender As Object, e As EventArgs) Handles txtCodigoTitulo.LostFocus
  761. End Sub
  762. Private Sub Control_CodigoTitulo()
  763. Dim valor As String
  764. End Sub
  765. Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged
  766. End Sub
  767. Private Sub txtMontoALiquidar_TextChanged(sender As Object, e As EventArgs) Handles txtMontoALiquidar.TextChanged
  768. End Sub
  769. Private Sub txtRendimientoNetoAntesISR_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNetoAntesISR.TextChanged
  770. End Sub
  771. Private Sub txtValorReCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorReCompra.TextChanged
  772. End Sub
  773. Private Sub txtValorNeto_TextChanged(sender As Object, e As EventArgs) Handles txtValorNeto.TextChanged
  774. End Sub
  775. Private Sub txtRendimientoNetoDespuesISR_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNetoDespuesISR.TextChanged
  776. End Sub
  777. Public Sub CargarRegistro(ByVal vCodigoInversion As String)
  778. Modo = "C"
  779. Me.CodigoInversion = vCodigoInversion
  780. End Sub
  781. End Class