frmPrestamoEmpresariales.vb 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354
  1. Public Class frmPrestamoEmpresariales
  2. Dim Prestamo As New PrestamoEmpresarialCE
  3. Dim PrestamoConsulta As New PrestamoEmpresarialDAO
  4. Dim oDAOGeneral As New DAOGeneral
  5. Dim Operaciones As New Operaciones
  6. Dim Base As Integer
  7. Dim FinCarga As Boolean = False
  8. Dim Estado As String = String.Empty
  9. Dim IndexCorte As Integer = 0
  10. Dim FechaCorte As Date
  11. Const IVA = 1.13
  12. Private Sub CargarTipoTasa()
  13. If cboTipoTasa.Items.Count = 0 Or cboTipoTasa.Items.Count = 1 Then
  14. Me.cboTipoTasa.DataSource = oDAOGeneral.ListaTipoTasa
  15. Me.cboTipoTasa.DisplayMember = "Descripcion"
  16. Me.cboTipoTasa.ValueMember = "Codigo"
  17. Me.cboTipoTasa.SelectedIndex = 0
  18. End If
  19. End Sub
  20. Private Sub CargarPeriodicidades()
  21. If cboPeriodicidad.Items.Count = 0 Or cboPeriodicidad.Items.Count = 1 Then
  22. Me.cboPeriodicidad.DataSource = oDAOGeneral.ListaPeriodicidad
  23. Me.cboPeriodicidad.DisplayMember = "Descripcion"
  24. Me.cboPeriodicidad.ValueMember = "Codigo"
  25. Me.cboPeriodicidad.SelectedIndex = 0
  26. End If
  27. End Sub
  28. Sub CargarBase()
  29. If cboBase.Items.Count = 0 Or cboBase.Items.Count = 1 Then
  30. Me.cboBase.DataSource = oDAOGeneral.ListaBase
  31. Me.cboBase.DisplayMember = "Descripcion"
  32. Me.cboBase.ValueMember = "Codigo"
  33. Me.cboBase.SelectedIndex = 0
  34. End If
  35. End Sub
  36. Private Sub frmPrestamoEmpresariales_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  37. dgvDetalles.Columns.Clear()
  38. Dias()
  39. AgregarCampos()
  40. CargarTipoTasa()
  41. CargarPeriodicidades()
  42. CargarBase()
  43. CargarDato()
  44. Dim Datos = CargarDetalles()
  45. RellenarDatos()
  46. If (Not Datos) Then
  47. Calculos(False, False)
  48. End If
  49. FinCarga = True
  50. ' CargarDetalles()
  51. ExisteInversion()
  52. ValidarExistencia()
  53. CargarTransladoNuevo()
  54. End Sub
  55. Function ExisteInversion()
  56. Dim Codigo As String = Variables.Codigo
  57. Dim TablaINV As String = "INV0"
  58. Dim TablaPINV As String = "PIN0"
  59. Dim General As New DAOGeneral
  60. Dim InvPro = Variables.InvPro
  61. If InvPro = "I" Then
  62. Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
  63. If INV0 Then
  64. navNuevo.Visible = True
  65. Return True
  66. Else
  67. navNuevo.Visible = False
  68. Calculos(False, False)
  69. Return False
  70. End If
  71. End If
  72. If InvPro = "P" Then
  73. Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
  74. If PINV0 Then
  75. navNuevo.Visible = True
  76. Return True
  77. Else
  78. navNuevo.Visible = False
  79. Calculos(False, False)
  80. Return False
  81. End If
  82. End If
  83. Return False
  84. End Function
  85. Sub CargarFecha()
  86. Dim Index As Integer = dgvDetalles.CurrentRow.Index
  87. Dim Anterior As Integer = Index - 1
  88. Dim Fecha = dtpFechaOperacion.Value
  89. Dim strFecha = Format(Fecha, "dd/MM/yyyy")
  90. If (String.IsNullOrEmpty(dgvDetalles.Rows(Index).Cells("Fechas de Pago").Value)) Then
  91. dgvDetalles.Rows(Index).Cells("Fechas de Pago").Value = strFecha
  92. End If
  93. End Sub
  94. Function CanRegistros()
  95. Dim Tabla As String = String.Empty
  96. Tabla = "PEMP1"
  97. Dim Codigo = Variables.Codigo
  98. Dim Cantidad As Integer = oDAOGeneral.CantidadRegistros(Codigo, Tabla)
  99. Return Cantidad
  100. End Function
  101. Sub ValidarExistencia()
  102. Dim General As New DAOGeneral
  103. Dim Codigo As String = Variables.Codigo
  104. Dim Tabla As String = String.Empty
  105. Tabla = "PEMP0"
  106. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  107. If (Existe) Then
  108. navNuevo.Enabled = False
  109. TbDetalles.Enabled = True
  110. navModificar.Enabled = True
  111. navEliminar.Enabled = True
  112. Else
  113. navNuevo.Enabled = True
  114. TbDetalles.Enabled = True
  115. navModificar.Enabled = False
  116. navEliminar.Enabled = False
  117. End If
  118. Estado = String.Empty
  119. btnAccion.Text = "Aceptar"
  120. End Sub
  121. Function ExisteValidacion()
  122. Dim General As New DAOGeneral
  123. Dim Codigo As String = Variables.Codigo
  124. Dim Tabla As String = String.Empty
  125. Tabla = "PEMP0"
  126. Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
  127. Return Existe
  128. End Function
  129. Sub Dias()
  130. Dim fecha1, fecha2
  131. fecha1 = dtpFechaOperacion.Value.ToString
  132. fecha2 = dtpFechaVencimiento.Value.ToString
  133. txtPlazoDias.Text = Prestamo.FechaDias(fecha1, fecha2)
  134. End Sub
  135. Private Sub dtpFechaOperacion_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOperacion.ValueChanged
  136. Formato()
  137. Dias()
  138. If (FinCarga) Then
  139. Calculos(False, False)
  140. End If
  141. End Sub
  142. Private Sub dtpFechaVencimiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaVencimiento.ValueChanged
  143. Formato()
  144. Dias()
  145. If (FinCarga) Then
  146. Calculos(False, False)
  147. End If
  148. End Sub
  149. Sub AgregarCampos()
  150. Dim plazo, fechapago, fechacorte, Contador, SaldoPendiente, ingresarcomision, ingresarinteres, IVA, amortizacion, montorecibir As New DataGridViewTextBoxColumn
  151. plazo.Name = "Plazo (Desembolso)"
  152. fechacorte.Name = "Fecha de corte"
  153. fechapago.Name = "Fechas de Pago"
  154. ingresarcomision.Name = "Ingreso por Comision"
  155. ingresarinteres.Name = "Ingreso por Interes"
  156. IVA.Name = "IVA"
  157. amortizacion.Name = "Amortizacion"
  158. SaldoPendiente.Name = "Saldo Pendiente"
  159. montorecibir.Name = "Monto a Recibir"
  160. Contador.Name = "Correlativo"
  161. dgvDetalles.Columns.Add(Contador)
  162. dgvDetalles.Columns.Add(plazo)
  163. dgvDetalles.Columns.Add(fechacorte)
  164. dgvDetalles.Columns.Add(fechapago)
  165. dgvDetalles.Columns.Add(ingresarcomision)
  166. dgvDetalles.Columns.Add(ingresarinteres)
  167. dgvDetalles.Columns.Add(IVA)
  168. dgvDetalles.Columns.Add(amortizacion)
  169. dgvDetalles.Columns.Add(SaldoPendiente)
  170. dgvDetalles.Columns.Add(montorecibir)
  171. End Sub
  172. Sub Formato()
  173. If (String.IsNullOrEmpty(txtMonto.Text.ToString)) Then
  174. txtMonto.Text = 0
  175. txtMonto.Text = Format(txtMonto.Text, "0.0")
  176. End If
  177. If (String.IsNullOrEmpty(txtTasa.Text.ToString.TrimEnd("%"))) Then
  178. txtTasa.Text = 0
  179. txtTasa.Text = Format(txtTasa.Text, "0.0")
  180. End If
  181. If (String.IsNullOrEmpty(txtComisionDesembolso.Text.ToString.TrimEnd("%"))) Then
  182. txtComisionDesembolso.Text = 0
  183. txtComisionDesembolso.Text = Format(txtComisionDesembolso.Text, "0.0")
  184. End If
  185. If (txtTasa.Text.ToString.IndexOf("%") = -1) Then
  186. txtTasa.Text = txtTasa.Text.ToString + "%"
  187. End If
  188. If (txtComisionDesembolso.Text.ToString.IndexOf("%") = -1) Then
  189. txtComisionDesembolso.Text = txtComisionDesembolso.Text.ToString + "%"
  190. End If
  191. End Sub
  192. Sub Calculos(ByVal Modificar As Boolean, ByVal Corte As Boolean)
  193. Dim V_txtMonto = 0.0, V_txtTasa = 0.0, V_txtComisionDesembolso = 0.0
  194. If Not String.IsNullOrEmpty(txtMonto.Text.Trim("%")) Then
  195. V_txtMonto = txtMonto.Text.Trim("%")
  196. End If
  197. If Not String.IsNullOrEmpty(txtTasa.Text.ToString.Trim("%")) Then
  198. V_txtTasa = (CDec(txtTasa.Text.ToString.Trim("%")) / 100)
  199. End If
  200. If Not String.IsNullOrEmpty(txtComisionDesembolso.Text.ToString.TrimEnd("%")) Then
  201. V_txtComisionDesembolso = (CDec(txtComisionDesembolso.Text.ToString.TrimEnd("%")) / 100)
  202. End If
  203. If (cboTipoTasa.SelectedIndex = -1) Then
  204. cboTipoTasa.SelectedIndex = 0
  205. End If
  206. If (cboBase.SelectedIndex = -1) Then
  207. cboBase.SelectedIndex = 0
  208. End If
  209. If (cboPeriodicidad.SelectedIndex = -1) Then
  210. cboPeriodicidad.SelectedIndex = 0
  211. End If
  212. Dim FechaInicial = dtpFechaOperacion.Value
  213. Dim FechaFinal = dtpFechaOperacion.Value
  214. Dim FechaVencimiento = dtpFechaOperacion.Value
  215. Dim FechaVen = dtpFechaVencimiento.Value
  216. Dim FechaAux = dtpFechaOperacion.Value
  217. Dim Index = 0
  218. Dim Contador As Integer = 0
  219. Dim Borrar As Boolean = True
  220. Dim diccionario As New Dictionary(Of String, String)
  221. While (True)
  222. If (Not Modificar And Borrar) Then
  223. Dim Cantidad As Integer = dgvDetalles.Rows.Count
  224. If (Cantidad > 1) Then
  225. Dim CantidadReal = Cantidad - 2
  226. Dim i As Integer = 0
  227. While i <= CantidadReal
  228. Dim FechaCort = dgvDetalles.Rows(i).Cells("fecha de corte").Value
  229. If Not FechaCort Is DBNull.Value Then
  230. If Not String.IsNullOrEmpty(FechaCort) Then
  231. diccionario.Add(i, FechaCort)
  232. End If
  233. End If
  234. i += 1
  235. End While
  236. dgvDetalles.Rows.Clear()
  237. End If
  238. Borrar = False
  239. End If
  240. Dim Mes As Integer
  241. If (Index = 0) Then
  242. Mes = FechaFinal.Month
  243. Else
  244. FechaFinal = FechaFinal.AddDays(1)
  245. Mes = FechaFinal.Month
  246. End If
  247. Dim Salir As Boolean = False
  248. FechaAux = FechaFinal
  249. 'While (Mes = FechaFinal.Month) Or (FechaFinal.Month = FechaVen.Month)
  250. ' FechaFinal = Format(FechaFinal, "dd/MM/yyyy")
  251. ' FechaVen = Format(FechaVen, "dd/MM/yyyy")
  252. ' FechaFinal = FechaFinal.AddDays(1)
  253. ' If (FechaFinal > FechaVen) Then
  254. ' Salir = True
  255. ' Exit While
  256. ' End If
  257. 'End While
  258. While (Mes = FechaFinal.Month)
  259. FechaFinal = Format(FechaFinal, "dd/MM/yyyy")
  260. FechaVen = Format(FechaVen, "dd/MM/yyyy")
  261. FechaFinal = FechaFinal.AddDays(1)
  262. If (FechaFinal > FechaVen) Then
  263. Salir = True
  264. Exit While
  265. End If
  266. End While
  267. If (Corte) Then
  268. If (Index >= IndexCorte) Then
  269. While FechaFinal.Date < FechaCorte.Date
  270. FechaCorte = FechaCorte.AddDays(-1)
  271. End While
  272. FechaFinal = FechaCorte
  273. Salir = True
  274. End If
  275. End If
  276. If (Index = 0) Then
  277. FechaInicial = dtpFechaOperacion.Value
  278. FechaFinal = dtpFechaOperacion.Value
  279. FechaAux = dtpFechaOperacion.Value
  280. ElseIf (Index = 1) Then
  281. Dim MesAño, Dia As Integer
  282. FechaAux = dtpFechaOperacion.Value
  283. MesAño = FechaAux.Month
  284. Dia = FechaAux.Day
  285. If (MesAño = 12 And Dia = 31) Then
  286. FechaInicial = FechaAux.AddDays(1)
  287. End If
  288. FechaFinal = FechaFinal.AddDays(-1)
  289. Else
  290. FechaInicial = FechaAux
  291. FechaFinal = FechaFinal.AddDays(-1)
  292. End If
  293. Dim FechaProv As Date = Date.Now.Date
  294. Dim CambioFecha As Boolean = False
  295. If Not (dgvDetalles.Rows(Index).Cells("Fecha de corte").Value) Is DBNull.Value Then
  296. If Not String.IsNullOrEmpty(dgvDetalles.Rows(Index).Cells("Fecha de corte").Value) Then
  297. FechaProv = FechaFinal
  298. FechaFinal = dgvDetalles.Rows(Index).Cells("Fecha de corte").Value
  299. CambioFecha = True
  300. End If
  301. End If
  302. Dim PlazoDatos = Plazo(Index, FechaFinal)
  303. Dim IngresoCom = IngresoComision(Index, V_txtComisionDesembolso, V_txtMonto)
  304. Dim IngresoInt = IngresoInteres(Index, PlazoDatos, FechaInicial, FechaFinal, V_txtTasa, V_txtMonto)
  305. Dim CalculosIVA = CalculoIVA(Index, IngresoCom, IngresoInt)
  306. Dim CalculoAmort = CalculoAmortizacion(Salir, V_txtMonto)
  307. Dim MontoRecibir = MontoARecibir(IngresoCom, IngresoInt, CalculosIVA, CalculoAmort)
  308. Dim SaldoPendi = SaldoPendiente(Index, CalculoAmort, V_txtMonto)
  309. If CambioFecha Then
  310. FechaFinal = FechaProv
  311. CambioFecha = False
  312. End If
  313. If Modificar Then
  314. Dim Fila = dgvDetalles.CurrentRow.Index
  315. Dim SalAnterior As Double = 0
  316. Dim SumaAmortizado = 0
  317. Dim CantidadFilas As Integer = dgvDetalles.Rows.Count - 2
  318. Dim Filas As Integer = dgvDetalles.Rows.Count - 2
  319. If (Index >= Fila) Then
  320. If (SaldoPendi > V_txtMonto) Then
  321. dgvDetalles.Rows(Index).Cells("Amortizacion").Value = 0
  322. SaldoPendi = 0
  323. Else
  324. For j As Integer = 0 To CantidadFilas - 1
  325. SumaAmortizado += dgvDetalles.Rows(j).Cells("Amortizacion").Value
  326. Next
  327. SaldoPendi = SaldoPendiente(Index, SumaAmortizado, V_txtMonto)
  328. If (SumaAmortizado > V_txtMonto) Then
  329. Dim PagoPendienteAnterior = dgvDetalles.Rows(Index - 1).Cells("Saldo Pendiente").Value
  330. SaldoPendi = PagoPendienteAnterior
  331. dgvDetalles.Rows(Index).Cells("Amortizacion").Value = SaldoPendi
  332. End If
  333. If (Index = CantidadFilas) Then
  334. Dim PagoPendienteAnterior = dgvDetalles.Rows(Index - 1).Cells("Saldo Pendiente").Value
  335. SaldoPendi = PagoPendienteAnterior
  336. dgvDetalles.Rows(Index).Cells("Amortizacion").Value = SaldoPendi
  337. End If
  338. End If
  339. If (Salir) Then
  340. End If
  341. Dim FechaProv2 As Date = Date.Now.Date
  342. Dim CambioFecha2 As Boolean = False
  343. If Not (dgvDetalles.Rows(Index).Cells("Fecha de corte").Value) Is DBNull.Value Then
  344. If Not String.IsNullOrEmpty(dgvDetalles.Rows(Index).Cells("Fecha de corte").Value) Then
  345. FechaProv2 = FechaFinal
  346. FechaFinal = dgvDetalles.Rows(Index).Cells("Fecha de corte").Value
  347. CambioFecha2 = True
  348. End If
  349. End If
  350. PlazoDatos = Plazo(Index, FechaFinal)
  351. IngresoCom = IngresoComision(Index, V_txtComisionDesembolso, V_txtMonto)
  352. IngresoInt = IngresoInteres(Index, PlazoDatos, FechaInicial, FechaFinal, V_txtTasa, SaldoPendi)
  353. CalculosIVA = CalculoIVA(Index, IngresoCom, IngresoInt)
  354. MontoRecibir = MontoARecibir(IngresoCom, IngresoInt, CalculosIVA, CalculoAmort)
  355. If CambioFecha2 Then
  356. FechaFinal = FechaProv2
  357. CambioFecha2 = False
  358. End If
  359. dgvDetalles.Rows(Index).Cells("Plazo (Desembolso)").Value = PlazoDatos
  360. dgvDetalles.Rows(Index).Cells("Ingreso por Comision").Value = IngresoCom
  361. dgvDetalles.Rows(Index).Cells("Ingreso por Interes").Value = IngresoInt
  362. dgvDetalles.Rows(Index).Cells("Saldo Pendiente").Value = SaldoPendi
  363. dgvDetalles.Rows(Index).Cells("IVA").Value = CalculosIVA
  364. dgvDetalles.Rows(Index).Cells("Monto a Recibir").Value = MontoRecibir
  365. End If
  366. Else
  367. Dim FechaCorte As String = String.Empty
  368. For Each Valor In diccionario
  369. If Valor.Key = Index Then
  370. FechaCorte = Valor.Value
  371. End If
  372. Next
  373. If String.IsNullOrEmpty(FechaCorte) Then
  374. dgvDetalles.Rows.Add(Index + 1, PlazoDatos, "", FechaFinal, IngresoCom, IngresoInt, CalculosIVA, CalculoAmort, SaldoPendi, MontoRecibir)
  375. Else
  376. dgvDetalles.Rows.Add(Index + 1, PlazoDatos, FechaCorte, FechaFinal, IngresoCom, IngresoInt, CalculosIVA, CalculoAmort, SaldoPendi, MontoRecibir)
  377. PlazoDatos = Plazo(Index, FechaCorte)
  378. IngresoCom = IngresoComision(Index, V_txtComisionDesembolso, V_txtMonto)
  379. IngresoInt = IngresoInteres(Index, PlazoDatos, FechaInicial, FechaCorte, V_txtTasa, SaldoPendi)
  380. CalculosIVA = CalculoIVA(Index, IngresoCom, IngresoInt)
  381. MontoRecibir = MontoARecibir(IngresoCom, IngresoInt, CalculosIVA, CalculoAmort)
  382. dgvDetalles.Rows(Index).Cells("Plazo (Desembolso)").Value = PlazoDatos
  383. dgvDetalles.Rows(Index).Cells("Ingreso por Comision").Value = IngresoCom
  384. dgvDetalles.Rows(Index).Cells("Ingreso por Interes").Value = IngresoInt
  385. dgvDetalles.Rows(Index).Cells("Saldo Pendiente").Value = SaldoPendi
  386. dgvDetalles.Rows(Index).Cells("IVA").Value = CalculosIVA
  387. dgvDetalles.Rows(Index).Cells("Monto a Recibir").Value = MontoRecibir
  388. End If
  389. Contador += 1
  390. End If
  391. If (Salir) Then
  392. Exit While
  393. End If
  394. Index += 1
  395. Dim IndexFin = dgvDetalles.Rows.Count - 3
  396. If (Index = IndexFin) Then
  397. Salir = True
  398. End If
  399. End While
  400. End Sub
  401. Function SaldoPendiente(ByVal Index As Integer, ByVal Amortizado As Double, ByVal Monto As Double)
  402. Dim Saldo As Double = 0
  403. Dim FilaAnterior As Integer = Index - 1
  404. Dim SaldoAnterior As Double = 0
  405. Dim PagoPendienteAnterior As Double = 0
  406. Dim PagoPendiente As Double = 0
  407. Dim Amortizacion As Double = 0
  408. If (Index = 0) Then
  409. Saldo = Monto - Amortizado
  410. ElseIf (Index > 0) Then
  411. SaldoAnterior = Monto
  412. PagoPendienteAnterior = dgvDetalles.Rows(Index - 1).Cells("Saldo Pendiente").Value
  413. Amortizacion = dgvDetalles.Rows(Index - 1).Cells("Amortizacion").Value
  414. 'PagoPendiente = dgvDetalles.Rows(Index).Cells("Saldo Pendiente").Value
  415. If (SaldoAnterior = Amortizado) Then
  416. Saldo = 0
  417. ElseIf (SaldoAnterior = Amortizado) Then
  418. Saldo = PagoPendienteAnterior
  419. ElseIf (SaldoAnterior < Amortizado) Then
  420. Saldo = 0
  421. ElseIf (PagoPendienteAnterior = Amortizacion) Then
  422. Saldo = 0
  423. Else
  424. Saldo = SaldoAnterior - Amortizado
  425. End If
  426. End If
  427. If (PagoPendienteAnterior = Amortizacion And Not Amortizacion = 0) Then
  428. Saldo = 0
  429. End If
  430. Return Saldo
  431. End Function
  432. Function Plazo(ByVal Index As Integer, ByVal fecha2 As Date)
  433. Dim fecha1 As Date
  434. Dim fecha1Str As String
  435. Dim fecha2Str As String
  436. Dim Valor
  437. Dim Anterior = Index - 1
  438. If (Index = 0) Then
  439. Valor = 0
  440. ElseIf (Index > 0) Then
  441. fecha1 = dgvDetalles.Rows(Anterior).Cells("Fechas de Pago").Value
  442. fecha1 = Format(fecha1, "yyyy/MM/dd")
  443. fecha2 = Format(fecha2, "yyyy/MM/dd")
  444. Valor = Prestamo.FechaDias(fecha1, fecha2)
  445. Else
  446. Valor = 0
  447. End If
  448. Return Valor
  449. End Function
  450. Function IngresoComision(ByVal Index As Integer, ByVal V_txtComisionDesembolso As Double, ByVal V_txtMonto As Double)
  451. Dim Valor
  452. If (Index = 0) Then
  453. If (Not String.IsNullOrEmpty(V_txtComisionDesembolso) And Not String.IsNullOrEmpty(V_txtMonto)) Then
  454. Valor = V_txtComisionDesembolso * V_txtMonto
  455. Else
  456. Valor = 0
  457. End If
  458. Else
  459. Valor = 0
  460. End If
  461. Return Valor
  462. End Function
  463. Function IngresoInteres(ByVal Index As Integer, ByVal plazo As Integer, ByVal FechaInicial As Date, ByVal FechaFinal As Date, ByVal V_txtTasa As Double, ByVal V_txtMonto As Double)
  464. If (Index = 0) Then
  465. Return 0
  466. Else
  467. Dim CambioDeFecha As Integer = Operaciones.CambioBase(FechaInicial, FechaFinal)
  468. Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(FechaInicial)
  469. Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
  470. Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
  471. Dim Valor1 = 0.0, Valor2 = 0.0, Valor = 0.0
  472. If (Not CambioDeFecha = 0) Then
  473. If CambioDeFecha = 1 Then
  474. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  475. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  476. Valor1 = V_txtMonto * V_txtTasa * DiasPrimeraFecha / 366
  477. Valor2 = V_txtMonto * V_txtTasa * DiasSegundaFecha / 365
  478. ElseIf CambioDeFecha = 2 Then
  479. DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(FechaInicial, PrimeraFechaUltima, CambioDeFecha)
  480. DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
  481. Valor1 = V_txtMonto * V_txtTasa * DiasPrimeraFecha / 365
  482. Valor2 = V_txtMonto * V_txtTasa * DiasSegundaFecha / 366
  483. End If
  484. Valor = Valor1 + Valor2
  485. Else
  486. If (Operaciones.AñoBisiesto(FechaInicial) = 364) Then
  487. Valor = V_txtMonto * V_txtTasa * plazo / 365
  488. End If
  489. If (Operaciones.AñoBisiesto(FechaInicial) = 365) Then
  490. Valor = V_txtMonto * V_txtTasa * plazo / 366
  491. End If
  492. End If
  493. Return Valor
  494. End If
  495. End Function
  496. Function CalculoIVA(ByVal Index As Integer, ByVal IngresoCom As Double, ByVal IngresoInteres As Double)
  497. Dim Valor
  498. If Index = 0 Then
  499. If (Not String.IsNullOrEmpty(IngresoCom) And Not String.IsNullOrEmpty(IngresoInteres)) Then
  500. Valor = IngresoCom - (IngresoCom / (1.13))
  501. End If
  502. Else
  503. If (Not String.IsNullOrEmpty(IngresoCom) And Not String.IsNullOrEmpty(IngresoInteres)) Then
  504. Valor = (IngresoCom + IngresoInteres) * 0.13
  505. Else
  506. Valor = 0
  507. End If
  508. End If
  509. Return Valor
  510. End Function
  511. Sub BorrarAnterior(ByVal Index As Integer)
  512. Dim IndexAnterior As Integer = Index - 1
  513. Dim Cantidad As Integer = dgvDetalles.Rows().Count - 1
  514. If (Cantidad >= 0) Then
  515. dgvDetalles.Rows(Index).Cells("Amortizacion").Value = 0
  516. End If
  517. End Sub
  518. Function CalculoAmortizacion(ByVal Ultimo As Integer, ByVal V_txtMonto As Double)
  519. Dim Monto As Integer = 0
  520. If (Ultimo) Then
  521. Monto = V_txtMonto
  522. End If
  523. Return Monto
  524. End Function
  525. Function MontoARecibir(ByVal IngresoComision As Double, ByVal IngresoInteres As Double, ByVal CalculoIVA As Double, ByVal Amortizacion As Double)
  526. Dim Monto As Double = 0
  527. If Not String.IsNullOrEmpty(txtMonto.Text) Then
  528. Monto = txtMonto.Text
  529. End If
  530. Dim Valor As Double = 0.0
  531. Valor = IngresoComision + IngresoInteres + CalculoIVA + Amortizacion
  532. If Amortizacion > Monto Then
  533. Valor = 0
  534. End If
  535. Return Valor
  536. End Function
  537. Function SaldoFinal(ByVal Index As Integer, ByVal V_txtMonto As Double)
  538. Dim Valor As Double
  539. Dim Anterior As Integer = Index - 1
  540. If (Index = 0) Then
  541. Valor = V_txtMonto - dgvDetalles.Rows(Index).Cells("Amortizacion").Value
  542. ElseIf (Index > 0) Then
  543. Valor = dgvDetalles.Rows(Anterior).Cells("Saldo Final").Value - dgvDetalles.Rows(Index).Cells("Amortizacion").Value
  544. Else
  545. Valor = 0
  546. End If
  547. Return Valor
  548. End Function
  549. Function Coleccion()
  550. Dim colec As New Collection
  551. Dim fechaoper, fechaven, tasa, periodicidad, base, tipotasa, comisiondesembolso, plazodias, monto
  552. monto = txtMonto.Text
  553. fechaoper = dtpFechaOperacion.Value
  554. fechaven = dtpFechaVencimiento.Value
  555. tasa = CDec(txtTasa.Text.ToString.Trim("%")) / 100
  556. periodicidad = cboPeriodicidad.SelectedValue
  557. base = Me.Base
  558. tipotasa = cboTipoTasa.SelectedValue
  559. comisiondesembolso = txtComisionDesembolso.Text.ToString.Trim("%") / 100
  560. plazodias = txtPlazoDias.Text
  561. colec.Add(monto)
  562. colec.Add(fechaoper)
  563. colec.Add(fechaven)
  564. colec.Add(tasa)
  565. colec.Add(periodicidad)
  566. colec.Add(base)
  567. colec.Add(tipotasa)
  568. colec.Add(comisiondesembolso)
  569. colec.Add(plazodias)
  570. Return colec
  571. End Function
  572. Sub RellenarDatos()
  573. If (String.IsNullOrEmpty(txtMonto.Text.ToString)) Then
  574. txtMonto.Text = "0.0"
  575. End If
  576. If (String.IsNullOrEmpty(txtTasa.Text.TrimEnd("%").ToString)) Then
  577. txtTasa.Text = "0.0%"
  578. End If
  579. If (cboTipoTasa.SelectedIndex = -1) Then
  580. cboTipoTasa.SelectedIndex = 0
  581. End If
  582. If (cboBase.SelectedIndex = -1) Then
  583. cboBase.SelectedIndex = 0
  584. End If
  585. If (cboPeriodicidad.SelectedIndex = -1) Then
  586. cboPeriodicidad.SelectedIndex = 0
  587. End If
  588. If (String.IsNullOrEmpty(txtComisionDesembolso.Text.Trim("%").ToString)) Then
  589. txtComisionDesembolso.Text = "0.0%"
  590. End If
  591. If (String.IsNullOrEmpty(txtPlazoDias.Text.ToString)) Then
  592. txtPlazoDias.Text = "0.0"
  593. End If
  594. End Sub
  595. Function ColeccionDetalle(ByVal Index As Integer)
  596. Dim Coleccion As New Collection
  597. Dim plazo, fecha, fechacorte, ingresocomision, ingresointeres, IVA, amortizacion, montorecibir, saldopendiente, correlativo
  598. correlativo = dgvDetalles.Rows(Index).Cells("Correlativo").Value
  599. plazo = dgvDetalles.Rows(Index).Cells("Plazo (Desembolso)").Value
  600. fecha = dgvDetalles.Rows(Index).Cells("Fechas de Pago").Value
  601. ingresocomision = dgvDetalles.Rows(Index).Cells("Ingreso por Comision").Value
  602. ingresointeres = dgvDetalles.Rows(Index).Cells("Ingreso por Interes").Value
  603. IVA = dgvDetalles.Rows(Index).Cells("IVA").Value
  604. amortizacion = dgvDetalles.Rows(Index).Cells("Amortizacion").Value
  605. saldopendiente = dgvDetalles.Rows(Index).Cells("Saldo Pendiente").Value
  606. montorecibir = dgvDetalles.Rows(Index).Cells("Monto a Recibir").Value
  607. fechacorte = dgvDetalles.Rows(Index).Cells("Fecha de corte").Value
  608. Coleccion.Add(correlativo)
  609. Coleccion.Add(plazo)
  610. Coleccion.Add(fecha)
  611. Coleccion.Add(ingresocomision)
  612. Coleccion.Add(ingresointeres)
  613. Coleccion.Add(IVA)
  614. Coleccion.Add(amortizacion)
  615. Coleccion.Add(saldopendiente)
  616. Coleccion.Add(montorecibir)
  617. Coleccion.Add(fechacorte)
  618. Return Coleccion
  619. End Function
  620. Sub Nuevo(ByVal codigo As String)
  621. PrestamoConsulta.NuevoDato(Coleccion, codigo)
  622. End Sub
  623. Sub ProcesoDatos(ByVal Colec As Collection, ByVal codigo As String, ByVal Diccionario As Dictionary(Of Integer, String), ByVal Diccionario2 As Dictionary(Of String, Collection), ByVal Estado As String)
  624. PrestamoConsulta.ProcesoDatos(Colec, codigo, Diccionario2, Estado)
  625. End Sub
  626. Sub Modificar(ByVal codigo As String)
  627. PrestamoConsulta.ModificarDato(Coleccion, codigo)
  628. End Sub
  629. Sub NuevoDetalle(ByVal AgregarModificar As Boolean, ByVal Cantidad As Integer)
  630. Dim i As Integer = 0
  631. Dim Index = dgvDetalles.Rows.Count - 2
  632. i = Cantidad
  633. While i <= Index
  634. Dim coleccion = ColeccionDetalle(i)
  635. If PrestamoConsulta.NuevoDetalle(coleccion, Codigo) Is Nothing Then
  636. Exit Sub
  637. End If
  638. i += 1
  639. End While
  640. MsgBox("Registro de ingresos actualizados")
  641. End Sub
  642. Function ColeccionCampos()
  643. Dim i As Integer = 0
  644. Dim diccionario As New Dictionary(Of String, Collection)
  645. Dim Index = dgvDetalles.Rows.Count - 2
  646. While i <= Index
  647. Dim coleccion = ColeccionDetalle(i)
  648. diccionario.Add(i, coleccion)
  649. i += 1
  650. End While
  651. Return diccionario
  652. End Function
  653. Sub EliminarDetalles(ByVal CantidadRegistros As Integer, ByVal Cantidad As Integer)
  654. Dim i As Integer = 0
  655. Dim Index = CantidadRegistros + 1
  656. i = Cantidad
  657. While i >= Index
  658. If PrestamoConsulta.EliminarDetalles(Index, Codigo) Is Nothing Then
  659. Exit Sub
  660. End If
  661. Index += 1
  662. End While
  663. End Sub
  664. Sub ModificarDetalle(ByVal codigo As String)
  665. Dim i As Integer = 0
  666. Dim CantidadRegistrosDB = CanRegistros()
  667. Dim CantidadRegistros As Integer = dgvDetalles.Rows.Count - 1
  668. While i < CantidadRegistrosDB
  669. If i < CantidadRegistros Then
  670. Dim coleccion = ColeccionDetalle(i)
  671. If PrestamoConsulta.ModificarDetalle(coleccion, codigo) Is Nothing Then
  672. Exit Sub
  673. End If
  674. End If
  675. i += 1
  676. End While
  677. NuevoDetalle(True, CantidadRegistrosDB)
  678. CantidadRegistrosDB = CanRegistros()
  679. EliminarDetalles(CantidadRegistros, CantidadRegistrosDB)
  680. End Sub
  681. Function ColeccionModificar(ByVal codigo As String)
  682. Dim i As Integer = 0
  683. Dim CantidadRegistrosDB = CanRegistros()
  684. Dim CantidadRegistros As Integer = dgvDetalles.Rows.Count - 1
  685. Dim diccionario As New Dictionary(Of String, Collection)
  686. While i < CantidadRegistrosDB
  687. If i < CantidadRegistros Then
  688. Dim coleccion = ColeccionDetalle(i)
  689. diccionario.Add(i, coleccion)
  690. End If
  691. i += 1
  692. End While
  693. Return diccionario
  694. End Function
  695. Function ColeccionNuevo(ByVal codigo As String)
  696. Dim i As Integer = 0
  697. Dim diccionario As New Dictionary(Of String, Collection)
  698. Dim Index = dgvDetalles.Rows.Count - 2
  699. While i <= Index
  700. Dim coleccion = ColeccionDetalle(i)
  701. diccionario.Add(i, coleccion)
  702. i += 1
  703. End While
  704. Return diccionario
  705. End Function
  706. Function ColeccionEliminar(ByVal codigo As String)
  707. Dim CantidadRegistros As Integer = dgvDetalles.Rows.Count - 1
  708. Dim Cantidad As Integer = CanRegistros()
  709. Dim i As Integer = 0
  710. Dim diccionario As New Dictionary(Of Integer, String)
  711. Dim Index = CantidadRegistros + 1
  712. i = Cantidad
  713. While i >= Index
  714. diccionario.Add(Index, codigo)
  715. Index += 1
  716. End While
  717. Return diccionario
  718. End Function
  719. Sub EliminarDatos(ByVal codigo As String)
  720. PrestamoConsulta.Eliminar(codigo)
  721. End Sub
  722. Private Sub dgvDetalles_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDetalles.CellContentClick
  723. End Sub
  724. Private Sub dgvDetalles_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvDetalles.CellEndEdit
  725. ' CargarFecha()
  726. Calculos(True, False)
  727. End Sub
  728. Private Sub cboBase_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboBase.SelectedIndexChanged
  729. Formato()
  730. If (cboBase.SelectedIndex = 0) Then
  731. Base = 360
  732. Else
  733. Base = 365
  734. End If
  735. End Sub
  736. Sub CargarDato()
  737. Dim codigo As String = Variables.Codigo
  738. Dim Retorno = PrestamoConsulta.CargarDato(codigo)
  739. Dim coleccion As New Collection
  740. If (TypeOf Retorno Is Boolean) Then
  741. Exit Sub
  742. Else
  743. coleccion = PrestamoConsulta.CargarDato(codigo)
  744. End If
  745. Dim Index As Integer = 0
  746. If (coleccion(6).ToString = "360") Then
  747. Index = 0
  748. Else
  749. Index = 1
  750. End If
  751. txtMonto.Text = coleccion(1)
  752. dtpFechaOperacion.Value = coleccion(2)
  753. dtpFechaVencimiento.Value = coleccion(3)
  754. txtTasa.Text = (CDec(coleccion(4).ToString.Trim("%")) * 100).ToString + "%"
  755. cboPeriodicidad.SelectedValue = coleccion(5)
  756. cboBase.SelectedIndex = Index
  757. cboTipoTasa.SelectedValue = coleccion(7)
  758. txtComisionDesembolso.Text = (CDec(coleccion(8).Trim("%")) * 100).ToString + "%"
  759. txtPlazoDias.Text = coleccion(9)
  760. End Sub
  761. Function CargarDetalles()
  762. Dim codigo As String = Variables.Codigo
  763. Dim dr = PrestamoConsulta.CargarDetalles(codigo)
  764. Dim Datos As Boolean = False
  765. If (Not dr Is Nothing) Then
  766. Dim Iterador As Integer = 0
  767. Dim ConvertirString As String
  768. While dr.Read
  769. ConvertirString = Format(dr("fechapago"), "dd/MM/yyyy")
  770. dgvDetalles.Rows.Add(dr("correlativo"), dr("plazo"), dr("fechacorte"), ConvertirString, dr("ingresarcomision"), dr("ingresarinteres"), dr("IVA"), dr("amortizacion"), dr("saldopendiente"), dr("montorecibir"))
  771. End While
  772. Datos = True
  773. End If
  774. Return Datos
  775. End Function
  776. Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click
  777. Dim codigo As String = Variables.Codigo
  778. Dim Colec As Collection = Coleccion()
  779. Dim Diccionario As Dictionary(Of Integer, String) = ColeccionEliminar(codigo)
  780. Dim Diccionario2 As Dictionary(Of String, Collection) = ColeccionNuevo(codigo)
  781. If (Estado = "N") Then
  782. PrestamoConsulta.ProcesoDatos(Colec, codigo, Diccionario2, "Nuevo")
  783. 'Nuevo(codigo)
  784. 'ModificarDetalle(codigo)
  785. ElseIf Not ExisteValidacion() Then
  786. Variables.ColeccionPEMP = Coleccion()
  787. Variables.ColeccionPEMPDi = ColeccionCampos()
  788. Me.Close()
  789. End If
  790. If (Estado = "M") Then
  791. PrestamoConsulta.ProcesoDatos(Colec, codigo, Diccionario2, "Modificar")
  792. End If
  793. If (Estado = "B") Then
  794. EliminarDatos(codigo)
  795. End If
  796. ValidarExistencia()
  797. End Sub
  798. Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
  799. Estado = "M"
  800. btnAccion.Text = "Modificar"
  801. ' btnagregar.Text = "Modificar"
  802. End Sub
  803. Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
  804. Estado = "N"
  805. btnAccion.Text = "Agregar"
  806. ' btnagregar.Text = "Agregar"
  807. End Sub
  808. Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
  809. Estado = "B"
  810. btnAccion.Text = "Eliminar"
  811. ' btnagregar.Text = "Eliminar"
  812. End Sub
  813. Private Sub btnagregar_Click(sender As Object, e As EventArgs)
  814. 'Dim codigo As String = Variables.Codigo
  815. 'If (Estado = "N") Then
  816. ' NuevoDetalle(codigo)
  817. 'End If
  818. 'If (Estado = "M") Then
  819. ' ModificarDetalle(codigo)
  820. 'End If
  821. 'If (Estado = "B") Then
  822. ' EliminarDetalle(codigo)
  823. 'End If
  824. End Sub
  825. Private Sub txtMonto_TextChanged(sender As Object, e As EventArgs) Handles txtMonto.TextChanged
  826. If (FinCarga) Then
  827. Calculos(False, False)
  828. End If
  829. End Sub
  830. Private Sub txtTasa_TextChanged(sender As Object, e As EventArgs) Handles txtTasa.TextChanged
  831. If (FinCarga) Then
  832. Calculos(False, False)
  833. End If
  834. End Sub
  835. Private Sub txtComisionDesembolso_TextChanged(sender As Object, e As EventArgs) Handles txtComisionDesembolso.TextChanged
  836. If (FinCarga) Then
  837. Calculos(False, False)
  838. End If
  839. End Sub
  840. Private Sub txtMonto_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMonto.KeyPress
  841. If String.IsNullOrEmpty(txtMonto.Text) Then
  842. If e.KeyChar = "." Then
  843. txtMonto.Text = "0"
  844. Exit Sub
  845. End If
  846. End If
  847. If (Not txtMonto.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  848. Operaciones.ValidarEntrada(sender, e, True)
  849. Else
  850. Operaciones.ValidarEntrada(sender, e, False)
  851. End If
  852. End Sub
  853. Private Sub txtTasa_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtTasa.KeyPress
  854. If String.IsNullOrEmpty(txtTasa.Text) Then
  855. If e.KeyChar = "." Then
  856. txtTasa.Text = "0"
  857. Exit Sub
  858. End If
  859. End If
  860. If (Not txtTasa.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  861. Operaciones.ValidarEntrada(sender, e, True)
  862. Else
  863. Operaciones.ValidarEntrada(sender, e, False)
  864. End If
  865. End Sub
  866. Private Sub txtComisionDesembolso_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtComisionDesembolso.KeyPress
  867. If String.IsNullOrEmpty(txtComisionDesembolso.Text) Then
  868. If e.KeyChar = "." Then
  869. txtComisionDesembolso.Text = "0"
  870. Exit Sub
  871. End If
  872. End If
  873. If (Not txtComisionDesembolso.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
  874. Operaciones.ValidarEntrada(sender, e, True)
  875. Else
  876. Operaciones.ValidarEntrada(sender, e, False)
  877. End If
  878. End Sub
  879. Private Sub btnCancelar_Click(sender As Object, e As EventArgs)
  880. Cancelar()
  881. End Sub
  882. Sub Cancelar()
  883. End Sub
  884. Private Sub txtMonto_Leave(sender As Object, e As EventArgs) Handles txtMonto.Leave
  885. Formato()
  886. End Sub
  887. Private Sub txtTasa_Leave(sender As Object, e As EventArgs) Handles txtTasa.Leave
  888. Formato()
  889. End Sub
  890. Private Sub cboTipoTasa_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboTipoTasa.SelectedIndexChanged
  891. Formato()
  892. End Sub
  893. Private Sub cboPeriodicidad_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboPeriodicidad.SelectedIndexChanged
  894. Formato()
  895. End Sub
  896. Private Sub txtComisionDesembolso_Leave(sender As Object, e As EventArgs) Handles txtComisionDesembolso.Leave
  897. Formato()
  898. End Sub
  899. Private Sub txtPlazoDias_Leave(sender As Object, e As EventArgs) Handles txtPlazoDias.Leave
  900. Formato()
  901. End Sub
  902. Private Sub txtMonto_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMonto.KeyUp
  903. If txtMonto.Text = "." Then
  904. txtMonto.Text = ".0"
  905. End If
  906. End Sub
  907. Private Sub txtTasa_KeyUp(sender As Object, e As KeyEventArgs) Handles txtTasa.KeyUp
  908. If txtTasa.Text = "." Then
  909. txtTasa.Text = ".0"
  910. End If
  911. End Sub
  912. Private Sub txtComisionDesembolso_KeyUp(sender As Object, e As KeyEventArgs) Handles txtComisionDesembolso.KeyUp
  913. If txtComisionDesembolso.Text = "." Then
  914. txtComisionDesembolso.Text = ".0"
  915. End If
  916. End Sub
  917. Sub CargarTransladoNuevo()
  918. Dim Existe As Boolean = ExisteInversion()
  919. If Not RetCodigoInversionExiste And Not Existe Then
  920. txtMonto.Text = Variables.RetMonto
  921. txtTasa.Text = Variables.RetRendimiento
  922. End If
  923. End Sub
  924. End Class