frmFOIN.vb 41 KB

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