| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519 |
- Imports System.Reflection
- Public Class frmPrestamoPersonal
- Dim Prestamo As New PrestamoPersonalCE
- Dim PrestamoConsulta As New PrestamoPersonalDAO
- Dim EstadoAccion As String = "Nada"
- Dim IndexIterable As Boolean = True
- Dim Operaciones As New Operaciones
- Dim FinCarga As Boolean = False
- Dim FechaCorte As Date
- Dim IndexCorte As Integer = 0
- Private Sub frmPrestamoPersonal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- dgvAmortizacion.Columns.Clear()
- AgregarCampos()
- CargarColecciones()
- CargarAmortizacion()
- FinCarga = True
- Formato()
- Calculos(False)
- ' Calculos()
- ExisteInversion()
- ValidarExistencia()
- CargarTransladoNuevo()
- End Sub
- Function ExisteInversion()
- Dim Codigo As String = Variables.Codigo
- Dim TablaINV As String = "INV0"
- Dim TablaPINV As String = "PIN0"
- Dim General As New DAOGeneral
- Dim InvPro = Variables.InvPro
- If InvPro = "I" Then
- Dim INV0 As Boolean = General.ExisteTitulo(Codigo, TablaINV)
- If INV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- If InvPro = "P" Then
- Dim PINV0 As Boolean = General.ExisteTitulo(Codigo, TablaPINV)
- If PINV0 Then
- navNuevo.Visible = True
- Return True
- Else
- navNuevo.Visible = False
- Return False
- End If
- End If
- Return False
- End Function
- Private Sub LLenarCuotaSinSeguro()
- Dim MontoPrestamo As Double = 0
- Dim CuotasMensuales As Integer = 0
- Dim TasaInteres As Double = 0
- If Not String.IsNullOrEmpty(txtMontoPrestamo.Text) Then
- MontoPrestamo = txtMontoPrestamo.Text
- End If
- If Not String.IsNullOrEmpty(txtCuotasMensuales.Text) Then
- CuotasMensuales = txtCuotasMensuales.Text
- End If
- If Not String.IsNullOrEmpty(txtTasaInteres.Text.Trim("%")) Then
- TasaInteres = txtTasaInteres.Text.Trim("%")
- End If
- If (Not MontoPrestamo = 0 And Not CuotasMensuales = 0 And Not TasaInteres = 0) Then
- txtCuotaSinSeguro.Text = Prestamo.TIR(MontoPrestamo, CuotasMensuales, TasaInteres / 100)
- End If
- If Not String.IsNullOrEmpty(txtCuotaSinSeguro.Text) Then
- If Double.IsInfinity(txtCuotaSinSeguro.Text) Then
- txtCuotaSinSeguro.Text = 0
- End If
- End If
- End Sub
- Private Sub txtTasaInteres_KeyUp(sender As Object, e As KeyEventArgs) Handles txtTasaInteres.KeyUp
- If txtTasaInteres.Text = "." Then
- txtTasaInteres.Text = ".0"
- End If
- LLenarCuotaSinSeguro()
- End Sub
- Private Sub txtMontoPrestamo_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMontoPrestamo.KeyUp
- If txtMontoPrestamo.Text = "." Then
- txtMontoPrestamo.Text = ".0"
- End If
- LLenarCuotaSinSeguro()
- End Sub
- Private Sub txtCuotasMensuales_KeyUp(sender As Object, e As KeyEventArgs) Handles txtCuotasMensuales.KeyUp
- If txtCuotasMensuales.Text = "." Then
- txtCuotasMensuales.Text = ".0"
- End If
- LLenarCuotaSinSeguro()
- End Sub
- Private Sub txtSeguro_KeyUp(sender As Object, e As KeyEventArgs) Handles txtSeguro.KeyUp
- If txtSeguro.Text = "." Then
- txtSeguro.Text = ".0"
- End If
- Dim CuotaSinSeguro As Double = 0
- Dim Seguro As Double = 0
- If Not String.IsNullOrEmpty(txtCuotaSinSeguro.Text) Then
- CuotaSinSeguro = txtCuotaSinSeguro.Text
- End If
- If Not String.IsNullOrEmpty(txtSeguro.Text) Then
- Seguro = txtSeguro.Text
- End If
- txtCuotaReal.Text = Prestamo.SumarCuota(CuotaSinSeguro, Seguro)
- End Sub
- Sub AgregarCampos()
- Dim Numero, Periodo, Fecha, FechaCorte, SaldoInicial, PagoCuota, PagoInteresIVA, IVA, PagoInteres, Abono, PrestamoRem, PagoSeguroDaños, PagoSeguroVivienda, TotalCuota, TotalPagado, AbonoExtra As New DataGridViewTextBoxColumn
- Numero.Name = "No. Cuota"
- Fecha.Name = "Fecha"
- FechaCorte.Name = "Fecha de Corte"
- Periodo.Name = "Periodo"
- SaldoInicial.Name = "Saldo Inicial"
- PagoCuota.Name = "Pago Cuota Mensual"
- PagoInteresIVA.Name = "Pago Interes(IVA)"
- IVA.Name = "IVA de Intereses"
- PagoInteres.Name = "Pago de Intereses"
- Abono.Name = "Abono a Capital"
- PrestamoRem.Name = "Prestamo Remanente"
- PagoSeguroDaños.Name = "Pago de Seguro de Daños"
- PagoSeguroVivienda.Name = "Pago de Seguro de Vivienda"
- TotalCuota.Name = "Total Cuota Mensual"
- TotalPagado.Name = "Total Pagado"
- AbonoExtra.Name = "Abono Extra a Capital"
- dgvAmortizacion.Columns.Add(Numero)
- dgvAmortizacion.Columns.Add(FechaCorte)
- dgvAmortizacion.Columns.Add(Fecha)
- dgvAmortizacion.Columns.Add(Periodo)
- dgvAmortizacion.Columns.Add(SaldoInicial)
- dgvAmortizacion.Columns.Add(PagoCuota)
- dgvAmortizacion.Columns.Add(PagoInteresIVA)
- dgvAmortizacion.Columns.Add(IVA)
- dgvAmortizacion.Columns.Add(PagoInteres)
- dgvAmortizacion.Columns.Add(Abono)
- dgvAmortizacion.Columns.Add(PrestamoRem)
- dgvAmortizacion.Columns.Add(PagoSeguroDaños)
- dgvAmortizacion.Columns.Add(PagoSeguroVivienda)
- dgvAmortizacion.Columns.Add(TotalCuota)
- dgvAmortizacion.Columns.Add(TotalPagado)
- dgvAmortizacion.Columns.Add(AbonoExtra)
- End Sub
- Sub CargarDatos()
- Dim Index As Integer = dgvAmortizacion.CurrentRow.Index
- Dim Anterior As Integer = Index - 1
- Dim Cantidad As Integer = dgvAmortizacion.Rows.Count
- Dim Fecha = Date.Today.Date
- Dim strFecha = Format(Fecha, "dd/MM/yyyy")
- If (String.IsNullOrEmpty(dgvAmortizacion.Rows(Index).Cells("Fecha").Value)) Then
- dgvAmortizacion.Rows(Index).Cells("Fecha").Value = strFecha
- End If
- End Sub
- Sub Formato()
- If (String.IsNullOrEmpty(txtCuotasMensuales.Text.ToString)) Then
- txtCuotasMensuales.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtTasaInteres.Text.ToString)) Then
- txtTasaInteres.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtAñoPrestamo.Text.ToString)) Then
- txtAñoPrestamo.Text = 0
- End If
- If (String.IsNullOrEmpty(txtCuotasMensuales.Text.ToString)) Then
- txtCuotasMensuales.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtMontoPrestamo.Text.ToString)) Then
- txtMontoPrestamo.Text = "0.0"
- End If
- If (String.IsNullOrEmpty(txtPeriodo.Text.ToString)) Then
- txtPeriodo.Text = 0
- End If
- If (String.IsNullOrEmpty(txtCuotaSinSeguro.Text.ToString)) Then
- txtCuotaSinSeguro.Text = Format(txtCuotaSinSeguro.Text, "0.0")
- If Double.IsInfinity(txtCuotaSinSeguro.Text) Then
- txtCuotaSinSeguro.Text = Format(txtCuotaSinSeguro.Text, "0.0")
- End If
- End If
- If (String.IsNullOrEmpty(txtSeguro.Text.ToString) Or txtSeguro.Text.ToString = "0") Then
- txtSeguro.Text = Format(txtSeguro.Text, "0.0")
- End If
- If (String.IsNullOrEmpty(txtCuotaReal.Text.ToString) Or txtCuotaReal.Text.ToString = "0") Then
- txtCuotaReal.Text = "0.0"
- End If
- If (txtTasaInteres.Text.ToString.IndexOf("%") = -1) Then
- txtTasaInteres.Text = txtTasaInteres.Text.ToString + "%"
- End If
- End Sub
- Sub Calculos(ByVal Corte As Boolean)
- If (FinCarga) Then
- Dim FechaInicial = dtpFechaOtorgamiento.Value
- Dim FechaFinal = dtpFechaOtorgamiento.Value
- Dim FechaVencimiento = dtpFechaOtorgamiento.Value
- Dim FechaVen = dtpFechaPago.Value
- Dim FechaAux = dtpFechaOtorgamiento.Value
- Dim Index = 0
- Dim Contador As Integer = 1
- Dim BaseContador As Integer = 0
- If Not String.IsNullOrEmpty(txtCuotasMensuales.Text) Then
- BaseContador = txtCuotasMensuales.Text
- End If
- Dim V_txtTasaInteres As Double = 0.0
- If (String.IsNullOrEmpty(txtTasaInteres.Text.Trim("%"))) Then
- V_txtTasaInteres = 0
- Else
- V_txtTasaInteres = txtTasaInteres.Text.TrimEnd("%") / 100
- End If
- LLenarCuotaSinSeguro()
- Dim Cantidad As Integer = dgvAmortizacion.Rows.Count
- Dim TipoCalculo As Integer = 0
- If (FechaInicial.Day = 31) Then
- TipoCalculo = 1
- ElseIf (FechaInicial.Day = 30) Then
- TipoCalculo = 2
- ElseIf (FechaInicial.Day = 29) Then
- TipoCalculo = 3
- Else
- TipoCalculo = 4
- End If
- Dim Salir As Boolean = False
- Dim TotalCuotas As Double = 0
- If Not String.IsNullOrEmpty(txtCuotasMensuales.Text) Then
- TotalCuotas = txtCuotasMensuales.Text
- End If
- Dim FechaAnterior As Date = FechaInicial
- Dim FechaPrimera = FechaInicial, FechaUltima = FechaInicial
- Dim AumentarDia As Boolean = False
- Dim DisminuirDia30 As Integer = True
- While (True)
- Dim Eliminar As Integer = dgvAmortizacion.Rows.Count - 2
- Dim CuotasMensuales As Integer = 0
- If Not String.IsNullOrEmpty(txtCuotasMensuales.Text) Then
- CuotasMensuales = txtCuotasMensuales.Text
- End If
- If Eliminar > CuotasMensuales Then
- While True
- If Eliminar >= CuotasMensuales Then
- dgvAmortizacion.Rows.Remove(dgvAmortizacion.Rows(Eliminar))
- Eliminar -= 1
- Else
- Exit While
- End If
- End While
- End If
- Dim ContadorMes As Integer = 0
- Dim Dia As Integer = 0
- Dia = FechaInicial.Day
- FechaPrimera = FechaInicial
- If (TipoCalculo = 1) Then
- FechaAnterior = FechaInicial
- If (Operaciones.AñoBisiesto(FechaAnterior) = 365) Then
- If FechaInicial.Month = 1 Then
- FechaUltima = FechaInicial.AddDays(29)
- FechaInicial = FechaInicial.AddDays(29)
- ElseIf (FechaInicial.Month = 12 Or FechaInicial.Month = 2 Or FechaInicial.Month = 4 Or FechaInicial.Month = 6 Or FechaInicial.Month = 7 Or FechaInicial.Month = 9 Or FechaInicial.Month = 11) Then
- FechaUltima = FechaInicial.AddDays(31)
- FechaInicial = FechaInicial.AddDays(31)
- Else
- FechaUltima = FechaInicial.AddDays(30)
- FechaInicial = FechaInicial.AddDays(30)
- End If
- Else
- If FechaInicial.Month = 1 Then
- FechaUltima = FechaInicial.AddDays(28)
- FechaInicial = FechaInicial.AddDays(28)
- ElseIf (FechaInicial.Month = 12 Or FechaInicial.Month = 2 Or FechaInicial.Month = 4 Or FechaInicial.Month = 6 Or FechaInicial.Month = 7 Or FechaInicial.Month = 9 Or FechaInicial.Month = 11) Then
- FechaUltima = FechaInicial.AddDays(31)
- FechaInicial = FechaInicial.AddDays(31)
- Else
- FechaUltima = FechaInicial.AddDays(30)
- FechaInicial = FechaInicial.AddDays(30)
- End If
- End If
- End If
- If (TipoCalculo = 3 Or TipoCalculo = 2) Then
- 'Fecha Anterior toma el valor de la primera fecha y fecha ultima, como la ultima
- If (FechaInicial.Month = 2) Then
- FechaAnterior = FechaInicial
- If (Operaciones.AñoBisiesto(FechaAnterior) = 365) Then
- If (TipoCalculo = 2) Then
- If FechaInicial.Month = 1 Then
- FechaUltima = FechaInicial.AddDays(29)
- FechaInicial = FechaInicial.AddDays(29)
- Else
- FechaUltima = FechaInicial.AddMonths(1)
- FechaInicial = FechaInicial.AddMonths(1)
- End If
- If (TipoCalculo = 2) Then
- DisminuirDia30 = 1
- End If
- Else
- If FechaInicial.Month = 1 Then
- FechaUltima = FechaInicial.AddDays(29)
- FechaInicial = FechaInicial.AddDays(29)
- Else
- FechaUltima = FechaInicial.AddMonths(1)
- FechaInicial = FechaInicial.AddMonths(1)
- End If
- If (TipoCalculo = 1) Then
- DisminuirDia30 = 1
- End If
- End If
- Else
- If (TipoCalculo = 2) Then
- If FechaInicial.Month = 1 Then
- FechaUltima = FechaInicial.AddDays(29)
- FechaInicial = FechaInicial.AddDays(29)
- Else
- FechaUltima = FechaInicial.AddMonths(1)
- FechaInicial = FechaInicial.AddMonths(1)
- End If
- If (TipoCalculo = 2) Then
- DisminuirDia30 = 1
- AumentarDia = True
- End If
- Else
- FechaUltima = FechaInicial.AddDays(29)
- FechaInicial = FechaInicial.AddDays(29)
- If (TipoCalculo = 1) Then
- DisminuirDia30 = 2
- ElseIf (TipoCalculo = 2) Then
- AumentarDia = True
- End If
- End If
- End If
- Else
- If (AumentarDia) Then
- FechaInicial = FechaInicial.AddDays(1)
- FechaPrimera = FechaInicial
- AumentarDia = False
- End If
- If (DisminuirDia30 = 1) Then
- FechaInicial = FechaInicial.AddDays(1)
- FechaPrimera = FechaInicial
- DisminuirDia30 = False
- ElseIf (DisminuirDia30 = 2) Then
- FechaInicial = FechaInicial.AddDays(2)
- FechaPrimera = FechaInicial
- DisminuirDia30 = False
- End If
- FechaAnterior = FechaInicial
- FechaUltima = FechaInicial.AddMonths(1)
- FechaInicial = FechaInicial.AddMonths(1)
- End If
- End If
- If (TipoCalculo = 4) Then
- FechaAnterior = FechaInicial
- FechaUltima = FechaInicial.AddMonths(1)
- FechaInicial = FechaInicial.AddMonths(1)
- End If
- If (Corte) Then
- If (Index >= IndexCorte) Then
- While Not FechaUltima.Date <= FechaCorte.Date
- FechaUltima = FechaUltima.AddDays(-1)
- End While
- Salir = True
- End If
- Else
- If (Contador >= TotalCuotas) Then
- Salir = True
- End If
- End If
- Dim PeriodoDias As Integer = 0
- Dim PagoDeCuotaMensual As Double = 0
- Dim PagoIni As Double = 0
- Dim PagoIVA As Double = 0
- Dim PagoInt As Double = 0
- Dim IVAInteres As Double = 0
- Dim SegDaños As Double = 0
- Dim SegVivienda As Double = 0
- Dim TotalPagado As Double = 0
- Dim AbonoDinero As Double = 0
- Dim PrestRemanente As Double = 0
- Dim Agregar As Integer = dgvAmortizacion.Rows.Count - 2
- Dim FechaProv As Date = Date.Now.Date
- Dim CambioFecha As Boolean = False
- If Agregar >= Index Then
- If Not (dgvAmortizacion.Rows(Index).Cells("Fecha de Corte").Value) Is DBNull.Value Then
- If Not String.IsNullOrEmpty(dgvAmortizacion.Rows(Index).Cells("Fecha de Corte").Value) Then
- FechaProv = FechaUltima
- FechaUltima = dgvAmortizacion.Rows(Index).Cells("Fecha de Corte").Value
- CambioFecha = True
- End If
- End If
- End If
- If Index = 0 Then
- If CkbPrueba.Checked Then
- FechaAnterior = dtpFechaPago.Value
- Dim FechaResp As Date = FechaAnterior
- Dim Meses As Integer = FechaResp.Month
- While Meses = FechaResp.Month
- FechaResp = FechaResp.AddDays(1)
- End While
- FechaUltima = FechaResp.AddDays(-1)
- End If
- End If
- PeriodoDias = Periodo(Index, FechaAnterior, FechaUltima)
- If Double.IsInfinity(PeriodoDias) Then
- PeriodoDias = 0
- End If
- PagoDeCuotaMensual = PagoCuotaMensual(Index, PeriodoDias, V_txtTasaInteres)
- If Double.IsInfinity(PagoDeCuotaMensual) Or Double.IsNaN(PagoDeCuotaMensual) Then
- PagoDeCuotaMensual = 0
- End If
- PagoIni = PagoInicial(Index)
- If Double.IsInfinity(PagoIni) Then
- PagoIni = 0
- End If
- PagoIVA = PagoInteresIVA(Index, PagoIni, PeriodoDias, FechaAnterior, FechaUltima, Contador, V_txtTasaInteres)
- If Double.IsInfinity(PagoIVA) Then
- PagoIVA = 0
- End If
- PagoInt = PagoIntereses(Index, PagoIVA)
- If Double.IsInfinity(PagoInt) Then
- PagoInt = 0
- End If
- IVAInteres = IVAIntereses(Index, PagoIVA, PagoInt)
- If Double.IsInfinity(IVAInteres) Then
- IVAInteres = 0
- End If
- SegDaños = SeguroDaños(Index)
- If Double.IsInfinity(SegDaños) Then
- SegDaños = 0
- End If
- SegVivienda = SeguroVivienda(Index)
- If Double.IsInfinity(SegVivienda) Then
- SegVivienda = 0
- End If
- TotalPagado = TotalCuota(Index, SegDaños, SegVivienda, PagoDeCuotaMensual)
- If Double.IsInfinity(TotalPagado) Then
- TotalPagado = 0
- End If
- AbonoDinero = Abono(Index, TotalPagado, PagoIVA)
- If Double.IsInfinity(AbonoDinero) Then
- AbonoDinero = 0
- End If
- PrestRemanente = PrestamoRemanente(Index, AbonoDinero)
- If Double.IsInfinity(PrestRemanente) Then
- PrestRemanente = 0
- End If
- Dim CuotaSeguro As Double = 0
- Dim Seguro As Double = 0
- If Not String.IsNullOrEmpty(txtCuotaSinSeguro.Text) Then
- CuotaSeguro = txtCuotaSinSeguro.Text
- End If
- If Not String.IsNullOrEmpty(txtSeguro.Text) Then
- Seguro = txtSeguro.Text
- End If
- txtCuotaReal.Text = Prestamo.SumarCuota(CuotaSeguro, Seguro)
- If Double.IsInfinity(txtCuotaReal.Text) Then
- txtCuotaReal.Text = 0
- End If
- If Agregar >= Index Then
- If CambioFecha Then
- FechaUltima = FechaProv
- CambioFecha = False
- End If
- End If
- Dim FechaCalculo As Date = FechaUltima
- Dim FechaRespaldo As Date = FechaUltima
- Dim Mes = FechaCalculo.Month
- While Mes = FechaCalculo.Month
- FechaCalculo = FechaCalculo.AddDays(1)
- End While
- FechaUltima = FechaCalculo.AddDays(-1)
- If Cantidad > 1 Then
- If Agregar >= Index Then
- dgvAmortizacion.Rows(Index).Cells("Fecha").Value = FechaUltima
- dgvAmortizacion.Rows(Index).Cells("Periodo").Value = PeriodoDias
- If Double.IsInfinity(PagoIni) Then
- PagoIni = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Saldo Inicial").Value = PagoIni
- If Double.IsInfinity(PagoDeCuotaMensual) Then
- PagoDeCuotaMensual = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Pago Cuota Mensual").Value = PagoDeCuotaMensual
- If Double.IsInfinity(PagoIVA) Then
- PagoIVA = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Pago Interes(IVA)").Value = PagoIVA
- If Double.IsInfinity(IVAInteres) Then
- IVAInteres = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("IVA de Intereses").Value = IVAInteres
- If Double.IsInfinity(PagoInt) Then
- PagoInt = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Pago de Intereses").Value = PagoInt
- If Double.IsInfinity(AbonoDinero) Then
- AbonoDinero = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Abono a Capital").Value = AbonoDinero
- If Double.IsInfinity(PrestRemanente) Then
- PrestRemanente = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Prestamo Remanente").Value = PrestRemanente
- If Double.IsInfinity(SegDaños) Then
- SegDaños = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Pago de Seguro de Daños").Value = SegDaños
- If Double.IsInfinity(SegVivienda) Then
- SegVivienda = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Pago de Seguro de Vivienda").Value = SegVivienda
- If Double.IsInfinity(TotalPagado) Then
- TotalPagado = 0
- End If
- dgvAmortizacion.Rows(Index).Cells("Total Pagado").Value = TotalPagado
- dgvAmortizacion.Rows(Index).Cells("Total Cuota Mensual").Value = TotalPagado
- Else
- dgvAmortizacion.Rows.Add(Contador, "", FechaUltima, PeriodoDias, PagoIni, PagoDeCuotaMensual, PagoIVA, IVAInteres, PagoInt, AbonoDinero, PrestRemanente, SegDaños, SegVivienda, TotalPagado, TotalPagado, 0)
- End If
- Else
- dgvAmortizacion.Rows.Add(Contador, "", FechaUltima, PeriodoDias, PagoIni, PagoDeCuotaMensual, PagoIVA, IVAInteres, PagoInt, AbonoDinero, PrestRemanente, SegDaños, SegVivienda, TotalPagado, TotalPagado, 0)
- End If
- FechaUltima = FechaRespaldo
- Contador += 1
- If (Salir) Then
- Exit While
- End If
- Index += 1
- End While
- End If
- 'Else
- 'Dim Index As Integer = dgvAmortizacion.CurrentRow.Index
- 'dgvAmortizacion.Rows(Index).Cells(2).Value = Periodo(Index)
- 'dgvAmortizacion.Rows(Index).Cells(4).Value = PagoCuotaMensual(Index)
- 'If (String.IsNullOrEmpty(dgvAmortizacion.Rows(Index).Cells(10).Value)) Then
- ' dgvAmortizacion.Rows(Index).Cells(10).Value = SeguroDaños(Index)
- 'End If
- 'If (String.IsNullOrEmpty(dgvAmortizacion.Rows(Index).Cells(11).Value)) Then
- ' dgvAmortizacion.Rows(Index).Cells(11).Value = SeguroVivienda(Index)
- 'End If
- 'dgvAmortizacion.Rows(Index).Cells(12).Value = TotalCuota(Index)
- 'dgvAmortizacion.Rows(Index).Cells(13).Value = TotalCuota(Index)
- 'If (String.IsNullOrEmpty(dgvAmortizacion.Rows(Index).Cells(14).Value)) Then
- ' dgvAmortizacion.Rows(Index).Cells(14).Value = 0
- ' End If
- ' dgvAmortizacion.Rows(Index).Cells(3).Value = PagoInicial(Index)
- ' dgvAmortizacion.Rows(Index).Cells(5).Value = PagoInteresIVA(Index)
- ' dgvAmortizacion.Rows(Index).Cells(7).Value = PagoIntereses(Index)
- ' dgvAmortizacion.Rows(Index).Cells(6).Value = IVAIntereses(Index)
- ' dgvAmortizacion.Rows(Index).Cells(8).Value = Abono(Index)
- ' dgvAmortizacion.Rows(Index).Cells(9).Value = PrestamoRemanente(Index)
- 'IndexIterable = False
- End Sub
- Function Periodo(ByVal Index As Integer, ByVal Fech As Date, ByVal Fecha2 As Date)
- Dim Valor
- Valor = Prestamo.Periodo(Fech, Fecha2)
- Return Valor
- End Function
- Function PagoCuotaMensual(ByVal Index As Integer, ByVal Dias As Integer, ByVal V_txtTasaInteres As Double)
- Dim MontoPrestamo As Integer = 0
- Dim CuotasMensuales As Integer = 0
- If Not String.IsNullOrEmpty(txtMontoPrestamo.Text) Then
- MontoPrestamo = txtMontoPrestamo.Text
- End If
- If Not String.IsNullOrEmpty(txtCuotasMensuales.Text) Then
- CuotasMensuales = txtCuotasMensuales.Text
- End If
- Dim Pago As Double = Prestamo.TIR(MontoPrestamo, CuotasMensuales, V_txtTasaInteres)
- Dim Total As Double = 0
- If (Index = 0) Then
- Total = Pago / 31 * Dias
- ElseIf (Index > 0) Then
- Total = Pago
- End If
- Return Total
- End Function
- Function SeguroDaños(ByVal Index As Integer)
- Dim Total As Double = 0
- If (Index = 0) Then
- Total = 0
- ElseIf (Index > 0) Then
- Index = Index - 1
- Total = dgvAmortizacion.Rows(Index).Cells("Pago de Seguro de Daños").Value
- End If
- Return Total
- End Function
- Function SeguroVivienda(ByVal Index As Integer)
- Dim Total As Double = 0
- If (Index = 0) Then
- Total = 0
- ElseIf (Index > 0) Then
- Index = Index - 1
- Total = dgvAmortizacion.Rows(Index).Cells("Pago de Seguro de Vivienda").Value
- End If
- Return Total
- End Function
- Function TotalCuota(ByVal Index As Integer, ByVal PagoSeguroDaño As Double, ByVal PagoSeguroVivienda As Double, ByVal PagoCuota As Double)
- Dim Total = PagoSeguroDaño + PagoSeguroVivienda + PagoCuota
- Return Total
- End Function
- Function PagoInicial(ByVal Index As Integer)
- Dim Total As Double = 0
- Dim Anterior As Integer = Index - 1
- If (Index = 0) Then
- If Not String.IsNullOrEmpty(txtMontoPrestamo.Text) Then
- Total = txtMontoPrestamo.Text
- End If
- ElseIf (Index > 0) Then
- Total = dgvAmortizacion.Rows(Anterior).Cells("Prestamo Remanente").Value
- End If
- Return Total
- End Function
- Function PagoInteresIVA(ByVal Index As Integer, ByVal SaldoInicial As Double, ByVal Periodo As Integer, ByVal Fechainicial As Date, ByVal FechaFinal As Date, ByVal Contador As Integer, ByVal V_txtTasaInteres As Double)
- Fechainicial = Format(Fechainicial, "yyyy/MM/dd")
- FechaFinal = Format(FechaFinal, "yyyy/MM/dd")
- Dim CambioDeFecha As Integer = Operaciones.CambioBase(Fechainicial, FechaFinal)
- Dim TasaInteres As New Double
- TasaInteres = V_txtTasaInteres
- Dim PrimeraFechaUltima = Operaciones.PrimeraFechaCambioBase(Fechainicial)
- Dim UltimaFechaPrimero = Operaciones.FinalFechaCambioBase(FechaFinal)
- Dim DiasPrimeraFecha = 0, DiasSegundaFecha = 0
- Dim Valor1 = 0.0, Valor2 = 0.0, Valor = 0.0
- If (Not CambioDeFecha = 0) Then
- If CambioDeFecha = 1 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(Fechainicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- Valor1 = SaldoInicial * TasaInteres * DiasPrimeraFecha / 366
- Valor2 = SaldoInicial * TasaInteres * DiasSegundaFecha / 365
- ElseIf CambioDeFecha = 2 Then
- DiasPrimeraFecha = Operaciones.DiasDespuesCambioPrimeraFecha365(Fechainicial, PrimeraFechaUltima, CambioDeFecha)
- DiasSegundaFecha = Operaciones.DiasDespuesCambioPrimeraFecha366(UltimaFechaPrimero, FechaFinal, CambioDeFecha)
- Valor1 = SaldoInicial * TasaInteres * DiasPrimeraFecha / 365
- Valor2 = SaldoInicial * TasaInteres * DiasSegundaFecha / 366
- End If
- Valor = Valor1 + Valor2
- Else
- If (Operaciones.AñoBisiesto(Fechainicial) = 364) Then
- Valor = SaldoInicial * TasaInteres * Periodo / 365
- End If
- If (Operaciones.AñoBisiesto(Fechainicial) = 365) Then
- Valor = SaldoInicial * TasaInteres * Periodo / 366
- End If
- End If
- Return Valor
- End Function
- Function PagoIntereses(ByVal Index As Integer, ByVal PagoIVA As Double)
- Dim Total = PagoIVA / 1.13
- Return Total
- End Function
- Function IVAIntereses(ByVal Index As Integer, ByVal PagoIVA As Double, ByVal PagoIVAInt As Double)
- Dim Total As Double
- Total = PagoIVA - PagoIVAInt
- Return Total
- End Function
- Function Abono(ByVal Index As Integer, ByVal TotalPagado As Double, ByVal PagoInteres As Double)
- Dim Total As Double
- Total = TotalPagado - PagoInteres
- Return Total
- End Function
- Function PrestamoRemanente(ByVal Index As Integer, ByVal Abono As Double)
- Dim Total As Double = 0
- Dim Monto As Double = 0
- If Not String.IsNullOrEmpty(txtMontoPrestamo.Text) Then
- Monto = txtMontoPrestamo.Text
- End If
- Dim Anterior As Integer = Index - 1
- Try
- If (Index = 0) Then
- Total = CDec(Monto) - CDec(Abono)
- ElseIf (Index > 0) Then
- Dim AnteriorValor = dgvAmortizacion.Rows(Anterior).Cells("Prestamo Remanente").Value
- Total = AnteriorValor - Abono
- End If
- Catch ex As Exception
- Total = 0
- End Try
- Return Total
- End Function
- Private Sub dgvAmortizacion_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvAmortizacion.CellContentClick
- CargarDatos()
- ' Calculos()
- End Sub
- Private Sub dgvAmortizacion_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles dgvAmortizacion.CellEndEdit
- CargarDatos()
- Calculos(False)
- End Sub
- Private Sub navModificar_Click(sender As Object, e As EventArgs) Handles navModificar.Click
- EstadoAccion = "M"
- btnAccion.Text = "Modificar"
- 'btnagregar.Text = "Modificar"
- End Sub
- Private Sub navNuevo_Click(sender As Object, e As EventArgs) Handles navNuevo.Click
- EstadoAccion = "N"
- btnAccion.Text = "Nuevo"
- ' btnagregar.Text = "Nuevo"
- End Sub
- Private Sub navEliminar_Click(sender As Object, e As EventArgs) Handles navEliminar.Click
- EstadoAccion = "B"
- btnAccion.Text = "Eliminar"
- 'btnagregar.Text = "Eliminar"
- End Sub
- Sub CargarColecciones()
- CargarDeudor()
- CargarDetalles()
- ' CargarAmortizacion()
- End Sub
- Sub CargarDeudor()
- Dim codigo As String = Variables.Codigo
- Dim Retorno = PrestamoConsulta.CargarDeudor(codigo)
- Dim coleccion As New Collection
- If (TypeOf Retorno Is Boolean) Then
- Exit Sub
- Else
- coleccion = PrestamoConsulta.CargarDeudor(codigo)
- End If
- txtNombreDeudor.Text = coleccion(1)
- txtNumeroDeudor.Text = coleccion(2)
- dtpFechaPago.Value = coleccion(3)
- dtpFechaOtorgamiento.Value = coleccion(4)
- txtPeriodo.Text = coleccion(5)
- End Sub
- Sub CargarDetalles()
- Dim codigo As String = Variables.Codigo
- Dim Retorno = PrestamoConsulta.CargarDetalles(codigo)
- Dim coleccion As New Collection
- If (TypeOf Retorno Is Boolean) Then
- Exit Sub
- Else
- coleccion = PrestamoConsulta.CargarDetalles(codigo)
- End If
- txtTasaInteres.Text = CDec(coleccion(1)) * 100
- txtAñoPrestamo.Text = coleccion(2)
- txtCuotasMensuales.Text = coleccion(3)
- txtMontoPrestamo.Text = coleccion(4)
- txtSeguro.Text = coleccion(5)
- End Sub
- Sub CargarAmortizacion()
- Dim codigo As String = Variables.Codigo
- Dim dr = PrestamoConsulta.CargarAmortizacion(codigo)
- Dim Iterador As Integer = 0
- Dim ConvertirString As String
- While dr.Read
- ConvertirString = Format(dr("fecha"), "dd/MM/yyyy")
- dgvAmortizacion.Rows.Add(dr("correlativo"), dr("fechacorte").ToString, ConvertirString, dr("periodo"), dr("saldoinicial"), dr("pagocuota"), dr("pagointeresIVA"), dr("IVAinteres"), dr("pagointeres"), dr("abono"), dr("prestamoremanente"), dr("pagodanos"), dr("pagovivienta"), dr("totalcuota"), dr("totalpagado"), dr("abonoextra"))
- End While
- End Sub
- Function ValidarDatos()
- Dim Continuar = True
- If (String.IsNullOrEmpty(txtNombreDeudor.Text)) Then
- Continuar = False
- MsgBox("Agregue un Nombre")
- End If
- If (String.IsNullOrEmpty(txtNumeroDeudor.Text)) Then
- MsgBox("Agregue un Numero")
- Continuar = False
- End If
- Return Continuar
- End Function
- Private Sub btnAccion_Click(sender As Object, e As EventArgs) Handles btnAccion.Click
- Dim codigo As String = Variables.Codigo
- Dim colecciondetalle = ColeccionDetalles()
- Dim colecciondeuda = ColeccionDeudor()
- Dim diccionarioAmort As Dictionary(Of String, Collection) = NuevoAmortDiccionario()
- If (EstadoAccion = "B") Then
- PrestamoConsulta.Eliminar(codigo)
- 'PrestamoConsulta.EliminarDetalle(codigo)
- 'PrestamoConsulta.EliminarAmortizacion(codigo)
- ValidarExistencia()
- End If
- If (EstadoAccion = "M") Then
- Dim Validar = ValidarDatos()
- If (Validar) Then
- PrestamoConsulta.ProcesoDatos(colecciondeuda, colecciondetalle, codigo, diccionarioAmort, "Modificar", "Modificar")
- 'PrestamoConsulta.ModificarDetalle(colecciondetalle, codigo)
- 'PrestamoConsulta.ModificarDeudor(colecciondeuda, codigo)
- 'ModificarAmort(codigo)
- ValidarExistencia()
- End If
- End If
- If (EstadoAccion = "N") Then
- Dim Validar = ValidarDatos()
- If (Validar) Then
- PrestamoConsulta.ProcesoDatos(colecciondeuda, colecciondetalle, codigo, diccionarioAmort, "Nuevo", "Nuevo")
- 'PrestamoConsulta.NuevoDetalle(colecciondetalle, codigo)
- 'PrestamoConsulta.NuevoDeudor(colecciondeuda, codigo)
- 'NuevoAmort(codigo)
- ValidarExistencia()
- End If
- ElseIf Not ExisteValidacion() Then
- Variables.ColeccionPPERDETALLE = colecciondetalle
- Variables.ColeccionPPERDEUDOR = colecciondeuda
- Variables.ColeccionPPERAMORTDi = diccionarioAmort
- Me.Close()
- End If
- End Sub
- Sub ValidarExistencia()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Tabla = "PPER0"
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- If (Existe) Then
- navNuevo.Enabled = False
- navModificar.Enabled = True
- navEliminar.Enabled = True
- Else
- navNuevo.Enabled = True
- navModificar.Enabled = False
- navEliminar.Enabled = False
- 'LimpiarCampos()
- End If
- EstadoAccion = String.Empty
- btnAccion.Text = "Aceptar"
- End Sub
- Function ExisteValidacion()
- Dim General As New DAOGeneral
- Dim Codigo As String = Variables.Codigo
- Dim Tabla As String = String.Empty
- Tabla = "PPER0"
- Dim Existe As Boolean = General.ExisteTitulo(Codigo, Tabla)
- Return Existe
- End Function
- Sub LimpiarCampos()
- dtpFechaOtorgamiento.Value = Date.Now.Date
- dtpFechaPago.Value = Date.Now.Date
- txtTasaInteres.Text = "0.0%"
- txtAñoPrestamo.Text = 0
- txtCuotasMensuales.Text = 0
- txtMontoPrestamo.Text = 0
- txtCuotaSinSeguro.Text = 0
- txtSeguro.Text = 0
- txtCuotaReal.Text = 0
- dgvAmortizacion.Rows.Clear()
- End Sub
- Function ColeccionDeudor()
- Dim coleccion As New Collection
- Dim NombreDeudor = txtNombreDeudor.Text
- Dim NumeroDeudor = txtNumeroDeudor.Text
- Dim fechaotor = dtpFechaOtorgamiento.Value
- Dim fechapago = dtpFechaPago.Value
- Dim periodogracias = txtPeriodo.Text
- coleccion.Add(NombreDeudor)
- coleccion.Add(NumeroDeudor)
- coleccion.Add(fechapago)
- coleccion.Add(fechaotor)
- coleccion.Add(periodogracias)
- Return coleccion
- End Function
- Function ColeccionDetalles()
- Dim coleccion As New Collection
- Dim tasainteres = CDec(txtTasaInteres.Text.ToString.TrimEnd("%")) / 100
- Dim duracionprestamo = txtAñoPrestamo.Text
- Dim totalcuotas = txtCuotasMensuales.Text
- Dim montoprestamo = txtMontoPrestamo.Text
- Dim seguro = txtSeguro.Text
- Dim CuotaSinSeguro = txtCuotaSinSeguro.Text
- Dim CuotaReal = txtCuotaReal.Text
- coleccion.Add(tasainteres)
- coleccion.Add(duracionprestamo)
- coleccion.Add(totalcuotas)
- coleccion.Add(montoprestamo)
- coleccion.Add(seguro)
- coleccion.Add(CuotaSinSeguro)
- coleccion.Add(CuotaReal)
- Return coleccion
- End Function
- Function coleccionAmortizacion(ByVal Index As Integer)
- Dim coleccion As New Collection
- Dim Posicion = dgvAmortizacion.Rows(Index).Cells("No. Cuota").Value
- Dim fecha = dgvAmortizacion.Rows(Index).Cells("Fecha").Value
- Dim fechaCorte = dgvAmortizacion.Rows(Index).Cells("Fecha de Corte").Value
- Dim Periodo = dgvAmortizacion.Rows(Index).Cells("Periodo").Value
- Dim saldoinicial = dgvAmortizacion.Rows(Index).Cells("Saldo Inicial").Value
- Dim pagocuota = dgvAmortizacion.Rows(Index).Cells("Pago Cuota Mensual").Value
- Dim PagoInteresIVA = dgvAmortizacion.Rows(Index).Cells("Pago Interes(IVA)").Value
- Dim IVAinteres = dgvAmortizacion.Rows(Index).Cells("IVA de Intereses").Value
- Dim pagointeres = dgvAmortizacion.Rows(Index).Cells("Pago de Intereses").Value
- Dim Abono = dgvAmortizacion.Rows(Index).Cells("Abono a Capital").Value
- Dim PrestamoRemanente = dgvAmortizacion.Rows(Index).Cells("Prestamo Remanente").Value
- Dim pagodanos = dgvAmortizacion.Rows(Index).Cells("Pago de Seguro de Daños").Value
- Dim pagovivienta = dgvAmortizacion.Rows(Index).Cells("Pago de Seguro de Vivienda").Value
- Dim TotalCuota = dgvAmortizacion.Rows(Index).Cells("Total Cuota Mensual").Value
- Dim totalpagado = dgvAmortizacion.Rows(Index).Cells("Total Pagado").Value
- Dim abonoextra = dgvAmortizacion.Rows(Index).Cells("Abono Extra a Capital").Value
- coleccion.Add(Posicion)
- coleccion.Add(fecha)
- coleccion.Add(Periodo)
- coleccion.Add(saldoinicial)
- coleccion.Add(pagocuota)
- coleccion.Add(PagoInteresIVA)
- coleccion.Add(IVAinteres)
- coleccion.Add(pagointeres)
- coleccion.Add(Abono)
- coleccion.Add(PrestamoRemanente)
- coleccion.Add(pagodanos)
- coleccion.Add(pagovivienta)
- coleccion.Add(TotalCuota)
- coleccion.Add(totalpagado)
- coleccion.Add(abonoextra)
- coleccion.Add(fechaCorte)
- Return coleccion
- End Function
- Sub NuevoAmort(ByVal codigo As String)
- Dim Index As Integer = dgvAmortizacion.Rows.Count - 2
- For i As Integer = 0 To Index
- Dim ColeccionAmort = coleccionAmortizacion(i)
- PrestamoConsulta.NuevaAmortizacion(ColeccionAmort, codigo)
- Next
- End Sub
- Function NuevoAmortDiccionario()
- Dim diccionario As New Dictionary(Of String, Collection)
- Dim Index As Integer = dgvAmortizacion.Rows.Count - 2
- For i As Integer = 0 To Index
- Dim ColeccionAmort = coleccionAmortizacion(i)
- diccionario.Add(i, ColeccionAmort)
- Next
- Return diccionario
- End Function
- Sub ModificarAmort(ByVal codigo As String)
- PrestamoConsulta.EliminarAmortizacion(codigo)
- NuevoAmort(codigo)
- End Sub
- Private Sub txtTasaInteres_TextChanged(sender As Object, e As EventArgs) Handles txtTasaInteres.TextChanged
- Calculos(False)
- End Sub
- Private Sub btnagregar_Click(sender As Object, e As EventArgs)
- 'Dim coleccionAmor = coleccionAmortizacion()
- 'Dim codigo As String = Variables.Codigo
- 'If (EstadoAccion = "N") Then
- ' PrestamoConsulta.NuevaAmortizacion(coleccionAmor, codigo)
- 'End If
- 'If (EstadoAccion = "B") Then
- ' Dim Siguiente = dgvAmortizacion.CurrentRow.Cells(0).Value
- ' PrestamoConsulta.EliminarAmortizacion(codigo, Siguiente)
- 'End If
- 'If (EstadoAccion = "M") Then
- ' PrestamoConsulta.ModificarAmortizacion(coleccionAmor, codigo)
- 'End If
- End Sub
- Private Sub btnAccion2_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtSeguro_TextChanged(sender As Object, e As EventArgs) Handles txtSeguro.TextChanged
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs)
- Calculos(False)
- End Sub
- Private Sub txtAñoPrestamo_TextChanged(sender As Object, e As EventArgs) Handles txtAñoPrestamo.TextChanged
- Calculos(False)
- End Sub
- Private Sub txtCuotasMensuales_TextChanged(sender As Object, e As EventArgs) Handles txtCuotasMensuales.TextChanged
- Calculos(False)
- End Sub
- Private Sub txtMontoPrestamo_TextChanged(sender As Object, e As EventArgs) Handles txtMontoPrestamo.TextChanged
- Calculos(False)
- End Sub
- Private Sub txtAplicacionCodigo_TextChanged(sender As Object, e As EventArgs)
- Calculos(False)
- End Sub
- Private Sub BindingNavigator1_RefreshItems(sender As Object, e As EventArgs) Handles BindingNavigator1.RefreshItems
- End Sub
- Private Sub txtCuotaSinSeguro_TextChanged(sender As Object, e As EventArgs) Handles txtCuotaSinSeguro.TextChanged
- End Sub
- Private Sub txtCuotaReal_TextChanged(sender As Object, e As EventArgs) Handles txtCuotaReal.TextChanged
- End Sub
- Private Sub txtTasaInteres_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtTasaInteres.KeyPress
- If String.IsNullOrEmpty(txtTasaInteres.Text) Then
- If e.KeyChar = "." Then
- txtTasaInteres.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtTasaInteres.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtAñoPrestamo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtAñoPrestamo.KeyPress
- If String.IsNullOrEmpty(txtAñoPrestamo.Text) Then
- If e.KeyChar = "." Then
- txtAñoPrestamo.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtAñoPrestamo.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtCuotasMensuales_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCuotasMensuales.KeyPress
- If String.IsNullOrEmpty(txtCuotasMensuales.Text) Then
- If e.KeyChar = "." Then
- txtCuotasMensuales.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtCuotasMensuales.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtMontoPrestamo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtMontoPrestamo.KeyPress
- If String.IsNullOrEmpty(txtMontoPrestamo.Text) Then
- If e.KeyChar = "." Then
- txtMontoPrestamo.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtMontoPrestamo.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtSeguro_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtSeguro.KeyPress
- If String.IsNullOrEmpty(txtSeguro.Text) Then
- If e.KeyChar = "." Then
- txtSeguro.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtSeguro.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub txtPeriodo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtPeriodo.KeyPress
- If String.IsNullOrEmpty(txtPeriodo.Text) Then
- If e.KeyChar = "." Then
- txtPeriodo.Text = "0"
- Exit Sub
- End If
- End If
- If (Not txtPeriodo.Text.ToString.IndexOf(".") = -1 And e.KeyChar = ".") Then
- Operaciones.ValidarEntrada(sender, e, True)
- Else
- Operaciones.ValidarEntrada(sender, e, False)
- End If
- End Sub
- Private Sub btnCancelar_Click(sender As Object, e As EventArgs)
- End Sub
- Private Sub txtPeriodo_TextChanged(sender As Object, e As EventArgs) Handles txtPeriodo.TextChanged
- Calculos(False)
- End Sub
- Private Sub dtpFechaOtorgamiento_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaOtorgamiento.ValueChanged
- Formato()
- Calculos(False)
- End Sub
- Private Sub dtpFechaPago_ValueChanged(sender As Object, e As EventArgs) Handles dtpFechaPago.ValueChanged
- Formato()
- Calculos(False)
- End Sub
- Private Sub txtPeriodo_Leave(sender As Object, e As EventArgs) Handles txtPeriodo.Leave
- Formato()
- End Sub
- Private Sub txtTasaInteres_Leave(sender As Object, e As EventArgs) Handles txtTasaInteres.Leave
- Formato()
- End Sub
- Private Sub txtAñoPrestamo_Leave(sender As Object, e As EventArgs) Handles txtAñoPrestamo.Leave
- Formato()
- End Sub
- Private Sub txtCuotasMensuales_Leave(sender As Object, e As EventArgs) Handles txtCuotasMensuales.Leave
- Formato()
- End Sub
- Private Sub txtMontoPrestamo_Leave(sender As Object, e As EventArgs) Handles txtMontoPrestamo.Leave
- Formato()
- End Sub
- Private Sub txtSeguro_Leave(sender As Object, e As EventArgs) Handles txtSeguro.Leave
- Formato()
- End Sub
- Private Sub txtAñoPrestamo_KeyUp(sender As Object, e As KeyEventArgs) Handles txtAñoPrestamo.KeyUp
- If txtAñoPrestamo.Text = "." Then
- txtAñoPrestamo.Text = ".0"
- End If
- End Sub
- Private Sub TabPage2_Click(sender As Object, e As EventArgs) Handles TabPage2.Click
- End Sub
- Sub CargarTransladoNuevo()
- Dim Existe As Boolean = ExisteInversion()
- If Not RetCodigoInversionExiste And Not Existe Then
- txtMontoPrestamo.Text = Variables.RetMonto
- txtTasaInteres.Text = Variables.RetRendimiento
- End If
- End Sub
- End Class
|