Visual Basic.NET - Estoy haciendo un programa que me calcule el periodo de gracia de un prestamo pero no lo e podido l

 
Vista:
sin imagen de perfil

Estoy haciendo un programa que me calcule el periodo de gracia de un prestamo pero no lo e podido l

Publicado por Ivan (2 intervenciones) el 07/12/2015 05:22:20
Estoy haciendo un programa que me calcule el periodo de gracia de un prestamo pero no lo e podido lograr.

Este es mi codigo, Cualquier ayuda se los agradeseria mucho:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
LoanAmount = Convert.ToDecimal(txtMonto.Text)
LoanIRate = Convert.ToDecimal(txtTasaInteres.Text)
LoanDuration = CInt(txtPlazo.Text)
Montoinicial = LoanAmount
'llama la funsion que calcula el interes mensual
Intrest = Percen.Percentage(LoanIRate)
 
Payment = (LoanAmount / LoanDuration)
 
Dim principal, interes, i, p As Double
dtgviewtable.Rows.Clear()
For Period = 1 To LoanDuration
	'Pago mensual
	IntPmt = (Payment + Intrest)
	'calcula el interes
	interes = LoanAmount * Intrest
	principal = Payment
 
	'calcula el saldo
	LoanAmount = LoanAmount - principal
	If Val(txtPeriodoGracia.Text) = 3 Then
		i = interes * Period
		p = Val(txtTasaInteres.Text) * Val(txtMonto.Text)
 
	End If
	Dim FechaInicial As Date = Date.Today
	'aqui adiciono un mes a la fecha.
	FechaInicial = DateAdd("M", Period, Date.Today)
 
	'aqui, me posiciono en el primer dia de la fecha a la que le voy adicionando el mes
	FechaInicial = FechaInicial.AddMonths(0)
	Dim b As Integer = dtgviewtable.Rows.Add
 
	dtgviewtable.Rows.Item(b).Cells(0).Value = Period
	dtgviewtable.Rows.Item(b).Cells(1).Value = (FechaInicial.ToString("D", CultureInfo.CreateSpecificCulture("es-MX")))
	dtgviewtable.Rows.Item(b).Cells(2).Value = (Format(Montoinicial, Fmt))
	dtgviewtable.Rows.Item(b).Cells(3).Value = (Format(IntPmt, Fmt))
	dtgviewtable.Rows.Item(b).Cells(4).Value = (Format(interes, Fmt))
	dtgviewtable.Rows.Item(b).Cells(5).Value = (Format(principal, Fmt))
	dtgviewtable.Rows.Item(b).Cells(6).Value = (Format(LoanAmount, Fmt))
Next

Perdon si esta un poco enredado.
Aqui adjunto una imagen de como quiero que se muestre.
Tabla

Muchas gracias!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder