frmFOIN.vb 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. Public Class frmFOIN
  2. Dim oCEFOIN As FondosDeInversionCE = New FondosDeInversionCE
  3. Dim oDAOGeneral As New DAOGeneral
  4. Dim FOIN As New FondoInversionDAO
  5. Dim EstadoBoton As String
  6. Dim Operaciones As New Operaciones
  7. Dim IndexBase As Integer = 0
  8. Dim TipoTransaccion As String = String.Empty
  9. Private Sub frmFOIN_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  10. CargarBase()
  11. CargarPeriodicidad()
  12. AgregarCampos()
  13. CargarRegistroPrincipal()
  14. CargarFilas()
  15. Rellenar()
  16. Calculos()
  17. ExisteInversion()
  18. ValidarExistencia()
  19. CargarTransladoNuevo()
  20. End Sub
  21. Sub ValidarExistencia()
  22. Dim General As New DAOGeneral
  23. Dim Codigo As String = Variables.Codigo
  24. Dim Tabla As String = String.Empty
  25. Tabla = "FINV"
  26. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  27. If (Existe) Then
  28. navNuevo.Enabled = False
  29. navModificar.Enabled = True
  30. navEliminar.Enabled = True
  31. Else
  32. navNuevo.Enabled = True
  33. navModificar.Enabled = False
  34. navEliminar.Enabled = False
  35. End If
  36. End Sub
  37. Function ExisteInversion()
  38. Dim Codigo As String = Variables.Codigo
  39. Dim TablaINV As String = "INV0"
  40. Dim TablaPINV As String = "PIN0"
  41. Dim General As New DAOGeneral
  42. Dim InvPro = Variables.InvPro
  43. If InvPro = "I" Then
  44. Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
  45. If INV0 Then
  46. navNuevo.Visible = True
  47. Return True
  48. Else
  49. navNuevo.Visible = False
  50. Return False
  51. End If
  52. End If
  53. If InvPro = "P" Then
  54. Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
  55. If PINV0 Then
  56. navNuevo.Visible = True
  57. Return True
  58. Else
  59. navNuevo.Visible = False
  60. Return False
  61. End If
  62. End If
  63. Return False
  64. End Function
  65. Sub CargarBase()
  66. If Me.cboAnioBase.Items.Count = 0 Or Me.cboAnioBase.Items.Count = 1 Then
  67. Me.cboAnioBase.DataSource = oDAOGeneral.ListaBase
  68. Me.cboAnioBase.DisplayMember = "Descripcion"
  69. Me.cboAnioBase.ValueMember = "Codigo"
  70. Me.cboAnioBase.SelectedIndex = 0
  71. End If
  72. End Sub
  73. Sub Rellenar()
  74. If (String.IsNullOrEmpty(txtValorNominal.Text.ToString)) Then
  75. txtValorNominal.Text = "0.0"
  76. End If
  77. If (String.IsNullOrEmpty(txtCuotasDeParticipacion.Text.ToString)) Then
  78. txtCuotasDeParticipacion.Text = "0.0"
  79. End If
  80. If (String.IsNullOrEmpty(txtValorDeParticipacion.Text.ToString)) Then
  81. txtValorDeParticipacion.Text = "0.0"
  82. End If
  83. If (String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%"))) Then
  84. txtPorcentajeComisionCasa.Text = "0.0%"
  85. End If
  86. If (String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%"))) Then
  87. txtPorcentajeComisionBolsa.Text = "0.0%"
  88. End If
  89. If (String.IsNullOrEmpty(txtComisionCasa.Text.ToString)) Then
  90. txtComisionCasa.Text = "0.0"
  91. End If
  92. If (String.IsNullOrEmpty(txtComisionBolsa.Text.ToString)) Then
  93. txtComisionBolsa.Text = "0.0"
  94. End If
  95. If (String.IsNullOrEmpty(txtValorTransado.Text.ToString)) Then
  96. txtValorTransado.Text = "0.0"
  97. End If
  98. If (String.IsNullOrEmpty(txtDiasLiq.Text.ToString)) Then
  99. txtDiasLiq.Text = "0.0"
  100. End If
  101. If (String.IsNullOrEmpty(txtRendimientoOfrecido.Text.ToString.Trim("%"))) Then
  102. txtRendimientoOfrecido.Text = "0.0%"
  103. End If
  104. If (String.IsNullOrEmpty(txtPlazo.Text.ToString)) Then
  105. txtPlazo.Text = "0.0"
  106. End If
  107. If (String.IsNullOrEmpty(txtDividendo.Text.ToString.Trim("%"))) Then
  108. txtDividendo.Text = "0.0%"
  109. End If
  110. End Sub
  111. Function CalcularFecha(ByVal FechaInicial As Date, ByVal DiaFijo As Integer)
  112. 'Declaracion de Variables'
  113. Dim Base As Integer = 0
  114. Dim Periodicidad As String = cboPeriodicidad.SelectedValue
  115. Dim TipoCalculo As String = String.Empty
  116. Dim FechaFinal As Date = Date.Today.Date
  117. 'Seleccion de Tipo de Calculo'
  118. If RadioButton1.Checked Then
  119. TipoCalculo = "FinMes"
  120. Else
  121. If RadioButton2.Checked Then
  122. TipoCalculo = "Mensual"
  123. End If
  124. End If
  125. IndexBase = cboAnioBase.SelectedIndex
  126. If (IndexBase = 0 Or IndexBase = 2) Then
  127. Base = 360
  128. If TipoCalculo = "FinMes" Then
  129. FechaFinal = Operaciones.FechaFinMes(FechaInicial, Periodicidad, Base)
  130. ElseIf TipoCalculo = "Mensual" Then
  131. FechaFinal = Operaciones.FechaMensual(FechaInicial, Periodicidad, TipoCalculo, 0, DiaFijo, Base)
  132. End If
  133. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  134. Base = 365
  135. If TipoCalculo = "FinMes" Then
  136. FechaFinal = Operaciones.FechaFinMes(FechaInicial, Periodicidad, Base)
  137. ElseIf TipoCalculo = "Mensual" Then
  138. FechaFinal = Operaciones.FechaMensual(FechaInicial, Periodicidad, TipoCalculo, 0, DiaFijo, Base)
  139. End If
  140. End If
  141. Return FechaFinal
  142. End Function
  143. Sub AgregarFecha()
  144. Dim Index As Integer = dgvIngresos.CurrentRow.Index
  145. Dim IndexAnterior As Integer = Index - 1
  146. Dim FechaAnterior As Date = Date.Today.Date
  147. Dim FechaActual As Date = Date.Today.Date
  148. Dim FechaLiquidacion As Date = dtpFechaLiquidacion.Value
  149. Dim DiaFijo As Integer = FechaLiquidacion.Day
  150. If Index > 0 Then
  151. FechaAnterior = Operaciones.ConvertirFecha(dgvIngresos.Rows(IndexAnterior).Cells("Fecha de Corte").Value.ToString)
  152. FechaActual = CalcularFecha(FechaAnterior, DiaFijo)
  153. dgvIngresos.Rows(Index).Cells("Fecha de Corte").Value = Format((FechaActual), "dd/MM/yyyy").ToString
  154. Else
  155. FechaActual = CalcularFecha(Operaciones.ConvertirFecha(FechaLiquidacion), DiaFijo)
  156. dgvIngresos.Rows(Index).Cells("Fecha de Corte").Value = Format(FechaActual, "dd/MM/yyyy").ToString
  157. End If
  158. End Sub
  159. Sub AgregarDias()
  160. Dim Index As Integer = dgvIngresos.CurrentRow.Index
  161. Dim IndexAnterior As Integer = Index - 1
  162. Dim FechaAnterior As String = String.Empty
  163. Dim FechaActual As String = String.Empty
  164. Dim FechaLiquidacion As Date = Format(dtpFechaLiquidacion.Value, "dd/MM/yyyy")
  165. Dim BaseIndex As Integer = cboAnioBase.SelectedIndex
  166. Dim BaseCalculo As Integer = 0
  167. Dim Meses As Integer = 0
  168. Dim TipoCalculo As String = String.Empty
  169. Dim DiasFinales As Integer = 0
  170. Dim CantidadDiasNormal360 As Integer = 0
  171. Dim CantidadDias360 As Integer = 0
  172. Dim Periodicidad As String = cboPeriodicidad.SelectedValue
  173. If Periodicidad = "M" Then
  174. Meses = 1
  175. ElseIf Periodicidad = "T" Then
  176. Meses = 3
  177. ElseIf Periodicidad = "S" Then
  178. Meses = 6
  179. ElseIf Periodicidad = "A" Then
  180. Meses = 12
  181. End If
  182. CantidadDiasNormal360 = Meses * 30
  183. If BaseIndex = 0 Or BaseIndex = 2 Then
  184. BaseCalculo = 360
  185. ElseIf BaseIndex = 1 Or BaseIndex = 3 Then
  186. BaseCalculo = 365
  187. End If
  188. If RadioButton1.Checked Then
  189. TipoCalculo = "FinMes"
  190. Else
  191. If RadioButton2.Checked Then
  192. TipoCalculo = "Mensual"
  193. End If
  194. End If
  195. If Index > 0 Then
  196. FechaAnterior = Operaciones.ConvertirFecha(dgvIngresos.Rows(IndexAnterior).Cells("Fecha de Corte").Value.ToString)
  197. FechaActual = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("Fecha de Corte").Value.ToString)
  198. If BaseCalculo = 360 Then
  199. If TipoCalculo = "FinMes" Then
  200. DiasFinales = Operaciones.Base360(FechaAnterior, FechaActual)
  201. ElseIf TipoCalculo = "Mensual" Then
  202. DiasFinales = CantidadDiasNormal360
  203. End If
  204. ElseIf BaseCalculo = 365 Then
  205. DiasFinales = Operaciones.Base365(FechaAnterior, FechaActual)
  206. End If
  207. Else
  208. 'Primera Fecha'
  209. FechaActual = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("Fecha de Corte").Value.ToString)
  210. If BaseCalculo = 360 Then
  211. If TipoCalculo = "FinMes" Then
  212. DiasFinales = Operaciones.Base360(FechaLiquidacion, FechaActual)
  213. ElseIf TipoCalculo = "Mensual" Then
  214. DiasFinales = CantidadDiasNormal360
  215. End If
  216. ElseIf BaseCalculo = 365 Then
  217. DiasFinales = Operaciones.Base365(FechaLiquidacion, FechaActual)
  218. End If
  219. End If
  220. dgvIngresos.Rows(Index).Cells("Dias").Value = DiasFinales
  221. End Sub
  222. Sub AgregarDividendo()
  223. Dim Index As Integer = dgvIngresos.CurrentRow.Index
  224. Dim Dividendo As String = String.Empty
  225. Dim DividendoAgregar As String = String.Empty
  226. Dim DividendoTexto As String = txtDividendo.Text.ToString.Trim("%")
  227. Dim NuevaFila As Boolean = False
  228. If dgvIngresos.Rows(Index).Cells("Dividendo").Value Is Nothing Then
  229. NuevaFila = True
  230. Else
  231. Dividendo = dgvIngresos.Rows(Index).Cells("Dividendo").Value.ToString
  232. End If
  233. If String.IsNullOrEmpty(Dividendo) Then
  234. If String.IsNullOrEmpty(DividendoTexto) Then
  235. DividendoAgregar = "0"
  236. Else
  237. DividendoAgregar = DividendoTexto
  238. End If
  239. dgvIngresos.Rows(Index).Cells("Dividendo").Value = (DividendoAgregar.ToString + "%")
  240. End If
  241. End Sub
  242. Sub AgregarIngreso()
  243. Dim Index As Integer = dgvIngresos.CurrentRow.Index
  244. Dim CuotasParticipacion As Double = 0
  245. Dim Dividendo As Double = 0
  246. Dim Dias As Integer = 0
  247. Dim Calculo As Double = 0
  248. If Index > 0 Then
  249. CuotasParticipacion = Operaciones.ConvertirDecimal(txtCuotasDeParticipacion.Text.ToString)
  250. If Not dgvIngresos.Rows(Index).Cells("Dividendo").Value Is Nothing Then
  251. Dividendo = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Dividendo").Value.ToString)
  252. End If
  253. Calculo = CuotasParticipacion * (Dividendo / 100)
  254. Else
  255. CuotasParticipacion = Operaciones.ConvertirDecimal(txtCuotasDeParticipacion.Text.ToString)
  256. If Not dgvIngresos.Rows(Index).Cells("Dividendo").Value Is Nothing Then
  257. Dividendo = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Dividendo").Value.ToString)
  258. End If
  259. If Not dgvIngresos.Rows(Index).Cells("Dias").Value Is Nothing Then
  260. Dias = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("Dias").Value)
  261. End If
  262. If Not Dias = 0 Then
  263. Dim FechaTemporal As Date = dtpFechaLiquidacion.Value.AddDays(1)
  264. If FechaTemporal.Month = dtpFechaLiquidacion.Value.Month Then
  265. Calculo = (((Dividendo / 100) * CuotasParticipacion) / Dias)
  266. Else
  267. Calculo = CuotasParticipacion * (Dividendo / 100)
  268. End If
  269. End If
  270. End If
  271. dgvIngresos.Rows(Index).Cells("Ingresos").Value = Calculo
  272. End Sub
  273. Sub AgregarRendimientos()
  274. Dim Index As Integer = dgvIngresos.CurrentRow.Index
  275. Dim ValorNominal As Double = 0
  276. Dim Dividendo As Double = 0
  277. Dim Dias As Integer = 0
  278. Dim Ingreso As Double = 0
  279. Dim Calculo As Double = 0
  280. Dim IndexBase As Integer = 0
  281. Dim BaseCalculo As Integer = 0
  282. If Not String.IsNullOrEmpty(txtValorNominal.Text.ToString) Then
  283. ValorNominal = txtValorNominal.Text
  284. End If
  285. If Not dgvIngresos.Rows(Index).Cells("Dividendo").Value Is Nothing Then
  286. Dividendo = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Dividendo").Value.ToString)
  287. End If
  288. If Not dgvIngresos.Rows(Index).Cells("Ingresos").Value Is Nothing Then
  289. Ingreso = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Ingresos").Value)
  290. End If
  291. If Not dgvIngresos.Rows(Index).Cells("Dias").Value Is Nothing Then
  292. Dias = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("Dias").Value)
  293. End If
  294. IndexBase = cboAnioBase.SelectedIndex
  295. If IndexBase = 0 Or IndexBase = 2 Then
  296. BaseCalculo = 360
  297. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  298. BaseCalculo = 365
  299. End If
  300. If Not Dias = 0 And Not ValorNominal = 0 And Not BaseCalculo = 0 Then
  301. Calculo = Ingreso / ValorNominal * BaseCalculo / Dias
  302. End If
  303. dgvIngresos.Rows(Index).Cells("Rendimiento Mensual").Value = (Calculo * 100).ToString + "%"
  304. End Sub
  305. Sub AgregarNumDiv()
  306. Dim Index As Integer = dgvIngresos.CurrentRow.Index
  307. Dim IndexAnterior As Integer = Index - 1
  308. Dim I_NumDivAnterior As Integer = 0
  309. Dim I_NumDivActual As Integer = 0
  310. Dim S_NumDivAnterior As String = String.Empty
  311. Dim S_NumDivActual As String = String.Empty
  312. S_NumDivActual = dgvIngresos.Rows(Index).Cells("NumDiv").Value
  313. I_NumDivActual = Operaciones.ConvertirEntero(S_NumDivActual)
  314. If Index > 0 Then
  315. S_NumDivAnterior = dgvIngresos.Rows(IndexAnterior).Cells("NumDiv").Value
  316. I_NumDivAnterior = Operaciones.ConvertirEntero(S_NumDivAnterior)
  317. If I_NumDivActual = 0 Then
  318. I_NumDivActual = I_NumDivAnterior + 1
  319. dgvIngresos.Rows(Index).Cells("NumDiv").Value = I_NumDivActual
  320. End If
  321. Else
  322. If I_NumDivActual = 0 Then
  323. I_NumDivActual = 1
  324. dgvIngresos.Rows(Index).Cells("NumDiv").Value = I_NumDivActual
  325. End If
  326. End If
  327. End Sub
  328. Sub AgregarCorrelativo()
  329. Dim Cantidad As Integer = dgvIngresos.Rows.Count - 2
  330. Dim Index As Integer = 0
  331. While Index <= Cantidad
  332. Dim Correlativo As Integer = Index + 1
  333. dgvIngresos.Rows(Index).Cells("correlativo").Value = Correlativo
  334. Index += 1
  335. End While
  336. End Sub
  337. Sub CalculosTabla()
  338. AgregarCorrelativo()
  339. AgregarFecha()
  340. AgregarDias()
  341. AgregarDividendo()
  342. AgregarIngreso()
  343. AgregarRendimientos()
  344. AgregarNumDiv()
  345. End Sub
  346. Sub CargarPeriodicidad()
  347. Me.cboPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad
  348. Me.cboPeriodicidad.DisplayMember = "Descripcion"
  349. Me.cboPeriodicidad.ValueMember = "Codigo"
  350. ' Me.cboPeriodicidad.SelectedIndex = -1
  351. End Sub
  352. Private Sub Calculos()
  353. Dim SCuotasDeParticipacion As String = String.Empty
  354. Dim SValorParticipacion As String = String.Empty
  355. Dim SValorNominal As String = String.Empty
  356. Dim SValorTransado As String = String.Empty
  357. Dim SDiasPlazo As String = String.Empty
  358. Dim SPorcentajeComisionCasa As String = String.Empty
  359. Dim SPorcentajeComisionBolsa As String = String.Empty
  360. Dim SComisionCasa As String = String.Empty
  361. Dim SComisionBolsa As String = String.Empty
  362. Dim SDiasLiquidos As String = String.Empty
  363. Dim ICuotasDeParticipacion As Double = 0
  364. Dim IValorParticipacion As Double = 0
  365. Dim IValorNominal As Double = 0
  366. Dim IValorTransado As Double = 0
  367. Dim FechaLiquidacion As Date = Date.Today.Date
  368. Dim FechaOperacion As Date = Date.Today.Date
  369. Dim FechaVencimiento As Date = Date.Today.Date
  370. Dim IDiasPlazo As Integer = 0
  371. Dim IPorcentajeComisionCasa As Double = 0
  372. Dim IPorcentajeComisionBolsa As Double = 0
  373. Dim IComisionCasa As Double = 0
  374. Dim IComisionBolsa As Double = 0
  375. Dim IDiasLiquidos As Integer = 0
  376. SDiasPlazo = txtPlazo.Text.ToString
  377. IDiasPlazo = Operaciones.ConvertirEntero(SDiasPlazo)
  378. SDiasLiquidos = txtDiasLiq.Text.ToString
  379. IDiasLiquidos = Operaciones.ConvertirEntero(SDiasLiquidos)
  380. SPorcentajeComisionCasa = txtPorcentajeComisionCasa.Text.ToString
  381. IPorcentajeComisionCasa = Operaciones.ConvertirDecimal(SPorcentajeComisionCasa) / 100
  382. SPorcentajeComisionBolsa = txtPorcentajeComisionBolsa.Text.ToString
  383. IPorcentajeComisionBolsa = Operaciones.ConvertirDecimal(SPorcentajeComisionBolsa) / 100
  384. SCuotasDeParticipacion = txtCuotasDeParticipacion.Text.ToString
  385. ICuotasDeParticipacion = Operaciones.ConvertirDecimal(SCuotasDeParticipacion)
  386. SValorParticipacion = txtValorDeParticipacion.Text.ToString
  387. IValorParticipacion = Operaciones.ConvertirDecimal(SValorParticipacion)
  388. FechaOperacion = dtpFechaOperacion.Value
  389. txtValorNominal.Text = oCEFOIN.CalculoValorNominal(ICuotasDeParticipacion, IValorParticipacion)
  390. SValorNominal = txtValorNominal.Text.ToString
  391. IValorNominal = Operaciones.ConvertirDecimal(SValorNominal)
  392. txtValorTransado.Text = IValorNominal
  393. IValorTransado = IValorNominal
  394. dtpFechaLiquidacion.Value = FechaOperacion
  395. dtpFechaLiquidacion.Value = oCEFOIN.CalculoFechaLiq(FechaOperacion, IDiasLiquidos)
  396. FechaLiquidacion = dtpFechaLiquidacion.Value
  397. txtComisionCasa.Text = CalculoComision(IPorcentajeComisionCasa, IValorTransado)
  398. txtComisionBolsa.Text = CalculoComision(IPorcentajeComisionBolsa, IValorTransado)
  399. IndexBase = cboAnioBase.SelectedIndex
  400. If (IndexBase = 0 Or IndexBase = 2) Then
  401. dtpFechaVencimiento.Value = Operaciones.FechaDias360(FechaLiquidacion, IDiasPlazo)
  402. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  403. dtpFechaVencimiento.Value = FechaLiquidacion.AddDays(IDiasPlazo)
  404. End If
  405. End Sub
  406. Function CalculoComision(ByVal PorcComision As Double, ByVal ValTra As Double)
  407. Return PorcComision * ValTra
  408. End Function
  409. Private Sub txtCuotasDeParticipacion_TextChanged(sender As Object, e As EventArgs) Handles txtCuotasDeParticipacion.TextChanged
  410. If Not Double.TryParse(txtCuotasDeParticipacion.Text, oCEFOIN.CuotasDeParticipacion) Then
  411. lblErrCuotasDeParticipacion.Visible = True
  412. Else
  413. lblErrCuotasDeParticipacion.Visible = False
  414. End If
  415. Calculos()
  416. End Sub
  417. Private Sub txtCuotasDeParticipacion_LostFocus(sender As Object, e As EventArgs) Handles txtCuotasDeParticipacion.LostFocus
  418. If Not Double.TryParse(txtCuotasDeParticipacion.Text, oCEFOIN.CuotasDeParticipacion) Then
  419. lblErrCuotasDeParticipacion.Visible = True
  420. Else
  421. lblErrCuotasDeParticipacion.Visible = False
  422. End If
  423. Me.txtCuotasDeParticipacion.Text = oCEFOIN.CuotasDeParticipacion.ToString()
  424. RefrescarValorControles()
  425. End Sub
  426. Private Sub txtValorDeParticipacion_TextChanged(sender As Object, e As EventArgs) Handles txtValorDeParticipacion.TextChanged
  427. If Not Double.TryParse(txtValorDeParticipacion.Text, oCEFOIN.ValorDeParticipacion) Then
  428. lblErrValorDeParticipacion.Visible = True
  429. Else
  430. lblErrValorDeParticipacion.Visible = False
  431. End If
  432. Calculos()
  433. End Sub
  434. Private Sub txtValorDeParticipacion_LostFocus(sender As Object, e As EventArgs) Handles txtValorDeParticipacion.LostFocus
  435. If Not Double.TryParse(txtValorDeParticipacion.Text, oCEFOIN.ValorDeParticipacion) Then
  436. lblErrValorDeParticipacion.Visible = True
  437. Else
  438. lblErrValorDeParticipacion.Visible = False
  439. End If
  440. Me.txtValorDeParticipacion.Text = oCEFOIN.ValorDeParticipacion.ToString()
  441. RefrescarValorControles()
  442. End Sub
  443. Sub RefrescarValorControles()
  444. Me.txtValorNominal.Text = oCEFOIN.ValorNominal.ToString()
  445. Me.txtComisionCasa.Text = oCEFOIN.ComisionCasa.ToString()
  446. Me.txtComisionBolsa.Text = oCEFOIN.ComisionBolsa.ToString()
  447. Me.txtValorTransado.Text = oCEFOIN.ValorTransado.ToString()
  448. End Sub
  449. Private Sub txtPorcentajeComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.TextChanged
  450. Dim valor As Double
  451. If (txtPorcentajeComisionCasa.ToString.IndexOf("%") = -1) Then
  452. txtPorcentajeComisionCasa.Text += "%"
  453. End If
  454. If Not Double.TryParse(Me.txtPorcentajeComisionCasa.Text.Replace("%", ""), valor) Then
  455. lblErrComisionCasa.Visible = True
  456. Else
  457. lblErrComisionCasa.Visible = False
  458. End If
  459. oCEFOIN.PorcentajeComisionCasa = valor / 100
  460. Calculos()
  461. End Sub
  462. Private Sub txtPorcentajeComisionCasa_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.LostFocus
  463. Me.txtPorcentajeComisionCasa.Text = oCEFOIN.PorcentajeComisionCasa.ToString(Configuraciones.CodigoTXTPorcentaje)
  464. RefrescarValorControles()
  465. End Sub
  466. Private Sub txtPorcentajeComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.TextChanged
  467. Dim valor As Double
  468. If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
  469. txtPorcentajeComisionBolsa.Text += "%"
  470. End If
  471. If Not Double.TryParse(Me.txtPorcentajeComisionBolsa.Text.Replace("%", ""), valor) Then
  472. lblErrComisionBolsa.Visible = True
  473. Else
  474. lblErrComisionBolsa.Visible = False
  475. End If
  476. oCEFOIN.PorcentajeComisionBolsa = valor / 100
  477. Calculos()
  478. End Sub
  479. Private Sub txtPorcentajeComisionBolsa_LostFocus(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.LostFocus
  480. Me.txtPorcentajeComisionBolsa.Text = oCEFOIN.PorcentajeComisionBolsa.ToString(Configuraciones.CodigoTXTPorcentaje)
  481. RefrescarValorControles()
  482. End Sub
  483. Private Sub dtpFechaOperacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacion.ValueChanged
  484. Calculos()
  485. End Sub
  486. Private Sub dtpFechaLiquidacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacion.ValueChanged
  487. oCEFOIN.FechaLiquidacion = dtpFechaLiquidacion.Value.Date
  488. End Sub
  489. Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged
  490. oCEFOIN.FechaVencimiento = dtpFechaVencimiento.Value.Date
  491. End Sub
  492. Private Sub txtRendimientoOfrecido_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoOfrecido.TextChanged
  493. Calculos()
  494. If (txtRendimientoOfrecido.ToString.IndexOf("%") = -1) Then
  495. txtRendimientoOfrecido.Text += "%"
  496. End If
  497. End Sub
  498. Private Sub txtRendimientoOfrecido_LostFocus(sender As Object, e As EventArgs) Handles txtRendimientoOfrecido.LostFocus
  499. End Sub
  500. Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodicidad.SelectedIndexChanged
  501. If Not TypeOf cboPeriodicidad.SelectedValue Is DataRowView Then
  502. If Not cboPeriodicidad.SelectedValue Is Nothing Then
  503. oCEFOIN.Periodicidad = cboPeriodicidad.SelectedValue.ToString
  504. End If
  505. End If
  506. End Sub
  507. Private Sub cboAnioBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBase.SelectedIndexChanged
  508. If Not TypeOf cboAnioBase.SelectedItem Is DataRowView Then
  509. oCEFOIN.AnioBase = cboAnioBase.SelectedItem
  510. End If
  511. End Sub
  512. Private Sub txtPlazo_TextChanged(sender As Object, e As EventArgs) Handles txtPlazo.TextChanged
  513. Calculos()
  514. End Sub
  515. Private Sub btnRefrescar_Click(sender As Object, e As EventArgs) Handles btnQuitar.Click
  516. QuitarFila()
  517. End Sub
  518. Private Sub txtDividendo_TextChanged(sender As Object, e As EventArgs)
  519. Calculos()
  520. End Sub
  521. Private Sub txtDividendo_LostFocus(sender As Object, e As EventArgs)
  522. End Sub
  523. Private Sub txtCuotasDeParticipacion_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCuotasDeParticipacion.KeyUp
  524. Calculos()
  525. End Sub
  526. Private Sub txtValorDeParticipacion_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorDeParticipacion.KeyUp
  527. Calculos()
  528. End Sub
  529. Private Sub txtDiasLiq_KeyUp(sender As Object, e As KeyEventArgs) Handles txtDiasLiq.KeyUp
  530. Calculos()
  531. End Sub
  532. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  533. TipoTransaccion = "M"
  534. btnAccion.Text = "Modificar"
  535. End Sub
  536. Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
  537. TipoTransaccion = "N"
  538. btnAccion.Text = "Nuevo"
  539. End Sub
  540. Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
  541. TipoTransaccion = "B"
  542. btnAccion.Text = "Eliminar"
  543. End Sub
  544. Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click
  545. Dim codigo As String = Variables.Codigo
  546. Dim Coleccion As Collection = ColeccionDatos()
  547. Dim Diccionario As Dictionary(Of String, Collection) = NuevoIngresoDiccionario()
  548. If (TipoTransaccion = "N") Then
  549. FOIN.ProcesoDatos(Coleccion, codigo, Diccionario, "Nuevo")
  550. ElseIf (TipoTransaccion = "M") Then
  551. FOIN.ProcesoDatos(Coleccion, codigo, Diccionario, "Modificar")
  552. ElseIf (TipoTransaccion = "B") Then
  553. Eliminar()
  554. ElseIf Not ExisteValidacion() Then
  555. Variables.ColeccionFINV = Coleccion
  556. Variables.ColeccionFINVDi = Diccionario
  557. Me.Close()
  558. End If
  559. End Sub
  560. Sub Eliminar()
  561. Dim codigo As String = Variables.Codigo
  562. FOIN.Eliminar(codigo)
  563. End Sub
  564. Function ExisteValidacion()
  565. Dim General As New DAOGeneral
  566. Dim Codigo As String = Variables.Codigo
  567. Dim Tabla As String = String.Empty
  568. Tabla = "FINV"
  569. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  570. Return Existe
  571. End Function
  572. Private Function NuevoIngresoDiccionario()
  573. Dim Diccionario As New Dictionary(Of String, Collection)
  574. Dim Cantidad As Integer = dgvIngresos.Rows.Count - 2
  575. Dim Index As Integer = 0
  576. While Index <= Cantidad
  577. Dim coleccion As New Collection
  578. Dim FechaCorte, Dias, Dividendo, Ingreso, RendMensual, NumDiv
  579. NumDiv = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("NumDiv").Value)
  580. FechaCorte = Operaciones.ConvertirFecha(dgvIngresos.Rows(Index).Cells("Fecha de Corte").Value)
  581. Dias = Operaciones.ConvertirEntero(dgvIngresos.Rows(Index).Cells("Dias").Value)
  582. Dividendo = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Dividendo").Value.ToString) / 100
  583. Ingreso = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Ingresos").Value)
  584. RendMensual = Operaciones.ConvertirDecimal(dgvIngresos.Rows(Index).Cells("Rendimiento Mensual").Value.ToString) / 100
  585. coleccion.Add(NumDiv)
  586. coleccion.Add(FechaCorte)
  587. coleccion.Add(Dias)
  588. coleccion.Add(Dividendo)
  589. coleccion.Add(Ingreso)
  590. coleccion.Add(RendMensual)
  591. Diccionario.Add(NumDiv, coleccion)
  592. Index += 1
  593. End While
  594. Return Diccionario
  595. End Function
  596. Private Function ColeccionDatos()
  597. Dim Coleccion As New Collection
  598. Dim TipoCalculo As String = Me.TipoCalculo
  599. Coleccion.Add(txtValorNominal.Text)
  600. Coleccion.Add(txtCuotasDeParticipacion.Text)
  601. Coleccion.Add(txtValorDeParticipacion.Text)
  602. Coleccion.Add((txtPorcentajeComisionCasa.Text.ToString.Trim("%")) / 100)
  603. Coleccion.Add((txtPorcentajeComisionBolsa.Text.ToString.Trim("%")) / 100)
  604. Coleccion.Add(txtComisionCasa.Text)
  605. Coleccion.Add(txtComisionBolsa.Text)
  606. Coleccion.Add(txtValorTransado.Text)
  607. Coleccion.Add(dtpFechaOperacion.Value)
  608. Coleccion.Add(dtpFechaLiquidacion.Value)
  609. Coleccion.Add(dtpFechaVencimiento.Value)
  610. Coleccion.Add(txtDiasLiq.Text)
  611. Coleccion.Add(CDec(txtRendimientoOfrecido.Text.ToString.Trim("%")) / 100)
  612. Coleccion.Add(cboPeriodicidad.SelectedValue)
  613. Coleccion.Add(cboAnioBase.SelectedIndex)
  614. Coleccion.Add(txtPlazo.Text)
  615. Coleccion.Add(txtDividendo.Text.ToString.Trim("%") / 100)
  616. Coleccion.Add(TipoCalculo)
  617. Return Coleccion
  618. End Function
  619. Function TipoCalculo()
  620. Dim TipCalculo As String = "FinMes"
  621. If RadioButton1.Checked Then
  622. TipCalculo = "FinMes"
  623. Else
  624. If RadioButton2.Checked Then
  625. TipCalculo = "Mensual"
  626. End If
  627. End If
  628. Return TipCalculo
  629. End Function
  630. Private Sub CargarRegistroPrincipal()
  631. Dim FONV As New FondoInversionDAO
  632. Dim Codigo As String = Variables.Codigo
  633. Dim Coleccion As Collection = FONV.Cargar(Codigo)
  634. Dim TipoOperacion As String = String.Empty
  635. If Not Coleccion.Count = 0 Then
  636. txtValorNominal.Text = Operaciones.ConvertirDecimal(Coleccion(1).ToString)
  637. txtCuotasDeParticipacion.Text = Operaciones.ConvertirDecimal(Coleccion(2).ToString)
  638. txtValorDeParticipacion.Text = Operaciones.ConvertirDecimal(Coleccion(3).ToString)
  639. txtPorcentajeComisionCasa.Text = Operaciones.ConvertirDecimal((Coleccion(4) * 100).ToString)
  640. txtPorcentajeComisionBolsa.Text = Operaciones.ConvertirDecimal((Coleccion(5) * 100).ToString)
  641. txtComisionCasa.Text = Operaciones.ConvertirDecimal(Coleccion(6).ToString)
  642. txtComisionBolsa.Text = Operaciones.ConvertirDecimal(Coleccion(7).ToString)
  643. txtValorTransado.Text = Operaciones.ConvertirDecimal(Coleccion(8).ToString)
  644. dtpFechaOperacion.Value = Operaciones.ConvertirFecha(Coleccion(9).ToString)
  645. dtpFechaLiquidacion.Value = Operaciones.ConvertirFecha(Coleccion(10).ToString)
  646. dtpFechaVencimiento.Value = Operaciones.ConvertirFecha(Coleccion(11))
  647. txtDiasLiq.Text = Operaciones.ConvertirEntero(Coleccion(12).ToString)
  648. txtRendimientoOfrecido.Text = Operaciones.ConvertirDecimal((Coleccion(13) * 100).ToString)
  649. cboPeriodicidad.SelectedValue = Coleccion(14).ToString
  650. cboAnioBase.SelectedIndex = Operaciones.ConvertirEntero(Coleccion(15).ToString)
  651. txtPlazo.Text = Operaciones.ConvertirEntero(Coleccion(16).ToString)
  652. txtDividendo.Text = Operaciones.ConvertirDecimal((Coleccion(17) * 100).ToString)
  653. TipoOperacion = Coleccion(18).ToString
  654. If TipoOperacion = "FinMes" Then
  655. RadioButton1.Checked = True
  656. Else
  657. If TipoOperacion = "Mensual" Then
  658. RadioButton2.Checked = True
  659. End If
  660. End If
  661. End If
  662. End Sub
  663. Sub CargarFilas()
  664. Dim FONV As New FondoInversionDAO
  665. Dim Codigo As String = Variables.Codigo
  666. Dim Tabla As DataTable = FONV.CargarFilas(Codigo)
  667. For Each rows As DataRow In Tabla.Rows
  668. Dim NumDiv As Integer = 0
  669. Dim Fecha As Date = Date.Today.Date
  670. Dim Dias As Integer = 0
  671. Dim Dividendo As String = String.Empty
  672. Dim Ingreso As Double = 0
  673. Dim Rend As String = String.Empty
  674. NumDiv = Operaciones.ConvertirEntero(rows("NumDiv").ToString)
  675. Fecha = Operaciones.ConvertirFecha(rows("Fecha").ToString)
  676. Dias = Operaciones.ConvertirEntero(rows("Dias").ToString)
  677. Dividendo = (Operaciones.ConvertirDecimal(rows("Dividendo").ToString) * 100).ToString + "%"
  678. Ingreso = Operaciones.ConvertirDecimal(rows("Ingreso").ToString)
  679. Rend = (Operaciones.ConvertirDecimal(rows("Rend").ToString) * 100).ToString + "%"
  680. dgvIngresos.Rows.Add("", Fecha, Dias, Dividendo, Ingreso, Rend, NumDiv)
  681. Next
  682. AgregarCorrelativo()
  683. End Sub
  684. Private Sub Button1_Click(sender As Object, e As EventArgs)
  685. End Sub
  686. Sub AgregarCampos()
  687. Dim CantidadColumnas As Integer = dgvIngresos.ColumnCount
  688. If CantidadColumnas = 0 Then
  689. Dim FechaCorte, Dias, Dividendo, Ingreso, RendMensual, correlativo, NumDiv As New DataGridViewTextBoxColumn
  690. correlativo.Name = "correlativo"
  691. FechaCorte.Name = "Fecha de Corte"
  692. Dias.Name = "Dias"
  693. Dividendo.Name = "Dividendo"
  694. Ingreso.Name = "Ingresos"
  695. RendMensual.Name = "Rendimiento Mensual"
  696. NumDiv.Name = "NumDiv"
  697. dgvIngresos.Columns.Add(correlativo)
  698. dgvIngresos.Columns.Add(FechaCorte)
  699. dgvIngresos.Columns.Add(Dias)
  700. dgvIngresos.Columns.Add(Dividendo)
  701. dgvIngresos.Columns.Add(Ingreso)
  702. dgvIngresos.Columns.Add(RendMensual)
  703. dgvIngresos.Columns.Add(NumDiv)
  704. End If
  705. End Sub
  706. Private Sub dgvIngresos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellContentClick
  707. End Sub
  708. Private Sub dgvIngresos_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvIngresos.CellMouseClick
  709. CalculosTabla()
  710. End Sub
  711. Private Sub dgvIngresos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresos.CellEndEdit
  712. End Sub
  713. Private Sub txtDiasLiq_TextChanged(sender As Object, e As EventArgs) Handles txtDiasLiq.TextChanged
  714. Rellenar()
  715. Calculos()
  716. End Sub
  717. Private Sub btnModificar_Click(sender As Object, e As EventArgs)
  718. End Sub
  719. Private Sub btnEliminar_Click(sender As Object, e As EventArgs)
  720. End Sub
  721. Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
  722. End Sub
  723. Private Sub btnRescate_Click(sender As Object, e As EventArgs)
  724. End Sub
  725. Private Sub txtCuotasDeParticipacion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCuotasDeParticipacion.KeyPress
  726. If String.IsNullOrEmpty(sender.Text) Then
  727. If e.KeyChar = "." Then
  728. sender.Text = "0"
  729. Exit Sub
  730. End If
  731. End If
  732. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  733. Operaciones.ValidarEntrada(sender, e, True)
  734. Else
  735. Operaciones.ValidarEntrada(sender, e, False)
  736. End If
  737. End Sub
  738. Private Sub txtValorDeParticipacion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorDeParticipacion.KeyPress
  739. If String.IsNullOrEmpty(sender.Text) Then
  740. If e.KeyChar = "." Then
  741. sender.Text = "0"
  742. Exit Sub
  743. End If
  744. End If
  745. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  746. Operaciones.ValidarEntrada(sender, e, True)
  747. Else
  748. Operaciones.ValidarEntrada(sender, e, False)
  749. End If
  750. End Sub
  751. Private Sub txtPorcentajeComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionCasa.KeyPress
  752. If String.IsNullOrEmpty(sender.Text) Then
  753. If e.KeyChar = "." Then
  754. sender.Text = "0"
  755. Exit Sub
  756. End If
  757. End If
  758. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  759. Operaciones.ValidarEntrada(sender, e, True)
  760. Else
  761. Operaciones.ValidarEntrada(sender, e, False)
  762. End If
  763. End Sub
  764. Private Sub txtPorcentajeComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionBolsa.KeyPress
  765. If String.IsNullOrEmpty(sender.Text) Then
  766. If e.KeyChar = "." Then
  767. sender.Text = "0"
  768. Exit Sub
  769. End If
  770. End If
  771. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  772. Operaciones.ValidarEntrada(sender, e, True)
  773. Else
  774. Operaciones.ValidarEntrada(sender, e, False)
  775. End If
  776. End Sub
  777. Private Sub txtDiasLiq_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDiasLiq.KeyPress
  778. If String.IsNullOrEmpty(sender.Text) Then
  779. If e.KeyChar = "." Then
  780. sender.Text = "0"
  781. Exit Sub
  782. End If
  783. End If
  784. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  785. Operaciones.ValidarEntrada(sender, e, True)
  786. Else
  787. Operaciones.ValidarEntrada(sender, e, False)
  788. End If
  789. End Sub
  790. Private Sub txtRendimientoOfrecido_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRendimientoOfrecido.KeyPress
  791. If String.IsNullOrEmpty(sender.Text) Then
  792. If e.KeyChar = "." Then
  793. sender.Text = "0"
  794. Exit Sub
  795. End If
  796. End If
  797. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  798. Operaciones.ValidarEntrada(sender, e, True)
  799. Else
  800. Operaciones.ValidarEntrada(sender, e, False)
  801. End If
  802. End Sub
  803. Private Sub txtPlazo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPlazo.KeyPress
  804. If String.IsNullOrEmpty(sender.Text) Then
  805. If e.KeyChar = "." Then
  806. sender.Text = "0"
  807. Exit Sub
  808. End If
  809. End If
  810. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  811. Operaciones.ValidarEntrada(sender, e, True)
  812. Else
  813. Operaciones.ValidarEntrada(sender, e, False)
  814. End If
  815. End Sub
  816. Private Sub GroupBox3_Enter(sender As Object, e As EventArgs) Handles GroupBox3.Enter
  817. End Sub
  818. Private Sub GroupBox2_Enter(sender As Object, e As EventArgs) Handles GroupBox2.Enter
  819. End Sub
  820. Private Sub dgvIngresos_Click(sender As Object, e As EventArgs) Handles dgvIngresos.Click
  821. End Sub
  822. Private Sub Button1_Click_1(sender As Object, e As EventArgs)
  823. End Sub
  824. Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs)
  825. End Sub
  826. Private Sub btnCancelat_Click(sender As Object, e As EventArgs) Handles btnCancelat.Click
  827. Me.Close()
  828. End Sub
  829. Sub QuitarFila()
  830. Dim CantidadFilas As Integer = dgvIngresos.Rows.Count - 1
  831. If CantidadFilas > 0 Then
  832. Dim result As Integer = MsgBox("¿Está seguro que desea eliminar la fila?", MsgBoxStyle.OkCancel)
  833. ' Test result.
  834. Dim codigo As String = Variables.Codigo
  835. Dim Numero As Integer = dgvIngresos.CurrentRow.Cells("NumDiv").Value
  836. If result = MsgBoxResult.Ok Then
  837. Try
  838. dgvIngresos.Rows.Remove(dgvIngresos.CurrentRow)
  839. FOIN.EliminarIngreso(codigo, Numero)
  840. Catch ex As Exception
  841. MsgBox("No ha seleccionado una fila")
  842. End Try
  843. End If
  844. Else
  845. MsgBox("Actualmente no tiene registros")
  846. End If
  847. End Sub
  848. Private Sub txtCuotasDeParticipacion_Leave(sender As Object, e As EventArgs) Handles txtCuotasDeParticipacion.Leave
  849. Rellenar()
  850. End Sub
  851. Private Sub txtValorDeParticipacion_Leave(sender As Object, e As EventArgs) Handles txtValorDeParticipacion.Leave
  852. Rellenar()
  853. End Sub
  854. Private Sub txtPorcentajeComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.Leave
  855. Rellenar()
  856. End Sub
  857. Private Sub txtPorcentajeComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.Leave
  858. Rellenar()
  859. End Sub
  860. Private Sub txtDiasLiq_Leave(sender As Object, e As EventArgs) Handles txtDiasLiq.Leave
  861. Rellenar()
  862. End Sub
  863. Private Sub txtRendimientoOfrecido_Leave(sender As Object, e As EventArgs) Handles txtRendimientoOfrecido.Leave
  864. Rellenar()
  865. End Sub
  866. Private Sub txtPlazo_Leave(sender As Object, e As EventArgs) Handles txtPlazo.Leave
  867. Rellenar()
  868. End Sub
  869. Private Sub txtDividendo_TextChanged_1(sender As Object, e As EventArgs) Handles txtDividendo.TextChanged
  870. If (txtDividendo.ToString.IndexOf("%") = -1) Then
  871. txtDividendo.Text += "%"
  872. End If
  873. Rellenar()
  874. End Sub
  875. Private Sub txtDividendo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDividendo.KeyPress
  876. If String.IsNullOrEmpty(sender.Text) Then
  877. If e.KeyChar = "." Then
  878. sender.Text = "0"
  879. Exit Sub
  880. End If
  881. End If
  882. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  883. Operaciones.ValidarEntrada(sender, e, True)
  884. Else
  885. Operaciones.ValidarEntrada(sender, e, False)
  886. End If
  887. End Sub
  888. Sub CargarTransladoNuevo()
  889. Dim Existe As Boolean = ExisteInversion()
  890. If Not RetCodigoInversionExiste And Not Existe Then
  891. txtRendimientoOfrecido.Text = Variables.RetRendimiento
  892. txtCuotasDeParticipacion.Text = Variables.RetCuotaParticipacionFINV
  893. txtValorDeParticipacion.Text = Variables.RetValorParticipacionFINV
  894. End If
  895. End Sub
  896. End Class