frmLetes.vb 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269
  1. Imports System.Globalization
  2. Public Class frmLetes
  3. Dim oCELetes As LETESCE
  4. Dim oDAOLetes As New LETESDAO
  5. Dim oDAOGeneral As New DAOGeneral
  6. Dim IndexBase As Integer = 0
  7. Dim TipoTransaccion = "OK"
  8. Dim Operaciones As New Operaciones
  9. Dim CalculosDias As New CalculosDias
  10. Dim V_txtPrecio = 0.0, V_txtValorTransado = 0.0, V_txtComisionCasa = 0.0, V_txtComisionBolsa = 0.0, V_txtIngresoBruto = 0.0, V_txtTotalAPagar = 0.0, V_txtIngresoNeto = 0.0, V_txtRendimientoNeto = 0.0, V_txtDiasAcumulados = 0.0
  11. Dim DecimalesRedondeo As Integer = 4
  12. Private CodigoInversion As String
  13. Dim Instrumento As String
  14. Private _Modo As String
  15. Private _IdDocumento As Integer
  16. Private _TipoDocumento As String
  17. Private _ValorNominal As Double
  18. Private _ValorTransado As Double
  19. Private _Precio As Double
  20. Private _PorcentajeCasa As Double
  21. Private _ComisionCasa As Double
  22. Private _PorcentajeBolsa As Double
  23. Private _ComisionBolsa As Double
  24. Private _TotalAPagar As Double
  25. Private _FechaOperacion As Date
  26. Private _FechaLiquidacion As Date
  27. Private _FechaVencimiento As Date
  28. Private _RendimientoBruto As Double
  29. Private _RendimientoNeto As Double
  30. Private _Periodicidad As String
  31. Private _Plazo As Integer
  32. Private _IngresoBruto As Double
  33. Private _IngresoNeto As Double
  34. Private PBUR As Double = False
  35. Private VCN As Double = False
  36. Private CET As Double = False
  37. Public Property Modo As String
  38. Get
  39. Return _Modo
  40. End Get
  41. Set(value As String)
  42. _Modo = value
  43. End Set
  44. End Property
  45. Private Property IdDocumento As Integer
  46. Get
  47. Return _IdDocumento
  48. End Get
  49. Set(value As Integer)
  50. _IdDocumento = value
  51. End Set
  52. End Property
  53. Private Property TipoDocumento As String
  54. Get
  55. Return _TipoDocumento
  56. End Get
  57. Set(value As String)
  58. _TipoDocumento = value
  59. End Set
  60. End Property
  61. 'GETS
  62. Function GetFechaOperacion() As Date
  63. Dim valor As Date
  64. valor = dtpFechaOperacion.Value
  65. Return valor
  66. End Function
  67. Function GetFechaLiquidacion() As Date
  68. Dim valor As Date
  69. valor = dtpFechaLiquidacion.Value
  70. Return valor
  71. End Function
  72. Function GetValorNominal() As Double
  73. Dim valor As Double
  74. If Me.txtValorNominal.Text.Length = 0 Then
  75. valor = 0
  76. Else
  77. valor = Me.txtValorNominal.Text
  78. End If
  79. Return valor
  80. End Function
  81. Function GetPrecio() As Double
  82. Dim valor As Double
  83. If Me.txtPrecio.Text.Length = 0 Then
  84. valor = 0
  85. Else
  86. Try
  87. valor = Me.txtPrecio.Text
  88. valor = valor / 100
  89. Catch ex As Exception
  90. valor = 0
  91. End Try
  92. End If
  93. Return valor
  94. End Function
  95. Function GetValorTransado() As Double
  96. Dim valor As Double
  97. If Me.txtValorTransado.Text.Length = 0 Then
  98. valor = 0
  99. Else
  100. valor = Me.txtValorTransado.Text
  101. End If
  102. Return valor
  103. End Function
  104. Function GetComisionBolsa() As Double
  105. Dim valor As Double
  106. If Me.txtComisionBolsa.Text.Length = 0 Then
  107. valor = 0
  108. Else
  109. valor = Me.txtComisionBolsa.Text
  110. End If
  111. Return valor
  112. End Function
  113. Function GetComisionCasa() As Double
  114. Dim valor As Double
  115. If Me.txtComisionCasa.Text.Length = 0 Then
  116. valor = 0
  117. Else
  118. valor = Me.txtComisionCasa.Text
  119. End If
  120. Return valor
  121. End Function
  122. Function GetTotalAPagar() As Double
  123. Dim valor As Double
  124. If Me.txtTotalAPagar.Text.Length = 0 Then
  125. valor = 0
  126. Else
  127. valor = Me.txtTotalAPagar.Text
  128. End If
  129. Return valor
  130. End Function
  131. 'CALCULOS
  132. Function CalcularValorApagar() As Double
  133. Dim valor As Double
  134. valor = GetValorTransado() + GetComisionBolsa() + GetComisionCasa()
  135. valor = Math.Round(valor, DecimalesRedondeo)
  136. Return valor
  137. End Function
  138. 'AUTO
  139. Sub RefrescarPlazoInversion()
  140. Me.txtPlazoInversion.Text = 0
  141. End Sub
  142. Sub RefrescarPrecio()
  143. Me.txtPrecio.Text = 0
  144. End Sub
  145. Sub RefrescarTotalAPagar()
  146. Me.txtTotalAPagar.Text = CalcularValorApagar()
  147. End Sub
  148. Sub CrearColumnasIngresosVCN()
  149. Dim Correlativo, Plazo, Fecha, Monto, CostoCedeval, PorcentajeRenta,
  150. CostoTransferencia, CostoBanco, TotalRecibir As New DataGridViewTextBoxColumn
  151. Correlativo.Name = "Correlativo"
  152. Plazo.Name = "Plazo"
  153. Fecha.Name = "Fecha"
  154. Monto.Name = "Monto"
  155. CostoCedeval.Name = "CostoCedeval"
  156. PorcentajeRenta.Name = "PorcentajeRenta"
  157. CostoTransferencia.Name = "CostoTransferencia"
  158. CostoBanco.Name = "CostoBanco"
  159. TotalRecibir.Name = "TotalRecibir"
  160. Correlativo.HeaderText = "Correlativo"
  161. Plazo.HeaderText = "Plazo"
  162. Fecha.HeaderText = "Fecha"
  163. Monto.HeaderText = "Monto"
  164. CostoCedeval.HeaderText = "Costo de Cedeval"
  165. PorcentajeRenta.HeaderText = "Porcentaje de la Renta"
  166. CostoTransferencia.HeaderText = "Costo de Transferencia"
  167. CostoBanco.HeaderText = "Costo de Banco"
  168. TotalRecibir.HeaderText = "Total a Recibir"
  169. dgvIngresosVCN.Columns.Add(Correlativo)
  170. dgvIngresosVCN.Columns.Add(Plazo)
  171. dgvIngresosVCN.Columns.Add(Fecha)
  172. dgvIngresosVCN.Columns.Add(Monto)
  173. dgvIngresosVCN.Columns.Add(CostoCedeval)
  174. dgvIngresosVCN.Columns.Add(PorcentajeRenta)
  175. dgvIngresosVCN.Columns.Add(CostoTransferencia)
  176. dgvIngresosVCN.Columns.Add(CostoBanco)
  177. dgvIngresosVCN.Columns.Add(TotalRecibir)
  178. End Sub
  179. Sub CalculosIngresosVCN()
  180. CalculosDias.AgregarFechaIngresos(dgvIngresosVCN, dtpFechaLiquidacion, "Fecha", DefinirBaseDias())
  181. End Sub
  182. Function DefinirBaseDias()
  183. Dim TipoBase As Integer = Operaciones.ConvertirEntero(cboBase.SelectedIndex)
  184. Return TipoBase
  185. End Function
  186. 'EVENTOS
  187. Private Sub Button1_Click(sender As Object, e As EventArgs)
  188. RefrescarPlazoInversion()
  189. End Sub
  190. Private Sub txtRendimientoBruto_TextChanged(sender As Object, e As EventArgs)
  191. If Modo = "N" Then
  192. RefrescarPrecio()
  193. End If
  194. End Sub
  195. Private Sub txtPlazoInversion_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.TextChanged, txtPlazoInversion.TextChanged
  196. RellenarDatos()
  197. End Sub
  198. Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged
  199. RellenarDatos()
  200. End Sub
  201. Private Sub dtpFechaLiquidacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaLiquidacion.ValueChanged
  202. RellenarDatos()
  203. End Sub
  204. Private Sub dtpFechaOperacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacion.ValueChanged
  205. RellenarDatos()
  206. AgregarDiasExtra()
  207. End Sub
  208. Private Sub txtValorNominal_TextChanged(sender As Object, e As EventArgs) Handles txtValorNominal.TextChanged
  209. RellenarDatos()
  210. End Sub
  211. Private Sub txtPrecio_TextChanged(sender As Object, e As EventArgs) Handles txtPrecio.TextChanged
  212. End Sub
  213. Private Sub txtPorcentajeComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.TextChanged
  214. RellenarDatos()
  215. End Sub
  216. Private Sub txtPorcentajeComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.TextChanged
  217. RellenarDatos()
  218. End Sub
  219. Private Sub txtValorTransado_TextChanged(sender As Object, e As EventArgs) Handles txtValorTransado.TextChanged
  220. End Sub
  221. Private Sub txtComisionCasa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionCasa.TextChanged
  222. If Modo = "N" Then
  223. RefrescarTotalAPagar()
  224. End If
  225. End Sub
  226. Private Sub txtComisionBolsa_TextChanged(sender As Object, e As EventArgs) Handles txtComisionBolsa.TextChanged
  227. If Modo = "N" Then
  228. RefrescarTotalAPagar()
  229. End If
  230. End Sub
  231. Private Sub txtTotalAPagar_TextChanged(sender As Object, e As EventArgs) Handles txtTotalAPagar.TextChanged
  232. End Sub
  233. Sub ValidarExistencia()
  234. Dim General As New DAOGeneral
  235. Dim Codigo As String = Variables.Codigo
  236. Dim Tabla As String = String.Empty
  237. If PBUR Then
  238. Tabla = "PBUR"
  239. ElseIf VCN Then
  240. Tabla = "VCN"
  241. ElseIf CET Then
  242. Tabla = "CET0"
  243. Else
  244. Tabla = "LET0"
  245. End If
  246. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  247. If (Existe) Then
  248. navNuevo.Enabled = False
  249. navModificar.Enabled = True
  250. navEliminar.Enabled = True
  251. Else
  252. navNuevo.Enabled = True
  253. navModificar.Enabled = False
  254. navEliminar.Enabled = False
  255. End If
  256. TipoTransaccion = String.Empty
  257. btnAceptar.Text = "Aceptar"
  258. End Sub
  259. Function ExisteValidacion()
  260. Dim General As New DAOGeneral
  261. Dim Codigo As String = Variables.Codigo
  262. Dim Tabla As String = String.Empty
  263. If PBUR Then
  264. Tabla = "PBUR"
  265. ElseIf VCN Then
  266. Tabla = "VCN"
  267. ElseIf CET Then
  268. Tabla = "CET0"
  269. Else
  270. Tabla = "LET0"
  271. End If
  272. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  273. Return Existe
  274. End Function
  275. Private Sub frmLetes_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  276. TipInstrumento()
  277. Me.ActiveControl = Me.txtValorNominal
  278. Call CargarCasasCorredoras()
  279. Call CargarBase()
  280. Call CargarPeriodicidad()
  281. If Variables.Codigo.IndexOf("LETE") > -1 Then
  282. Instrumento = "LETE"
  283. ElseIf Variables.Codigo.IndexOf("PBUR") > -1 Then
  284. Instrumento = "PBUR"
  285. lblBono.Text = "PAPEL BURSATIL"
  286. Me.Text = "PAPEL BURSATIL"
  287. lblInteresAcumulado.Visible = True
  288. lblDiasAcumulados.Visible = True
  289. dtpUltimaFecha.Visible = True
  290. txtInteresAcumulado.Visible = True
  291. chbValorPar.Visible = True
  292. ElseIf Variables.Codigo.IndexOf("CETE") > -1 Then
  293. Instrumento = "CETE"
  294. lblBono.Text = "CETES"
  295. Me.Text = "CETE"
  296. lblInteresAcumulado.Visible = True
  297. lblDiasAcumulados.Visible = True
  298. dtpUltimaFecha.Visible = True
  299. txtInteresAcumulado.Visible = True
  300. ConfiguracionCETE()
  301. ElseIf Variables.Codigo.IndexOf("VCN") > -1 Then
  302. Instrumento = "VCN"
  303. lblBono.Text = "VALORES COMERCIALES"
  304. Me.Text = "VALORES COMERCIALES"
  305. lblInteresAcumulado.Visible = True
  306. lblDiasAcumulados.Visible = True
  307. lblOtrosCostos.Visible = True
  308. dtpUltimaFecha.Visible = True
  309. txtInteresAcumulado.Visible = True
  310. txtOtrosCostos.Visible = True
  311. chbValorPar.Visible = True
  312. dtpFechaVencimiento.Enabled = True
  313. txtPlazoInversion.ReadOnly = True
  314. CrearColumnasIngresosVCN()
  315. Else
  316. Instrumento = "NADA"
  317. End If
  318. CargarReg(Instrumento)
  319. Call CargarRegistroBD()
  320. SetPeriodicidad()
  321. AgregarPorcentaje()
  322. Rellenar()
  323. ExisteInversion()
  324. ValidarExistencia()
  325. End Sub
  326. Sub TipInstrumento()
  327. If Variables.Codigo.IndexOf("PBUR") > -1 Then
  328. PBUR = True
  329. End If
  330. If Variables.Codigo.IndexOf("VCN") > -1 Then
  331. VCN = True
  332. End If
  333. If Variables.Codigo.IndexOf("CETE") > -1 Then
  334. CET = True
  335. End If
  336. End Sub
  337. Sub SetPeriodicidad()
  338. If String.IsNullOrEmpty(Variables.Periodicidad) Then
  339. cboPeriodicidad.SelectedValue = "M"
  340. Else
  341. cboPeriodicidad.SelectedValue = Variables.Periodicidad
  342. End If
  343. End Sub
  344. Function ExisteInversion()
  345. Dim Codigo As String = Variables.Codigo
  346. Dim TablaINV As String = "INV0"
  347. Dim TablaPINV As String = "PIN0"
  348. Dim General As New DAOGeneral
  349. Dim InvPro = Variables.InvPro
  350. If InvPro = "I" Then
  351. Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
  352. If INV0 Then
  353. navNuevo.Visible = True
  354. Return True
  355. Else
  356. navNuevo.Visible = False
  357. Return False
  358. End If
  359. End If
  360. If InvPro = "P" Then
  361. Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
  362. If PINV0 Then
  363. navNuevo.Visible = True
  364. Return True
  365. Else
  366. navNuevo.Visible = False
  367. Return False
  368. End If
  369. End If
  370. Return False
  371. End Function
  372. Sub ConfiguracionCETE()
  373. txtPrecio.Text = "100%"
  374. End Sub
  375. Private Sub CargarReg(Instrumento)
  376. Dim Letes As New LETESDAO
  377. Dim Base As Integer = 0
  378. Dim dat = Letes.Cargar(Variables.Codigo, Instrumento)
  379. If (Not dat(1).ToString = "False") Then
  380. txtValorNominal.Text = Operaciones.ConvertirDecimal(dat(1).ToString)
  381. dtpFechaOperacion.Value = Operaciones.ConvertirFecha(dat(2).ToString)
  382. dtpFechaLiquidacion.Value = Operaciones.ConvertirFecha(dat(3).ToString)
  383. txtPlazoInversion.Text = Operaciones.ConvertirEntero(dat(4).ToString)
  384. If (String.IsNullOrEmpty(txtRendimientoBruto.Text)) Then
  385. txtRendimientoBruto.Text = CStr(Format((txtRendimientoBruto.Text), "0.00")) + "%"
  386. Else
  387. txtRendimientoBruto.Text = CStr(Operaciones.ConvertirDecimal(dat(5).ToString) * 100) + "%"
  388. End If
  389. cboCasasCorredoras.SelectedValue = dat(6).ToString
  390. cboPeriodicidad.SelectedValue = dat(7).ToString
  391. Base = Operaciones.ConvertirEntero(dat(8).ToString)
  392. cboBase.SelectedIndex = Base
  393. If (String.IsNullOrEmpty(dat(9).ToString)) Then
  394. txtPorcentajeComisionCasa.Text = Format(((txtPorcentajeComisionCasa.Text.Trim("%")) * 100), "0.00").ToString + "%"
  395. Else
  396. txtPorcentajeComisionCasa.Text = CStr(Operaciones.ConvertirDecimal(dat(9).ToString) * 100) + "%"
  397. End If
  398. If (String.IsNullOrEmpty(dat(10).ToString)) Then
  399. txtPorcentajeComisionBolsa.Text = Format((txtPorcentajeComisionBolsa.Text.Trim("%")) * 100, "0.00").ToString + "%"
  400. Else
  401. txtPorcentajeComisionBolsa.Text = CStr(Operaciones.ConvertirDecimal(dat(10).ToString) * 100) + "%"
  402. End If
  403. cboCasasCorredoras.SelectedValue = dat(12).ToString
  404. If (PBUR Or VCN) Then
  405. If (Not String.IsNullOrEmpty(dat(13).ToString)) Then
  406. chbValorPar.Checked = CBool(dat(13))
  407. End If
  408. If (Not String.IsNullOrEmpty(dat(14).ToString)) Then
  409. dtpUltimaFecha.Value = Operaciones.ConvertirFecha(dat(14).ToString)
  410. End If
  411. ElseIf CET Then
  412. If (Not String.IsNullOrEmpty(dat(13).ToString)) Then
  413. dtpUltimaFecha.Value = Operaciones.ConvertirFecha(dat(13).ToString)
  414. End If
  415. End If
  416. If VCN Then
  417. txtOtrosCostos.Text = Operaciones.ConvertirDecimal(dat(15).ToString)
  418. End If
  419. End If
  420. End Sub
  421. Private Sub Modificar(ByVal Instrumento As String)
  422. Dim ValNom As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
  423. Dim FOpe As Date = Operaciones.ConvertirFecha(dtpFechaOperacion.Value.ToString)
  424. Dim FLiq As Date = Operaciones.ConvertirFecha(dtpFechaLiquidacion.Value.ToString)
  425. Dim RendBruto As Double = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString) / 100
  426. Dim Plazo As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
  427. Dim PorcentajeComisionCasa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionCasa.Text.ToString) / 100
  428. Dim PorcentajeComisionBolsa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionBolsa.Text.ToString) / 100
  429. Dim ValTrans As Double = Operaciones.ConvertirDecimal(txtValorTransado.Text.ToString)
  430. Dim Precio As Double = Operaciones.ConvertirDecimal(txtPrecio.Text.ToString.ToString) / 100
  431. Dim TotPagar As Double = Operaciones.ConvertirDecimal(txtTotalAPagar.Text.ToString)
  432. Dim RendNeto As Double = Operaciones.ConvertirDecimal(txtRendimientoNeto.Text.ToString) / 100
  433. Dim IngrBruto As Double = Operaciones.ConvertirDecimal(txtIngresoBruto.Text.ToString)
  434. Dim IngrNeto As Double = Operaciones.ConvertirDecimal(txtIngresoNeto.Text.ToString)
  435. Dim ComisionCasaValor As Double = Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString)
  436. Dim ComisionBolsaValor As Double = Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString)
  437. Dim FUlt As Date = Operaciones.ConvertirFecha(dtpUltimaFecha.Value.ToString)
  438. Dim FRed As Date = Operaciones.ConvertirFecha(dtpRedencion.Value.ToString)
  439. Dim FVenc As Date = Operaciones.ConvertirFecha(dtpFechaVencimiento.Value.ToString)
  440. Dim IntAcumulado As Double = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString.ToString) / 100
  441. Dim OtrosCostos As Double = Operaciones.ConvertirDecimal(txtOtrosCostos.Text.ToString)
  442. Dim periodo As String = String.Empty
  443. If Not cboPeriodicidad.SelectedIndex = -1 Then
  444. periodo = cboPeriodicidad.SelectedValue
  445. End If
  446. Dim Casas As String = String.Empty
  447. If Not cboCasasCorredoras.SelectedIndex = -1 Then
  448. Casas = cboCasasCorredoras.SelectedValue
  449. End If
  450. Dim ValorPar As Boolean = chbValorPar.Checked
  451. Dim Base As Integer
  452. Dim FechaUltima As Date = dtpUltimaFecha.Value
  453. If (cboBase.SelectedIndex = 0) Then
  454. Base = 0
  455. ElseIf (cboBase.SelectedIndex = 1) Then
  456. Base = 1
  457. ElseIf (cboBase.SelectedIndex = 2) Then
  458. Base = 2
  459. Else
  460. Base = 3
  461. End If
  462. Dim coleccion As New Collection
  463. coleccion.Add(ValNom)
  464. coleccion.Add(FOpe)
  465. coleccion.Add(FLiq)
  466. coleccion.Add(RendBruto)
  467. coleccion.Add(Plazo)
  468. coleccion.Add(Variables.Codigo)
  469. coleccion.Add(PorcentajeComisionCasa)
  470. coleccion.Add(PorcentajeComisionBolsa)
  471. coleccion.Add(periodo)
  472. coleccion.Add(Base)
  473. coleccion.Add(Casas)
  474. If (PBUR Or VCN) Then
  475. coleccion.Add(ValorPar)
  476. coleccion.Add(FechaUltima)
  477. ElseIf CET Then
  478. coleccion.Add(FechaUltima)
  479. End If
  480. If VCN Then
  481. coleccion.Add(OtrosCostos)
  482. End If
  483. coleccion.Add(ValTrans)
  484. coleccion.Add(Precio)
  485. coleccion.Add(TotPagar)
  486. coleccion.Add(RendNeto)
  487. coleccion.Add(IngrBruto)
  488. coleccion.Add(IngrNeto)
  489. coleccion.Add(ComisionCasaValor)
  490. coleccion.Add(ComisionBolsaValor)
  491. coleccion.Add(FUlt)
  492. coleccion.Add(FRed)
  493. coleccion.Add(FVenc)
  494. If CET Or PBUR Or VCN Then
  495. coleccion.Add(IntAcumulado)
  496. End If
  497. oDAOLetes.ActualizarLETE(coleccion, Instrumento)
  498. End Sub
  499. Public Function Nuevo(ByVal Instrumento As String)
  500. Dim ValNom As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
  501. Dim FOpe As Date = Operaciones.ConvertirFecha(dtpFechaOperacion.Value.ToString)
  502. Dim FLiq As Date = Operaciones.ConvertirFecha(dtpFechaLiquidacion.Value.ToString)
  503. Dim RendBruto As Double = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString) / 100
  504. Dim Plazo As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
  505. Dim PorcentajeComisionCasa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionCasa.Text.ToString) / 100
  506. Dim PorcentajeComisionBolsa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionBolsa.Text.ToString) / 100
  507. Dim ValTrans As Double = Operaciones.ConvertirDecimal(txtValorTransado.Text.ToString)
  508. Dim Precio As Double = Operaciones.ConvertirDecimal(txtPrecio.Text.ToString.ToString) / 100
  509. Dim TotPagar As Double = Operaciones.ConvertirDecimal(txtTotalAPagar.Text.ToString)
  510. Dim RendNeto As Double = Operaciones.ConvertirDecimal(txtRendimientoNeto.Text.ToString) / 100
  511. Dim IngrBruto As Double = Operaciones.ConvertirDecimal(txtIngresoBruto.Text.ToString)
  512. Dim IngrNeto As Double = Operaciones.ConvertirDecimal(txtIngresoNeto.Text.ToString)
  513. Dim ComisionCasaValor As Double = Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString)
  514. Dim ComisionBolsaValor As Double = Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString)
  515. Dim FUlt As Date = Operaciones.ConvertirFecha(dtpUltimaFecha.Value.ToString)
  516. Dim FRed As Date = Operaciones.ConvertirFecha(dtpRedencion.Value.ToString)
  517. Dim FVenc As Date = Operaciones.ConvertirFecha(dtpFechaVencimiento.Value.ToString)
  518. Dim IntAcumulado As Double = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString.ToString) / 100
  519. Dim periodo As String = String.Empty
  520. If Not cboPeriodicidad.SelectedIndex = -1 Then
  521. periodo = cboPeriodicidad.SelectedValue
  522. End If
  523. Dim Casas As String = String.Empty
  524. If Not cboCasasCorredoras.SelectedIndex = -1 Then
  525. Casas = cboCasasCorredoras.SelectedValue
  526. End If
  527. Dim ValorPar As Boolean = chbValorPar.Checked
  528. Dim Base As Integer
  529. Dim FechaUltima As Date = dtpUltimaFecha.Value
  530. Dim OtrosCostos = txtOtrosCostos.Text
  531. If (cboBase.SelectedIndex = 0) Then
  532. Base = 0
  533. ElseIf (cboBase.SelectedIndex = 1) Then
  534. Base = 1
  535. ElseIf (cboBase.SelectedIndex = 2) Then
  536. Base = 2
  537. Else
  538. Base = 3
  539. End If
  540. Dim coleccion As New Collection
  541. coleccion.Add(ValNom)
  542. coleccion.Add(FOpe)
  543. coleccion.Add(FLiq)
  544. coleccion.Add(RendBruto)
  545. coleccion.Add(Plazo)
  546. coleccion.Add(Variables.Codigo)
  547. coleccion.Add(PorcentajeComisionCasa)
  548. coleccion.Add(PorcentajeComisionBolsa)
  549. coleccion.Add(periodo)
  550. coleccion.Add(Base)
  551. coleccion.Add(Casas)
  552. If (PBUR Or VCN) Then
  553. coleccion.Add(ValorPar)
  554. coleccion.Add(FechaUltima)
  555. ElseIf CET Then
  556. coleccion.Add(FechaUltima)
  557. End If
  558. If VCN Then
  559. coleccion.Add(OtrosCostos)
  560. End If
  561. coleccion.Add(ValTrans)
  562. coleccion.Add(Precio)
  563. coleccion.Add(TotPagar)
  564. coleccion.Add(RendNeto)
  565. coleccion.Add(IngrBruto)
  566. coleccion.Add(IngrNeto)
  567. coleccion.Add(ComisionCasaValor)
  568. coleccion.Add(ComisionBolsaValor)
  569. coleccion.Add(FUlt)
  570. coleccion.Add(FRed)
  571. coleccion.Add(FVenc)
  572. If CET Or PBUR Or VCN Then
  573. coleccion.Add(IntAcumulado)
  574. End If
  575. Return coleccion
  576. End Function
  577. Sub NuevoRegistro(ByVal Instrumento As String)
  578. Dim Coleccion As New Collection
  579. Coleccion = Nuevo(Instrumento)
  580. If Coleccion.Count > 0 Then
  581. oDAOLetes.NuevoIngreso(Coleccion, Instrumento)
  582. Coleccion.Clear()
  583. End If
  584. End Sub
  585. Private Sub Eliminar(ByVal Instrumento As String)
  586. oDAOLetes.Eliminar(Variables.Codigo, Instrumento)
  587. End Sub
  588. Private Sub btnAceptar_Click(sender As Object, e As EventArgs) Handles btnAceptar.Click
  589. If (TipoTransaccion = "M") Then
  590. Modificar(Instrumento)
  591. ValidarExistencia()
  592. ElseIf (TipoTransaccion = "N") Then
  593. NuevoRegistro(Instrumento)
  594. ValidarExistencia()
  595. ElseIf (TipoTransaccion = "B") Then
  596. Eliminar(Instrumento)
  597. ValidarExistencia()
  598. ElseIf Not ExisteValidacion() Then
  599. Variables.ColeccionLETE = Nuevo(Instrumento)
  600. Close()
  601. End If
  602. End Sub
  603. Function RetornarObjeto()
  604. Return oCELetes
  605. End Function
  606. Sub CargarCasasCorredoras()
  607. If Me.cboCasasCorredoras.Items.Count = 0 Or Me.cboCasasCorredoras.Items.Count = 1 Then
  608. Me.cboCasasCorredoras.DataSource = oDAOGeneral.ListaCasasCorredoras.Tables("CasasCorredoras")
  609. Me.cboCasasCorredoras.DisplayMember = "Descripcion"
  610. Me.cboCasasCorredoras.ValueMember = "Codigo"
  611. Me.cboCasasCorredoras.SelectedIndex = 0
  612. End If
  613. End Sub
  614. Sub CargarPeriodicidad()
  615. If cboPeriodicidad.Items.Count = 0 Or cboPeriodicidad.Items.Count = 1 Then
  616. Me.cboPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad
  617. Me.cboPeriodicidad.DisplayMember = "Descripcion"
  618. Me.cboPeriodicidad.ValueMember = "Codigo"
  619. Me.cboPeriodicidad.SelectedIndex = 0
  620. End If
  621. End Sub
  622. Sub CargarBase()
  623. If Me.cboBase.Items.Count = 0 Or Me.cboBase.Items.Count = 1 Then
  624. Me.cboBase.DataSource = oDAOGeneral.ListaBase
  625. Me.cboBase.DisplayMember = "Descripcion"
  626. Me.cboBase.ValueMember = "Codigo"
  627. Me.cboBase.SelectedIndex = 0
  628. End If
  629. End Sub
  630. Private Sub CargarRegistroBD()
  631. Dim oCELetes As LETESCE
  632. CodigoInversion = Variables.Codigo
  633. If Not oCELetes Is Nothing Then
  634. Dim vValorNominal As Double = oCELetes.ValorNominal
  635. Dim vFechaOperacion As Date = oCELetes.FechaOperacion
  636. Dim vFechaLiquidacion As Date = oCELetes.FechaLiquidacion
  637. Dim vFechaVencimiento As Date = oCELetes.FechaVencimiento
  638. Dim vPlazoInversion As Integer = oCELetes.Plazo
  639. Dim vCodigoCasa As String = oCELetes.CodigoCasa
  640. Dim vPeriodicidad As String = oCELetes.Periodicidad
  641. Dim vRendimientoBruto As Double = oCELetes.RendimientoBruto
  642. Dim vRendimientoNeto As Double = oCELetes.RendimientoNeto
  643. Dim vIngresoBruto As Double = oCELetes.IngresoBruto
  644. Dim vIngresoNeto As Double = oCELetes.IngresoNeto
  645. Dim vValorTransado As Double = oCELetes.ValorNominal
  646. Dim vPrecio As Double = oCELetes.Precio
  647. Dim vTotalAPagar As Double = oCELetes.TotalaPagar
  648. vRendimientoBruto = vRendimientoBruto * 100
  649. vRendimientoNeto = vRendimientoNeto * 100
  650. vPrecio = vPrecio * 100
  651. End If
  652. End Sub
  653. Public Sub CargarRegistro(vId As Integer, vTipo As String)
  654. Modo = "C"
  655. IdDocumento = vId
  656. TipoDocumento = vTipo
  657. End Sub
  658. Private Sub txtRendimientoBruto_MouseCaptureChanged(sender As Object, e As EventArgs) Handles txtRendimientoBruto.MouseCaptureChanged
  659. End Sub
  660. Function ValorTrasado()
  661. Return Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString) *
  662. (Operaciones.ConvertirDecimal(V_txtPrecio.ToString) / 100)
  663. End Function
  664. Function Precio()
  665. Dim Rendimiento As Double = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString)
  666. Dim Plazo As Integer = Operaciones.ConvertirDecimal(txtPlazoInversion.Text.ToString)
  667. Dim Pr = 0.0
  668. If (IndexBase = 0) Then
  669. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
  670. Return Pr
  671. ElseIf (IndexBase = 1) Then
  672. Dim FechaInicial = dtpFechaLiquidacion.Value
  673. Dim FechaFinal = dtpFechaVencimiento.Value
  674. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  675. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  676. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  677. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  678. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  679. If (Not CambioDeFecha = 0) Then
  680. If CambioDeFecha = 1 Then
  681. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  682. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  683. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
  684. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
  685. ElseIf CambioDeFecha = 2 Then
  686. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  687. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  688. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
  689. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
  690. End If
  691. Pr = (1 - (PrOpc1 + PrOpc2)) * 100
  692. Else
  693. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  694. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
  695. End If
  696. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  697. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
  698. End If
  699. End If
  700. Return Pr
  701. ElseIf (IndexBase = 2) Then
  702. ''''''''''''''''''
  703. Dim FechaInicial = dtpFechaLiquidacion.Value
  704. Dim FechaFinal = dtpFechaVencimiento.Value
  705. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  706. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  707. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  708. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  709. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  710. If (Not CambioDeFecha = 0) Then
  711. If CambioDeFecha = 1 Then
  712. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  713. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  714. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 366)) * DiasPrimeraFecha / 366))
  715. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 365)) * DiasSegundaFecha / 365))
  716. ElseIf CambioDeFecha = 2 Then
  717. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  718. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  719. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 365)) * DiasPrimeraFecha / 365))
  720. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 366)) * DiasSegundaFecha / 366))
  721. End If
  722. Pr = (1 - (PrOpc1 + PrOpc2)) * 100
  723. Else
  724. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  725. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 365)) * Plazo / 365)) * 100
  726. End If
  727. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  728. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 366)) * Plazo / 366)) * 100
  729. End If
  730. End If
  731. Return Pr
  732. Else
  733. Dim FechaInicial = dtpFechaLiquidacion.Value
  734. Dim FechaFinal = dtpFechaVencimiento.Value
  735. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  736. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  737. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  738. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  739. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  740. If (Not CambioDeFecha = 0) Then
  741. If CambioDeFecha = 1 Then
  742. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  743. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  744. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
  745. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
  746. ElseIf CambioDeFecha = 2 Then
  747. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  748. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  749. PrOpc1 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasPrimeraFecha / 360)) * DiasPrimeraFecha / 360))
  750. PrOpc2 = ((((Rendimiento / 100) / (1 + (Rendimiento / 100) * DiasSegundaFecha / 360)) * DiasSegundaFecha / 360))
  751. End If
  752. Pr = (1 - (PrOpc1 + PrOpc2)) * 100
  753. Else
  754. Pr = ((1 - ((Rendimiento / 100) / (1 + (Rendimiento / 100) * Plazo / 360)) * Plazo / 360)) * 100
  755. End If
  756. Return Pr
  757. End If
  758. Return 0
  759. End Function
  760. Function ComisionCasa()
  761. Dim ValorTras As Double = ValorTrasado()
  762. Dim ComisionDeCasa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionCasa.Text.ToString)
  763. Dim PlazoInversion As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
  764. Dim Comision = 0.0
  765. If (IndexBase = 0) Then
  766. Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 360)
  767. Return Comision
  768. ElseIf IndexBase = 1 Then
  769. Dim FechaInicial = dtpFechaLiquidacion.Value
  770. Dim FechaFinal = dtpFechaVencimiento.Value
  771. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  772. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  773. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  774. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  775. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  776. If (Not CambioDeFecha = 0) Then
  777. If CambioDeFecha = 1 Then
  778. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  779. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  780. ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 366)
  781. ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 365)
  782. ElseIf CambioDeFecha = 2 Then
  783. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  784. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  785. ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 365)
  786. ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 366)
  787. End If
  788. Comision = ComisionOpc1 + ComisionOpc2
  789. Else
  790. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  791. Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 365)
  792. End If
  793. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  794. Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 366)
  795. End If
  796. End If
  797. Return Comision
  798. ElseIf IndexBase = 2 Then
  799. Dim FechaInicial = dtpFechaLiquidacion.Value
  800. Dim FechaFinal = dtpFechaVencimiento.Value
  801. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  802. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  803. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  804. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  805. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  806. If (Not CambioDeFecha = 0) Then
  807. If CambioDeFecha = 1 Then
  808. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  809. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  810. ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 366)
  811. ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 365)
  812. ElseIf CambioDeFecha = 2 Then
  813. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  814. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  815. ComisionOpc1 = (ValorTras * ComisionDeCasa / 100) * (DiasPrimeraFecha / 365)
  816. ComisionOpc2 = (ValorTras * ComisionDeCasa / 100) * (DiasSegundaFecha / 366)
  817. End If
  818. Comision = ComisionOpc1 + ComisionOpc2
  819. Else
  820. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  821. Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 365)
  822. End If
  823. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  824. Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 366)
  825. End If
  826. End If
  827. Return Comision
  828. Else
  829. Comision = (ValorTras * ComisionDeCasa / 100) * (PlazoInversion / 360)
  830. Return Comision
  831. End If
  832. Return 0
  833. End Function
  834. Function ComisionBolsa()
  835. Dim ValorTras As Double = ValorTrasado()
  836. Dim ComisionDeBolsa As Double = Operaciones.ConvertirDecimal(txtPorcentajeComisionBolsa.Text.ToString)
  837. Dim PlazoInversion As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
  838. Dim Comision As Double = 0.0
  839. If (IndexBase = 0) Then
  840. Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 360)
  841. Return Comision
  842. ElseIf IndexBase = 1 Then
  843. Dim FechaInicial = dtpFechaLiquidacion.Value
  844. Dim FechaFinal = dtpFechaVencimiento.Value
  845. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  846. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  847. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  848. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  849. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  850. If (Not CambioDeFecha = 0) Then
  851. If CambioDeFecha = 1 Then
  852. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  853. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  854. ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 366)
  855. ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 365)
  856. ElseIf CambioDeFecha = 2 Then
  857. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  858. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  859. ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 365)
  860. ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 366)
  861. End If
  862. Comision = ComisionOpc1 + ComisionOpc2
  863. Else
  864. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  865. Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 365)
  866. End If
  867. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  868. Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 366)
  869. End If
  870. End If
  871. Return Comision
  872. ElseIf IndexBase = 2 Then
  873. Dim FechaInicial = dtpFechaLiquidacion.Value
  874. Dim FechaFinal = dtpFechaVencimiento.Value
  875. Dim ComisionOpc1 = 0.0, ComisionOpc2 = 0.0
  876. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  877. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  878. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  879. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  880. If (Not CambioDeFecha = 0) Then
  881. If CambioDeFecha = 1 Then
  882. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  883. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  884. ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 366)
  885. ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 365)
  886. ElseIf CambioDeFecha = 2 Then
  887. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  888. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  889. ComisionOpc1 = (ValorTras * ComisionDeBolsa / 100) * (DiasPrimeraFecha / 365)
  890. ComisionOpc2 = (ValorTras * ComisionDeBolsa / 100) * (DiasSegundaFecha / 366)
  891. End If
  892. Comision = ComisionOpc1 + ComisionOpc2
  893. Else
  894. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  895. Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 365)
  896. End If
  897. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  898. Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 366)
  899. End If
  900. End If
  901. Return Comision
  902. Else
  903. Comision = (ValorTras * ComisionDeBolsa / 100) * (PlazoInversion / 360)
  904. Return Comision
  905. End If
  906. Return 0
  907. End Function
  908. Function RendimientoNeto()
  909. Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
  910. Dim TotalPagar As Double = Operaciones.ConvertirDecimal(V_txtTotalAPagar.ToString)
  911. Dim PlazoInversion As Integer = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
  912. Dim RendBruto As Double = 0
  913. Dim ComisionCasa As Double = 0
  914. Dim ComisionBolsa As Double = 0
  915. If Not String.IsNullOrEmpty(txtRendimientoBruto.Text.ToString.Trim("%")) Then
  916. RendBruto = txtRendimientoBruto.Text.ToString.Trim("%")
  917. End If
  918. If Not String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%")) Then
  919. ComisionCasa = txtPorcentajeComisionCasa.Text.ToString.Trim("%")
  920. End If
  921. If Not String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%")) Then
  922. ComisionBolsa = txtPorcentajeComisionBolsa.Text.ToString.Trim("%")
  923. End If
  924. If (CDec(TotalPagar) = 0 Or CDec(PlazoInversion) = 0) Then
  925. Return 0
  926. End If
  927. If (Double.TryParse(RendBruto, Nothing) And Double.TryParse(RendBruto, Nothing) And Double.TryParse(CDec(ValorNominal), Nothing) And Double.TryParse(CDec(TotalPagar), Nothing) And Double.TryParse(CDec(PlazoInversion), Nothing)) Then
  928. Dim RendimientoNet As Double = 0
  929. If ((chbValorPar.Checked And (VCN Or PBUR))) Then
  930. RendimientoNet = (RendBruto - ComisionCasa - ComisionBolsa) * 0.9
  931. Return RendimientoNet
  932. ElseIf CET Then
  933. RendimientoNet = (RendBruto - ComisionCasa - ComisionBolsa)
  934. Return RendimientoNet
  935. Else
  936. If (IndexBase = 0) Then
  937. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (360 / CDec(PlazoInversion))) * 100)
  938. Return RendimientoNet
  939. ElseIf IndexBase = 1 Then
  940. Dim FechaInicial = dtpFechaLiquidacion.Value
  941. Dim FechaFinal = dtpFechaVencimiento.Value
  942. Dim RendimientoNetOpc1 = 0.0, RendimientoNetOpc2 = 0.0
  943. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  944. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  945. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  946. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  947. If (Not CambioDeFecha = 0) Then
  948. If CambioDeFecha = 1 Then
  949. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  950. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  951. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasPrimeraFecha))) * 100)
  952. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasSegundaFecha))) * 100)
  953. ElseIf CambioDeFecha = 2 Then
  954. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  955. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  956. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasPrimeraFecha))) * 100)
  957. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasSegundaFecha))) * 100)
  958. End If
  959. RendimientoNet = RendimientoNetOpc1 + RendimientoNetOpc2
  960. Else
  961. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  962. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(PlazoInversion))) * 100)
  963. End If
  964. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  965. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(PlazoInversion))) * 100)
  966. End If
  967. End If
  968. Return RendimientoNet
  969. ElseIf IndexBase = 2 Then
  970. Dim FechaInicial = dtpFechaLiquidacion.Value
  971. Dim FechaFinal = dtpFechaVencimiento.Value
  972. Dim RendimientoNetOpc1 = 0.0, RendimientoNetOpc2 = 0.0
  973. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  974. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase360(FechaInicial)
  975. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase360(FechaFinal)
  976. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  977. If (Not CambioDeFecha = 0) Then
  978. If CambioDeFecha = 1 Then
  979. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  980. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  981. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasPrimeraFecha))) * 100)
  982. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasSegundaFecha))) * 100)
  983. ElseIf CambioDeFecha = 2 Then
  984. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  985. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  986. RendimientoNetOpc1 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(DiasPrimeraFecha))) * 100)
  987. RendimientoNetOpc2 = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(DiasSegundaFecha))) * 100)
  988. End If
  989. RendimientoNet = RendimientoNetOpc1 + RendimientoNetOpc2
  990. Else
  991. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  992. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (365 / CDec(PlazoInversion))) * 100)
  993. End If
  994. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  995. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (366 / CDec(PlazoInversion))) * 100)
  996. End If
  997. End If
  998. Return RendimientoNet
  999. Else
  1000. RendimientoNet = ((((CDec(ValorNominal) - CDec(TotalPagar)) / CDec(TotalPagar)) * (360 / CDec(PlazoInversion))) * 100)
  1001. Return RendimientoNet
  1002. End If
  1003. End If
  1004. End If
  1005. Return 0
  1006. End Function
  1007. Function IngresoBruto()
  1008. Dim ValorNominal As Double = 0
  1009. Dim ValorTrasado As Double = 0
  1010. ValorNominal = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
  1011. ValorTrasado = Operaciones.ConvertirDecimal(V_txtValorTransado.ToString)
  1012. Dim TasaPeriodo = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString)
  1013. TasaPeriodo = Operaciones.ConvertirDecimal(txtRendimientoBruto.Text.ToString) / 100
  1014. Dim Base As Integer = 365
  1015. Dim Bruto As Double = 0
  1016. Dim Plazo As Integer = 0
  1017. Plazo = Operaciones.ConvertirEntero(txtPlazoInversion.Text.ToString)
  1018. If (chbValorPar.Checked Or CET) Then
  1019. Dim PlazoDias As Integer = 0
  1020. Dim Fecha1 = dtpFechaLiquidacion.Value
  1021. Dim Fecha2 = dtpFechaVencimiento.Value
  1022. IndexBase = cboBase.SelectedIndex
  1023. Dim Valor As Double = 0
  1024. If (IndexBase = 0) Then
  1025. Valor = CDec(ValorNominal * TasaPeriodo * Plazo) / 360
  1026. Return Valor
  1027. ElseIf (IndexBase = 1) Then
  1028. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  1029. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1030. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
  1031. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
  1032. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1033. PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1034. PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1035. Valor = PrOpc1 + PrOpc2
  1036. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1037. Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1038. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  1039. Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1040. Else
  1041. Valor = 0
  1042. End If
  1043. Return Valor
  1044. ElseIf (IndexBase = 2) Then
  1045. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  1046. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1047. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha360Bi(Fecha1, Fecha2)
  1048. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha360(Fecha1, Fecha2)
  1049. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1050. PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1051. PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1052. Valor = PrOpc1 + PrOpc2
  1053. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1054. Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 365
  1055. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  1056. Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 366
  1057. Else
  1058. Valor = 0
  1059. End If
  1060. Return Valor
  1061. Else
  1062. Dim PrOpc1 = 0.0, PrOpc2 = 0.0
  1063. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  1064. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366Varios(Fecha1, Fecha2)
  1065. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365Varios(Fecha1, Fecha2)
  1066. If (DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1067. PrOpc1 = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 360
  1068. PrOpc2 = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 360
  1069. Valor = PrOpc1 + PrOpc2
  1070. ElseIf (Not DiasPrimeraFecha > 0 And DiasSegundaFecha > 0) Then
  1071. Valor = CDec(ValorNominal * TasaPeriodo * DiasSegundaFecha) / 360
  1072. ElseIf (DiasPrimeraFecha > 0 And Not DiasSegundaFecha > 0) Then
  1073. Valor = CDec(ValorNominal * TasaPeriodo * DiasPrimeraFecha) / 360
  1074. Else
  1075. Valor = 0
  1076. End If
  1077. Return Valor
  1078. End If
  1079. Else
  1080. If (Double.TryParse(ValorNominal, Nothing) And Double.TryParse(ValorTrasado, Nothing)) Then
  1081. Bruto = CDec(ValorNominal) - CDec(ValorTrasado)
  1082. Return Bruto
  1083. End If
  1084. End If
  1085. Return 0
  1086. End Function
  1087. Function IngresoNeto()
  1088. Dim ValorNominal As Double = Operaciones.ConvertirDecimal(txtValorNominal.Text.ToString)
  1089. Dim TotalPagar As Double = Operaciones.ConvertirDecimal(V_txtTotalAPagar.ToString)
  1090. Dim Neto As Double = 0
  1091. If chbValorPar.Checked Or CET Then
  1092. Dim IngBruto = Operaciones.ConvertirDecimal(txtIngresoBruto.Text.ToString)
  1093. Dim Descuentos = (Operaciones.ConvertirDecimal(txtComisionBolsa.Text.ToString) + Operaciones.ConvertirDecimal(txtComisionCasa.Text.ToString))
  1094. Neto = (IngBruto * 0.9) - Descuentos
  1095. Return Neto
  1096. End If
  1097. If (Double.TryParse(ValorNominal, Nothing) And Double.TryParse(TotalPagar, Nothing)) Then
  1098. Neto = CDec(ValorNominal) - CDec(TotalPagar)
  1099. Return Neto
  1100. End If
  1101. Return 0
  1102. End Function
  1103. Function TotalPagar()
  1104. Dim ValorTrasado As Double = Operaciones.ConvertirDecimal(V_txtValorTransado.ToString)
  1105. Dim ComisionCasa As Double = Operaciones.ConvertirDecimal(V_txtComisionCasa.ToString)
  1106. Dim ComisionBolsa As Double = Operaciones.ConvertirDecimal(V_txtComisionBolsa.ToString)
  1107. Dim OtrCost As Double = Operaciones.ConvertirDecimal(txtOtrosCostos.Text.ToString)
  1108. txtInteresAcumulado.Text = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString)
  1109. Dim InteresAcumulado = Operaciones.ConvertirDecimal(txtInteresAcumulado.Text.ToString)
  1110. If (PBUR Or CET) Then
  1111. If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
  1112. Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa) + InteresAcumulado
  1113. Return Total
  1114. End If
  1115. ElseIf VCN Then
  1116. If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
  1117. Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa) + InteresAcumulado + OtrCost
  1118. Return Total
  1119. End If
  1120. Else
  1121. If (Double.TryParse(ValorTrasado, Nothing) And Double.TryParse(ComisionCasa, Nothing) And Double.TryParse(ComisionBolsa, Nothing)) Then
  1122. Dim Total = CDec(ValorTrasado) + CDec(ComisionCasa) + CDec(ComisionBolsa)
  1123. Return Total
  1124. End If
  1125. End If
  1126. Return 0
  1127. End Function
  1128. Sub Rellenar()
  1129. If (String.IsNullOrEmpty(txtOtrosCostos.Text.ToString)) Then
  1130. txtOtrosCostos.Text = "0.0"
  1131. End If
  1132. If (String.IsNullOrEmpty(txtPlazoInversion.Text.ToString)) Then
  1133. txtPlazoInversion.Text = "0.0"
  1134. End If
  1135. If (String.IsNullOrEmpty(txtValorNominal.Text.ToString.Trim("%"))) Then
  1136. txtValorNominal.Text = 0
  1137. txtValorNominal.Text = Format(txtValorNominal.Text, "0.0")
  1138. End If
  1139. If (String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text.ToString.Trim("%"))) Then
  1140. txtPorcentajeComisionCasa.Text = 0
  1141. txtPorcentajeComisionCasa.Text = Format(txtPorcentajeComisionCasa.Text, "0.0")
  1142. End If
  1143. If (String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text.ToString.Trim("%"))) Then
  1144. txtPorcentajeComisionBolsa.Text = 0
  1145. txtPorcentajeComisionBolsa.Text = Format(txtPorcentajeComisionBolsa.Text, "0.0")
  1146. End If
  1147. If (String.IsNullOrEmpty(txtRendimientoBruto.Text.ToString.Trim("%"))) Then
  1148. txtRendimientoBruto.Text = 0
  1149. txtRendimientoBruto.Text = Format(txtRendimientoBruto.Text, "0.0")
  1150. End If
  1151. If (String.IsNullOrEmpty(txtInteresAcumulado.Text.ToString.Trim("%"))) Then
  1152. txtInteresAcumulado.Text = "0.0%"
  1153. End If
  1154. If (txtPorcentajeComisionCasa.Text.ToString.IndexOf("%") = -1) Then
  1155. txtPorcentajeComisionCasa.Text += "%"
  1156. End If
  1157. If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
  1158. txtPorcentajeComisionBolsa.Text += "%"
  1159. End If
  1160. If (txtRendimientoBruto.ToString.IndexOf("%") = -1) Then
  1161. txtRendimientoBruto.Text += "%"
  1162. End If
  1163. End Sub
  1164. Sub RellenarDatos()
  1165. If (cboBase.SelectedIndex = 0) Then
  1166. IndexBase = 0
  1167. ElseIf (cboBase.SelectedIndex = 1) Then
  1168. IndexBase = 1
  1169. ElseIf (cboBase.SelectedIndex = 2) Then
  1170. IndexBase = 2
  1171. ElseIf (cboBase.SelectedIndex = 3) Then
  1172. IndexBase = 3
  1173. End If
  1174. Dim FechaOperacion = Date.Now.Date, FechaLiquidacion = Date.Now.Date
  1175. AgregarDias()
  1176. If (CET) Then
  1177. V_txtPrecio = "100"
  1178. Else
  1179. If (chbValorPar.Checked) Then
  1180. V_txtPrecio = "100"
  1181. txtPrecio.Text = "100%"
  1182. Else
  1183. txtPrecio.Text = Format(Precio(), "0.0000")
  1184. V_txtPrecio = Format(Precio(), "0.000000000")
  1185. End If
  1186. End If
  1187. txtValorTransado.Text = Format(ValorTrasado(), "0.0000")
  1188. V_txtValorTransado = Format(ValorTrasado(), "0.000000000")
  1189. txtComisionCasa.Text = Format(ComisionCasa(), "0.0000")
  1190. V_txtComisionCasa = Format(ComisionCasa(), "0.000000000")
  1191. txtComisionBolsa.Text = Format(ComisionBolsa(), "0.0000")
  1192. V_txtComisionBolsa = Format(ComisionBolsa(), "0.000000000")
  1193. txtIngresoBruto.Text = Format(IngresoBruto(), "0.0000")
  1194. V_txtIngresoBruto = Format(IngresoBruto(), "0.000000000")
  1195. FechaOperacion = dtpFechaOperacion.Value
  1196. FechaLiquidacion = dtpFechaLiquidacion.Value
  1197. 'txtDiasAcumulados.Text = Operaciones.DiasAcumulados(FechaOperacion, FechaLiquidacion, 1).ToString()
  1198. Dim Dias = 0
  1199. Dim Fecha As String = Format(dtpUltimaFecha.Value, "yyyy/MM/dd")
  1200. dtpUltimaFecha.Value = Fecha
  1201. Dim FechaLiq As String = Format(dtpFechaLiquidacion.Value, "yyyy/MM/dd")
  1202. dtpFechaLiquidacion.Value = FechaLiq
  1203. If (IndexBase = 0 Or IndexBase = 2) Then
  1204. Dias = Operaciones.Base360(dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)
  1205. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  1206. Dias = Operaciones.Base365(dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)
  1207. End If
  1208. V_txtDiasAcumulados = Dias
  1209. Dim ValorNominal, RendBruto
  1210. ValorNominal = txtValorNominal.Text
  1211. If String.IsNullOrEmpty(ValorNominal.ToString) Then
  1212. ValorNominal = 0
  1213. End If
  1214. RendBruto = txtRendimientoBruto.Text
  1215. If String.IsNullOrEmpty(RendBruto.ToString.Trim("%")) Then
  1216. RendBruto = 0
  1217. Else
  1218. RendBruto = txtRendimientoBruto.Text.TrimEnd("%") / 100
  1219. End If
  1220. txtInteresAcumulado.Text = Format(CDec(Operaciones.InteresAcumuladoPBUR(ValorNominal, RendBruto, V_txtDiasAcumulados, IndexBase, dtpUltimaFecha.Value, dtpFechaLiquidacion.Value)), "0.0000").ToString + "%"
  1221. txtTotalAPagar.Text = Format(TotalPagar(), "0.0000")
  1222. V_txtTotalAPagar = Format(TotalPagar(), "0.000000000")
  1223. txtIngresoNeto.Text = Format(IngresoNeto(), "0.0000")
  1224. V_txtIngresoNeto = Format(IngresoNeto(), "0.000000000")
  1225. txtRendimientoNeto.Text = Format(RendimientoNeto(), "0.0000")
  1226. V_txtRendimientoNeto = Format(RendimientoNeto(), "0.000000000")
  1227. AgregarPorcentaje()
  1228. End Sub
  1229. Private Sub Button1_Click_1(sender As Object, e As EventArgs)
  1230. End Sub
  1231. Sub AgregarDias()
  1232. Dim Dias As Integer = 0
  1233. If Not String.IsNullOrEmpty(txtPlazoInversion.Text) Then
  1234. Dias = txtPlazoInversion.Text
  1235. End If
  1236. Dim Fechaliquidacion = Operaciones.ConvertirFecha(dtpFechaLiquidacion.Value.ToString)
  1237. Dim FechaVencimiento = Operaciones.ConvertirFecha(dtpFechaVencimiento.Value.ToString)
  1238. If (IndexBase = 0 Or IndexBase = 2) Then
  1239. If VCN Then
  1240. txtPlazoInversion.Text = Operaciones.Base360(Fechaliquidacion, FechaVencimiento) - 1
  1241. Else
  1242. dtpFechaVencimiento.Value = Operaciones.FechaDias360(Fechaliquidacion, Dias)
  1243. End If
  1244. ElseIf IndexBase = 1 Or IndexBase = 3 Then
  1245. If VCN Then
  1246. txtPlazoInversion.Text = Operaciones.Base365(Fechaliquidacion, FechaVencimiento)
  1247. Else
  1248. dtpFechaVencimiento.Value = dtpFechaLiquidacion.Value.AddDays(Dias)
  1249. End If
  1250. End If
  1251. End Sub
  1252. Sub AgregarPorcentaje()
  1253. If (txtRendimientoBruto.ToString.IndexOf("%") = -1) Then
  1254. txtRendimientoBruto.Text += "%"
  1255. End If
  1256. If (txtPorcentajeComisionCasa.Text.ToString.IndexOf("%") = -1) Then
  1257. txtPorcentajeComisionCasa.Text += "%"
  1258. End If
  1259. If (txtPorcentajeComisionBolsa.ToString.IndexOf("%") = -1) Then
  1260. txtPorcentajeComisionBolsa.Text += "%"
  1261. End If
  1262. If (txtRendimientoNeto.ToString.IndexOf("%") = -1) Then
  1263. txtRendimientoNeto.Text += "%"
  1264. End If
  1265. If (txtPrecio.ToString.IndexOf("%") = -1) Then
  1266. txtPrecio.Text += "%"
  1267. End If
  1268. End Sub
  1269. Private Sub txtRendimientoBruto_Leave(sender As Object, e As EventArgs) Handles txtRendimientoBruto.Leave
  1270. Rellenar()
  1271. End Sub
  1272. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  1273. TipoTransaccion = "M"
  1274. btnAceptar.Text = "Modificar"
  1275. End Sub
  1276. Private Sub txtValorNominal_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtValorNominal.KeyPress
  1277. If String.IsNullOrEmpty(txtValorNominal.Text) Then
  1278. If e.KeyChar = "." Then
  1279. txtValorNominal.Text = "0"
  1280. Exit Sub
  1281. End If
  1282. End If
  1283. If (Not txtValorNominal.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1284. Operaciones.ValidarEntrada(sender, e, True)
  1285. Else
  1286. Operaciones.ValidarEntrada(sender, e, False)
  1287. End If
  1288. End Sub
  1289. Private Sub txtPlazoInversion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPlazoInversion.KeyPress
  1290. If String.IsNullOrEmpty(txtPlazoInversion.Text) Then
  1291. If e.KeyChar = "." Then
  1292. txtPlazoInversion.Text = "0"
  1293. Exit Sub
  1294. End If
  1295. End If
  1296. If (Not txtPlazoInversion.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1297. Operaciones.ValidarEntrada(sender, e, True)
  1298. Else
  1299. Operaciones.ValidarEntrada(sender, e, False)
  1300. End If
  1301. End Sub
  1302. Private Sub txtPorcentajeComisionCasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionCasa.KeyPress
  1303. If String.IsNullOrEmpty(txtPorcentajeComisionCasa.Text) Then
  1304. If e.KeyChar = "." Then
  1305. txtPorcentajeComisionCasa.Text = "0"
  1306. Exit Sub
  1307. End If
  1308. End If
  1309. If (Not txtPorcentajeComisionCasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1310. Operaciones.ValidarEntrada(sender, e, True)
  1311. Else
  1312. Operaciones.ValidarEntrada(sender, e, False)
  1313. End If
  1314. End Sub
  1315. Private Sub txtPorcentajeComisionBolsa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentajeComisionBolsa.KeyPress
  1316. If String.IsNullOrEmpty(txtPorcentajeComisionBolsa.Text) Then
  1317. If e.KeyChar = "." Then
  1318. txtPorcentajeComisionBolsa.Text = "0"
  1319. Exit Sub
  1320. End If
  1321. End If
  1322. If (Not txtPorcentajeComisionBolsa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1323. Operaciones.ValidarEntrada(sender, e, True)
  1324. Else
  1325. Operaciones.ValidarEntrada(sender, e, False)
  1326. End If
  1327. End Sub
  1328. Private Sub txtRendimientoBruto_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRendimientoBruto.KeyPress
  1329. If String.IsNullOrEmpty(txtRendimientoBruto.Text) Then
  1330. If e.KeyChar = "." Then
  1331. txtRendimientoBruto.Text = "0"
  1332. Exit Sub
  1333. End If
  1334. End If
  1335. If (Not txtRendimientoBruto.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1336. Operaciones.ValidarEntrada(sender, e, True)
  1337. Else
  1338. Operaciones.ValidarEntrada(sender, e, False)
  1339. End If
  1340. End Sub
  1341. Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
  1342. TipoTransaccion = "N"
  1343. btnAceptar.Text = "Agregar"
  1344. End Sub
  1345. Private Sub chbValorPar_CheckedChanged(sender As Object, e As EventArgs) Handles chbValorPar.CheckedChanged
  1346. RellenarDatos()
  1347. End Sub
  1348. Private Sub txtRendimientoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtRendimientoNeto.TextChanged
  1349. End Sub
  1350. Private Sub txtInteresAcumulado_TextChanged(sender As Object, e As EventArgs) Handles txtInteresAcumulado.TextChanged
  1351. End Sub
  1352. Private Sub txtIngresoBruto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoBruto.TextChanged
  1353. End Sub
  1354. Private Sub dtpUltimaFecha_ValueChanged(sender As Object, e As EventArgs)
  1355. RellenarDatos()
  1356. End Sub
  1357. Private Sub Label14_Click(sender As Object, e As EventArgs) Handles Label14.Click
  1358. End Sub
  1359. Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodicidad.SelectedIndexChanged
  1360. RellenarDatos()
  1361. End Sub
  1362. Private Sub cboCasasCorredoras_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCasasCorredoras.SelectedIndexChanged
  1363. RellenarDatos()
  1364. End Sub
  1365. Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
  1366. End Sub
  1367. Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
  1368. End Sub
  1369. Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
  1370. End Sub
  1371. Private Sub Label3_Click(sender As Object, e As EventArgs) Handles Label3.Click
  1372. End Sub
  1373. Private Sub Label10_Click(sender As Object, e As EventArgs) Handles Label10.Click
  1374. End Sub
  1375. Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click
  1376. End Sub
  1377. Private Sub Label11_Click(sender As Object, e As EventArgs) Handles Label11.Click
  1378. End Sub
  1379. Private Sub txtIngresoNeto_TextChanged(sender As Object, e As EventArgs) Handles txtIngresoNeto.TextChanged
  1380. End Sub
  1381. Private Sub Label12_Click(sender As Object, e As EventArgs) Handles Label12.Click
  1382. End Sub
  1383. Private Sub Label13_Click(sender As Object, e As EventArgs) Handles Label13.Click
  1384. End Sub
  1385. Private Sub Label15_Click(sender As Object, e As EventArgs) Handles Label15.Click
  1386. End Sub
  1387. Private Sub Label16_Click(sender As Object, e As EventArgs) Handles Label16.Click
  1388. End Sub
  1389. Private Sub Label17_Click(sender As Object, e As EventArgs) Handles Label17.Click
  1390. End Sub
  1391. Private Sub Label6_Click(sender As Object, e As EventArgs) Handles Label6.Click
  1392. End Sub
  1393. Private Sub lblInteresAcumulado_Click(sender As Object, e As EventArgs) Handles lblInteresAcumulado.Click
  1394. End Sub
  1395. Private Sub dtpUltimaFecha_ValueChanged_1(sender As Object, e As EventArgs) Handles dtpUltimaFecha.ValueChanged
  1396. RellenarDatos()
  1397. End Sub
  1398. Private Sub txtOtrosCostos_TextChanged(sender As Object, e As EventArgs) Handles txtOtrosCostos.TextChanged
  1399. RellenarDatos()
  1400. End Sub
  1401. Private Sub txtOtrosCostos_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtOtrosCostos.KeyPress
  1402. If String.IsNullOrEmpty(txtOtrosCostos.Text) Then
  1403. If e.KeyChar = "." Then
  1404. txtOtrosCostos.Text = "0"
  1405. Exit Sub
  1406. End If
  1407. End If
  1408. If (Not txtOtrosCostos.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  1409. Operaciones.ValidarEntrada(sender, e, True)
  1410. Else
  1411. Operaciones.ValidarEntrada(sender, e, False)
  1412. End If
  1413. End Sub
  1414. Private Sub btnRedencion_Click(sender As Object, e As EventArgs) Handles btnRedencion.Click
  1415. If (btnRedencion.Text = "Redención") Then
  1416. lblRedencion.Visible = True
  1417. dtpRedencion.Visible = True
  1418. btnRedencion.Text = "Cancelar"
  1419. Else
  1420. lblRedencion.Visible = False
  1421. dtpRedencion.Visible = False
  1422. btnRedencion.Text = "Redención"
  1423. End If
  1424. End Sub
  1425. Private Sub txtDiasAcumulados_TextChanged(sender As Object, e As EventArgs)
  1426. RellenarDatos()
  1427. End Sub
  1428. Private Sub txtValorNominal_Leave(sender As Object, e As EventArgs) Handles txtValorNominal.Leave
  1429. Rellenar()
  1430. End Sub
  1431. Private Sub txtPlazoInversion_Leave(sender As Object, e As EventArgs) Handles txtPlazoInversion.Leave
  1432. Rellenar()
  1433. End Sub
  1434. Private Sub txtOtrosCostos_Leave(sender As Object, e As EventArgs) Handles txtOtrosCostos.Leave
  1435. Rellenar()
  1436. End Sub
  1437. Private Sub txtValorNominal_ModifiedChanged(sender As Object, e As EventArgs) Handles txtValorNominal.ModifiedChanged
  1438. End Sub
  1439. Private Sub txtValorNominal_KeyUp(sender As Object, e As KeyEventArgs) Handles txtValorNominal.KeyUp
  1440. If txtValorNominal.Text = "." Then
  1441. txtValorNominal.Text = ".0"
  1442. End If
  1443. End Sub
  1444. Private Sub txtPlazoInversion_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPlazoInversion.KeyUp
  1445. If txtPlazoInversion.Text = "." Then
  1446. txtPlazoInversion.Text = ".0"
  1447. End If
  1448. End Sub
  1449. Private Sub txtPorcentajeComisionCasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeComisionCasa.KeyUp
  1450. If txtPorcentajeComisionCasa.Text = "." Then
  1451. txtPorcentajeComisionCasa.Text = ".0"
  1452. End If
  1453. End Sub
  1454. Private Sub txtPorcentajeComisionBolsa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtPorcentajeComisionBolsa.KeyUp
  1455. If txtPorcentajeComisionBolsa.Text = "." Then
  1456. txtPorcentajeComisionBolsa.Text = ".0"
  1457. End If
  1458. End Sub
  1459. Private Sub txtRendimientoBruto_KeyUp(sender As Object, e As KeyEventArgs) Handles txtRendimientoBruto.KeyUp
  1460. If txtRendimientoBruto.Text = "." Then
  1461. txtRendimientoBruto.Text = ".0"
  1462. End If
  1463. End Sub
  1464. Private Sub txtOtrosCostos_KeyUp(sender As Object, e As KeyEventArgs) Handles txtOtrosCostos.KeyUp
  1465. If txtOtrosCostos.Text = "." Then
  1466. txtOtrosCostos.Text = ".0"
  1467. End If
  1468. End Sub
  1469. Private Sub dtpRedencion_ValueChanged(sender As Object, e As EventArgs) Handles dtpRedencion.ValueChanged
  1470. End Sub
  1471. Private Sub dgvIngresosVCN_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvIngresosVCN.CellClick
  1472. CalculosIngresosVCN()
  1473. End Sub
  1474. Private Sub btnReporto_Click(sender As Object, e As EventArgs)
  1475. End Sub
  1476. Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
  1477. TipoTransaccion = "B"
  1478. btnAceptar.Text = "Eliminar"
  1479. End Sub
  1480. Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
  1481. Me.Close()
  1482. End Sub
  1483. Private Sub cboBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboBase.SelectedIndexChanged
  1484. RellenarDatos()
  1485. End Sub
  1486. Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
  1487. End Sub
  1488. Private Sub txtPorcentajeComisionCasa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionCasa.Leave
  1489. Rellenar()
  1490. End Sub
  1491. Private Sub txtPorcentajeComisionBolsa_Leave(sender As Object, e As EventArgs) Handles txtPorcentajeComisionBolsa.Leave
  1492. Rellenar()
  1493. End Sub
  1494. Sub AgregarDiasExtra()
  1495. dtpFechaLiquidacion.Value = dtpFechaOperacion.Value.AddDays(2)
  1496. End Sub
  1497. End Class