frmReporto.vb 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819
  1. Public Class frmReporto
  2. Dim oDAOGeneral As New DAOGeneral
  3. Dim Aniobase As Integer = 365
  4. Const PorcentajeComisionCasa As Double = 0.2825
  5. Const PorcentajeComisionBolsa As Double = 0.2825
  6. Const PorcentajeComisionIOF As Double = 0.25
  7. Dim PorcentajeISR As Double = 10
  8. Dim oCEReporto As ReportosCE
  9. Dim oDAOReportos As ReportosDAO
  10. Dim Reporto As New ReportosCE
  11. Dim ReportoConsula As New ReportosDAO
  12. Private CodigoInversion As String
  13. Dim Estado As String = String.Empty
  14. Dim CargarUnaVez As Boolean = True
  15. Dim Operaciones As New Operaciones
  16. Dim NombreTitulo As New Dictionary(Of String, String)
  17. Dim Modificado As Boolean = False
  18. Dim InstrumentoFinanciero As String = oDAOGeneral.ObtenerInstrumento(Variables.Codigo)
  19. Dim CodigoRotar As Integer = 0
  20. Private _Modo As String
  21. Private _IdDocumento As Integer
  22. Private _TipoDocumento As String
  23. Private Cargado As Boolean = False
  24. Private Procesado As Boolean = False
  25. Private Tabla As String = String.Empty
  26. Private Base As Integer = 0
  27. Private IOFEstado As Integer = 0
  28. Private RentaEstado As Integer = 0
  29. Private TipoOperacionRepo As String = String.Empty
  30. Private CodigoRepo As String = String.Empty
  31. Private CodigoProveniente As String = String.Empty
  32. Dim CodigoCheque As String = String.Empty
  33. Sub New()
  34. ' Esta llamada es exigida por el diseñador.
  35. InitializeComponent()
  36. ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
  37. End Sub
  38. Public Property Modo As String
  39. Get
  40. Return _Modo
  41. End Get
  42. Set(value As String)
  43. _Modo = value
  44. End Set
  45. End Property
  46. Sub AgregarCampos(ByVal Tipo As Integer)
  47. Dim ValTrans, Dias, FVen, Rend, IOF, ComisionCB, CB, OtrosCostos, TotCostos, MontoLiq, InterGen, codigo As New DataGridViewTextBoxColumn
  48. Dim CostoTransfv, Correlativo, RendNetoAntImp, ValReCompra, ImpLiquidacion, IngrNeto, ValNeto, RendNetoDespImp As New DataGridViewTextBoxColumn
  49. Dim Nombre, FCompra, ComisionCasa, ComisionBolsa, Casa, Base, EstadoIOF, EstadoRenta As New DataGridViewTextBoxColumn
  50. Dim Cantidad As Integer = dgvReportos.ColumnCount
  51. If Cantidad = 0 Then
  52. Correlativo.Name = "Correlativo"
  53. codigo.Name = "Codigo"
  54. codigo.Visible = False
  55. ValTrans.Name = "Valor Trasado"
  56. Dias.Name = "Dias"
  57. FVen.Name = "Fecha de Vencimiento"
  58. Rend.Name = "Rendimiento"
  59. IOF.Name = "IOF"
  60. ComisionCB.Name = "Comision CB"
  61. CB.Name = "Comision Bolsa"
  62. OtrosCostos.Name = "Otros Costos"
  63. TotCostos.Name = "Total Costos"
  64. MontoLiq.Name = "Monto a Liquidar"
  65. InterGen.Name = "Interes a Genrerar"
  66. CostoTransfv.Name = "Costo de Transferencia"
  67. RendNetoAntImp.Name = "R% Neto (Antes de Impuesto)"
  68. ValReCompra.Name = "Valor de ReCompra"
  69. ImpLiquidacion.Name = "Impuesto de Liquidacion"
  70. IngrNeto.Name = "Ingreso Neto"
  71. ValNeto.Name = "Valor Neto"
  72. RendNetoDespImp.Name = "R% Neto (Despues de Impuesto)"
  73. Nombre.Name = "Nombre"
  74. FCompra.Name = "FCompra"
  75. ComisionCasa.Name = "ComisionCasa"
  76. ComisionBolsa.Name = "ComisionBolsa"
  77. Casa.Name = "Casa"
  78. Base.Name = "Base"
  79. EstadoIOF.Name = "EstadoIOF"
  80. EstadoRenta.Name = "EstadoRenta"
  81. Nombre.Visible = False
  82. FCompra.Visible = False
  83. ComisionCasa.Visible = False
  84. ComisionBolsa.Visible = False
  85. Casa.Visible = False
  86. Base.Visible = False
  87. EstadoIOF.Visible = False
  88. EstadoRenta.Visible = False
  89. Dim cod As String = Variables.Codigo
  90. If cod.IndexOf("REPOVENTA") > -1 Then
  91. RendNetoAntImp.HeaderText = "Costo Financiero (Antes de Impuesto)"
  92. RendNetoDespImp.HeaderText = "Costo Financiero (Despues de Impuesto)"
  93. Rend.HeaderText = "Costo Financiero"
  94. TotCostos.HeaderText = "Total a Pagar"
  95. Else
  96. RendNetoAntImp.HeaderText = "R% Neto (Antes de Impuesto)"
  97. RendNetoDespImp.HeaderText = "R% Neto (Despues de Impuesto)"
  98. Rend.HeaderText = "Rendimiento"
  99. TotCostos.HeaderText = "Total Costos"
  100. End If
  101. dgvReportos.Columns.Add(Correlativo)
  102. dgvReportos.Columns.Add(ValTrans)
  103. dgvReportos.Columns.Add(Dias)
  104. dgvReportos.Columns.Add(FVen)
  105. dgvReportos.Columns.Add(Rend)
  106. dgvReportos.Columns.Add(ComisionCB)
  107. dgvReportos.Columns.Add(CB)
  108. dgvReportos.Columns.Add(IOF)
  109. dgvReportos.Columns.Add(OtrosCostos)
  110. dgvReportos.Columns.Add(TotCostos)
  111. dgvReportos.Columns.Add(MontoLiq)
  112. dgvReportos.Columns.Add(InterGen)
  113. dgvReportos.Columns.Add(CostoTransfv)
  114. dgvReportos.Columns.Add(RendNetoAntImp)
  115. dgvReportos.Columns.Add(ValReCompra)
  116. dgvReportos.Columns.Add(ImpLiquidacion)
  117. dgvReportos.Columns.Add(IngrNeto)
  118. dgvReportos.Columns.Add(ValNeto)
  119. dgvReportos.Columns.Add(RendNetoDespImp)
  120. dgvReportos.Columns.Add(Nombre)
  121. dgvReportos.Columns.Add(FCompra)
  122. dgvReportos.Columns.Add(ComisionCasa)
  123. dgvReportos.Columns.Add(ComisionBolsa)
  124. dgvReportos.Columns.Add(Casa)
  125. dgvReportos.Columns.Add(codigo)
  126. dgvReportos.Columns.Add(Base)
  127. dgvReportos.Columns.Add(EstadoIOF)
  128. dgvReportos.Columns.Add(EstadoRenta)
  129. Dim CodImp, code As New DataGridViewTextBoxColumn
  130. CodImp.Name = "CodImp"
  131. code.Name = "codigo"
  132. End If
  133. End Sub
  134. Sub LlenarBase()
  135. Dim Index As Integer = dgvReportos.Rows.Count - 2
  136. Base = cboAnioBase.SelectedIndex
  137. Dim i As Integer = 0
  138. While i <= Index
  139. dgvReportos.Rows(i).Cells("Base").Value = Base
  140. i += 1
  141. End While
  142. End Sub
  143. Sub IngresarDatos()
  144. If Cargado Then
  145. If Procesado Then
  146. If Not dgvReportos.CurrentRow Is Nothing Then
  147. Dim Index As Integer = dgvReportos.CurrentRow.Index
  148. dgvReportos.Rows(Index).Cells("Nombre").Value = txtCodigoTitulo.Text
  149. dgvReportos.Rows(Index).Cells("FCompra").Value = dtpFechaCompra.Value
  150. If txtComisionCasa.Text.ToString.Trim("%") = 0 Then
  151. dgvReportos.Rows(Index).Cells("ComisionCasa").Value = "0.0"
  152. Else
  153. dgvReportos.Rows(Index).Cells("ComisionCasa").Value = CDec(txtComisionCasa.Text.ToString.Trim("%")) / 100
  154. End If
  155. If txtComisionBolsa.Text.ToString.Trim("%") = 0 Then
  156. dgvReportos.Rows(Index).Cells("ComisionBolsa").Value = "0.0"
  157. Else
  158. dgvReportos.Rows(Index).Cells("ComisionBolsa").Value = CDec(txtComisionBolsa.Text.ToString.Trim("%")) / 100
  159. End If
  160. If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  161. dgvReportos.Rows(Index).Cells("Casa").Value = cboCasaCorredora.SelectedValue
  162. End If
  163. End If
  164. End If
  165. End If
  166. End Sub
  167. Sub IngresarDatosReves()
  168. Procesado = False
  169. If Cargado Then
  170. If Not dgvReportos.CurrentRow Is Nothing Then
  171. Dim Index As Integer = dgvReportos.CurrentRow.Index
  172. Dim Nombre = dgvReportos.Rows(Index).Cells("Nombre").Value
  173. Dim FCompra = dgvReportos.Rows(Index).Cells("FCompra").Value
  174. Dim ComisionCasa = dgvReportos.Rows(Index).Cells("ComisionCasa").Value
  175. Dim ComisionBolsa = dgvReportos.Rows(Index).Cells("ComisionBolsa").Value
  176. Dim EstadoIOF = dgvReportos.Rows(Index).Cells("EstadoIOF").Value
  177. Dim EstadoRenta = dgvReportos.Rows(Index).Cells("EstadoRenta").Value
  178. Dim Casa = dgvReportos.Rows(Index).Cells("Casa").Value
  179. If Not Nombre Is DBNull.Value Then
  180. If Not Nombre Is Nothing Then
  181. If Not String.IsNullOrEmpty(Nombre) Then
  182. txtCodigoTitulo.Text = Nombre
  183. Else
  184. txtCodigoTitulo.Text = String.Empty
  185. End If
  186. Else
  187. txtCodigoTitulo.Text = String.Empty
  188. End If
  189. Else
  190. txtCodigoTitulo.Text = String.Empty
  191. End If
  192. If Not FCompra Is DBNull.Value Then
  193. If Not FCompra Is Nothing Then
  194. If Not String.IsNullOrEmpty(FCompra) Then
  195. dtpFechaCompra.Value = FCompra
  196. Else
  197. dtpFechaCompra.Value = Date.Now.Date
  198. End If
  199. Else
  200. dtpFechaCompra.Value = Date.Now.Date
  201. End If
  202. Else
  203. dtpFechaCompra.Value = Date.Now.Date
  204. End If
  205. If Not ComisionCasa Is DBNull.Value Then
  206. If Not ComisionCasa Is Nothing Then
  207. If Not String.IsNullOrEmpty(ComisionCasa.ToString.Trim("%")) Then
  208. txtComisionCasa.Text = ComisionCasa.ToString.Trim("%") * 100
  209. Else
  210. txtComisionCasa.Text = "0.2825%"
  211. End If
  212. Else
  213. txtComisionCasa.Text = "0.2825%"
  214. End If
  215. Else
  216. txtComisionCasa.Text = "0.2825%"
  217. End If
  218. If Not ComisionBolsa Is DBNull.Value Then
  219. If Not ComisionBolsa Is Nothing Then
  220. If Not String.IsNullOrEmpty(ComisionBolsa.ToString.Trim("%")) Then
  221. txtComisionBolsa.Text = ComisionBolsa.ToString.Trim("%") * 100
  222. Else
  223. txtComisionBolsa.Text = "0.2825%"
  224. End If
  225. Else
  226. txtComisionBolsa.Text = "0.2825%"
  227. End If
  228. Else
  229. txtComisionBolsa.Text = "0.2825%"
  230. End If
  231. If Not EstadoIOF Is DBNull.Value Then
  232. If Not EstadoIOF Is Nothing Then
  233. If Not String.IsNullOrEmpty(EstadoIOF) Then
  234. If Index = 0 Then
  235. If EstadoIOF = 1 Then
  236. ChkIOF.Checked = True
  237. Else
  238. ChkIOF.Checked = False
  239. End If
  240. Else
  241. Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
  242. If EstadoIOFAnt = 1 Then
  243. ChkIOF.Checked = True
  244. Else
  245. ChkIOF.Checked = False
  246. End If
  247. End If
  248. Else
  249. If Not Index = 0 Then
  250. Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
  251. If EstadoIOFAnt = 1 Then
  252. ChkIOF.Checked = True
  253. Else
  254. ChkIOF.Checked = False
  255. End If
  256. End If
  257. End If
  258. Else
  259. If Not Index = 0 Then
  260. Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
  261. If EstadoIOFAnt = 1 Then
  262. ChkIOF.Checked = True
  263. Else
  264. ChkIOF.Checked = False
  265. End If
  266. End If
  267. End If
  268. Else
  269. If Not Index = 0 Then
  270. Dim EstadoIOFAnt = dgvReportos.Rows(Index - 1).Cells("EstadoIOF").Value
  271. If EstadoIOFAnt = 1 Then
  272. ChkIOF.Checked = True
  273. Else
  274. ChkIOF.Checked = False
  275. End If
  276. End If
  277. End If
  278. If Not EstadoRenta Is DBNull.Value Then
  279. If Not EstadoRenta Is Nothing Then
  280. If Not String.IsNullOrEmpty(EstadoRenta) Then
  281. If Index = 0 Then
  282. If EstadoRenta = 1 Then
  283. ChkRenta.Checked = True
  284. Else
  285. ChkRenta.Checked = False
  286. End If
  287. Else
  288. Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
  289. If EstadoRentaAnt = 1 Then
  290. ChkRenta.Checked = True
  291. Else
  292. ChkRenta.Checked = False
  293. End If
  294. End If
  295. Else
  296. If Not Index = 0 Then
  297. Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
  298. If EstadoRentaAnt = 1 Then
  299. ChkRenta.Checked = True
  300. Else
  301. ChkRenta.Checked = False
  302. End If
  303. End If
  304. End If
  305. Else
  306. If Not Index = 0 Then
  307. Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
  308. If EstadoRentaAnt = 1 Then
  309. ChkRenta.Checked = True
  310. Else
  311. ChkRenta.Checked = False
  312. End If
  313. End If
  314. End If
  315. Else
  316. If Not Index = 0 Then
  317. Dim EstadoRentaAnt = dgvReportos.Rows(Index - 1).Cells("EstadoRenta").Value
  318. If EstadoRentaAnt = 1 Then
  319. ChkRenta.Checked = True
  320. Else
  321. ChkRenta.Checked = False
  322. End If
  323. End If
  324. End If
  325. If Not Casa Is DBNull.Value Then
  326. If Not Casa Is Nothing Then
  327. If Not String.IsNullOrEmpty(Casa) Then
  328. cboCasaCorredora.SelectedValue = Casa
  329. Else
  330. cboCasaCorredora.SelectedIndex = -1
  331. End If
  332. Else
  333. cboCasaCorredora.SelectedIndex = -1
  334. End If
  335. Else
  336. cboCasaCorredora.SelectedIndex = -1
  337. End If
  338. End If
  339. End If
  340. Procesado = True
  341. End Sub
  342. Sub ComisionCasa(ByVal ComisionCasa As Double, ByVal Index As Integer)
  343. Dim ValorTrasado As Double = 0.0
  344. Dim Dias As Integer = 0
  345. Dim por As Double = 0
  346. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  347. Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  348. por = ComisionCasa
  349. Dim Fecha1 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  350. Dim Fecha2 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
  351. dgvReportos.Rows(Index).Cells("Comision CB").Value = Operaciones.ConvertirDecimal(Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base).ToString)
  352. End Sub
  353. Function ComisionCasaCargar(ByVal Index As Integer)
  354. Dim ValorTrasado As Double = 0
  355. Dim Dias As Integer = 0
  356. Dim por As Double = 0
  357. If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Valor Trasado").Value) Then
  358. ValorTrasado = dgvReportos.Rows(Index).Cells("Valor Trasado").Value
  359. End If
  360. If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Dias").Value) Then
  361. Dias = dgvReportos.Rows(Index).Cells("Dias").Value
  362. End If
  363. If (String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%"))) Then
  364. txtComisionCasa.Text = "0.2825%"
  365. Else
  366. por = CDec(txtComisionCasa.Text.ToString.Trim("%")) / 100
  367. End If
  368. Dim Fecha1 As Date = dgvReportos.Rows(Index).Cells("FCompra").Value
  369. Dim Fecha2 As Date = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
  370. Dim Com = Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base)
  371. dgvReportos.Rows(Index).Cells("Comision CB").Value = Com
  372. Return Com
  373. End Function
  374. Sub ComisionBolsa(ByVal ComisionBolsa As Double, ByVal Index As Integer)
  375. Dim ValorTrasado As Double = 0
  376. Dim Dias As Integer = 0
  377. Dim por As Double = 0
  378. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  379. Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  380. por = ComisionBolsa
  381. Dim Fecha1 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  382. Dim Fecha2 As Date = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
  383. dgvReportos.Rows(Index).Cells("Comision Bolsa").Value = Operaciones.ConvertirDecimal(Reporto.Comision(ValorTrasado, Dias, por, Fecha1, Fecha2, Base).ToString)
  384. End Sub
  385. Sub IOF(ByVal Index As Integer)
  386. Dim ValorTrasado As Double = 0
  387. Dim ComisionCasa As Double = 0
  388. Dim ComisionBolsa As Double = 0
  389. Dim dias As Integer = 0
  390. Dim Porcentaje As Double = 0.0025
  391. Dim Fecha1 As Date = Date.Now.Date
  392. Dim Fecha2 As Date = Date.Now.Date
  393. If ChkIOF.Checked Then
  394. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  395. ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value.ToString)
  396. ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value.ToString)
  397. dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  398. Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  399. Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
  400. dgvReportos.Rows(Index).Cells("IOF").Value = Operaciones.ConvertirDecimal(Reporto.IOF(ValorTrasado, ComisionCasa, ComisionBolsa, dias, Porcentaje, Fecha1, Fecha2, Base).ToString)
  401. Else
  402. dgvReportos.Rows(Index).Cells("IOF").Value = 0
  403. End If
  404. End Sub
  405. Sub TotalCostos(ByVal Index As Integer)
  406. Dim ComisionCasa As Double = 0
  407. Dim ComisionBolsa As Double = 0
  408. Dim IOF As Double = 0
  409. Dim OC As Double = 0
  410. Dim ValorTransado As Double = 0
  411. Dim Instrumento As String = String.Empty
  412. If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  413. Instrumento = "REPOVENTA"
  414. Else
  415. Instrumento = "REPO"
  416. End If
  417. ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value.ToString)
  418. ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value.ToString)
  419. IOF = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("IOF").Value.ToString)
  420. OC = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Otros Costos").Value.ToString)
  421. ValorTransado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  422. dgvReportos.Rows(Index).Cells("Total Costos").Value = Operaciones.ConvertirDecimal(Reporto.TotCostos(ComisionCasa, ComisionBolsa, IOF, OC, ValorTransado, Instrumento).ToString)
  423. End Sub
  424. Sub MontoLiquidacion(ByVal Index As Integer)
  425. Dim ValorTrasado As Double = 0
  426. Dim TotalCosto As Double = 0
  427. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  428. TotalCosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString)
  429. dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value = Operaciones.ConvertirDecimal(Reporto.MontoLiquidacion(ValorTrasado, TotalCosto).ToString)
  430. End Sub
  431. Sub InteresGenerar(ByVal Index As Integer)
  432. Dim ValorTrasado As Double = 0
  433. Dim rendimiento As Double = 0
  434. Dim dias As Integer = 0
  435. Dim Fecha1 As Date = Date.Now.Date
  436. Dim Fecha2 As Date = Date.Now.Date
  437. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  438. rendimiento = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Rendimiento").Value.ToString)
  439. dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  440. Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  441. Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
  442. dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value = Operaciones.ConvertirDecimal(Reporto.InteresGenerar(ValorTrasado, rendimiento, dias, Fecha1, Fecha2, Base).ToString)
  443. End Sub
  444. Sub RendimientoAntes(ByVal Index As Integer)
  445. Dim ValorTrasado As Double = 0
  446. Dim dias As Integer = 0
  447. Dim InteresGenerar As Double = 0
  448. Dim Totcosto As Double = 0
  449. Dim Fecha1 As Date = Date.Now.Date
  450. Dim Fecha2 As Date = Date.Now.Date
  451. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  452. dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  453. InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
  454. Totcosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString)
  455. Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  456. Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
  457. dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value = Operaciones.ConvertirDecimal(Reporto.RendimientoAntes(InteresGenerar, Totcosto, ValorTrasado, dias, Fecha1, Fecha2, Base, Tabla).ToString)
  458. End Sub
  459. Sub ValorRecompra(ByVal Index As Integer)
  460. Dim ValorTrasado As Double = 0
  461. Dim InteresGenerar As Double = 0
  462. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  463. InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
  464. dgvReportos.Rows(Index).Cells("Valor de ReCompra").Value = Operaciones.ConvertirDecimal(Reporto.ValorRecompras(ValorTrasado, InteresGenerar).ToString)
  465. End Sub
  466. Sub Renta(ByVal Index As String)
  467. Dim InteresGenerar As Double = 0
  468. If ChkRenta.Checked Then
  469. InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
  470. dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = (InteresGenerar * 0.1)
  471. Else
  472. dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0
  473. End If
  474. End Sub
  475. Sub IngresoNeto(ByVal Index As Integer)
  476. Dim InteresGenerar As Double = 0
  477. Dim Renta As Double = 0
  478. InteresGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value.ToString)
  479. Renta = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value.ToString)
  480. dgvReportos.Rows(Index).Cells("Ingreso Neto").Value = Operaciones.ConvertirDecimal(Reporto.IngresoNet(InteresGenerar, Renta).ToString)
  481. End Sub
  482. Sub ValorNeto(ByVal Index As Integer)
  483. Dim ValorTrasado As Double = 0
  484. Dim IngresoNeto As Double = 0
  485. Dim CostoTrans As Double = 0
  486. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  487. IngresoNeto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString)
  488. CostoTrans = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value.ToString)
  489. dgvReportos.Rows(Index).Cells("Valor Neto").Value = Operaciones.ConvertirDecimal(Reporto.ValorNet(ValorTrasado, IngresoNeto, CostoTrans).ToString)
  490. End Sub
  491. Sub RendimientoDespues(ByVal Index As Integer)
  492. Dim ValorTrasado As Double = 0
  493. Dim IngresoNeto As Double = 0
  494. Dim TotalCosto As Double = 0
  495. Dim dias As Integer = 0
  496. Dim Fecha1 As Date = Date.Now.Date
  497. Dim Fecha2 As Date = Date.Now.Date
  498. ValorTrasado = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value.ToString)
  499. IngresoNeto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString)
  500. TotalCosto = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value.ToString)
  501. dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  502. Fecha1 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  503. Fecha2 = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value.ToString)
  504. dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value = Operaciones.ConvertirDecimal(Reporto.RendimientoDespues(IngresoNeto, TotalCosto, ValorTrasado, dias, Fecha1, Fecha2, Base).ToString)
  505. End Sub
  506. Sub CargarFecha()
  507. Dim Index As Integer = dgvReportos.CurrentRow.Index
  508. Dim Fecha As Date = dtpFechaCompra.Value
  509. Dim Fecha2 As Date = Date.Now.Date
  510. If Not String.IsNullOrEmpty(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value) Then
  511. Fecha2 = dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value
  512. End If
  513. End Sub
  514. Private Sub CargarCasaCorredora()
  515. If cboCasaCorredora.Items.Count = 0 Or cboCasaCorredora.Items.Count = 1 Then
  516. Me.cboCasaCorredora.DataSource = oDAOGeneral.ListaTiposImpuesto
  517. Me.cboCasaCorredora.DisplayMember = "Descripcion"
  518. Me.cboCasaCorredora.ValueMember = "Codigo"
  519. Me.cboCasaCorredora.SelectedIndex = 0
  520. End If
  521. End Sub
  522. Sub CargarBase()
  523. If cboAnioBase.Items.Count = 0 Or cboAnioBase.Items.Count = 1 Then
  524. Me.cboAnioBase.DataSource = oDAOGeneral.ListaBase
  525. Me.cboAnioBase.DisplayMember = "Descripcion"
  526. Me.cboAnioBase.ValueMember = "Codigo"
  527. Me.cboAnioBase.SelectedIndex = 0
  528. End If
  529. End Sub
  530. Private Sub frmReporto_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  531. Titulo.TabPages.Remove(TbImpuestos)
  532. Dim CantidadFilas As Integer = dgvReportos.Rows.Count
  533. CargarCasaCorredora()
  534. CargarBase()
  535. If Variables.Codigo.IndexOf("REPO") > -1 And Not Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  536. Tabla = "REP0"
  537. lblReporto.Text = "Reporto de Compra"
  538. Variables.Inicio = True
  539. txtComisionCasa.Text = PorcentajeComisionCasa
  540. txtComisionBolsa.Text = PorcentajeComisionBolsa
  541. If CantidadFilas <= 1 Then
  542. AgregarCampos(1)
  543. CargarReporto(Tabla)
  544. End If
  545. Calculos()
  546. Variables.Inicio = False
  547. Calculos()
  548. CargarUnaVez = False
  549. CodigoRotar = 0
  550. ElseIf Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  551. OcultarValoresImp()
  552. Tabla = "REP0VENTA"
  553. lblReporto.Text = "Reporto de Venta"
  554. lblFechaCompra.Text = "Fecha de Venta"
  555. lblCodigoInstrumento.Visible = True
  556. txtCodigoInstrumento.Visible = True
  557. If Not String.IsNullOrEmpty(CodigoProveniente) Then
  558. txtCodigoInstrumento.Text = CodigoProveniente
  559. End If
  560. If CantidadFilas <= 1 Then
  561. AgregarCampos(2)
  562. CargarReporto(Tabla)
  563. End If
  564. CodigoRotar = 0
  565. Calculos()
  566. CargarMontoRepoVenta()
  567. End If
  568. Cargado = True
  569. CorrelativoSinBD()
  570. ExisteInversion()
  571. ValidarExistencia()
  572. Formato()
  573. CargarTransladoNuevo()
  574. End Sub
  575. Sub CargarMontoRepoVenta()
  576. If Operaciones.ConvertirDecimal(txtMonto.Text.ToString) > 0 Then
  577. If dgvReportos.Rows(0).Cells("Valor Trasado").Value = 0 Then
  578. dgvReportos.Rows(0).Cells("Valor Trasado").Value = txtMonto.Text
  579. txtMonto.Text = 0
  580. End If
  581. End If
  582. End Sub
  583. Sub OcultarValoresImp()
  584. ChkIOF.Checked = False
  585. ChkRenta.Checked = False
  586. ChkRenta.Visible = False
  587. ChkIOF.Visible = False
  588. End Sub
  589. Function ExisteInversion()
  590. Dim Codigo As String = Variables.Codigo
  591. Dim TablaINV As String = "INV0"
  592. Dim TablaPINV As String = "PIN0"
  593. Dim General As New DAOGeneral
  594. Dim InvPro = Variables.InvPro
  595. If InvPro = "I" Then
  596. Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
  597. If INV0 Then
  598. navNuevo.Visible = True
  599. Return True
  600. Else
  601. navNuevo.Visible = False
  602. Return False
  603. End If
  604. End If
  605. If InvPro = "P" Then
  606. Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
  607. If PINV0 Then
  608. navNuevo.Visible = True
  609. Return True
  610. Else
  611. navNuevo.Visible = False
  612. Return False
  613. End If
  614. End If
  615. Return False
  616. End Function
  617. Sub Formato()
  618. If (String.IsNullOrEmpty(txtDias.Text.ToString)) Then
  619. txtDias.Text = 0
  620. End If
  621. If (String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%"))) Then
  622. txtComisionCasa.Text = "0.2825%"
  623. End If
  624. If (String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.Trim("%"))) Then
  625. txtComisionBolsa.Text = "0.2825%"
  626. End If
  627. If txtComisionBolsa.Text.ToString.IndexOf("%") = -1 Then
  628. txtComisionBolsa.Text = txtComisionBolsa.Text.ToString + "%"
  629. End If
  630. If txtComisionCasa.Text.ToString.IndexOf("%") = -1 Then
  631. txtComisionCasa.Text = txtComisionCasa.Text.ToString + "%"
  632. End If
  633. If cboCasaCorredora.SelectedIndex = -1 Then
  634. Try
  635. cboCasaCorredora.SelectedIndex = 0
  636. Catch ex As Exception
  637. End Try
  638. End If
  639. End Sub
  640. Sub IOFRentaEstado()
  641. Dim CantidadRegistro As Integer = dgvReportos.Rows.Count - 2
  642. Dim EstadoImpIOF As Integer = 0
  643. Dim EstadoImpRenta As Integer = 0
  644. If ChkIOF.Checked Then
  645. EstadoImpIOF = 1
  646. Else
  647. EstadoImpIOF = 0
  648. End If
  649. If ChkRenta.Checked Then
  650. EstadoImpRenta = 1
  651. Else
  652. EstadoImpRenta = 0
  653. End If
  654. Dim i As Integer = 0
  655. While i <= CantidadRegistro
  656. dgvReportos.Rows(i).Cells("EstadoIOF").Value = EstadoImpIOF
  657. dgvReportos.Rows(i).Cells("EstadoRenta").Value = EstadoImpRenta
  658. i += 1
  659. End While
  660. End Sub
  661. Sub ActualizarImpuestos(ByVal Valor As Integer)
  662. CargarReporto(Tabla)
  663. End Sub
  664. Sub Calculos()
  665. If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  666. Dim Cantidad As Integer = dgvReportos.Rows.Count - 2
  667. Dim Index As Integer = 0
  668. While Index <= Cantidad
  669. Dim FCompra As Date
  670. Dim VComisionCasa As Double = 0
  671. Dim VComisionBolsa As Double = 0
  672. FCompra = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("FCompra").Value.ToString)
  673. VComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value.ToString)
  674. VComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value.ToString)
  675. FechaVen(FCompra, Index)
  676. ComisionCasa(VComisionCasa, Index)
  677. ComisionBolsa(VComisionBolsa, Index)
  678. IOF(Index)
  679. TotalCostos(Index)
  680. MontoLiquidacion(Index)
  681. InteresGenerar(Index)
  682. RendimientoAntes(Index)
  683. ValorRecompra(Index)
  684. Renta(Index)
  685. IngresoNeto(Index)
  686. ValorNeto(Index)
  687. RendimientoDespues(Index)
  688. Index += 1
  689. End While
  690. Else
  691. End If
  692. End Sub
  693. Sub NuevaFila()
  694. If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  695. Dim i As Integer = dgvReportos.CurrentRow.Index
  696. Dim IndexAnterior As Integer = dgvReportos.CurrentRow.Index - 1
  697. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Codigo").Value)) Then
  698. dgvReportos.Rows(i).Cells("Codigo").Value = Correlativo()
  699. End If
  700. If Not i = 0 Then
  701. If (Not String.IsNullOrEmpty(dgvReportos.Rows(IndexAnterior).Cells("EstadoIOF").Value)) Then
  702. dgvReportos.Rows(i).Cells("EstadoIOF").Value = dgvReportos.Rows(IndexAnterior).Cells("EstadoIOF").Value
  703. Else
  704. dgvReportos.Rows(i).Cells("EstadoIOF").Value = 0
  705. End If
  706. If (Not String.IsNullOrEmpty(dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value)) Then
  707. dgvReportos.Rows(i).Cells("EstadoRenta").Value = dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value
  708. Else
  709. dgvReportos.Rows(IndexAnterior).Cells("EstadoRenta").Value = 0
  710. End If
  711. End If
  712. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor Trasado").Value)) Then
  713. dgvReportos.Rows(i).Cells("Valor Trasado").Value = 0
  714. End If
  715. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Dias").Value)) Then
  716. dgvReportos.Rows(i).Cells("Dias").Value = 0
  717. End If
  718. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Fecha de Vencimiento").Value)) Then
  719. Dim FechaVenc As String = Format(Date.Now.Date, "dd/MM/yyyy")
  720. dgvReportos.Rows(i).Cells("Fecha de Vencimiento").Value = FechaVenc
  721. End If
  722. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Rendimiento").Value)) Then
  723. dgvReportos.Rows(i).Cells("Rendimiento").Value = 0
  724. End If
  725. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("IOF").Value)) Then
  726. dgvReportos.Rows(i).Cells("IOF").Value = 0
  727. End If
  728. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Comision CB").Value)) Then
  729. dgvReportos.Rows(i).Cells("Comision CB").Value = 0
  730. End If
  731. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Comision Bolsa").Value)) Then
  732. dgvReportos.Rows(i).Cells("Comision Bolsa").Value = 0
  733. End If
  734. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Otros Costos").Value)) Then
  735. dgvReportos.Rows(i).Cells("Otros Costos").Value = 0
  736. End If
  737. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Total Costos").Value)) Then
  738. dgvReportos.Rows(i).Cells("Total Costos").Value = 0
  739. End If
  740. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Monto a Liquidar").Value)) Then
  741. dgvReportos.Rows(i).Cells("Monto a Liquidar").Value = 0
  742. End If
  743. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Interes a Genrerar").Value)) Then
  744. dgvReportos.Rows(i).Cells("Interes a Genrerar").Value = 0
  745. End If
  746. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Costo de Transferencia").Value)) Then
  747. dgvReportos.Rows(i).Cells("Costo de Transferencia").Value = 0
  748. End If
  749. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("R% Neto (Antes de Impuesto)").Value)) Then
  750. dgvReportos.Rows(i).Cells("R% Neto (Antes de Impuesto)").Value = 0
  751. End If
  752. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor de ReCompra").Value)) Then
  753. dgvReportos.Rows(i).Cells("Valor de ReCompra").Value = 0
  754. End If
  755. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value)) Then
  756. dgvReportos.Rows(i).Cells("Impuesto de Liquidacion").Value = 0
  757. End If
  758. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Ingreso Neto").Value)) Then
  759. dgvReportos.Rows(i).Cells("Ingreso Neto").Value = 0
  760. End If
  761. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("Valor Neto").Value)) Then
  762. dgvReportos.Rows(i).Cells("Valor Neto").Value = 0
  763. End If
  764. If (String.IsNullOrEmpty(dgvReportos.Rows(i).Cells("R% Neto (Despues de Impuesto)").Value)) Then
  765. dgvReportos.Rows(i).Cells("R% Neto (Despues de Impuesto)").Value = 0
  766. End If
  767. End If
  768. End Sub
  769. Sub QuitarFila()
  770. Dim result As Integer = MsgBox("¿Está seguro que desea eliminar la fila?", MsgBoxStyle.OkCancel)
  771. ' Test result.
  772. Dim codigo As String = Variables.Codigo
  773. Dim Numero As Integer = dgvReportos.CurrentRow.Cells("codigo").Value
  774. If result = MsgBoxResult.Ok Then
  775. Try
  776. dgvReportos.Rows.Remove(dgvReportos.CurrentRow)
  777. ReportoConsula.Eliminar(codigo, Numero, Tabla)
  778. Catch ex As Exception
  779. MsgBox("No ha seleccionado una fila")
  780. End Try
  781. End If
  782. End Sub
  783. Sub FechaVen(ByVal FCompra As Date, ByVal Index As Integer)
  784. Dim FechaCompra As Date = FCompra
  785. Dim Dias As Integer = 0
  786. Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value.ToString)
  787. dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value = CStr(Format(Reporto.FechaDeVencimiento(FechaCompra, Dias), "dd/MM/yyyy"))
  788. End Sub
  789. Sub CorrelativoSinBD()
  790. Dim Index As Integer = 0
  791. Dim IndexCantidad As Integer = dgvReportos.Rows.Count - 2
  792. Dim NumeroMayor As Integer = 0
  793. While Index <= IndexCantidad
  794. dgvReportos.Rows(Index).Cells("Correlativo").Value = Index + 1
  795. Index += 1
  796. End While
  797. End Sub
  798. Function Correlativo()
  799. Dim Index As Integer = 0
  800. Dim IndexCantidad As Integer = dgvReportos.Rows.Count - 2
  801. Dim NumeroMayor As Integer = 0
  802. While Index <= IndexCantidad
  803. Dim Numero As Integer = dgvReportos.Rows(Index).Cells("codigo").Value
  804. If Numero > NumeroMayor Then
  805. NumeroMayor = Numero
  806. End If
  807. Index += 1
  808. End While
  809. Return NumeroMayor + 1
  810. End Function
  811. Sub CargarReporto(ByVal Tabla As String)
  812. Dim ConvertirString As String
  813. Dim Activo = 0.0, ActivoRenta = 0.0
  814. Dim EstadoIOF, EstadoRenta
  815. Dim dr = ReportoConsula.CargarReporto(Codigo, Tabla)
  816. If Tabla = "REP0" Or Tabla = "REP0VENTA" Then
  817. If (Not dr Is Nothing) Then
  818. While dr.Read
  819. If dr("EstadoIOF") Then
  820. EstadoIOF = 1
  821. ChkIOF.Checked = True
  822. Else
  823. EstadoIOF = 0
  824. ChkIOF.Checked = False
  825. End If
  826. If dr("EstadoRenta") Then
  827. EstadoRenta = 1
  828. ChkRenta.Checked = True
  829. Else
  830. EstadoRenta = 0
  831. ChkRenta.Checked = False
  832. End If
  833. Dim FechaVencimiento As Date = dr("FCompra")
  834. Dim Dias As Integer = dr("Dias")
  835. FechaVencimiento = FechaVencimiento.AddDays(Dias)
  836. ConvertirString = Format(FechaVencimiento, "dd/MM/yyyy")
  837. dtpFechaCompra.Value = dr("FCompra")
  838. If (dr("IOF")) Then
  839. Activo = 1
  840. Else
  841. Activo = 0
  842. End If
  843. If (dr("Renta")) Then
  844. ActivoRenta = 1
  845. Else
  846. ActivoRenta = 0
  847. End If
  848. Dim ComisionCasa As Double = 0
  849. Dim ComisionBolsa As Double = 0
  850. If Not String.IsNullOrEmpty(dr("ComisionCasa").ToString) Then
  851. ComisionCasa = dr("ComisionCasa")
  852. End If
  853. If Not String.IsNullOrEmpty(dr("ComisionBolsa").ToString) Then
  854. ComisionBolsa = dr("ComisionBolsa")
  855. End If
  856. If Tabla = "REP0VENTA" Then
  857. dgvReportos.Rows.Add("", dr("ValTrans"), dr("Dias"), ConvertirString, (dr("Rend")), 0, 0, 0, 0, 0, 0, 0, 0, 0, dr("CostoTransfr"), ActivoRenta, "", "", "", dr("Nombre"), dr("FCompra"), ComisionCasa, ComisionBolsa, dr("Casa"), dr("codigo"), "", EstadoIOF, EstadoRenta)
  858. End If
  859. End While
  860. End If
  861. Else
  862. End If
  863. End Sub
  864. Function ObtenerDatos(ByVal Index As Integer)
  865. Dim coleccion As New Collection
  866. Dim Renta, IOF, Nombre, FCompra, ValTrans, Dias, FVenc, Rend, CostoTransfr, codigo, ComisionCasa, ComisionBolsa, Casa, Casa2
  867. Dim EstadoIOF, EstadoRenta
  868. If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  869. Dim ComisionCasaValor, ComisionBolsaValor, IOFValor, OtrosCostos, TotalCostos, MontoLiq
  870. Dim IntGenerar, RendAntImp, RendDesImp, ImpLiq, IngrNet, ValorNet
  871. ValorNet = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Neto").Value.ToString)
  872. IngrNet = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Ingreso Neto").Value.ToString)
  873. ImpLiq = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value)
  874. RendDesImp = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("R% Neto (Despues de Impuesto)").Value)
  875. RendAntImp = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("R% Neto (Antes de Impuesto)").Value)
  876. IntGenerar = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Interes a Genrerar").Value)
  877. MontoLiq = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Monto a Liquidar").Value)
  878. TotalCostos = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Total Costos").Value)
  879. OtrosCostos = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Otros Costos").Value)
  880. IOFValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("IOF").Value)
  881. ComisionBolsaValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision Bolsa").Value)
  882. ComisionCasaValor = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Comision CB").Value)
  883. Nombre = dgvReportos.Rows(Index).Cells("Nombre").Value.ToString
  884. FCompra = Operaciones.ConvertirFechaBaseDatos(dgvReportos.Rows(Index).Cells("FCompra").Value)
  885. ValTrans = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Valor Trasado").Value)
  886. Dias = Operaciones.ConvertirEntero(dgvReportos.Rows(Index).Cells("Dias").Value)
  887. FVenc = Operaciones.ConvertirFecha(dgvReportos.Rows(Index).Cells("Fecha de Vencimiento").Value)
  888. Rend = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Rendimiento").Value)
  889. CostoTransfr = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("Costo de Transferencia").Value)
  890. codigo = dgvReportos.Rows(Index).Cells("Codigo").Value.ToString
  891. ComisionCasa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionCasa").Value)
  892. ComisionBolsa = Operaciones.ConvertirDecimal(dgvReportos.Rows(Index).Cells("ComisionBolsa").Value)
  893. Casa = dgvReportos.Rows(Index).Cells("Casa").Value.ToString
  894. If (Not dgvReportos.Rows(Index).Cells("IOF").Value = 0) Then
  895. IOF = 1
  896. Else
  897. IOF = 0
  898. End If
  899. If (Not dgvReportos.Rows(Index).Cells("Impuesto de Liquidacion").Value = 0) Then
  900. Renta = 1
  901. Else
  902. Renta = 0
  903. End If
  904. If (dgvReportos.Rows(Index).Cells("EstadoIOF").Value = 1) Then
  905. EstadoIOF = 1
  906. Else
  907. EstadoIOF = 0
  908. End If
  909. If (dgvReportos.Rows(Index).Cells("EstadoRenta").Value = 1) Then
  910. EstadoRenta = 1
  911. Else
  912. EstadoRenta = 0
  913. End If
  914. coleccion.Add(Nombre)
  915. coleccion.Add(CDate(FCompra))
  916. coleccion.Add(CDec(ValTrans))
  917. coleccion.Add(CInt(Dias))
  918. coleccion.Add(CDate(FVenc))
  919. coleccion.Add(CDec(Rend))
  920. coleccion.Add(CDec(CostoTransfr))
  921. coleccion.Add(codigo)
  922. coleccion.Add(ComisionCasa)
  923. coleccion.Add(ComisionBolsa)
  924. coleccion.Add(Casa)
  925. coleccion.Add(IOF)
  926. coleccion.Add(Renta)
  927. coleccion.Add(Base)
  928. coleccion.Add(ComisionCasaValor)
  929. coleccion.Add(ComisionBolsaValor)
  930. coleccion.Add(IOFValor)
  931. coleccion.Add(OtrosCostos)
  932. coleccion.Add(TotalCostos)
  933. coleccion.Add(MontoLiq)
  934. coleccion.Add(IntGenerar)
  935. coleccion.Add(RendAntImp)
  936. coleccion.Add(RendDesImp)
  937. coleccion.Add(ImpLiq)
  938. coleccion.Add(IngrNet)
  939. coleccion.Add(ValorNet)
  940. coleccion.Add(EstadoIOF)
  941. coleccion.Add(EstadoRenta)
  942. End If
  943. Return coleccion
  944. End Function
  945. 'GETS
  946. Private Sub dgvReportos_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellEndEdit
  947. CorrelativoSinBD()
  948. Correlativo()
  949. Calculos()
  950. End Sub
  951. Private Sub dtpFechaCompra_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaCompra.ValueChanged
  952. Formato()
  953. IngresarDatos()
  954. If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  955. End If
  956. Modificado = True
  957. Calculos()
  958. End Sub
  959. Private Sub dgvReportos_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellClick
  960. IOFRentaEstado()
  961. IngresarDatosReves()
  962. NuevaFila()
  963. If Variables.Codigo.IndexOf("REPO") > -1 Or Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  964. Dim Index = dgvReportos.CurrentRow.Cells("codigo").Value
  965. CargarFecha()
  966. Calculos()
  967. End If
  968. Formato()
  969. End Sub
  970. Private Sub dgvReportos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvReportos.CellContentClick
  971. End Sub
  972. Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
  973. End Sub
  974. Private Sub txtCodigoTitulo_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoTitulo.TextChanged
  975. Modificado = True
  976. End Sub
  977. Private Sub txtIOF_TextChanged(sender As Object, e As EventArgs)
  978. End Sub
  979. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  980. btnAccion.Text = "Modificar"
  981. Estado = "M"
  982. End Sub
  983. Sub NuevoIngreso(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer, ByVal Tabla As String)
  984. Dim i As Integer = 0
  985. Dim Index = dgvReportos.Rows.Count - 2
  986. i = Cantidad
  987. While i <= Index
  988. Dim coleccion = ObtenerDatos(i)
  989. If ReportoConsula.Nuevo(coleccion, Codigo, Tabla) Is Nothing Then
  990. Exit Sub
  991. End If
  992. i += 1
  993. End While
  994. MsgBox("Reportos actualizados")
  995. End Sub
  996. Function NuevoIngresoColeccion()
  997. Dim i As Integer = 0
  998. Dim Index = dgvReportos.Rows.Count - 2
  999. Dim diccionario As New Dictionary(Of String, Collection)
  1000. While i <= Index
  1001. Dim coleccion = ObtenerDatos(i)
  1002. diccionario.Add(i, coleccion)
  1003. i += 1
  1004. End While
  1005. Return diccionario
  1006. End Function
  1007. Function CanRegistros(ByVal Tabla As String)
  1008. Dim Codigo = Variables.Codigo
  1009. Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
  1010. Return Cantidad
  1011. End Function
  1012. Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click
  1013. LlenarBase()
  1014. Dim Codigo = Variables.Codigo
  1015. Dim diccionario As Dictionary(Of String, Collection) = NuevoIngresoColeccion()
  1016. If (Estado = "N") Then
  1017. ReportoConsula.ProcesoDatos(diccionario, Codigo, Tabla)
  1018. ValidarExistencia()
  1019. ElseIf Not ExisteValidacion() Then
  1020. Variables.ColeccionREPO = diccionario
  1021. Me.Close()
  1022. ElseIf (Estado = "M") Then
  1023. ReportoConsula.ProcesoDatos(diccionario, Codigo, Tabla)
  1024. ValidarExistencia()
  1025. ElseIf (Estado = "B") Then
  1026. QuitarFila()
  1027. ValidarExistencia()
  1028. End If
  1029. End Sub
  1030. Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
  1031. btnAccion.Text = "Agregar"
  1032. Estado = "N"
  1033. End Sub
  1034. Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
  1035. btnAccion.Text = "Eliminar"
  1036. Estado = "B"
  1037. End Sub
  1038. Private Sub Button1_Click(sender As Object, e As EventArgs)
  1039. End Sub
  1040. Private Sub btnAgregarImpuesto_Click(sender As Object, e As EventArgs)
  1041. End Sub
  1042. Private Sub dgvImpuestos_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
  1043. End Sub
  1044. Private Sub TabPage3_Click(sender As Object, e As EventArgs) Handles TbImpuestos.Click
  1045. End Sub
  1046. Private Sub dgvImpuestoAgregado_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
  1047. End Sub
  1048. Private Sub btnQuitar_Click(sender As Object, e As EventArgs)
  1049. End Sub
  1050. Private Sub FlpIOF_Click(sender As Object, e As EventArgs) Handles FlpIOF.Click
  1051. End Sub
  1052. Private Sub FlpIOF_MouseClick(sender As Object, e As MouseEventArgs) Handles FlpIOF.MouseClick
  1053. End Sub
  1054. Private Sub FlpIOF_ChangeUICues(sender As Object, e As UICuesEventArgs) Handles FlpIOF.ChangeUICues
  1055. End Sub
  1056. Private Sub FlpIOF_Paint(sender As Object, e As PaintEventArgs) Handles FlpIOF.Paint
  1057. End Sub
  1058. Private Sub txtComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionCasa.KeyPress
  1059. If String.IsNullOrEmpty(txtComisionCasa.Text.ToString.Trim("%")) Then
  1060. If e.KeyChar = "." Then
  1061. txtComisionCasa.Text = "0.0%"
  1062. Exit Sub
  1063. End If
  1064. End If
  1065. If (Not txtComisionCasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1066. Operaciones.ValidarEntrada(sender, e, True)
  1067. Else
  1068. Operaciones.ValidarEntrada(sender, e, False)
  1069. End If
  1070. End Sub
  1071. Private Sub txtComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionBolsa.KeyPress
  1072. If String.IsNullOrEmpty(txtComisionBolsa.Text.ToString.Trim("%")) Then
  1073. If e.KeyChar = "." Then
  1074. txtComisionBolsa.Text = "0.2825%"
  1075. Exit Sub
  1076. End If
  1077. End If
  1078. If (Not txtComisionBolsa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1079. Operaciones.ValidarEntrada(sender, e, True)
  1080. Else
  1081. Operaciones.ValidarEntrada(sender, e, False)
  1082. End If
  1083. End Sub
  1084. Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
  1085. End Sub
  1086. Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
  1087. IngresarDatos()
  1088. Modificado = True
  1089. Calculos()
  1090. End Sub
  1091. Private Sub txtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
  1092. IngresarDatos()
  1093. If (InstrumentoFinanciero = "REPOVENTA") Then
  1094. End If
  1095. Modificado = True
  1096. Calculos()
  1097. End Sub
  1098. Private Sub txtDias_TextChanged(sender As Object, e As EventArgs) Handles txtDias.TextChanged
  1099. IngresarDatos()
  1100. If (InstrumentoFinanciero = "REPOVENTA") Then
  1101. End If
  1102. Modificado = True
  1103. Calculos()
  1104. End Sub
  1105. Private Sub cboCasaCorredora_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasaCorredora.SelectedIndexChanged
  1106. Modificado = True
  1107. IngresarDatos()
  1108. End Sub
  1109. Private Sub txtCodigoTitulo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCodigoTitulo.KeyPress
  1110. End Sub
  1111. Private Sub txtDias_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDias.KeyPress
  1112. If String.IsNullOrEmpty(txtDias.Text) Then
  1113. If e.KeyChar = "." Then
  1114. txtDias.Text = "0"
  1115. Exit Sub
  1116. End If
  1117. End If
  1118. If (Not txtDias.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1119. Operaciones.ValidarEntrada(sender, e, True)
  1120. Else
  1121. Operaciones.ValidarEntrada(sender, e, False)
  1122. End If
  1123. End Sub
  1124. Private Sub txtCodigoTitulo_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCodigoTitulo.KeyUp
  1125. IngresarDatos()
  1126. End Sub
  1127. Private Sub txtComisionCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionCasa.KeyUp
  1128. If txtComisionCasa.Text = "." Then
  1129. txtComisionCasa.Text = ".0%"
  1130. End If
  1131. IngresarDatos()
  1132. Calculos()
  1133. End Sub
  1134. Private Sub txtComisionBolsa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionBolsa.KeyUp
  1135. If txtComisionBolsa.Text = "." Then
  1136. txtComisionBolsa.Text = ".0%"
  1137. End If
  1138. IngresarDatos()
  1139. Calculos()
  1140. End Sub
  1141. Sub ValidarExistencia()
  1142. Dim General As New DAOGeneral
  1143. Dim Codigo As String = Variables.Codigo
  1144. Dim Tabla As String = String.Empty
  1145. If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  1146. Tabla = "REP0VENTA"
  1147. ElseIf Variables.Codigo.IndexOf("REPO") > -1 Then
  1148. Tabla = "REP0"
  1149. End If
  1150. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  1151. If (Existe) Then
  1152. navNuevo.Enabled = False
  1153. navModificar.Enabled = True
  1154. navEliminar.Enabled = True
  1155. Else
  1156. navNuevo.Enabled = True
  1157. navModificar.Enabled = False
  1158. navEliminar.Enabled = False
  1159. End If
  1160. Estado = String.Empty
  1161. btnAccion.Text = "Aceptar"
  1162. End Sub
  1163. Function ExisteValidacion()
  1164. Dim General As New DAOGeneral
  1165. Dim Codigo As String = Variables.Codigo
  1166. Dim Tabla As String = String.Empty
  1167. If Variables.Codigo.IndexOf("REPOVENTA") > -1 Then
  1168. Tabla = "REP0VENTA"
  1169. ElseIf Variables.Codigo.IndexOf("REPO") > -1 Then
  1170. Tabla = "REP0"
  1171. End If
  1172. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  1173. Return Existe
  1174. End Function
  1175. Private Sub btnGuardar_Click(sender As Object, e As EventArgs)
  1176. End Sub
  1177. Private Sub dgvReportos_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) Handles dgvReportos.CellBeginEdit
  1178. CorrelativoSinBD()
  1179. Correlativo()
  1180. End Sub
  1181. Private Sub txtDias_KeyUp(sender As Object, e As KeyEventArgs) Handles txtDias.KeyUp
  1182. If txtDias.Text = "." Then
  1183. txtDias.Text = ".0"
  1184. End If
  1185. IngresarDatos()
  1186. Calculos()
  1187. End Sub
  1188. Private Sub cboAnioBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboAnioBase.SelectedIndexChanged
  1189. LlenarBase()
  1190. IngresarDatos()
  1191. If (InstrumentoFinanciero = "REPOVENTA") Then
  1192. End If
  1193. Modificado = True
  1194. Calculos()
  1195. End Sub
  1196. Private Sub txtDias_Leave(sender As Object, e As EventArgs) Handles txtDias.Leave
  1197. Formato()
  1198. End Sub
  1199. Private Sub txtComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtComisionCasa.Leave
  1200. Formato()
  1201. End Sub
  1202. Private Sub txtComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtComisionBolsa.Leave
  1203. Formato()
  1204. End Sub
  1205. Private Sub frmReporto_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
  1206. dgvReportos.Width = Me.Width - 10
  1207. dgvReportos.Height = Me.Height - 290
  1208. End Sub
  1209. Private Sub ChkIOF_CheckedChanged(sender As Object, e As EventArgs) Handles ChkIOF.CheckedChanged
  1210. IOFRentaEstado()
  1211. Modificado = True
  1212. IngresarDatos()
  1213. Calculos()
  1214. End Sub
  1215. Private Sub ChkRenta_CheckedChanged(sender As Object, e As EventArgs) Handles ChkRenta.CheckedChanged
  1216. IOFRentaEstado()
  1217. Modificado = True
  1218. IngresarDatos()
  1219. Calculos()
  1220. End Sub
  1221. Private Sub txtCodigoInstrumento_TextChanged(sender As Object, e As EventArgs) Handles txtCodigoInstrumento.TextChanged
  1222. IngresarDatos()
  1223. Modificado = True
  1224. Calculos()
  1225. End Sub
  1226. Sub SeleccionarInstrumento()
  1227. Dim frmInstrumentos As New frmSeleccionTitulosReportos
  1228. frmInstrumentos.Show()
  1229. End Sub
  1230. Private Sub btnSaldoDisponible_Click(sender As Object, e As EventArgs)
  1231. SeleccionarInstrumento()
  1232. End Sub
  1233. Private Sub btnRequisicion_Click(sender As Object, e As EventArgs)
  1234. End Sub
  1235. Sub CargarTransladoNuevo()
  1236. Dim Existe As Boolean = ExisteInversion()
  1237. If Not RetCodigoInversionExiste And Not Existe Then
  1238. If dgvReportos.Rows(0).Cells("Valor Trasado").Value = 0 Then
  1239. dgvReportos.Rows(0).Cells("Valor Trasado").Value = Variables.RetMonto
  1240. End If
  1241. End If
  1242. End Sub
  1243. End Class