frmAcciones.vb 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998
  1. 
  2. Imports System.Data.OleDb
  3. Imports System.IO
  4. Public Class frmAcciones
  5. Private TipoOperacion As String
  6. Public Sub New()
  7. ' Esta llamada es exigida por el diseñador.
  8. InitializeComponent()
  9. ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
  10. End Sub
  11. Public Sub New(ByVal ConsTOperacion As String)
  12. ' Esta llamada es exigida por el diseñador.
  13. InitializeComponent()
  14. TOperacion(ConsTOperacion)
  15. TipoOperacion = ConsTOperacion
  16. ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
  17. End Sub
  18. Dim PorcentajeComisionBolsa_Compra As Double = 0.070625
  19. Dim PorcentajeComisionBolsa_Venta As Double = 0.0353125
  20. Dim Cargar As Boolean = True
  21. Dim PorcentajeComisionCasa_Compra As Double = 0.45
  22. Dim PorcentajeComisionCasa_Venta As Double = 0.4
  23. Dim Agregar As Boolean = False
  24. Dim PorcentajeLIOF As Double = 0.25
  25. Dim oAccionesCE As AccionesCE = New AccionesCE
  26. Dim oAccionesDAO As New AccionesDAO
  27. Dim oDAOGeneral As New DAOGeneral
  28. Dim Estado As String = ""
  29. Dim MostrarMensaje As Boolean = False
  30. Dim EditarDividendos As Boolean = False
  31. Dim EditarISR As Boolean = False
  32. Dim CambioCalculo = False
  33. Dim HabilitarBoton As Boolean = False
  34. Dim DobleClick As Boolean = False
  35. Dim Operaciones As New Operaciones
  36. Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
  37. Dim Cargado As Boolean = False
  38. Dim Cierre As Boolean = False
  39. Dim DatosCargados As Boolean = False
  40. Private _Modo As String
  41. Private _IdDocumento As Integer
  42. Private _TipoDocumento As String
  43. Private _CodigoInversion As String
  44. Private _TipoTransaccion As String
  45. Public Property TipoTransaccion As String
  46. Get
  47. Return _TipoTransaccion
  48. End Get
  49. Set(value As String)
  50. _TipoTransaccion = value
  51. End Set
  52. End Property
  53. Private Property IdDocumento As Integer
  54. Get
  55. Return _IdDocumento
  56. End Get
  57. Set(value As Integer)
  58. _IdDocumento = value
  59. End Set
  60. End Property
  61. Private Property TipoDocumento As String
  62. Get
  63. Return _TipoDocumento
  64. End Get
  65. Set(value As String)
  66. _TipoDocumento = value
  67. End Set
  68. End Property
  69. Private Property CodigoInversion As String
  70. Get
  71. Return _CodigoInversion
  72. End Get
  73. Set(value As String)
  74. _CodigoInversion = value
  75. End Set
  76. End Property
  77. Sub Instrumento()
  78. If (InstrumentoFinanciero = "ACCNC") Then
  79. lblTitulo.Text = "Acciones Nacionales Comunes"
  80. Me.Text = "Acciones Nacionales Comunes"
  81. ElseIf (InstrumentoFinanciero = "ACCNP") Then
  82. lblTitulo.Text = "Acciones Preferentes Nacionales"
  83. ModificacionesPreferentes()
  84. Me.Text = "Acciones Preferentes Nacionales"
  85. ElseIf (InstrumentoFinanciero = "ACCI") Then
  86. lblTitulo.Text = "Acciones Internacionales"
  87. Me.Text = "Acciones Internacionales"
  88. End If
  89. End Sub
  90. Function ColeccionDatos()
  91. Dim coleccion As New Collection
  92. Dim PrecioLimpioC, FOperC, FLiqC, DiasTC, GCapTotC, GCapUnC, RetAnBrC, RetAnNetC, UnC, ValTransC, MontoNetoC, PrecSucioC
  93. Dim PrecioLimpioV, FOperV, FLiqV, DiasTV, GCapTotV, GCapUnV, RetAnBrV, RetAnNetV, UnV, ValTransV, MontoNetoV, PrecSucioV
  94. Dim ComisionCompraCasa, ComisionCompraBolsa, ComisionVentaCasa, ComisionVentaBolsa As Double
  95. Dim IOF, Renta, Tipo, RetornoBruto, RetornoNeto
  96. Dim ComisionCompraCasaValor, ComisionCompraBolsaValor, ComisionVentaCasaValor, ComisionVentaBolsaValor As Double
  97. PrecioLimpioC = txtPrecioLimpioCompra.Text.Trim("%")
  98. FOperC = dtpFechaOperacionCompra.Value
  99. FLiqC = dtpFechaVencimientoCompra.Value
  100. DiasTC = txtDiasDeTenenciaCompra.Text.Trim("%")
  101. GCapTotC = txtGananciaCapitalTotalCompra.Text.Trim("%")
  102. GCapUnC = txtGananciaCapitalUnitarioCompra.Text.Trim("%")
  103. RetAnNetC = txtRetornoAnualNetoCompra.Text.Trim("%")
  104. UnC = txtUnidadesCompra.Text.Trim("%")
  105. ValTransC = txtValorTransadoCompra.Text.Trim("%")
  106. MontoNetoC = txtMontoNetoCompra.Text.Trim("%")
  107. PrecSucioC = txtPrecioSucioCompra.Text.Trim("%")
  108. PrecioLimpioV = txtPrecioLimpioVenta.Text.Trim("%")
  109. FOperV = dtpFechaOperacionVenta.Value
  110. FLiqV = dtpFechaVencimientoVenta.Value
  111. DiasTV = txtDiasDeTenenciaVenta.Text.Trim("%")
  112. GCapTotV = txtGananciaCapitalTotalVenta.Text.Trim("%")
  113. GCapUnV = txtGananciaCapitalUnitarioVenta.Text.Trim("%")
  114. RetAnBrV = txtRetornoAnualBrutoVenta.Text.Trim("%")
  115. RetAnNetV = txtRetornoAnualNetoVenta.Text.Trim("%")
  116. UnV = txtUnidadesVenta.Text.Trim("%")
  117. ValTransV = txtValorTransadoVenta.Text.Trim("%")
  118. MontoNetoV = txtMontoNetoVenta.Text.Trim("%")
  119. PrecSucioV = txtPrecioSucioVenta.Text.Trim("%")
  120. ComisionCompraCasa = txtComisionPorcentajeCasaCompra.Text.Trim("%") / 100
  121. ComisionCompraBolsa = txtComisionPorcentajeBolsaCompra.Text.Trim("%") / 100
  122. ComisionVentaCasa = txtComisionPorcentajeCasaVenta.Text.Trim("%") / 100
  123. ComisionVentaBolsa = txtComisionPorcentajeBolsaVenta.Text.Trim("%") / 100
  124. ComisionCompraCasaValor = txtComisionCasaCompra.Text
  125. ComisionCompraBolsaValor = txtComisionBolsaCompra.Text
  126. ComisionVentaCasaValor = txtComisionCasaVenta.Text
  127. ComisionVentaBolsaValor = txtComisionBolsaVenta.Text
  128. If (Not String.IsNullOrEmpty(txtRetornoAnualBrutoCompra.Text.ToString.ToString.Trim("%"))) Then
  129. RetornoBruto = txtRetornoAnualBrutoCompra.Text.Trim("%") / 100
  130. Else
  131. RetornoBruto = 0
  132. End If
  133. If (ChkIOF.Checked) Then
  134. IOF = 1
  135. Else
  136. IOF = 0
  137. End If
  138. If (ChkRenta.Checked) Then
  139. Renta = 1
  140. Else
  141. Renta = 0
  142. End If
  143. If rdbPorcentaje.Checked Then
  144. Tipo = "Porcentaje"
  145. Else
  146. Tipo = "Efectivo"
  147. End If
  148. coleccion.Add(PrecioLimpioC)
  149. coleccion.Add(FOperC)
  150. coleccion.Add(FLiqC)
  151. coleccion.Add(DiasTC)
  152. coleccion.Add(GCapTotC)
  153. coleccion.Add(GCapUnC)
  154. coleccion.Add(RetornoBruto)
  155. coleccion.Add(RetAnNetC)
  156. coleccion.Add(UnC)
  157. coleccion.Add(ValTransC)
  158. coleccion.Add(MontoNetoC)
  159. coleccion.Add(PrecSucioC)
  160. coleccion.Add(PrecioLimpioV)
  161. coleccion.Add(FOperV)
  162. coleccion.Add(FLiqV)
  163. coleccion.Add(DiasTV)
  164. coleccion.Add(GCapTotV)
  165. coleccion.Add(GCapUnV)
  166. coleccion.Add(RetAnBrV)
  167. coleccion.Add(RetAnNetV)
  168. coleccion.Add(UnV)
  169. coleccion.Add(ValTransV)
  170. coleccion.Add(MontoNetoV)
  171. coleccion.Add(PrecSucioV)
  172. coleccion.Add(ComisionCompraCasa)
  173. coleccion.Add(ComisionCompraBolsa)
  174. coleccion.Add(ComisionVentaCasa)
  175. coleccion.Add(ComisionVentaBolsa)
  176. coleccion.Add(IOF)
  177. coleccion.Add(Renta)
  178. coleccion.Add(Tipo)
  179. coleccion.Add(ComisionCompraCasaValor)
  180. coleccion.Add(ComisionCompraBolsaValor)
  181. coleccion.Add(ComisionVentaCasaValor)
  182. coleccion.Add(ComisionVentaBolsaValor)
  183. Return coleccion
  184. End Function
  185. Function Correlativo()
  186. Dim Index As Integer = 0
  187. Dim IndexCantidad As Integer = dgvDividendos.Rows.Count - 2
  188. Dim NumeroMayor As Integer = 0
  189. While Index <= IndexCantidad
  190. Dim Numero As Integer = dgvDividendos.Rows(Index).Cells("NumDiv").Value
  191. If Numero > NumeroMayor Then
  192. NumeroMayor = Numero
  193. End If
  194. Index += 1
  195. End While
  196. Return NumeroMayor + 1
  197. End Function
  198. Sub CorrelativoSinBD()
  199. Dim Index As Integer = 0
  200. Dim IndexCantidad As Integer = dgvDividendos.Rows.Count - 2
  201. Dim NumeroMayor As Integer = 0
  202. While Index <= IndexCantidad
  203. dgvDividendos.Rows(Index).Cells("Correlativo").Value = Index + 1
  204. Index += 1
  205. End While
  206. End Sub
  207. Function ColeccionesElementos(ByVal Index As Integer)
  208. Dim coleccion As New Collection
  209. Dim Fecha, Estado, Dividendo, CantidadBase, IngresoBruto, PorcISR, ISR, IngresoNeto, Correlativo, Tipo, FechaInicio, FechaCorte
  210. If rdbPorcentaje.Checked Then
  211. Tipo = "Porcentaje"
  212. Else
  213. Tipo = "Efectivo"
  214. End If
  215. Fecha = CDate(dgvDividendos.Rows(Index).Cells("Fecha").Value)
  216. Dividendo = dgvDividendos.Rows(Index).Cells("Dividendo").Value.ToString.Trim("%")
  217. If (Tipo = "Porcentaje") Then
  218. Dividendo /= 100
  219. End If
  220. CantidadBase = dgvDividendos.Rows(Index).Cells("CantidadBase").Value.ToString.TrimEnd("%")
  221. IngresoBruto = dgvDividendos.Rows(Index).Cells("IngresoBruto").Value.ToString.TrimEnd("%")
  222. PorcISR = dgvDividendos.Rows(Index).Cells("PorcISR").Value.ToString.TrimEnd("%")
  223. ISR = dgvDividendos.Rows(Index).Cells("ISR").Value.ToString.TrimEnd("%")
  224. IngresoNeto = dgvDividendos.Rows(Index).Cells("IngresoNeto").Value.ToString.TrimEnd("%")
  225. Estado = "A"
  226. Correlativo = dgvDividendos.Rows(Index).Cells("NumDiv").Value.ToString.TrimEnd("%")
  227. FechaInicio = dgvDividendos.Rows(Index).Cells("FechaInicio").Value
  228. FechaCorte = dgvDividendos.Rows(Index).Cells("FechaCorte").Value
  229. If (Tipo = "Porcentaje") Then
  230. If FechaInicio Is DBNull.Value Or FechaCorte Is DBNull.Value Then
  231. MsgBox("Verifique las fechas")
  232. Exit Function
  233. Else
  234. If (String.IsNullOrEmpty(FechaInicio) Or String.IsNullOrEmpty(FechaCorte)) Then
  235. MsgBox("Verifique las fechas")
  236. Exit Function
  237. End If
  238. End If
  239. End If
  240. coleccion.Add(Fecha)
  241. coleccion.Add(CDec(Dividendo))
  242. coleccion.Add(CDec(CantidadBase))
  243. coleccion.Add(CDec(IngresoBruto))
  244. coleccion.Add(CDec(PorcISR))
  245. coleccion.Add(CDec(ISR))
  246. coleccion.Add(CDec(IngresoNeto))
  247. coleccion.Add(Estado)
  248. coleccion.Add(CInt(Correlativo))
  249. coleccion.Add(FechaInicio)
  250. coleccion.Add(FechaCorte)
  251. Return coleccion
  252. End Function
  253. Sub NuevoElementoAccion(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer)
  254. Dim Codigo As String = Variables.Codigo
  255. Dim i As Integer = 0
  256. Dim Index = dgvDividendos.Rows.Count - 2
  257. i = Cantidad
  258. While i <= Index
  259. Dim coleccion = ColeccionesElementos(i)
  260. If (oAccionesDAO.NuevoElementoAccion(Codigo, coleccion) Is Nothing) Then
  261. Exit Sub
  262. End If
  263. i += 1
  264. End While
  265. MsgBox("Registro de ingresos actualizados")
  266. End Sub
  267. Function CanRegistros()
  268. Dim Tabla As String = String.Empty
  269. Tabla = "ACC1"
  270. Dim Codigo = Variables.Codigo
  271. Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
  272. Return Cantidad
  273. End Function
  274. Sub ModificarElementoAccion()
  275. Dim i As Integer = 0
  276. Dim CantidadRegistrosDB = CanRegistros()
  277. While i < CantidadRegistrosDB
  278. Dim coleccion = ColeccionesElementos(i)
  279. If oAccionesDAO.ModificarElementoAccion(Codigo, coleccion) Is Nothing Then
  280. Exit Sub
  281. End If
  282. i += 1
  283. End While
  284. NuevoElementoAccion(True, CantidadRegistrosDB)
  285. End Sub
  286. Function ColeccionNuevo(ByVal codigo As String)
  287. Dim i As Integer = 0
  288. Dim diccionario As New Dictionary(Of String, Collection)
  289. Dim Index = dgvDividendos.Rows.Count - 2
  290. While i <= Index
  291. Dim coleccion = ColeccionesElementos(i)
  292. diccionario.Add(i, coleccion)
  293. i += 1
  294. End While
  295. Return diccionario
  296. End Function
  297. Public Function NuevaAccion()
  298. Dim Coleccion = ColeccionDatos()
  299. Return Coleccion
  300. End Function
  301. Sub Eliminar()
  302. Dim Codigo = Variables.Codigo
  303. oAccionesDAO.Eliminar(Codigo)
  304. End Sub
  305. Sub ModificacionesPreferentes()
  306. GrpVenta.Visible = False
  307. txtRetornoAnualBrutoCompra.Visible = True
  308. txtRetornoAnualBrutoCompra.ReadOnly = False
  309. txtRetornoAnualBrutoCompra.Text = "0.0"
  310. Label19.Visible = False
  311. End Sub
  312. Sub Redimencionar()
  313. dgvDividendos.Width = Me.Width - 10
  314. dgvDividendos.Height = Me.Height - 50
  315. End Sub
  316. Private Sub frmAcciones_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  317. Dim VExisteInversion As Boolean = False
  318. VExisteInversion = ExisteInversion()
  319. If VExisteInversion Then
  320. TipoOperacion = "C"
  321. TipoTransaccion = "C"
  322. Else
  323. TipoOperacion = String.Empty
  324. TipoTransaccion = String.Empty
  325. End If
  326. If Variables.TipoOperacionCMVTA = "C" Then
  327. GrpVenta.Enabled = False
  328. GrpCompra.Enabled = True
  329. Else
  330. GrpVenta.Enabled = True
  331. GrpCompra.Enabled = False
  332. End If
  333. Call Instrumento()
  334. HabilitarBotones()
  335. PrepararTablaDividendos()
  336. If VExisteInversion Then
  337. TipoOperacion = "C"
  338. TipoTransaccion = "C"
  339. Else
  340. TipoOperacion = String.Empty
  341. TipoTransaccion = String.Empty
  342. End If
  343. If TipoTransaccion = "C" Then
  344. Call CargarRegistroBD()
  345. Formato()
  346. ValidarRentaIOF()
  347. CargarDividendos()
  348. End If
  349. ModificarDividendo()
  350. CalcularDividendos()
  351. Cargado = True
  352. ValidarExistencia()
  353. Formato()
  354. DatosCargados = True
  355. CargarTransladoNuevo()
  356. ConfiguracionCMVTA(VExisteInversion)
  357. End Sub
  358. Sub ConfiguracionCMVTA(ByRef VExisteInversion As Boolean)
  359. Dim Codigo As String = Variables.Codigo
  360. Dim ExisteCMVTA As Boolean = oDAOGeneral.ExisteCMVTA(Codigo)
  361. If Not ExisteCMVTA And Variables.InvocadorProInv = "frmINV" Then
  362. btnVenderTitulo.Visible = True
  363. End If
  364. If CantFormAbierto = False And Not VExisteInversion Then
  365. If Not Variables.TrasladarCMVTA Is Nothing Then
  366. dtpFechaOperacionCompra.Value = Variables.TrasladarCMVTA.FechaOperacionACC
  367. dtpFechaVencimientoCompra.Value = Variables.TrasladarCMVTA.FechaVencimientoACC
  368. txtPrecioLimpioCompra.Text = Variables.TrasladarCMVTA.PrecioLimpioACC
  369. txtUnidadesCompra.Text = Variables.TrasladarCMVTA.UnidadesACC
  370. txtComisionPorcentajeCasaCompra.Text = Variables.TrasladarCMVTA.PorcentajeCasaACC
  371. txtComisionPorcentajeBolsaCompra.Text = Variables.TrasladarCMVTA.PorcentajeBolsaACC
  372. End If
  373. End If
  374. End Sub
  375. Function ExisteInversion()
  376. Dim Codigo As String = Variables.Codigo
  377. Dim TablaINV As String = "INV0"
  378. Dim TablaPINV As String = "PIN0"
  379. Dim General As New DAOGeneral
  380. Dim InvPro = Variables.InvPro
  381. If InvPro = "I" Then
  382. Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
  383. If INV0 Then
  384. navNuevo.Visible = True
  385. Return True
  386. Else
  387. navNuevo.Visible = False
  388. Return False
  389. End If
  390. End If
  391. If InvPro = "P" Then
  392. Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
  393. If PINV0 Then
  394. navNuevo.Visible = True
  395. Return True
  396. Else
  397. navNuevo.Visible = False
  398. Return False
  399. End If
  400. End If
  401. Return False
  402. End Function
  403. Sub ModificarDividendo()
  404. Dim Cantidad As Integer = dgvDividendos.Rows.Count - 2
  405. For i As Integer = 0 To Cantidad
  406. If rdbPorcentaje.Checked Then
  407. dgvDividendos.Rows(i).Cells("Dividendo").Value *= 100
  408. End If
  409. Next
  410. End Sub
  411. Private Sub chkAccionPreferente_CheckedChanged(sender As Object, e As EventArgs)
  412. End Sub
  413. Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
  414. Dim codigo As String = Variables.Codigo
  415. Dim Accion As Collection = NuevaAccion()
  416. Dim ElementosAccion As Dictionary(Of String, Collection) = ColeccionNuevo(codigo)
  417. If (Estado = "N") Then
  418. oAccionesDAO.ProcesoDatos(Accion, codigo, ElementosAccion, "Nuevo")
  419. ElseIf Not ExisteValidacion() Then
  420. Variables.ColeccionACC = NuevaAccion()
  421. Me.Close()
  422. End If
  423. If Estado = "M" Then
  424. oAccionesDAO.ProcesoDatos(Accion, codigo, ElementosAccion, "Modificar")
  425. End If
  426. If Estado = "B" Then
  427. Eliminar()
  428. End If
  429. ValidarExistencia()
  430. End Sub
  431. Sub ValidarExistencia()
  432. Dim General As New DAOGeneral
  433. Dim Codigo As String = Variables.Codigo
  434. Dim Tabla As String = String.Empty
  435. Tabla = "ACC0"
  436. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  437. If (Existe) Then
  438. navNuevo.Enabled = False
  439. TbDividendos.Enabled = True
  440. navModificar.Enabled = True
  441. navEliminar.Enabled = True
  442. Else
  443. navNuevo.Enabled = True
  444. TbDividendos.Enabled = False
  445. navModificar.Enabled = False
  446. navEliminar.Enabled = False
  447. DatosCargados = True
  448. End If
  449. TipoTransaccion = String.Empty
  450. btnAceptar.Text = "Aceptar"
  451. End Sub
  452. Function ExisteValidacion()
  453. Dim General As New DAOGeneral
  454. Dim Codigo As String = Variables.Codigo
  455. Dim Tabla As String = String.Empty
  456. Tabla = "ACC0"
  457. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  458. Return Existe
  459. End Function
  460. Public Function RetornarObjeto()
  461. Return oAccionesCE
  462. End Function
  463. Private Sub CargarRegistroBD()
  464. oAccionesCE = Nothing
  465. CodigoInversion = Variables.Codigo
  466. oAccionesCE = oAccionesDAO.CargarRegistro(Me.CodigoInversion)
  467. TipoTransaccion = "C"
  468. RefrescarValorControlesInicial()
  469. End Sub
  470. Public Sub CargarRegistro(vId As Integer, vTipo As String)
  471. TipoTransaccion = "C"
  472. IdDocumento = vId
  473. TipoDocumento = vTipo
  474. End Sub
  475. Public Sub CargarRegistro(ByRef vCodigoInversion As String)
  476. TipoTransaccion = "C"
  477. Me.CodigoInversion = vCodigoInversion
  478. End Sub
  479. Private Sub txtDiasDeTenencia_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtDiasDeTenenciaCompra.TextChanged
  480. End Sub
  481. Private Sub txtGananciaCapitalTotal_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalTotalCompra.TextChanged
  482. End Sub
  483. Private Sub txtGananciaCapitalUnitario_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalUnitarioCompra.TextChanged
  484. End Sub
  485. Private Sub txtRetornoAnualBruto_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualBrutoCompra.TextChanged
  486. If (txtRetornoAnualBrutoCompra.ToString.IndexOf("%") = -1) Then
  487. txtRetornoAnualBrutoCompra.Text += "%"
  488. End If
  489. If (String.IsNullOrEmpty(txtRetornoAnualBrutoCompra.Text.ToString.Trim("%"))) Then
  490. txtRetornoAnualBrutoCompra.Text = "0.0%"
  491. End If
  492. End Sub
  493. Private Sub txtRetornoAnualNeto_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualNetoCompra.TextChanged
  494. End Sub
  495. Private Sub cboCasa_C_SelectedIndexChanged(sender As Object, e As EventArgs)
  496. End Sub
  497. Private Sub txtPrecioSucio_Compra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioCompra.TextChanged
  498. End Sub
  499. Private Sub txtGananciaCapitalUnitario_Venta_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalUnitarioVenta.TextChanged
  500. End Sub
  501. Private Sub txtRetornoAnualBruto_Venta_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualBrutoVenta.TextChanged
  502. End Sub
  503. Private Sub txtRetornoAnualNeto_Venta_TextChanged(sender As Object, e As EventArgs) Handles txtRetornoAnualNetoVenta.TextChanged
  504. End Sub
  505. Private Sub cboCasa_V_SelectedIndexChanged(sender As Object, e As EventArgs)
  506. End Sub
  507. '********** CONTROL DE VALORES **********
  508. 'COMPRA
  509. Private Sub ControlPrecioLimpioCompra()
  510. If DatosCargados Then
  511. Dim valor As Double = 0
  512. If Not Double.TryParse(Me.txtPrecioLimpioCompra.Text, valor) Then
  513. oAccionesCE.PrecioLimpioVenta = "0.0"
  514. Else
  515. oAccionesCE.PrecioLimpioCompra = valor
  516. Me.txtPrecioLimpioCompra.BackColor = Color.White
  517. If (Me.TipoTransaccion = "N") Then
  518. oAccionesCE.PrecioLimpioVenta = oAccionesCE.PrecioLimpioCompra
  519. End If
  520. RefrescarValorControles()
  521. End If
  522. End If
  523. End Sub
  524. Private Sub ControlFechaOperacionCompra()
  525. oAccionesCE.FechaOperacionCompra = Me.dtpFechaOperacionCompra.Value.Date
  526. RefrescarValorControles()
  527. End Sub
  528. Private Sub ControlFechaLiquidacionCompra()
  529. oAccionesCE.FechaVencimientoCompra = Me.dtpFechaVencimientoCompra.Value.Date
  530. RefrescarValorControles()
  531. End Sub
  532. Private Sub ControlCantidadCompra()
  533. Dim valor As Integer = 0
  534. If Not Integer.TryParse(Me.txtUnidadesCompra.Text, valor) Then
  535. oAccionesCE.CantidadCompra = "0"
  536. Else
  537. Me.txtUnidadesCompra.BackColor = Color.White
  538. oAccionesCE.CantidadCompra = valor
  539. If (Me.TipoTransaccion = "N" Or TipoTransaccion = "A") Then
  540. oAccionesCE.CantidadVenta = oAccionesCE.CantidadCompra
  541. End If
  542. RefrescarValorControles()
  543. End If
  544. End Sub
  545. 'VENTA
  546. Private Sub ControlPrecioLimpioVenta()
  547. If DatosCargados Then
  548. Dim valor As Double
  549. If Not Double.TryParse(Me.txtPrecioLimpioVenta.Text, valor) Then
  550. oAccionesCE.PrecioLimpioVenta = "0.0"
  551. Else
  552. Me.txtPrecioLimpioVenta.BackColor = Color.White
  553. oAccionesCE.PrecioLimpioVenta = valor
  554. End If
  555. RefrescarValorControles()
  556. End If
  557. End Sub
  558. Private Sub ControlFechaOperacionVenta()
  559. oAccionesCE.FechaOperacionVenta = dtpFechaOperacionVenta.Value.Date
  560. RefrescarValorControles()
  561. End Sub
  562. Private Sub ControlFechaLiquidacionVenta()
  563. oAccionesCE.FechaVencimientoVenta = dtpFechaVencimientoVenta.Value.Date
  564. RefrescarValorControles()
  565. End Sub
  566. Private Sub ControlCantidadVenta()
  567. Dim valor As Integer
  568. If Not Integer.TryParse(Me.txtUnidadesVenta.Text, valor) Then
  569. Me.txtUnidadesVenta.Text = "0"
  570. oAccionesCE.CantidadVenta = "0"
  571. Else
  572. Me.txtUnidadesVenta.BackColor = Color.White
  573. oAccionesCE.CantidadVenta = valor
  574. End If
  575. RefrescarValorControles()
  576. End Sub
  577. '********** FIN CONTROL DE VALORES **********
  578. '********** EVENTOS DE CONTROLES **********
  579. 'COMPRA
  580. Private Sub txtPrecioLimpioCompra_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.TextChanged
  581. ControlPrecioLimpioCompra()
  582. End Sub
  583. Private Sub txtPrecioLimpioCompra_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.LostFocus
  584. ControlPrecioLimpioCompra()
  585. End Sub
  586. Private Sub dtpFechaOperacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacionCompra.ValueChanged
  587. If DatosCargados Then
  588. ControlFechaOperacionCompra()
  589. RefrescarValorControles()
  590. Formato()
  591. End If
  592. End Sub
  593. Private Sub dtpFechaLiquidacionCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoCompra.ValueChanged
  594. If DatosCargados Then
  595. ControlFechaLiquidacionCompra()
  596. RefrescarValorControles()
  597. Formato()
  598. End If
  599. End Sub
  600. Private Sub txtUnidadesCompra_TextChanged(sender As Object, e As EventArgs) Handles txtUnidadesCompra.TextChanged
  601. If DatosCargados Then
  602. ControlCantidadCompra()
  603. CopiarDatos()
  604. End If
  605. End Sub
  606. Sub CopiarDatos()
  607. txtUnidadesVenta.Text = txtUnidadesCompra.Text
  608. End Sub
  609. Private Sub txtUnidadesCompra_LostFocus(sender As Object, e As EventArgs) Handles txtUnidadesCompra.LostFocus
  610. ControlCantidadCompra()
  611. End Sub
  612. 'VENTA
  613. Private Sub txtPrecioLimpioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioLimpioVenta.TextChanged
  614. ControlPrecioLimpioVenta()
  615. End Sub
  616. Private Sub txtPrecioLimpioVenta_LostFocus(sender As Object, e As EventArgs) Handles txtPrecioLimpioVenta.LostFocus
  617. ControlPrecioLimpioVenta()
  618. End Sub
  619. Private Sub dtpFechaOperacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacionVenta.ValueChanged
  620. If DatosCargados Then
  621. ControlFechaOperacionVenta()
  622. RefrescarValorControles()
  623. End If
  624. End Sub
  625. Private Sub dtpFechaLiquidacionVenta_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimientoVenta.ValueChanged
  626. If DatosCargados Then
  627. ControlFechaLiquidacionVenta()
  628. RefrescarValorControles()
  629. End If
  630. End Sub
  631. Private Sub txtUnidadesVenta_TextChanged(sender As Object, e As EventArgs) Handles txtUnidadesVenta.TextChanged
  632. If DatosCargados Then
  633. ControlCantidadVenta()
  634. MensajeAlerta()
  635. MostrarMensaje = True
  636. End If
  637. End Sub
  638. Sub MensajeAlerta()
  639. If (MostrarMensaje) Then
  640. Dim UnidadesVenta As Integer = 0
  641. Dim UnidadesCompra As Integer = 0
  642. If Not String.IsNullOrEmpty(txtUnidadesVenta.Text) Then
  643. UnidadesVenta = txtUnidadesVenta.Text
  644. End If
  645. If Not String.IsNullOrEmpty(txtUnidadesCompra.Text) Then
  646. UnidadesCompra = txtUnidadesCompra.Text
  647. End If
  648. If (CDec(UnidadesVenta) > CDec(UnidadesCompra)) Then
  649. MsgBox("Esta Tratando de Ingresar más acciones de las compradas, verifique los datos si ha cometido algún error.")
  650. End If
  651. End If
  652. End Sub
  653. Private Sub txtUnidadesVenta_LostFocus(sender As Object, e As EventArgs) Handles txtUnidadesVenta.LostFocus
  654. ControlCantidadVenta()
  655. End Sub
  656. Private Sub chkBolsa_CheckedChanged(sender As Object, e As EventArgs)
  657. End Sub
  658. '********** FIN EVENTOS DE CONTROLES **********
  659. '********** FUNCIONES **********
  660. Private Sub RefrescarClaseEntidad()
  661. ControlPrecioLimpioCompra()
  662. ControlFechaOperacionCompra()
  663. ControlFechaLiquidacionCompra()
  664. ControlCantidadCompra()
  665. ControlPrecioLimpioVenta()
  666. ControlFechaOperacionVenta()
  667. ControlFechaLiquidacionVenta()
  668. ControlCantidadVenta()
  669. End Sub
  670. Private Sub Formato()
  671. If DatosCargados Then
  672. If (String.IsNullOrEmpty(Me.txtRetornoAnualBrutoCompra.Text.ToString.Trim("%"))) Then
  673. Me.txtRetornoAnualBrutoCompra.Text = "0.0"
  674. End If
  675. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaCompra.Text.Trim("%"))) Then
  676. Me.txtComisionPorcentajeCasaCompra.Text = "0.0%"
  677. End If
  678. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaCompra.Text.Trim("%"))) Then
  679. Me.txtComisionPorcentajeBolsaCompra.Text = "0.0%"
  680. End If
  681. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaVenta.Text.Trim("%"))) Then
  682. Me.txtComisionPorcentajeCasaVenta.Text = "0.0%"
  683. End If
  684. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaVenta.Text.Trim("%"))) Then
  685. Me.txtComisionPorcentajeBolsaVenta.Text = "0.0%"
  686. End If
  687. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaCompra.Text.Trim("%"))) Then
  688. Me.txtComisionPorcentajeBolsaCompra.Text = "0.0%"
  689. End If
  690. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaVenta.Text.Trim("%"))) Then
  691. Me.txtComisionPorcentajeBolsaVenta.Text = "0.0%"
  692. End If
  693. If String.IsNullOrEmpty(txtRetornoAnualBrutoVenta.Text.ToString) Then
  694. txtRetornoAnualBrutoVenta.Text = 0
  695. End If
  696. If String.IsNullOrEmpty(txtPrecioLimpioCompra.Text.ToString) Then
  697. txtPrecioLimpioCompra.Text = 0
  698. End If
  699. If String.IsNullOrEmpty(txtPrecioLimpioVenta.Text.ToString) Then
  700. txtPrecioLimpioVenta.Text = 0
  701. End If
  702. If String.IsNullOrEmpty(txtUnidadesCompra.Text.ToString) Then
  703. txtUnidadesCompra.Text = 0
  704. End If
  705. If String.IsNullOrEmpty(txtUnidadesVenta.Text.ToString) Then
  706. txtUnidadesVenta.Text = 0
  707. End If
  708. If (txtComisionPorcentajeCasaVenta.ToString.IndexOf("%") = -1) Then
  709. txtComisionPorcentajeCasaVenta.Text += "%"
  710. End If
  711. If (txtComisionPorcentajeBolsaVenta.ToString.IndexOf("%") = -1) Then
  712. txtComisionPorcentajeBolsaVenta.Text += "%"
  713. End If
  714. If String.IsNullOrEmpty(txtGananciaCapitalUnitarioVenta.Text) Then
  715. txtGananciaCapitalUnitarioVenta.Text = 0
  716. End If
  717. If String.IsNullOrEmpty(txtRetornoAnualNetoVenta.Text) Then
  718. txtRetornoAnualNetoVenta.Text = 0
  719. End If
  720. End If
  721. End Sub
  722. Sub RefrescarValorControlesInicial()
  723. Me.txtRetornoAnualBrutoCompra.Text = oAccionesCE.RetornoBruto * 100
  724. Dim IOF = oAccionesCE.IOF
  725. Dim Renta = oAccionesCE.Renta
  726. If (IOF) Then
  727. ChkIOF.Checked = True
  728. Else
  729. ChkIOF.Checked = False
  730. End If
  731. If (Renta) Then
  732. ChkRenta.Checked = True
  733. Else
  734. ChkRenta.Checked = False
  735. End If
  736. Me.txtComisionPorcentajeCasaCompra.Text = CStr(oAccionesCE.ComisionPorcentajeCompraCasa * 100) + "%"
  737. Me.txtComisionPorcentajeBolsaCompra.Text = CStr(oAccionesCE.ComisionPorcentajeCompraBolsa * 100) + "%"
  738. Me.txtComisionPorcentajeCasaVenta.Text = CStr(oAccionesCE.ComisionPorcentajeVentaCasa * 100) + "%"
  739. Me.txtComisionPorcentajeBolsaVenta.Text = CStr(oAccionesCE.ComisionPorcentajeVentaBolsa * 100) + "%"
  740. Me.txtComisionCasaCompra.Text = oAccionesCE.ComisionCompraCasa
  741. Me.txtComisionBolsaCompra.Text = oAccionesCE.ComisionCompraBolsa
  742. Me.txtComisionCasaVenta.Text = oAccionesCE.ComisionVentaCasa
  743. Me.txtComisionBolsaVenta.Text = oAccionesCE.ComisionVentaBolsa
  744. If (oAccionesCE.Tipo = "Porcentaje") Then
  745. rdbPorcentaje.Checked = True
  746. ElseIf (oAccionesCE.Tipo = "Efectivo") Then
  747. rdbEfectivo.Checked = True
  748. End If
  749. 'COMPRA
  750. Me.txtPrecioLimpioCompra.Text = oAccionesCE.PrecioLimpioCompra.ToString()
  751. dtpFechaOperacionCompra.Value = CDate(oAccionesCE.FechaOperacionCompra)
  752. dtpFechaVencimientoCompra.Value = CDate(oAccionesCE.FechaVencimientoCompra)
  753. Me.txtDiasDeTenenciaCompra.Text = oAccionesCE.DiasDeTenenciaCompra.ToString
  754. Me.txtGananciaCapitalTotalCompra.Text = oAccionesCE.GananciaDeCapitalTotalCompra.ToString
  755. Me.txtGananciaCapitalUnitarioCompra.Text = oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString
  756. Me.txtRetornoAnualNetoCompra.Text = oAccionesCE.RetornoAnualizadoNetoCompra.ToString()
  757. Me.txtUnidadesCompra.Text = oAccionesCE.CantidadCompra.ToString
  758. Me.txtValorTransadoCompra.Text = oAccionesCE.ValorTransadoCompra.ToString()
  759. Dim ValorIOFCompra = 0.0, ValorRentaCompra = 0.0
  760. Me.txtMontoNetoCompra.Text = oAccionesCE.MontoNetoComprasus
  761. Me.txtPrecioSucioCompra.Text = oAccionesCE.PrecioSucioCompra.ToString()
  762. 'VENTA
  763. Me.txtPrecioLimpioVenta.Text = oAccionesCE.PrecioLimpioVenta.ToString()
  764. Me.dtpFechaOperacionVenta.Value = oAccionesCE.FechaOperacionVenta
  765. Me.dtpFechaVencimientoVenta.Value = oAccionesCE.FechaVencimientoVenta
  766. Me.txtDiasDeTenenciaVenta.Text = oAccionesCE.DiasDeTenenciaVenta.ToString
  767. Me.txtGananciaCapitalTotalVenta.Text = oAccionesCE.GananciaDeCapitalTotalVentasus.ToString()
  768. Me.txtGananciaCapitalUnitarioVenta.Text = oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString
  769. txtRetornoAnualBrutoVenta.Text = oAccionesCE.RetornoAnualizadoBrutoVentasus.ToString
  770. Me.txtRetornoAnualNetoVenta.Text = oAccionesCE.RetornoAnualizadoNetoVenta.ToString()
  771. Me.txtUnidadesVenta.Text = oAccionesCE.CantidadVenta.ToString
  772. Me.txtValorTransadoVenta.Text = oAccionesCE.ValorTransadoVenta.ToString()
  773. Me.txtImpuestosYComisionesVenta.Text = oAccionesCE.SumaImpuestosYComisionesVenta.ToString()
  774. Dim ComisionCasaVenta As Double = 0
  775. Dim ComisionBolsaVenta As Double = 0
  776. Dim ValorTransadoVenta As Double = 0
  777. Dim ValorIOFVenta = 0.0, ValorRentaVenta = 0.0
  778. Me.txtMontoNetoVenta.Text = oAccionesCE.MontoNetoVentasus.ToString
  779. Me.txtPrecioSucioVenta.Text = oAccionesCE.PrecioSucioVentasus.ToString()
  780. End Sub
  781. Sub RefrescarValorControles()
  782. If DatosCargados Then
  783. If (Cargar) Then
  784. If (String.IsNullOrEmpty(oAccionesCE.RetornoBruto.ToString())) Then
  785. Else
  786. Me.txtRetornoAnualBrutoCompra.Text = oAccionesCE.RetornoBruto * 100
  787. End If
  788. If String.IsNullOrEmpty(txtGananciaCapitalUnitarioVenta.Text) Then
  789. txtGananciaCapitalUnitarioVenta.Text = 0
  790. End If
  791. If String.IsNullOrEmpty(txtRetornoAnualNetoVenta.Text) Then
  792. txtRetornoAnualNetoVenta.Text = 0
  793. End If
  794. Dim IOF = oAccionesCE.IOF
  795. Dim Renta = oAccionesCE.Renta
  796. If (IOF) Then
  797. ChkIOF.Checked = True
  798. Else
  799. ChkIOF.Checked = False
  800. End If
  801. If (Renta) Then
  802. ChkRenta.Checked = True
  803. Else
  804. ChkRenta.Checked = False
  805. End If
  806. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaCompra.Text.TrimEnd("%"))) Then
  807. If (String.IsNullOrEmpty(oAccionesCE.ComisionCompraCasa)) Then
  808. Else
  809. If Not oAccionesCE.ComisionCompraCasa = "0" Then
  810. Me.txtComisionPorcentajeCasaCompra.Text = CStr(oAccionesCE.ComisionCompraCasa * 100) + "%"
  811. End If
  812. End If
  813. End If
  814. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaCompra.Text.TrimEnd("%"))) Then
  815. If (String.IsNullOrEmpty(oAccionesCE.ComisionCompraBolsa)) Then
  816. Else
  817. If Not oAccionesCE.ComisionCompraBolsa = "0" Then
  818. Me.txtComisionPorcentajeBolsaCompra.Text = CStr(oAccionesCE.ComisionCompraBolsa * 100) + "%"
  819. End If
  820. End If
  821. End If
  822. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeCasaVenta.Text.TrimEnd("%"))) Then
  823. If (String.IsNullOrEmpty(oAccionesCE.ComisionVentaCasa)) Then
  824. End If
  825. If Not oAccionesCE.ComisionVentaCasa = "0" Then
  826. Me.txtComisionPorcentajeCasaVenta.Text = CStr(oAccionesCE.ComisionVentaCasa * 100) + "%"
  827. End If
  828. End If
  829. If (String.IsNullOrEmpty(Me.txtComisionPorcentajeBolsaVenta.Text.TrimEnd("%"))) Then
  830. If (String.IsNullOrEmpty(oAccionesCE.ComisionVentaBolsa)) Then
  831. Else
  832. If Not oAccionesCE.ComisionVentaBolsa = "0" Then
  833. Me.txtComisionPorcentajeBolsaVenta.Text = CStr(oAccionesCE.ComisionVentaBolsa * 100) + "%"
  834. End If
  835. End If
  836. End If
  837. Else
  838. If (oAccionesCE.Tipo = "Porcentaje") Then
  839. rdbPorcentaje.Checked = True
  840. ElseIf (oAccionesCE.Tipo = "Efectivo") Then
  841. rdbEfectivo.Checked = True
  842. End If
  843. End If
  844. 'COMPRA
  845. If (String.IsNullOrEmpty(oAccionesCE.PrecioLimpioCompra.ToString())) Then
  846. Else
  847. If Not oAccionesCE.PrecioLimpioCompra.ToString() = "0" Then
  848. Me.txtPrecioLimpioCompra.Text = oAccionesCE.PrecioLimpioCompra.ToString()
  849. End If
  850. End If
  851. If (String.IsNullOrEmpty(oAccionesCE.FechaOperacionCompra)) Then
  852. Me.dtpFechaOperacionCompra.Value = Date.Now.Date
  853. Else
  854. Me.dtpFechaOperacionCompra.Value = oAccionesCE.FechaOperacionCompra
  855. End If
  856. If (String.IsNullOrEmpty(oAccionesCE.FechaVencimientoCompra)) Then
  857. Me.dtpFechaVencimientoCompra.Value = Date.Now.Date
  858. Else
  859. Me.dtpFechaVencimientoCompra.Value = oAccionesCE.FechaVencimientoCompra
  860. End If
  861. If (String.IsNullOrEmpty(oAccionesCE.DiasDeTenenciaCompra.ToString)) Then
  862. Else
  863. Me.txtDiasDeTenenciaCompra.Text = oAccionesCE.DiasDeTenenciaCompra.ToString
  864. End If
  865. If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalTotalCompra.ToString)) Then
  866. Else
  867. Me.txtGananciaCapitalTotalCompra.Text = oAccionesCE.GananciaDeCapitalTotalCompra.ToString
  868. End If
  869. If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString)) Then
  870. Else
  871. Me.txtGananciaCapitalUnitarioCompra.Text = oAccionesCE.GananciaDeCapitalUnitarioCompra.ToString
  872. End If
  873. If (String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoNetoCompra.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
  874. Else
  875. Me.txtRetornoAnualNetoCompra.Text = oAccionesCE.RetornoAnualizadoNetoCompra.ToString()
  876. End If
  877. If (String.IsNullOrEmpty(oAccionesCE.CantidadCompra.ToString)) Then
  878. Else
  879. If Not oAccionesCE.CantidadCompra.ToString = "0" Then
  880. Me.txtUnidadesCompra.Text = oAccionesCE.CantidadCompra.ToString
  881. End If
  882. End If
  883. If (String.IsNullOrEmpty(oAccionesCE.ValorTransadoCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
  884. Else
  885. Me.txtValorTransadoCompra.Text = oAccionesCE.ValorTransadoCompra.ToString()
  886. End If
  887. Dim ComisionCasaCompra As Double = 0
  888. Dim ComisionBolsaCompra As Double = 0
  889. Dim ValorTransadoCompra As Double = 0
  890. If String.IsNullOrEmpty(txtComisionPorcentajeCasaCompra.Text.TrimEnd("%")) Then
  891. ComisionCasaCompra = 0
  892. Else
  893. ComisionCasaCompra = txtComisionPorcentajeCasaCompra.Text.TrimEnd("%") / 100
  894. End If
  895. If String.IsNullOrEmpty(txtComisionPorcentajeBolsaCompra.Text.TrimEnd("%")) Then
  896. ComisionBolsaCompra = 0
  897. Else
  898. ComisionBolsaCompra = txtComisionPorcentajeBolsaCompra.Text.TrimEnd("%") / 100
  899. End If
  900. If Not String.IsNullOrEmpty(txtValorTransadoCompra.Text) Then
  901. ValorTransadoCompra = txtValorTransadoCompra.Text
  902. End If
  903. Me.txtComisionCasaCompra.Text = CalcularComisionImpuestos(ComisionCasaCompra, txtValorTransadoCompra.Text)
  904. Me.txtComisionBolsaCompra.Text = CalcularComisionImpuestos(ComisionBolsaCompra, txtValorTransadoCompra.Text)
  905. If (String.IsNullOrEmpty(oAccionesCE.SumaImpuestosYComisionesCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
  906. Else
  907. Me.txtImpuestosYComisionesCompra.Text = oAccionesCE.SumaImpuestosYComisionesCompra.ToString()
  908. End If
  909. Dim ValorIOFCompra = 0.0, ValorRentaCompra = 0.0
  910. If (Not String.IsNullOrEmpty(txtIOFCompra.Text.ToString)) Then
  911. ValorIOFCompra = txtIOFCompra.Text
  912. End If
  913. If (Not String.IsNullOrEmpty(txtRentaCompra.Text.ToString)) Then
  914. ValorRentaCompra = txtRentaCompra.Text
  915. End If
  916. If (String.IsNullOrEmpty(oAccionesCE.PrecioSucioCompra.ToString(Configuraciones.CodigoTXTMontos))) Then
  917. Else
  918. Me.txtPrecioSucioCompra.Text = oAccionesCE.PrecioSucioCompra.ToString()
  919. End If
  920. 'VENTA
  921. If (String.IsNullOrEmpty(oAccionesCE.PrecioLimpioVenta.ToString())) Then
  922. Else
  923. If Not oAccionesCE.PrecioLimpioVenta = 0 Then
  924. Me.txtPrecioLimpioVenta.Text = oAccionesCE.PrecioLimpioVenta.ToString()
  925. End If
  926. End If
  927. If (String.IsNullOrEmpty(oAccionesCE.FechaOperacionVenta)) Then
  928. Me.dtpFechaOperacionVenta.Value = Date.Now.Date
  929. Else
  930. Me.dtpFechaOperacionVenta.Value = oAccionesCE.FechaOperacionVenta
  931. End If
  932. If (String.IsNullOrEmpty(oAccionesCE.FechaVencimientoVenta)) Then
  933. Me.dtpFechaVencimientoVenta.Value = Date.Now.Date
  934. Else
  935. Me.dtpFechaVencimientoVenta.Value = oAccionesCE.FechaVencimientoVenta
  936. End If
  937. If (String.IsNullOrEmpty(oAccionesCE.DiasDeTenenciaVenta.ToString)) Then
  938. Else
  939. Me.txtDiasDeTenenciaVenta.Text = oAccionesCE.DiasDeTenenciaVenta.ToString
  940. End If
  941. If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalTotalVenta.ToString(Configuraciones.CodigoTXTMontos))) Then
  942. Else
  943. Me.txtGananciaCapitalTotalVenta.Text = oAccionesCE.GananciaDeCapitalTotalVenta.ToString()
  944. End If
  945. If (String.IsNullOrEmpty(oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString)) Then
  946. Else
  947. If Double.IsNaN(oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString) Then
  948. Else
  949. Me.txtGananciaCapitalUnitarioVenta.Text = oAccionesCE.GananciaDeCapitalUnitarioVenta.ToString
  950. End If
  951. End If
  952. If String.IsNullOrEmpty(txtRetornoAnualBrutoVenta.Text.ToString) Then
  953. txtRetornoAnualBrutoVenta.Text = 0
  954. End If
  955. Variables.IngresoBruto = CalcularIngresoBruto()
  956. Variables.IngresoNeto = CalcularIngresoNeto()
  957. If (rdbEfectivo.Checked) Then
  958. If (String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoBrutoVenta.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
  959. Else
  960. Me.txtRetornoAnualBrutoVenta.Text = oAccionesCE.RetornoAnualizadoBrutoVenta.ToString()
  961. End If
  962. Else
  963. Dim Existe = dgvDividendos.Rows.Count
  964. If (Existe >= 1) Then
  965. If (Not dgvDividendos.Rows(0).Cells("Dividendo").Value Is Nothing) Then
  966. Dim Valor = dgvDividendos.Rows(0).Cells("Dividendo").Value.ToString.Trim("%")
  967. If (String.IsNullOrEmpty(Valor)) Then
  968. Else
  969. Me.txtRetornoAnualBrutoVenta.Text = CStr((CDec(Valor.ToString.Trim("%")) * 100)) + "%"
  970. End If
  971. End If
  972. End If
  973. End If
  974. If (rdbEfectivo.Checked) Then
  975. If (String.IsNullOrEmpty(oAccionesCE.RetornoAnualizadoNetoVenta.ToString(Configuraciones.CodigoTXTPorcentaje))) Then
  976. Else
  977. Me.txtRetornoAnualNetoVenta.Text = oAccionesCE.RetornoAnualizadoNetoVenta.ToString()
  978. End If
  979. Else
  980. Dim Existe = dgvDividendos.Rows.Count
  981. If (Existe >= 1) Then
  982. Dim Valor = dgvDividendos.Rows(0).Cells("PorcISR").Value
  983. If (String.IsNullOrEmpty(Valor)) Then
  984. Else
  985. Me.txtRetornoAnualNetoVenta.Text = CStr(CDec(txtRetornoAnualBrutoVenta.Text.Trim("%")) * (1 - Valor)) + "%"
  986. End If
  987. End If
  988. End If
  989. If (String.IsNullOrEmpty(oAccionesCE.CantidadVenta.ToString)) Then
  990. Else
  991. If Not oAccionesCE.CantidadVenta = 0 Then
  992. Me.txtUnidadesVenta.Text = oAccionesCE.CantidadVenta.ToString
  993. End If
  994. End If
  995. If (String.IsNullOrEmpty(oAccionesCE.ValorTransadoVenta.ToString())) Then
  996. Else
  997. Me.txtValorTransadoVenta.Text = oAccionesCE.ValorTransadoVenta.ToString()
  998. End If
  999. If (String.IsNullOrEmpty(oAccionesCE.SumaImpuestosYComisionesVenta.ToString())) Then
  1000. Else
  1001. Me.txtImpuestosYComisionesVenta.Text = oAccionesCE.SumaImpuestosYComisionesVenta.ToString()
  1002. End If
  1003. Dim ComisionCasaVenta As Double = 0
  1004. Dim ComisionBolsaVenta As Double = 0
  1005. Dim ValorTransadoVenta As Double = 0
  1006. If Not String.IsNullOrEmpty(txtComisionPorcentajeCasaVenta.Text.TrimEnd("%")) Then
  1007. ComisionCasaVenta = txtComisionPorcentajeCasaVenta.Text.TrimEnd("%") / 100
  1008. End If
  1009. If Not String.IsNullOrEmpty(txtComisionPorcentajeBolsaVenta.Text.TrimEnd("%")) Then
  1010. ComisionBolsaVenta = txtComisionPorcentajeBolsaVenta.Text.TrimEnd("%") / 100
  1011. End If
  1012. If Not String.IsNullOrEmpty(txtValorTransadoVenta.Text) Then
  1013. ValorTransadoVenta = txtValorTransadoVenta.Text
  1014. End If
  1015. Me.txtComisionCasaVenta.Text = CalcularComisionImpuestos(ComisionCasaVenta, ValorTransadoVenta)
  1016. Me.txtComisionBolsaVenta.Text = CalcularComisionImpuestos(ComisionBolsaVenta, ValorTransadoVenta)
  1017. txtGananciaCapitalTotalVenta.Text += SumaComisiones()
  1018. Dim ValorIOFVenta = 0.0, ValorRentaVenta = 0.0
  1019. If (Not String.IsNullOrEmpty(txtIOFVenta.Text.ToString)) Then
  1020. ValorIOFVenta = txtIOFVenta.Text
  1021. End If
  1022. If (Not String.IsNullOrEmpty(txtRentaVenta.Text.ToString)) Then
  1023. ValorRentaVenta = txtRentaVenta.Text
  1024. End If
  1025. If (String.IsNullOrEmpty(oAccionesCE.MontoNetoVenta.ToString())) Then
  1026. Else
  1027. Me.txtMontoNetoVenta.Text = CDec(oAccionesCE.MontoNetoVenta.ToString()) - CDec(txtComisionBolsaVenta.Text) - CDec(txtComisionCasaVenta.Text) - ValorIOFVenta - ValorRentaVenta
  1028. End If
  1029. If (String.IsNullOrEmpty(CDec(oAccionesCE.MontoNetoCompra.ToString(Configuraciones.CodigoTXTMontos)))) Or String.IsNullOrEmpty((CDec(txtComisionBolsaCompra.Text)) Or String.IsNullOrEmpty(CDec(txtComisionCasaCompra.Text)) Or String.IsNullOrEmpty(ValorIOFCompra) Or String.IsNullOrEmpty(ValorRentaCompra)) Then
  1030. Else
  1031. Me.txtMontoNetoCompra.Text = (CDec(oAccionesCE.MontoNetoCompra.ToString())) + (CDec(txtComisionBolsaCompra.Text) + CDec(txtComisionCasaCompra.Text) + ValorIOFCompra + ValorRentaCompra)
  1032. End If
  1033. If (String.IsNullOrEmpty(oAccionesCE.PrecioSucioVenta.ToString())) Then
  1034. Me.txtPrecioSucioVenta.Text = "0.0"
  1035. Else
  1036. If Double.IsNaN(oAccionesCE.PrecioSucioVenta.ToString()) Then
  1037. Me.txtPrecioSucioVenta.Text = "0.0"
  1038. Else
  1039. Me.txtPrecioSucioVenta.Text = oAccionesCE.PrecioSucioVenta.ToString()
  1040. End If
  1041. End If
  1042. End If
  1043. End Sub
  1044. Function CalcularIngresoBruto()
  1045. Dim Cantidad = dgvDividendos.Rows.Count - 1
  1046. Dim FechaActual = Date.Now.Date
  1047. Dim ContadorIngreso As Double = 0.0
  1048. For i As Integer = 0 To Cantidad
  1049. Try
  1050. If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)) Then
  1051. Dim FechaPrograma As Date = CDate(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)
  1052. If (FechaActual >= FechaPrograma) Then
  1053. If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("IngresoBruto").Value.ToString)) Then
  1054. ContadorIngreso += CDec(dgvDividendos.Rows(i).Cells("IngresoBruto").Value.ToString)
  1055. End If
  1056. End If
  1057. End If
  1058. Catch ex As Exception
  1059. End Try
  1060. Next
  1061. Return ContadorIngreso
  1062. End Function
  1063. Function CalcularIngresoNeto()
  1064. Dim Cantidad = dgvDividendos.Rows.Count - 1
  1065. Dim FechaActual = Date.Now.Date
  1066. Dim ContadorIngreso As Double = 0.0
  1067. For i As Integer = 0 To Cantidad
  1068. Try
  1069. If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)) Then
  1070. Dim FechaPrograma As Date = CDate(dgvDividendos.Rows(i).Cells("Fecha").Value.ToString)
  1071. If (FechaActual >= FechaPrograma) Then
  1072. If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("IngresoNeto").Value.ToString)) Then
  1073. ContadorIngreso += CDec(dgvDividendos.Rows(i).Cells("IngresoNeto").Value.ToString)
  1074. End If
  1075. End If
  1076. End If
  1077. Catch ex As Exception
  1078. End Try
  1079. Next
  1080. Return ContadorIngreso
  1081. End Function
  1082. Function SumaComisiones()
  1083. Dim ComisionCasaVenta As Double = txtComisionCasaVenta.Text
  1084. Dim ComisionBolsaVenta As Double = txtComisionBolsaVenta.Text
  1085. Dim Total As Double = 0.0
  1086. Total = ComisionCasaVenta + ComisionBolsaVenta
  1087. Return Total
  1088. End Function
  1089. Function CalcularComisionImpuestos(ByVal Comision As Double, ByVal ValorTransado As Double)
  1090. Return Comision * ValorTransado
  1091. End Function
  1092. Private Sub PrepararTablaDividendos()
  1093. Dim oDataGridViewTextBoxColumn As DataGridViewTextBoxColumn
  1094. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1095. oDataGridViewTextBoxColumn.Name = "CodInv"
  1096. oDataGridViewTextBoxColumn.DataPropertyName = "CodInv"
  1097. oDataGridViewTextBoxColumn.HeaderText = "Código Inversión"
  1098. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1099. oDataGridViewTextBoxColumn.Visible = False
  1100. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1101. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1102. oDataGridViewTextBoxColumn.Name = "Correlativo"
  1103. oDataGridViewTextBoxColumn.DataPropertyName = "Correlativo"
  1104. oDataGridViewTextBoxColumn.HeaderText = "Correlativo"
  1105. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1106. oDataGridViewTextBoxColumn.Visible = True
  1107. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1108. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1109. oDataGridViewTextBoxColumn.Name = "Fecha"
  1110. oDataGridViewTextBoxColumn.DataPropertyName = "Fecha"
  1111. oDataGridViewTextBoxColumn.HeaderText = "Fecha"
  1112. oDataGridViewTextBoxColumn.Name = "Fecha"
  1113. oDataGridViewTextBoxColumn.ValueType = GetType(Date)
  1114. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1115. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1116. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1117. oDataGridViewTextBoxColumn.Name = "Dividendo"
  1118. oDataGridViewTextBoxColumn.DataPropertyName = "Dividendo"
  1119. oDataGridViewTextBoxColumn.HeaderText = "Dividendo"
  1120. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1121. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1122. oDataGridViewTextBoxColumn.Name = "CantidadBase"
  1123. oDataGridViewTextBoxColumn.DataPropertyName = "CantidadBase"
  1124. oDataGridViewTextBoxColumn.HeaderText = "Cantidad Base"
  1125. oDataGridViewTextBoxColumn.ValueType = GetType(Double)
  1126. oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
  1127. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1128. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1129. oDataGridViewTextBoxColumn.Name = "IngresoBruto"
  1130. oDataGridViewTextBoxColumn.DataPropertyName = "IngresoBruto"
  1131. oDataGridViewTextBoxColumn.HeaderText = "Ingreso Bruto"
  1132. oDataGridViewTextBoxColumn.ValueType = GetType(Double)
  1133. oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
  1134. oDataGridViewTextBoxColumn.ReadOnly = True
  1135. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1136. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1137. oDataGridViewTextBoxColumn.Name = "PorcISR"
  1138. oDataGridViewTextBoxColumn.DataPropertyName = "PorcISR"
  1139. oDataGridViewTextBoxColumn.HeaderText = "% ISR"
  1140. oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTPorcentaje
  1141. oDataGridViewTextBoxColumn.ValueType = GetType(Double)
  1142. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1143. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1144. oDataGridViewTextBoxColumn.Name = "ISR"
  1145. oDataGridViewTextBoxColumn.DataPropertyName = "ISR"
  1146. oDataGridViewTextBoxColumn.HeaderText = "ISR"
  1147. oDataGridViewTextBoxColumn.ValueType = GetType(Double)
  1148. oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
  1149. oDataGridViewTextBoxColumn.ReadOnly = True
  1150. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1151. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1152. oDataGridViewTextBoxColumn.Name = "IngresoNeto"
  1153. oDataGridViewTextBoxColumn.DataPropertyName = "IngresoNeto"
  1154. oDataGridViewTextBoxColumn.HeaderText = "Ingreso Neto"
  1155. oDataGridViewTextBoxColumn.ValueType = GetType(Double)
  1156. oDataGridViewTextBoxColumn.DefaultCellStyle.Format = Configuraciones.CodigoTXTMontos
  1157. oDataGridViewTextBoxColumn.ReadOnly = True
  1158. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1159. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1160. oDataGridViewTextBoxColumn.Name = "Estado"
  1161. oDataGridViewTextBoxColumn.DataPropertyName = "Estado"
  1162. oDataGridViewTextBoxColumn.HeaderText = "Estado"
  1163. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1164. oDataGridViewTextBoxColumn.Visible = False
  1165. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1166. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1167. oDataGridViewTextBoxColumn.Name = "FechaInicio"
  1168. oDataGridViewTextBoxColumn.DataPropertyName = "FechaInicio"
  1169. oDataGridViewTextBoxColumn.HeaderText = "FechaInicio"
  1170. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1171. oDataGridViewTextBoxColumn.Visible = False
  1172. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1173. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1174. oDataGridViewTextBoxColumn.Name = "FechaCorte"
  1175. oDataGridViewTextBoxColumn.DataPropertyName = "FechaCorte"
  1176. oDataGridViewTextBoxColumn.HeaderText = "FechaCorte"
  1177. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1178. oDataGridViewTextBoxColumn.Visible = False
  1179. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1180. oDataGridViewTextBoxColumn = New DataGridViewTextBoxColumn
  1181. oDataGridViewTextBoxColumn.Name = "NumDiv"
  1182. oDataGridViewTextBoxColumn.DataPropertyName = "NumDiv"
  1183. oDataGridViewTextBoxColumn.HeaderText = "NuvDiv"
  1184. oDataGridViewTextBoxColumn.ValueType = GetType(String)
  1185. oDataGridViewTextBoxColumn.Visible = False
  1186. Me.dgvDividendos.Columns.Add(oDataGridViewTextBoxColumn)
  1187. End Sub
  1188. Private Function FechaDividendo()
  1189. Dim Index = dgvDividendos.CurrentRow.Index
  1190. Dim IndexAnterior = Index - 1
  1191. Dim FechaInicial = dtpFechaOperacionCompra.Value
  1192. Dim FechaActual = dgvDividendos.Rows(Index).Cells("Fecha").Value
  1193. Dim FechaCalcul As Date = Date.Now.Date
  1194. If (String.IsNullOrEmpty(FechaActual)) Then
  1195. If (Index = 0) Then
  1196. FechaCalcul = Operaciones.Meses(12, FechaInicial, FechaInicial)
  1197. Else
  1198. Dim Fecha = dgvDividendos.Rows(IndexAnterior).Cells("Fecha").Value
  1199. FechaCalcul = Operaciones.Meses(12, Fecha, FechaInicial)
  1200. End If
  1201. Else
  1202. FechaCalcul = FechaActual
  1203. End If
  1204. Return FechaCalcul
  1205. End Function
  1206. Private Sub PrepararCalculoDividendos(ByVal IdFila As Integer)
  1207. Dim vFila As DataGridViewRow = dgvDividendos.Rows(IdFila)
  1208. If (rdbEfectivo.Checked) Then
  1209. If vFila.IsNewRow Then
  1210. vFila.Cells("Fecha").Value = FechaDividendo()
  1211. vFila.Cells("Dividendo").Value = oAccionesCE.FactorDeDividendo
  1212. End If
  1213. If rdbEfectivo.Checked Then
  1214. If (String.IsNullOrEmpty(txtUnidadesCompra.Text)) Then
  1215. vFila.Cells("CantidadBase").Value = 0.0
  1216. Else
  1217. vFila.Cells("CantidadBase").Value = CDec(txtUnidadesCompra.Text)
  1218. End If
  1219. Else
  1220. If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
  1221. vFila.Cells("CantidadBase").Value = 0.0
  1222. Else
  1223. vFila.Cells("CantidadBase").Value = CDec(txtValorTransadoCompra.Text)
  1224. End If
  1225. End If
  1226. vFila.Cells("IngresoBruto").Value = 0.00
  1227. vFila.Cells("PorcISR").Value = 0.05
  1228. vFila.Cells("ISR").Value = 0.00
  1229. vFila.Cells("IngresoNeto").Value = 0.00
  1230. If dgvDividendos.Rows(IdFila).Cells("NumDiv").Value Is DBNull.Value Then
  1231. dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
  1232. Else
  1233. If String.IsNullOrEmpty(dgvDividendos.Rows(IdFila).Cells("NumDiv").Value) Then
  1234. dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
  1235. End If
  1236. End If
  1237. Else
  1238. If vFila.IsNewRow Then
  1239. vFila.Cells("Fecha").Value = FechaDividendo()
  1240. vFila.Cells("Dividendo").Value = oAccionesCE.FactorDeDividendo.ToString + "%"
  1241. If (vFila.Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
  1242. vFila.Cells("Dividendo").Value += "%"
  1243. End If
  1244. If rdbEfectivo.Checked Then
  1245. If (String.IsNullOrEmpty(txtUnidadesCompra.Text)) Then
  1246. vFila.Cells("CantidadBase").Value = 0.0
  1247. Else
  1248. vFila.Cells("CantidadBase").Value = CDec(txtUnidadesCompra.Text)
  1249. End If
  1250. Else
  1251. If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
  1252. vFila.Cells("CantidadBase").Value = 0.0
  1253. Else
  1254. vFila.Cells("CantidadBase").Value = CDec(txtValorTransadoCompra.Text)
  1255. End If
  1256. End If
  1257. vFila.Cells("IngresoBruto").Value = 0.00
  1258. vFila.Cells("PorcISR").Value = 0.05
  1259. vFila.Cells("ISR").Value = 0.00
  1260. vFila.Cells("IngresoNeto").Value = 0.00
  1261. If dgvDividendos.Rows(IdFila).Cells("NumDiv").Value Is DBNull.Value Then
  1262. dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
  1263. Else
  1264. If String.IsNullOrEmpty(dgvDividendos.Rows(IdFila).Cells("NumDiv").Value) Then
  1265. dgvDividendos.Rows(IdFila).Cells("NumDiv").Value = Correlativo()
  1266. End If
  1267. End If
  1268. End If
  1269. End If
  1270. If (vFila.Cells("Fecha").Value Is DBNull.Value) Then
  1271. vFila.Cells("Fecha").Value = FechaDividendo()
  1272. Else
  1273. If String.IsNullOrEmpty(vFila.Cells("Fecha").Value) Then
  1274. vFila.Cells("Fecha").Value = FechaDividendo()
  1275. End If
  1276. End If
  1277. RefrescarValorControles()
  1278. End Sub
  1279. Sub AgregarFechaCO()
  1280. dgvDividendos.CurrentRow.Cells("FechaInicio").Value = Variables.FechaInicialCorte
  1281. dgvDividendos.CurrentRow.Cells("FechaCorte").Value = Variables.FechaCorteCorte
  1282. End Sub
  1283. Function CalculoIngresoBrutoEfectivo(ByVal CantidadUnidades As Double, ByVal Dividendo As Double)
  1284. Dim Total = CantidadUnidades * (Dividendo)
  1285. Return Total
  1286. End Function
  1287. Function CalculoIngresoBrutoPorcentaje(ByVal ValorTransado As Double, ByVal Dividendo As Double, ByVal Dias As Integer, ByVal Fecha As Date)
  1288. Dim Total As Double = 0
  1289. If (Operaciones.AñoBisiesto(Fecha) = 364) Then
  1290. Total = (ValorTransado * (Dividendo / 100) * Dias) / 365
  1291. End If
  1292. If (Operaciones.AñoBisiesto(Fecha) = 365) Then
  1293. Total = (ValorTransado * (Dividendo / 100) * Dias) / 366
  1294. End If
  1295. Return Total
  1296. End Function
  1297. Private Sub dgvDividendos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvDividendos.CellBeginEdit
  1298. PrepararCalculoDividendos(e.RowIndex)
  1299. End Sub
  1300. Private Sub dgvDividendos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellEndEdit
  1301. CalcularDividendos()
  1302. RefrescarValorControles()
  1303. End Sub
  1304. Private Sub dgvDividendos_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs) Handles dgvDividendos.UserDeletedRow
  1305. End Sub
  1306. Private Sub dgvImpuestosYComisiones_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs)
  1307. End Sub
  1308. Private Sub dgvImpuestosYComisiones_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs)
  1309. End Sub
  1310. Private Sub dgvImpuestosYComisiones_UserDeletedRow(sender As Object, e As DataGridViewRowEventArgs)
  1311. oAccionesCE.ImpuestosYComisiones.AcceptChanges()
  1312. End Sub
  1313. Private Sub dgvImpuestosYComisiones_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
  1314. End Sub
  1315. Private Sub dgvDividendos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellContentClick
  1316. End Sub
  1317. Private Sub TabPage2_Click(sender As Object, e As EventArgs)
  1318. End Sub
  1319. Private Sub txtImpuestosYComisionesCompra_TextChanged(sender As Object, e As EventArgs) Handles txtImpuestosYComisionesCompra.TextChanged
  1320. End Sub
  1321. Private Sub TOperacion(ByVal TOperacion As String)
  1322. If (TOperacion = "N") Then
  1323. HabilitarBotones()
  1324. ElseIf (TOperacion = "B") Then
  1325. DeshabilitarBotones()
  1326. End If
  1327. End Sub
  1328. Sub HabilitarBotones()
  1329. txtUnidadesCompra.Enabled = True
  1330. txtUnidadesVenta.Enabled = True
  1331. End Sub
  1332. Sub DeshabilitarBotones()
  1333. txtDiasDeTenenciaCompra.Enabled = False
  1334. txtDiasDeTenenciaVenta.Enabled = False
  1335. txtGananciaCapitalTotalCompra.Enabled = False
  1336. txtGananciaCapitalTotalVenta.Enabled = False
  1337. txtGananciaCapitalUnitarioCompra.Enabled = False
  1338. txtGananciaCapitalUnitarioVenta.Enabled = False
  1339. txtRetornoAnualBrutoCompra.Enabled = False
  1340. txtRetornoAnualBrutoVenta.Enabled = False
  1341. txtRetornoAnualNetoCompra.Enabled = False
  1342. txtRetornoAnualNetoVenta.Enabled = False
  1343. txtUnidadesCompra.Enabled = False
  1344. txtUnidadesVenta.Enabled = False
  1345. txtValorTransadoCompra.Enabled = False
  1346. txtValorTransadoVenta.Enabled = False
  1347. txtImpuestosYComisionesCompra.Enabled = False
  1348. txtImpuestosYComisionesVenta.Enabled = False
  1349. txtMontoNetoCompra.Enabled = False
  1350. txtMontoNetoVenta.Enabled = False
  1351. txtPrecioSucioCompra.Enabled = False
  1352. txtPrecioSucioVenta.Enabled = False
  1353. End Sub
  1354. Private Sub dtgcomisiones_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
  1355. End Sub
  1356. Private Sub TabPage4_Click(sender As Object, e As EventArgs)
  1357. End Sub
  1358. Private Sub dtgcomisiones_CellContentClick_1(sender As Object, e As DataGridViewCellEventArgs)
  1359. End Sub
  1360. Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
  1361. Estado = "N"
  1362. btnAceptar.Text = "Nuevo"
  1363. End Sub
  1364. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  1365. Estado = "M"
  1366. btnAceptar.Text = "Modificar"
  1367. End Sub
  1368. Private Sub Button1_Click(sender As Object, e As EventArgs)
  1369. If (Estado = "N") Then
  1370. NuevaAccion()
  1371. End If
  1372. End Sub
  1373. Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
  1374. Estado = "B"
  1375. btnAceptar.Text = "Eliminar"
  1376. End Sub
  1377. Private Sub btnAgregar_Click(sender As Object, e As EventArgs)
  1378. End Sub
  1379. Private Sub dgvDividendos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellClick
  1380. ModificarFechaCorte()
  1381. PrepararCalculoDividendos(e.RowIndex)
  1382. End Sub
  1383. Sub ModificarFechaCorte()
  1384. If rdbPorcentaje.Checked Then
  1385. Dim Index As Integer = dgvDividendos.CurrentRow.Index
  1386. If dgvDividendos.Rows(Index).Cells("Fecha").ColumnIndex = dgvDividendos.CurrentCell.ColumnIndex Then
  1387. Dim FechaReferencia = dgvDividendos.Rows(Index).Cells("Fecha").Value
  1388. If (Not String.IsNullOrEmpty(FechaReferencia)) Then
  1389. Dim año = FechaReferencia.Year
  1390. Dim PrimeraFecha, SegundaFecha
  1391. If (dgvDividendos.Rows(Index).Cells("FechaInicio").Value Is Nothing) Then
  1392. PrimeraFecha = CDate("1/1/" + año.ToString)
  1393. ElseIf (dgvDividendos.Rows(Index).Cells("FechaInicio").Value Is DBNull.Value) Then
  1394. PrimeraFecha = CDate("1/1/" + año.ToString)
  1395. Else
  1396. PrimeraFecha = dgvDividendos.Rows(Index).Cells("FechaInicio").Value
  1397. End If
  1398. If (dgvDividendos.Rows(Index).Cells("FechaCorte").Value Is Nothing) Then
  1399. SegundaFecha = CDate("31/12/" + año.ToString)
  1400. ElseIf (dgvDividendos.Rows(Index).Cells("FechaCorte").Value Is DBNull.Value) Then
  1401. SegundaFecha = CDate("31/12/" + año.ToString)
  1402. Else
  1403. SegundaFecha = dgvDividendos.Rows(Index).Cells("FechaCorte").Value
  1404. End If
  1405. Variables.FechaInicial = PrimeraFecha
  1406. Variables.FechaCorte = SegundaFecha
  1407. Variables.CorrelativoACC = dgvDividendos.Rows(Index).Cells("NumDiv").Value
  1408. frmFechasAcciones.Show()
  1409. End If
  1410. Cierre = True
  1411. End If
  1412. End If
  1413. End Sub
  1414. Private Sub txtComisionPorcentajeCasaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaCompra.TextChanged
  1415. RefrescarValorControles()
  1416. End Sub
  1417. Private Sub txtComisionPorcentajeBolsaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaCompra.TextChanged
  1418. RefrescarValorControles()
  1419. End Sub
  1420. Private Sub txtComisionPorcentajeCasaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaVenta.TextChanged
  1421. RefrescarValorControles()
  1422. End Sub
  1423. Private Sub txtComisionPorcentajeBolsaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaVenta.TextChanged
  1424. RefrescarValorControles()
  1425. End Sub
  1426. Private Sub txtMontoNetoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtMontoNetoCompra.TextChanged
  1427. End Sub
  1428. Private Sub btnAgregarImpuesto_Click(sender As Object, e As EventArgs)
  1429. End Sub
  1430. Private Sub dgvImpuestoAgregado_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
  1431. End Sub
  1432. Private Sub btnQuitar_Click(sender As Object, e As EventArgs)
  1433. End Sub
  1434. Private Sub dgvImpuestoAgregado_CellClick(sender As Object, e As DataGridViewCellEventArgs)
  1435. End Sub
  1436. Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs)
  1437. End Sub
  1438. Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
  1439. End Sub
  1440. Sub ValidarRentaIOF()
  1441. If (ChkIOF.Checked) Then
  1442. CalculosIOF()
  1443. Else
  1444. BloquearIOF()
  1445. End If
  1446. RefrescarValorControles()
  1447. If (ChkRenta.Checked) Then
  1448. CalculosRenta()
  1449. Else
  1450. BloquearRenta()
  1451. End If
  1452. RefrescarValorControles()
  1453. End Sub
  1454. Private Sub ChkIOF_CheckedChanged(sender As Object, e As EventArgs) Handles ChkIOF.CheckedChanged
  1455. If (ChkIOF.Checked) Then
  1456. oAccionesCE.IOF = 1
  1457. CalculosIOF()
  1458. Else
  1459. oAccionesCE.IOF = 0
  1460. BloquearIOF()
  1461. End If
  1462. RefrescarValorControles()
  1463. End Sub
  1464. Sub BloquearIOF()
  1465. lblCompra1.Visible = False
  1466. lblVenta1.Visible = False
  1467. txtIOFCompra.Text = String.Empty
  1468. txtIOFCompra.Visible = False
  1469. txtIOFVenta.Text = String.Empty
  1470. txtIOFVenta.Visible = False
  1471. End Sub
  1472. Sub CalculosIOF()
  1473. If (Not String.IsNullOrEmpty(txtValorTransadoCompra.Text) And Not String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
  1474. lblCompra1.Visible = True
  1475. lblVenta1.Visible = True
  1476. txtIOFCompra.Visible = True
  1477. txtIOFVenta.Visible = True
  1478. Dim ValorTransadoCompra = txtValorTransadoCompra.Text
  1479. Dim ValorTransadoVenta = txtValorTransadoVenta.Text
  1480. txtIOFCompra.Text = CalculoImpuestos(ValorTransadoCompra, 0.0025)
  1481. txtIOFVenta.Text = CalculoImpuestos(ValorTransadoVenta, 0.0025)
  1482. End If
  1483. End Sub
  1484. Private Sub ChkRenta_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRenta.CheckedChanged
  1485. If (ChkRenta.Checked) Then
  1486. oAccionesCE.Renta = 1
  1487. CalculosRenta()
  1488. Else
  1489. oAccionesCE.Renta = 0
  1490. BloquearRenta()
  1491. End If
  1492. RefrescarValorControles()
  1493. End Sub
  1494. Sub CalculosRenta()
  1495. If (Not String.IsNullOrEmpty(txtValorTransadoCompra.Text) And Not String.IsNullOrEmpty(txtValorTransadoVenta.Text)) Then
  1496. lblCompra2.Visible = True
  1497. lblVenta2.Visible = True
  1498. txtRentaVenta.Visible = True
  1499. txtRentaCompra.Visible = True
  1500. Dim ValorTransadoCompra = txtValorTransadoCompra.Text
  1501. Dim ValorTransadoVenta = txtValorTransadoVenta.Text
  1502. txtRentaCompra.Text = CalculoImpuestos(ValorTransadoCompra, 0.1)
  1503. txtRentaVenta.Text = CalculoImpuestos(ValorTransadoVenta, 0.1)
  1504. End If
  1505. End Sub
  1506. Sub BloquearRenta()
  1507. lblCompra2.Visible = False
  1508. lblVenta2.Visible = False
  1509. txtRentaCompra.Text = String.Empty
  1510. txtRentaCompra.Visible = False
  1511. txtRentaVenta.Text = String.Empty
  1512. txtRentaVenta.Visible = False
  1513. End Sub
  1514. Function CalculoImpuestos(ByVal ValorTransado As Double, ByVal Impuesto As Double)
  1515. Dim Valor = ValorTransado * Impuesto
  1516. Return Valor
  1517. End Function
  1518. Private Sub rdbEfectivo_CheckedChanged(sender As Object, e As EventArgs) Handles rdbEfectivo.CheckedChanged
  1519. If (rdbEfectivo.Checked) Then
  1520. LimpiarDividendosCambios(1)
  1521. Else
  1522. LimpiarDividendosCambios(2)
  1523. End If
  1524. CambiarBase()
  1525. CambioCalculo = True
  1526. CambioCalculo = False
  1527. If (Cargado) Then
  1528. RefrescarValorControles()
  1529. End If
  1530. End Sub
  1531. Private Sub rdbPorcentaje_CheckedChanged(sender As Object, e As EventArgs) Handles rdbPorcentaje.CheckedChanged
  1532. If (rdbEfectivo.Checked) Then
  1533. LimpiarDividendosCambios(1)
  1534. Else
  1535. LimpiarDividendosCambios(2)
  1536. End If
  1537. CambiarBase()
  1538. CambioCalculo = True
  1539. CambioCalculo = False
  1540. If (Cargado) Then
  1541. RefrescarValorControles()
  1542. End If
  1543. End Sub
  1544. Sub CambiarBase()
  1545. Dim Cantidad As Integer = dgvDividendos.Rows.Count - 1
  1546. For i As Integer = 0 To Cantidad
  1547. If (dgvDividendos.Rows(i).Cells("NumDiv").Value Is DBNull.Value) Then
  1548. Exit For
  1549. Else
  1550. If String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("NumDiv").Value) Then
  1551. Exit For
  1552. End If
  1553. End If
  1554. If rdbEfectivo.Checked Then
  1555. If (String.IsNullOrEmpty(txtUnidadesCompra.Text)) Then
  1556. dgvDividendos.Rows(i).Cells("CantidadBase").Value = 0.0
  1557. Else
  1558. dgvDividendos.Rows(i).Cells("CantidadBase").Value = CDec(txtUnidadesCompra.Text)
  1559. End If
  1560. Else
  1561. If (String.IsNullOrEmpty(txtValorTransadoCompra.Text)) Then
  1562. dgvDividendos.Rows(i).Cells("CantidadBase").Value = 0.0
  1563. Else
  1564. dgvDividendos.Rows(i).Cells("CantidadBase").Value = CDec(txtValorTransadoCompra.Text)
  1565. End If
  1566. End If
  1567. Next
  1568. CalcularDividendos()
  1569. End Sub
  1570. Private Sub dgvDividendos_Click(sender As Object, e As EventArgs) Handles dgvDividendos.Click
  1571. End Sub
  1572. Sub ClonarDatos()
  1573. If (String.IsNullOrEmpty(txtUnidadesVenta.Text.ToString)) Then
  1574. txtUnidadesVenta.Text = txtUnidadesCompra.Text
  1575. End If
  1576. End Sub
  1577. Private Sub txtUnidadesCompra_Leave(sender As Object, e As EventArgs) Handles txtUnidadesCompra.Leave
  1578. ClonarDatos()
  1579. Formato()
  1580. End Sub
  1581. Private Sub rdbEfectivo_Click(sender As Object, e As EventArgs) Handles rdbEfectivo.Click
  1582. End Sub
  1583. Private Sub dgvDividendos_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDividendos.CellDoubleClick
  1584. End Sub
  1585. Private Sub txtPrecioLimpioCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioLimpioCompra.KeyPress
  1586. If String.IsNullOrEmpty(txtPrecioLimpioCompra.Text) Then
  1587. If e.KeyChar = "." Then
  1588. txtPrecioLimpioCompra.Text = "0"
  1589. Exit Sub
  1590. End If
  1591. End If
  1592. If (Not txtPrecioLimpioCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1593. Operaciones.ValidarEntrada(sender, e, True)
  1594. Else
  1595. Operaciones.ValidarEntrada(sender, e, False)
  1596. End If
  1597. End Sub
  1598. Private Sub txtPrecioLimpioVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPrecioLimpioVenta.KeyPress
  1599. If String.IsNullOrEmpty(txtPrecioLimpioVenta.Text) Then
  1600. If e.KeyChar = "." Then
  1601. txtPrecioLimpioVenta.Text = "0"
  1602. Exit Sub
  1603. End If
  1604. End If
  1605. If (Not txtPrecioLimpioVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1606. Operaciones.ValidarEntrada(sender, e, True)
  1607. Else
  1608. Operaciones.ValidarEntrada(sender, e, False)
  1609. End If
  1610. End Sub
  1611. Private Sub txtUnidadesCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtUnidadesCompra.KeyPress
  1612. If String.IsNullOrEmpty(txtUnidadesCompra.Text) Then
  1613. If e.KeyChar = "." Then
  1614. txtUnidadesCompra.Text = "0"
  1615. Exit Sub
  1616. End If
  1617. End If
  1618. If (Not txtUnidadesCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1619. Operaciones.ValidarEntrada(sender, e, True)
  1620. Else
  1621. Operaciones.ValidarEntrada(sender, e, False)
  1622. End If
  1623. End Sub
  1624. Private Sub txtUnidadesVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtUnidadesVenta.KeyPress
  1625. If String.IsNullOrEmpty(txtUnidadesVenta.Text) Then
  1626. If e.KeyChar = "." Then
  1627. txtUnidadesVenta.Text = "0"
  1628. Exit Sub
  1629. End If
  1630. End If
  1631. If (Not txtUnidadesVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1632. Operaciones.ValidarEntrada(sender, e, True)
  1633. Else
  1634. Operaciones.ValidarEntrada(sender, e, False)
  1635. End If
  1636. End Sub
  1637. Private Sub txtComisionPorcentajeCasaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeCasaCompra.KeyPress
  1638. If String.IsNullOrEmpty(txtComisionPorcentajeCasaCompra.Text) Then
  1639. If e.KeyChar = "." Then
  1640. txtComisionPorcentajeCasaCompra.Text = "0"
  1641. Exit Sub
  1642. End If
  1643. End If
  1644. If (Not txtComisionPorcentajeCasaCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1645. Operaciones.ValidarEntrada(sender, e, True)
  1646. Else
  1647. Operaciones.ValidarEntrada(sender, e, False)
  1648. End If
  1649. End Sub
  1650. Private Sub txtComisionPorcentajeBolsaCompra_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeBolsaCompra.KeyPress
  1651. If String.IsNullOrEmpty(txtComisionPorcentajeBolsaCompra.Text) Then
  1652. If e.KeyChar = "." Then
  1653. txtComisionPorcentajeBolsaCompra.Text = "0"
  1654. Exit Sub
  1655. End If
  1656. End If
  1657. If (Not txtComisionPorcentajeBolsaCompra.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1658. Operaciones.ValidarEntrada(sender, e, True)
  1659. Else
  1660. Operaciones.ValidarEntrada(sender, e, False)
  1661. End If
  1662. End Sub
  1663. Private Sub txtComisionPorcentajeCasaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeCasaVenta.KeyPress
  1664. If String.IsNullOrEmpty(txtComisionPorcentajeCasaVenta.Text) Then
  1665. If e.KeyChar = "." Then
  1666. txtComisionPorcentajeCasaVenta.Text = "0"
  1667. Exit Sub
  1668. End If
  1669. End If
  1670. If (Not txtComisionPorcentajeCasaVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1671. Operaciones.ValidarEntrada(sender, e, True)
  1672. Else
  1673. Operaciones.ValidarEntrada(sender, e, False)
  1674. End If
  1675. End Sub
  1676. Private Sub txtComisionPorcentajeBolsaVenta_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionPorcentajeBolsaVenta.KeyPress
  1677. If String.IsNullOrEmpty(txtComisionPorcentajeBolsaVenta.Text) Then
  1678. If e.KeyChar = "." Then
  1679. txtComisionPorcentajeBolsaVenta.Text = "0"
  1680. Exit Sub
  1681. End If
  1682. End If
  1683. If (Not txtComisionPorcentajeBolsaVenta.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1684. Operaciones.ValidarEntrada(sender, e, True)
  1685. Else
  1686. Operaciones.ValidarEntrada(sender, e, False)
  1687. End If
  1688. End Sub
  1689. Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
  1690. End Sub
  1691. Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint
  1692. End Sub
  1693. Private Sub TabPage1_Click(sender As Object, e As EventArgs) Handles TbOperacion.Click
  1694. End Sub
  1695. Private Sub txtGananciaCapitalTotalVenta_TextChanged(sender As Object, e As EventArgs) Handles txtGananciaCapitalTotalVenta.TextChanged
  1696. End Sub
  1697. Private Sub txtDiasDeTenenciaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtDiasDeTenenciaVenta.TextChanged
  1698. End Sub
  1699. Private Sub Label9_Click(sender As Object, e As EventArgs) Handles Label9.Click
  1700. End Sub
  1701. Private Sub Label6_Click(sender As Object, e As EventArgs) Handles Label6.Click
  1702. End Sub
  1703. Private Sub txtIOFCompra_TextChanged(sender As Object, e As EventArgs) Handles txtIOFCompra.TextChanged
  1704. End Sub
  1705. Private Sub txtRentaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtRentaCompra.TextChanged
  1706. End Sub
  1707. Private Sub CalcularDividendos()
  1708. Dim Cantidad As Integer = dgvDividendos.Rows.Count - 2
  1709. For i As Integer = 0 To Cantidad
  1710. If (String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Dividendo").Value)) Then
  1711. dgvDividendos.Rows(i).Cells("Dividendo").Value = 0
  1712. End If
  1713. If rdbEfectivo.Checked Then
  1714. If (String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("Dividendo").Value)) Then
  1715. dgvDividendos.Rows(i).Cells("Dividendo").Value = 0
  1716. End If
  1717. End If
  1718. Dim Dividendos As Double = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.Trim("%")
  1719. Dim Porcentaje As Double = dgvDividendos.Rows(i).Cells("PorcISR").Value
  1720. Dim Valor = dgvDividendos.Rows(i).Cells("CantidadBase").Value
  1721. If rdbEfectivo.Checked Then
  1722. Dim CalculoIB = CalculoIngresoBrutoEfectivo(Valor, Dividendos)
  1723. Dim CalculoRenta = CalculoIB * Porcentaje
  1724. Dim CalculoIN = CalculoIB - CalculoRenta
  1725. dgvDividendos.Rows(i).Cells("IngresoBruto").Value = CalculoIB
  1726. dgvDividendos.Rows(i).Cells("ISR").Value = CalculoRenta
  1727. dgvDividendos.Rows(i).Cells("IngresoNeto").Value = CalculoIN
  1728. Else
  1729. If (dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
  1730. dgvDividendos.Rows(i).Cells("Dividendo").Value = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString + "%"
  1731. End If
  1732. Dim Dias As Integer = 0
  1733. Dim FechaInicialCorte As Date = Date.Now.Date
  1734. Dim FechaCorteCorte As Date = Date.Now.Date
  1735. If (dgvDividendos.Rows(i).Cells("FechaInicio").Value IsNot DBNull.Value And dgvDividendos.Rows(i).Cells("FechaCorte").Value IsNot DBNull.Value) Then
  1736. If (Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("FechaInicio").Value) And Not String.IsNullOrEmpty(dgvDividendos.Rows(i).Cells("FechaCorte").Value)) Then
  1737. FechaInicialCorte = dgvDividendos.Rows(i).Cells("FechaInicio").Value
  1738. FechaCorteCorte = dgvDividendos.Rows(i).Cells("FechaCorte").Value
  1739. Dias = DateDiff(DateInterval.Day, FechaInicialCorte, FechaCorteCorte)
  1740. Dias += 1
  1741. Dim CalculoIBP = CalculoIngresoBrutoPorcentaje(Valor, Dividendos, Dias, FechaInicialCorte)
  1742. Dim CalculoRenta = CalculoIBP * Porcentaje
  1743. Dim CalculoIN = CalculoIBP - CalculoRenta
  1744. dgvDividendos.Rows(i).Cells("IngresoBruto").Value = CalculoIBP
  1745. dgvDividendos.Rows(i).Cells("ISR").Value = CalculoRenta
  1746. dgvDividendos.Rows(i).Cells("IngresoNeto").Value = CalculoIN
  1747. End If
  1748. End If
  1749. End If
  1750. Next
  1751. CorrelativoSinBD()
  1752. End Sub
  1753. Public Sub btnActualizar_Click(sender As Object, e As EventArgs) Handles btnActualizar.Click
  1754. AgregarFechaCO()
  1755. CalcularDividendos()
  1756. End Sub
  1757. Private Sub TabPage3_Click(sender As Object, e As EventArgs) Handles TbDividendos.Click
  1758. End Sub
  1759. Sub LimpiarDividendosCambios(ByVal Calculo As Integer)
  1760. Dim Cantidad As Integer = dgvDividendos.Rows.Count - 2
  1761. For i As Integer = 0 To Cantidad
  1762. If (Calculo = 1) Then
  1763. If (Not dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
  1764. dgvDividendos.Rows(i).Cells("Dividendo").Value = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.ToString.Trim("%")
  1765. End If
  1766. Else
  1767. If (dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString.IndexOf("%") = -1) Then
  1768. dgvDividendos.Rows(i).Cells("Dividendo").Value = dgvDividendos.Rows(i).Cells("Dividendo").Value.ToString + "%"
  1769. End If
  1770. End If
  1771. dgvDividendos.Rows(i).Cells("IngresoBruto").Value = 0
  1772. dgvDividendos.Rows(i).Cells("ISR").Value = 0
  1773. dgvDividendos.Rows(i).Cells("IngresoNeto").Value = 0
  1774. Next
  1775. End Sub
  1776. Sub CargarDividendos()
  1777. Dim Codigo As String = Variables.Codigo
  1778. Dim dr = oAccionesDAO.CargarDividendo(Codigo)
  1779. While dr.Read
  1780. dgvDividendos.Rows.Add("", "", dr("Fecha"), dr("Dividendo"), dr("CantidadBase"), dr("IngresoBruto"), dr("PorcISR"), dr("ISR"), dr("IngresoNeto"), "", dr("FechaInicio"), dr("FechaCorte"), dr("NumDiv"))
  1781. End While
  1782. End Sub
  1783. Private Sub btnGenerarAccion_Click(sender As Object, e As EventArgs)
  1784. End Sub
  1785. Private Sub dgvDividendos_CellMouseMove(sender As Object, e As DataGridViewCellMouseEventArgs) Handles dgvDividendos.CellMouseMove
  1786. If Cierre Then
  1787. AgregarFechaCO()
  1788. CalcularDividendos()
  1789. Cierre = False
  1790. End If
  1791. End Sub
  1792. Private Sub dgvDividendos_MouseMove(sender As Object, e As MouseEventArgs) Handles dgvDividendos.MouseMove
  1793. If Cierre Then
  1794. AgregarFechaCO()
  1795. CalcularDividendos()
  1796. Cierre = False
  1797. End If
  1798. End Sub
  1799. Private Sub btnQuitar_Click_1(sender As Object, e As EventArgs) Handles btnQuitar.Click
  1800. QuitarFila()
  1801. CorrelativoSinBD()
  1802. End Sub
  1803. Sub QuitarFila()
  1804. Dim result As Integer = MsgBox("¿Está seguro que desea eliminar la fila?", MsgBoxStyle.OkCancel)
  1805. ' Test result.
  1806. Dim codigo As String = Variables.Codigo
  1807. Dim Numero As Integer = dgvDividendos.CurrentRow.Cells("NumDiv").Value
  1808. If result = MsgBoxResult.Ok Then
  1809. Try
  1810. dgvDividendos.Rows.Remove(dgvDividendos.CurrentRow)
  1811. oAccionesDAO.EliminarElemenoInd(codigo, Numero)
  1812. Catch ex As Exception
  1813. MsgBox("No ha seleccionado una fila")
  1814. End Try
  1815. End If
  1816. End Sub
  1817. Private Sub txtPrecioSucioVenta_TextChanged(sender As Object, e As EventArgs) Handles txtPrecioSucioVenta.TextChanged
  1818. End Sub
  1819. Private Sub txtPrecioLimpioCompra_Leave(sender As Object, e As EventArgs) Handles txtPrecioLimpioCompra.Leave
  1820. Formato()
  1821. End Sub
  1822. Private Sub txtComisionPorcentajeCasaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaCompra.Leave
  1823. Formato()
  1824. End Sub
  1825. Private Sub txtComisionPorcentajeBolsaCompra_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaCompra.Leave
  1826. Formato()
  1827. End Sub
  1828. Private Sub txtPrecioLimpioVenta_Leave(sender As Object, e As EventArgs) Handles txtPrecioLimpioVenta.Leave
  1829. Formato()
  1830. End Sub
  1831. Private Sub txtUnidadesVenta_Leave(sender As Object, e As EventArgs) Handles txtUnidadesVenta.Leave
  1832. Formato()
  1833. End Sub
  1834. Private Sub txtComisionPorcentajeCasaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeCasaVenta.Leave
  1835. Formato()
  1836. End Sub
  1837. Private Sub txtComisionPorcentajeBolsaVenta_Leave(sender As Object, e As EventArgs) Handles txtComisionPorcentajeBolsaVenta.Leave
  1838. Formato()
  1839. End Sub
  1840. Private Sub frmAcciones_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
  1841. Redimencionar()
  1842. End Sub
  1843. Private Sub txtPrecioLimpioCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioLimpioCompra.KeyUp
  1844. If txtPrecioLimpioCompra.Text = "." Then
  1845. txtPrecioLimpioCompra.Text = ".0"
  1846. End If
  1847. End Sub
  1848. Private Sub txtUnidadesCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtUnidadesCompra.KeyUp
  1849. If txtUnidadesCompra.Text = "." Then
  1850. txtUnidadesCompra.Text = ".0"
  1851. End If
  1852. End Sub
  1853. Private Sub txtComisionPorcentajeCasaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeCasaCompra.KeyUp
  1854. If txtComisionPorcentajeCasaCompra.Text = "." Then
  1855. txtComisionPorcentajeCasaCompra.Text = ".0"
  1856. End If
  1857. End Sub
  1858. Private Sub txtComisionPorcentajeBolsaCompra_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeBolsaCompra.KeyUp
  1859. If txtComisionPorcentajeBolsaCompra.Text = "." Then
  1860. txtComisionPorcentajeBolsaCompra.Text = ".0"
  1861. End If
  1862. End Sub
  1863. Private Sub txtPrecioLimpioVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPrecioLimpioVenta.KeyUp
  1864. If txtPrecioLimpioVenta.Text = "." Then
  1865. txtPrecioLimpioVenta.Text = ".0"
  1866. End If
  1867. End Sub
  1868. Private Sub txtUnidadesVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtUnidadesVenta.KeyUp
  1869. If txtUnidadesVenta.Text = "." Then
  1870. txtUnidadesVenta.Text = ".0"
  1871. End If
  1872. End Sub
  1873. Private Sub txtComisionPorcentajeCasaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeCasaVenta.KeyUp
  1874. If txtComisionPorcentajeCasaVenta.Text = "." Then
  1875. txtComisionPorcentajeCasaVenta.Text = ".0"
  1876. End If
  1877. End Sub
  1878. Private Sub txtComisionPorcentajeBolsaVenta_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionPorcentajeBolsaVenta.KeyUp
  1879. If txtComisionPorcentajeBolsaVenta.Text = "." Then
  1880. txtComisionPorcentajeBolsaVenta.Text = ".0"
  1881. End If
  1882. End Sub
  1883. Private Sub btnVenta_Click(sender As Object, e As EventArgs)
  1884. End Sub
  1885. Private Sub txtValorTransadoCompra_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoCompra.TextChanged
  1886. End Sub
  1887. Sub CargarTransladoNuevo()
  1888. Dim Existe As Boolean = ExisteInversion()
  1889. If CantFormAbierto = False Then
  1890. If Not RetCodigoInversionExiste And Not Existe Then
  1891. Dim TipoTransaccionCompraVenta As String = Variables.TipoTransaccionCompraVenta
  1892. If TipoTransaccionCompraVenta = "C" Then
  1893. txtPrecioLimpioCompra.Text = Variables.RetPrecio
  1894. txtUnidadesCompra.Text = Variables.RetUnidadesAcciones
  1895. ElseIf TipoTransaccionCompraVenta = "V" Then
  1896. txtPrecioLimpioVenta.Text = Variables.RetPrecio
  1897. txtUnidadesVenta.Text = Variables.RetUnidadesAcciones
  1898. End If
  1899. End If
  1900. End If
  1901. End Sub
  1902. Private Sub btnVenderTitulo_Click(sender As Object, e As EventArgs) Handles btnVenderTitulo.Click
  1903. If Variables.InvocadorProInv = "frmINV" Then
  1904. Dim TrasladarDatos As New TrasladarDatosCMVTA
  1905. Dim General As New DAOGeneral
  1906. Dim Codigo = Variables.Codigo
  1907. Dim Tabla As String = "INV0"
  1908. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  1909. TrasladarDatos = RellenarDatosCMVTA()
  1910. If Existe Then
  1911. Dim CodigoInversion As String = Variables.Codigo
  1912. Dim frmPINVCMVTA As New frmPIN("V", CodigoInversion, TrasladarDatos)
  1913. frmINV.Close()
  1914. Me.Close()
  1915. frmPINVCMVTA.ShowDialog()
  1916. End If
  1917. End If
  1918. End Sub
  1919. Function RellenarDatosCMVTA()
  1920. Dim TrasladarDatos As New TrasladarDatosCMVTA
  1921. TrasladarDatos.FechaOperacionACC = Operaciones.ConvertirFecha(dtpFechaOperacionCompra.Value.ToString)
  1922. TrasladarDatos.FechaVencimientoACC = Operaciones.ConvertirFecha(dtpFechaVencimientoCompra.Value.ToString)
  1923. TrasladarDatos.PrecioLimpioACC = Operaciones.ConvertirDecimal(txtPrecioLimpioCompra.Text.ToString)
  1924. TrasladarDatos.UnidadesACC = Operaciones.ConvertirEntero(txtUnidadesCompra.Text.ToString)
  1925. TrasladarDatos.PorcentajeBolsaACC = Operaciones.ConvertirDecimal(txtComisionPorcentajeBolsaCompra.Text.ToString)
  1926. TrasladarDatos.PorcentajeCasaACC = Operaciones.ConvertirDecimal(txtComisionPorcentajeCasaCompra.Text.ToString)
  1927. TrasladarDatos.NombreInstrumento = "ACC"
  1928. TrasladarDatos.AgregarCMVTA = True
  1929. Return TrasladarDatos
  1930. End Function
  1931. Private Sub txtValorTransadoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransadoVenta.TextChanged
  1932. End Sub
  1933. Private Sub txtMontoNetoVenta_TextChanged(sender As Object, e As EventArgs) Handles txtMontoNetoVenta.TextChanged
  1934. End Sub
  1935. Private Sub txtComisionCasaCompra_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasaCompra.TextChanged
  1936. End Sub
  1937. Private Sub txtComisionCasaVenta_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasaVenta.TextChanged
  1938. End Sub
  1939. End Class