frmSeleccionTitulosReportos.vb 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. Public Class frmSeleccionTitulosReportos
  2. Dim DAOGeneral As New DAOGeneral
  3. Dim Operaciones As New Operaciones
  4. Dim NombreTrasladar As String = String.Empty
  5. Dim ObtenerInstanciaObjetotexto As New TextBox
  6. Dim ObtenerInstanciaObjetocheque As New CheckBox
  7. Dim SeleccionDAO As New SeleccionTitulosReportosDAO
  8. Dim General As New DAOGeneral
  9. Dim CodigoAsociado As String = String.Empty
  10. Dim MontoUsado As Double = 0
  11. Dim Empresa As String = String.Empty
  12. Dim NombreEm As String = String.Empty
  13. Dim CodigoReporto As String = String.Empty
  14. Dim IdFlujo As Integer = 0
  15. Private Sub frmSeleccionTitulosReportos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  16. Formato()
  17. DefinirValoresIniciales()
  18. CargarTitulos()
  19. SaldoGarantia()
  20. Controladores(0)
  21. End Sub
  22. Sub DefinirValoresIniciales()
  23. txtCodigoAsociado.Text = CodigoAsociado
  24. txtMonto.Text = MontoUsado
  25. End Sub
  26. Sub New()
  27. ' Esta llamada es exigida por el diseñador.
  28. InitializeComponent()
  29. ' Agregue cualquier inicialización después de la llamada a InitializeComponent().
  30. End Sub
  31. Sub New(DicDatos As Dictionary(Of String, Object))
  32. Me.New
  33. If DicDatos.ContainsKey("MontoUsado") Then
  34. Me.MontoUsado = DicDatos.Item("MontoUsado")
  35. End If
  36. If DicDatos.ContainsKey("CodigoAsociado") Then
  37. Me.CodigoAsociado = DicDatos.Item("CodigoAsociado")
  38. End If
  39. If DicDatos.ContainsKey("Empresa") Then
  40. Me.Empresa = DicDatos.Item("Empresa")
  41. End If
  42. If DicDatos.ContainsKey("NombreEmpresa") Then
  43. Me.NombreEm = DicDatos.Item("NombreEmpresa")
  44. End If
  45. If DicDatos.ContainsKey("CodigoReporto") Then
  46. Me.CodigoReporto = DicDatos.Item("CodigoReporto")
  47. End If
  48. If DicDatos.ContainsKey("IdFlujo") Then
  49. Me.IdFlujo = DicDatos.Item("IdFlujo")
  50. End If
  51. End Sub
  52. Sub CargarTitulos()
  53. Dim dt As New DataTable
  54. dt = DAOGeneral.ListaInstrumentos("Propuesta")
  55. For Each Item As DataRow In dt.Rows
  56. ''GeneracionCheques
  57. Dim cheque As New CheckBox
  58. cheque.Width = 215
  59. cheque.Margin = New Padding(90, 10, 0, 10)
  60. cheque.Name = Item("Codigo").ToString
  61. cheque.Text = Item("Descripcion").ToString
  62. flpTitulos.AutoScroll = True
  63. ''GeneracionTexto
  64. Dim texto As New TextBox
  65. Dim Label As New Label
  66. Label.Text = " "
  67. Label.ForeColor = Color.Maroon
  68. Label.Name = Item("Codigo").ToString
  69. texto.Width = 150
  70. texto.Margin = New Padding(0, 10, 0, 10)
  71. Label.Margin = New Padding(50, 10, 0, 10)
  72. texto.Name = Item("Codigo").ToString
  73. texto.Text = 0
  74. flpValor.AutoScroll = True
  75. texto.ReadOnly = True
  76. texto.BorderStyle = BorderStyle.FixedSingle
  77. texto.BackColor = SystemColors.Control
  78. AddHandler cheque.CheckedChanged, AddressOf ObtenerNombre
  79. AddHandler cheque.MouseMove, AddressOf Focuss
  80. flpTitulos.Controls.Add(cheque)
  81. flpValor.Controls.Add(Label)
  82. flpValor.Controls.Add(texto)
  83. Next
  84. End Sub
  85. Sub Focuss()
  86. flpValor.VerticalScroll.Value = flpTitulos.VerticalScroll.Value
  87. End Sub
  88. Sub ObtenerNombre(sender As Object, e As EventArgs)
  89. Controladores(1)
  90. NombreTrasladar = sender.name.ToString
  91. For Each Item In flpValor.Controls
  92. If TypeOf Item Is TextBox Then
  93. If Item.Name = NombreTrasladar Then
  94. If sender.checked Then
  95. ObtenerInstanciaObjetotexto = Item
  96. ObtenerInstanciaObjetocheque = sender
  97. Else
  98. ObtenerInstanciaObjetotexto = Item
  99. NombreTrasladar = sender.name.ToString
  100. Item.Text = 0
  101. ObtenerInstanciaObjetotexto.BackColor = SystemColors.Control
  102. ObtenerInstanciaObjetotexto.ForeColor = Color.Black
  103. ObtenerInstanciaObjetotexto = Nothing
  104. NombreTrasladar = String.Empty
  105. ObtenerInstanciaObjetocheque = Nothing
  106. End If
  107. End If
  108. ElseIf TypeOf Item Is Label Then
  109. If Item.Name = NombreTrasladar Then
  110. Item.text = "------>"
  111. Else
  112. Item.text = " "
  113. End If
  114. End If
  115. Next
  116. flpValor.VerticalScroll.Value = flpTitulos.VerticalScroll.Value
  117. End Sub
  118. Function TrasladarMonto()
  119. Dim MoverLimpio As Double = Operaciones.ConvertirDecimal(txtMover.Text.ToString)
  120. Dim PorcRest As Double = Operaciones.ConvertirDecimal(lblPorcentajeRestanteValor.Text.ToString)
  121. Dim MontoDisponible As Double = Operaciones.ConvertirDecimal(lblMontoDisponible.Text.ToString)
  122. Dim MontoTotal As Double = Operaciones.ConvertirDecimal(lblMontoPorcentaje.Text.ToString)
  123. If rdbMonto.Checked Then
  124. If (MoverLimpio <= 0) Then
  125. MsgBox("Ingrese un numero mayor a 0")
  126. Return 0
  127. ElseIf MoverLimpio > MontoTotal Then
  128. MsgBox("El Monto Máximo es de " + MontoTotal.ToString)
  129. Return 0
  130. ElseIf MoverLimpio > MontoDisponible Then
  131. MsgBox("Monto Fuera de Rango")
  132. Return 0
  133. Else
  134. If Not String.IsNullOrEmpty(NombreTrasladar) And Not ObtenerInstanciaObjetotexto Is Nothing Then
  135. If Not lblMontoDisponible.Text = 0 Then
  136. ObtenerInstanciaObjetotexto.BackColor = Color.Brown
  137. ObtenerInstanciaObjetotexto.ForeColor = Color.White
  138. End If
  139. End If
  140. CalculoSaldoUsado()
  141. Return 1
  142. End If
  143. Else
  144. If (MoverLimpio <= 0) Then
  145. MsgBox("Ingrese un numero mayor a 0")
  146. Return 0
  147. ElseIf MoverLimpio > 100 Then
  148. MsgBox("El Porcentaje máximo es de 100 %")
  149. Return 0
  150. ElseIf MoverLimpio > PorcRest Then
  151. MsgBox("Porcentaje Fuera de Rango")
  152. Return 0
  153. Else
  154. If Not String.IsNullOrEmpty(NombreTrasladar) And Not ObtenerInstanciaObjetotexto Is Nothing Then
  155. If Not lblMontoDisponible.Text = 0 Then
  156. ObtenerInstanciaObjetotexto.BackColor = Color.Brown
  157. ObtenerInstanciaObjetotexto.ForeColor = Color.White
  158. End If
  159. End If
  160. CalculoSaldoUsado()
  161. Return 1
  162. End If
  163. End If
  164. End Function
  165. Sub CalculoSaldoUsado()
  166. Dim TipoValor As String = String.Empty
  167. If rdbMonto.Checked Then
  168. TipoValor = "Monto"
  169. Else
  170. TipoValor = "Porc"
  171. End If
  172. ''Es Positivo
  173. If TipoValor = "Monto" Then
  174. ObtenerInstanciaObjetotexto.Text = txtMover.Text
  175. txtMover.Text = 0
  176. Else
  177. If Not lblMontoDisponible.Text = 0 Then
  178. ObtenerInstanciaObjetotexto.Text = (Operaciones.ConvertirDecimal(lblMontoPorcentaje.Text) * (Operaciones.ConvertirDecimal(txtMover.Text) / 100))
  179. Else
  180. MsgBox("No cuenta con suficientes fondos")
  181. End If
  182. End If
  183. End Sub
  184. Private Sub tlpValor_Paint(sender As Object, e As PaintEventArgs)
  185. End Sub
  186. Private Sub flpTitulos_Scroll(sender As Object, e As ScrollEventArgs) Handles flpTitulos.Scroll
  187. flpValor.VerticalScroll.Value = flpTitulos.VerticalScroll.Value
  188. End Sub
  189. Private Sub btnMover_Click(sender As Object, e As EventArgs) Handles btnMover.Click
  190. Dim Continuar As Integer = TrasladarMonto()
  191. If Continuar = 1 Then
  192. Controladores(2)
  193. End If
  194. End Sub
  195. Function ConteoSaldoUsado()
  196. Dim Monto As Double = 0
  197. Dim CantidadFilas = dgvDetalles.Rows.Count - 1
  198. Dim Index As Integer = 0
  199. While (CantidadFilas >= Index)
  200. Monto += Operaciones.ConvertirDecimal(dgvDetalles.Rows(Index).Cells("Monto").Value.ToString)
  201. Index += 1
  202. End While
  203. Return Monto
  204. End Function
  205. Function CalculoSaldo()
  206. Dim MontoActualPorcentaje As Double = 0
  207. Dim MontoUsado As Double = 0
  208. Dim MontoDisponible As Double = 0
  209. Dim Positivo As Boolean = False
  210. MontoActualPorcentaje = Operaciones.ConvertirDecimal(lblMontoPorcentaje.Text.ToString)
  211. MontoUsado = Operaciones.ConvertirDecimal(ConteoSaldoUsado.ToString)
  212. lblMontoUsado.Text = MontoUsado
  213. MontoDisponible = MontoActualPorcentaje - MontoUsado
  214. If MontoDisponible >= 0 Then
  215. lblMontoDisponible.Text = MontoDisponible
  216. Positivo = True
  217. Else
  218. Positivo = False
  219. End If
  220. Return Positivo
  221. End Function
  222. Private Sub btnCancelar_Click(sender As Object, e As EventArgs) Handles btnCancelar.Click
  223. txtMover.Text = 0
  224. If Not ObtenerInstanciaObjetocheque Is Nothing Then
  225. ObtenerInstanciaObjetocheque.Checked = False
  226. ObtenerInstanciaObjetocheque = Nothing
  227. End If
  228. Controladores(0)
  229. End Sub
  230. Private Sub btnAgregar_Click(sender As Object, e As EventArgs) Handles btnAgregar.Click
  231. End Sub
  232. Private Sub flpTitulos_CursorChanged(sender As Object, e As EventArgs) Handles flpTitulos.CursorChanged
  233. End Sub
  234. Sub SaldoGarantia()
  235. Dim PorcentajeIngresado As Double = Operaciones.ConvertirDecimal(txtPorcentaje.Text.ToString)
  236. If PorcentajeIngresado > 100 Then
  237. txtPorcentaje.Text = "100 %"
  238. MsgBox("Porcentaje Demasiado Alto,Ingrese uno menor")
  239. End If
  240. Dim Porcentaje As Double = 0
  241. Dim ValorTitulo As Double = 0
  242. If Not String.IsNullOrEmpty(txtPorcentaje.Text) Then
  243. Porcentaje = (Operaciones.ConvertirDecimal(txtPorcentaje.Text.ToString) / 100)
  244. End If
  245. Dim Monto As Double = Operaciones.ConvertirDecimal(txtMonto.Text.ToString)
  246. Dim MontoDisponible As Double = Monto * Porcentaje
  247. ValorTitulo = Monto - MontoDisponible
  248. txtValorTitulo.Text = ValorTitulo
  249. lblMontoDisponible.Text = MontoDisponible
  250. lblMontoPorcentaje.Text = MontoDisponible
  251. End Sub
  252. Private Sub lblMontoDisponible_Click(sender As Object, e As EventArgs) Handles lblMontoDisponible.Click
  253. End Sub
  254. Private Sub txtPorcentaje_TextChanged(sender As Object, e As EventArgs) Handles txtPorcentaje.TextChanged
  255. SaldoGarantia()
  256. End Sub
  257. Sub Guardar()
  258. Dim Valores As New Collection
  259. Valores = GuardarValores()
  260. SeleccionDAO.ProcesoDatos(Valores)
  261. End Sub
  262. Function GuardarValores() As Collection
  263. Dim ColRegistros As New Collection
  264. Dim Tipo As String = String.Empty
  265. If rdbMonto.Checked Then
  266. Tipo = "Monto"
  267. Else
  268. Tipo = "Porcentaje"
  269. End If
  270. Dim CantidadFilas = dgvDetalles.Rows.Count - 1
  271. Dim Index As Integer = 0
  272. While (CantidadFilas >= Index)
  273. Dim DicRegistrosInstrumentos As New Dictionary(Of String, Object)
  274. Dim CodigoAso As String = Me.CodigoAsociado
  275. Dim CodigoReporto As String = Me.CodigoReporto
  276. Dim IdFlujo As Integer = Operaciones.ConvertirEntero(Me.IdFlujo.ToString)
  277. Dim NombreInstrumento As String = dgvDetalles.Rows(Index).Cells("NombreInstrumento").Value.ToString
  278. Dim NombreEmpresa As String = dgvDetalles.Rows(Index).Cells("NombreEmpresa").Value.ToString
  279. Dim TipoAsignacion As String = Tipo
  280. Dim MontoInicial As Double = Operaciones.ConvertirDecimal(txtMonto.Text.ToString)
  281. Dim MontoTotalUsado As Double = Operaciones.ConvertirDecimal(lblMontoPorcentaje.Text.ToString)
  282. Dim PorcentajeRestante As Double = Operaciones.ConvertirDecimal(dgvDetalles.Rows(Index).Cells("PorcentajeRestantes").Value.ToString)
  283. Dim PorcentajeMontoUsado As Double = Operaciones.ConvertirDecimal(txtPorcentaje.Text.ToString)
  284. Dim MontoDisponible As Double = Operaciones.ConvertirDecimal(dgvDetalles.Rows(Index).Cells("SaldoDisponible").Value.ToString)
  285. Dim MontoUsado As Double = Operaciones.ConvertirDecimal(dgvDetalles.Rows(Index).Cells("SaldoUsado").Value.ToString)
  286. Dim MontoTitulo As Double = Operaciones.ConvertirDecimal(dgvDetalles.Rows(Index).Cells("Monto").Value.ToString)
  287. Dim MontoNoUsado As Double = Operaciones.ConvertirDecimal(txtValorTitulo.Text.ToString)
  288. Dim FechaCreado As Date = Date.Now.Date
  289. Dim EstadoProceso As String = "P"
  290. Dim Asociado As String = "No"
  291. ''AgregarCampos al Dicionario
  292. DicRegistrosInstrumentos.Add("CodigoAsociado", CodigoAso)
  293. DicRegistrosInstrumentos.Add("NombreInstrumento", NombreInstrumento)
  294. DicRegistrosInstrumentos.Add("NombreEmpresa", NombreEmpresa)
  295. DicRegistrosInstrumentos.Add("TipoAsignacion", TipoAsignacion)
  296. DicRegistrosInstrumentos.Add("MontoInicial", MontoInicial)
  297. DicRegistrosInstrumentos.Add("MontoTotalUsado", MontoTotalUsado)
  298. DicRegistrosInstrumentos.Add("PorcentajeRestante", PorcentajeRestante)
  299. DicRegistrosInstrumentos.Add("PorcentajeMontoUsado", PorcentajeMontoUsado)
  300. DicRegistrosInstrumentos.Add("MontoDisponible", MontoDisponible)
  301. DicRegistrosInstrumentos.Add("MontoUsado", MontoUsado)
  302. DicRegistrosInstrumentos.Add("MontoTitulo", MontoTitulo)
  303. DicRegistrosInstrumentos.Add("MontoNoUsado", MontoNoUsado)
  304. DicRegistrosInstrumentos.Add("FechaCreado", FechaCreado)
  305. DicRegistrosInstrumentos.Add("EstadoProceso", EstadoProceso)
  306. DicRegistrosInstrumentos.Add("Asociado", Asociado)
  307. DicRegistrosInstrumentos.Add("CodigoReporto", CodigoReporto)
  308. DicRegistrosInstrumentos.Add("IdFlujo", IdFlujo)
  309. ColRegistros.Add(DicRegistrosInstrumentos)
  310. Index += 1
  311. End While
  312. Return ColRegistros
  313. End Function
  314. Private Sub btnGenerar_Click(sender As Object, e As EventArgs) Handles btnGenerar.Click
  315. Guardar()
  316. frmColaTitulos.Inicializacion()
  317. frmColaTitulos.dgvDetalles.DataSource = Nothing
  318. Me.Close()
  319. End Sub
  320. Private Sub btnAgregarSiguiente_Click(sender As Object, e As EventArgs) Handles btnAgregarSiguiente.Click
  321. Dim Estado As String = String.Empty
  322. AgregarSiguiente()
  323. CalculoSaldo()
  324. PorcentajeRestante()
  325. Limpiar()
  326. Controladores(3)
  327. End Sub
  328. Sub AgregarSiguiente()
  329. Dim Nombre As String = String.Empty
  330. Dim NombreInstrumento As String = String.Empty
  331. Dim Monto As Double = 0
  332. Dim SaldoDisponible As Double = 0
  333. Dim SaldoUsado As Double = 0
  334. Dim PorcentajeRestante As Double = 0
  335. Dim Codigo As String = Variables.Codigo
  336. Dim Empresa As String = Me.Empresa
  337. Dim NombreEmpresa As String = Me.NombreEm
  338. For Each Item In flpValor.Controls
  339. If TypeOf Item Is TextBox Then
  340. If Item.BackColor = Color.Brown Then
  341. Nombre = Item.name.ToString
  342. Monto = Operaciones.ConvertirDecimal(Item.text.ToString)
  343. SaldoDisponible = Operaciones.ConvertirDecimal(lblMontoDisponible.Text.ToString) - Monto
  344. SaldoUsado = Operaciones.ConvertirDecimal(lblMontoUsado.Text.ToString) + Monto
  345. PorcentajeRestante = (SaldoDisponible / Operaciones.ConvertirDecimal(lblMontoPorcentaje.Text.ToString)) * 100
  346. End If
  347. End If
  348. Next
  349. For Each Item In flpTitulos.Controls
  350. If TypeOf Item Is CheckBox Then
  351. If Item.checked Then
  352. NombreInstrumento = Item.text.ToString
  353. If Not String.IsNullOrEmpty(NombreInstrumento) Then
  354. Exit For
  355. End If
  356. End If
  357. End If
  358. Next
  359. If String.IsNullOrEmpty(Nombre) And String.IsNullOrEmpty(Monto.ToString) Or
  360. String.IsNullOrEmpty(SaldoDisponible.ToString) Or String.IsNullOrEmpty(SaldoUsado.ToString) Or
  361. String.IsNullOrEmpty(PorcentajeRestante.ToString) Or String.IsNullOrEmpty(Empresa.ToString) Or
  362. String.IsNullOrEmpty(NombreInstrumento.ToString) Or String.IsNullOrEmpty(NombreEm.ToString) Then
  363. MsgBox("Error en Traspaso")
  364. Else
  365. dgvDetalles.Rows.Add(Nombre, NombreInstrumento, Empresa, NombreEm, Monto.ToString, SaldoDisponible.ToString, SaldoUsado.ToString, PorcentajeRestante.ToString + " %".ToString)
  366. End If
  367. End Sub
  368. Private Sub btnAgregarMismoIns_Click(sender As Object, e As EventArgs)
  369. End Sub
  370. Sub Limpiar()
  371. For Each Item In flpValor.Controls
  372. If TypeOf Item Is TextBox Then
  373. Item.text = 0
  374. Item.backcolor = SystemColors.Control
  375. End If
  376. If TypeOf Item Is Label Then
  377. Item.text = " "
  378. End If
  379. Next
  380. For Each Item In flpTitulos.Controls
  381. If TypeOf Item Is CheckBox Then
  382. Item.checked = False
  383. End If
  384. Next
  385. End Sub
  386. Private Sub lblMontoUsado_Click(sender As Object, e As EventArgs) Handles lblMontoUsado.Click
  387. End Sub
  388. Sub PorcentajeRestante()
  389. Dim PorcentajeCompleto As Integer = 0
  390. Dim MontoCompleto As Double = 0
  391. Dim MontoUsado As Double = 0
  392. Dim Porcentaje As Double = 0
  393. MontoCompleto = Operaciones.ConvertirDecimal(lblMontoPorcentaje.Text.ToString)
  394. MontoUsado = Operaciones.ConvertirDecimal(lblMontoUsado.Text.ToString)
  395. Porcentaje = 100 - ((MontoUsado / MontoCompleto) * 100)
  396. lblPorcentajeRestanteValor.Text = Porcentaje.ToString + " %"
  397. End Sub
  398. Sub Controladores(ByRef PasoDatos As Integer)
  399. If PasoDatos = 0 Then
  400. btnAgregarSiguiente.Enabled = False
  401. pnlControladores.Enabled = False
  402. btnCancelar.Enabled = False
  403. btnAgregar.Enabled = False
  404. flpTitulos.Enabled = True
  405. ElseIf PasoDatos = 1 Then
  406. flpTitulos.Enabled = False
  407. pnlControladores.Enabled = True
  408. btnCancelar.Enabled = True
  409. ElseIf PasoDatos = 2 Then
  410. btnAgregarSiguiente.Enabled = True
  411. pnlControladores.Enabled = False
  412. ElseIf PasoDatos = 3 Then
  413. btnAgregar.Enabled = False
  414. flpTitulos.Enabled = True
  415. pnlControladores.Enabled = False
  416. btnCancelar.Enabled = False
  417. btnAgregarSiguiente.Enabled = False
  418. If rdbMonto.Checked Then
  419. txtMover.Text = "1 "
  420. Else
  421. txtMover.Text = "1 %"
  422. End If
  423. End If
  424. End Sub
  425. Private Sub txtPorcentaje_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPorcentaje.KeyPress
  426. If String.IsNullOrEmpty(sender.Text) Then
  427. If e.KeyChar = "." Then
  428. sender.Text = "0"
  429. Exit Sub
  430. End If
  431. End If
  432. If (Not sender.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  433. Operaciones.ValidarEntrada(sender, e, True)
  434. Else
  435. Operaciones.ValidarEntrada(sender, e, False)
  436. End If
  437. End Sub
  438. Sub Formato()
  439. If rdbPorcentaje.Checked Then
  440. Dim Porcentaje As String = txtPorcentaje.Text.Trim(" ").Trim("%")
  441. Dim PorcentajeNumero As Double = 0
  442. PorcentajeNumero = Operaciones.ConvertirDecimal(Porcentaje)
  443. If PorcentajeNumero = 0 Then
  444. PorcentajeNumero = 1
  445. End If
  446. Porcentaje = PorcentajeNumero.ToString + " %"
  447. txtPorcentaje.Text = Porcentaje
  448. End If
  449. End Sub
  450. Private Sub txtPorcentaje_Leave(sender As Object, e As EventArgs) Handles txtPorcentaje.Leave
  451. Formato()
  452. End Sub
  453. Private Sub rdbMonto_CheckedChanged(sender As Object, e As EventArgs) Handles rdbMonto.CheckedChanged
  454. CambioCalculo()
  455. Formato()
  456. End Sub
  457. Private Sub rdbPorcentaje_CheckedChanged(sender As Object, e As EventArgs) Handles rdbPorcentaje.CheckedChanged
  458. CambioCalculo()
  459. Formato()
  460. End Sub
  461. Sub CambioCalculo()
  462. If rdbPorcentaje.Checked Then
  463. txtPorcentaje.Text = "100 %"
  464. txtMover.Text = "1 %"
  465. Else
  466. txtPorcentaje.Text = "100 %"
  467. txtMover.Text = "1"
  468. End If
  469. End Sub
  470. Private Sub lblPorcentajeRestanteValor_Click(sender As Object, e As EventArgs) Handles lblPorcentajeRestanteValor.Click
  471. End Sub
  472. Private Sub txtMover_Leave(sender As Object, e As EventArgs) Handles txtMover.Leave
  473. If rdbPorcentaje.Checked Then
  474. txtMover.Text = Operaciones.ConvertirDecimal(txtMover.Text.ToString).ToString + " %"
  475. End If
  476. End Sub
  477. Private Sub dgvDetalles_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDetalles.CellContentClick
  478. End Sub
  479. End Class