Ver Mensaje Individual
  #4  
Antiguo 12-05-2008
Avatar de chino150
chino150 chino150 is offline
Miembro
 
Registrado: dic 2007
Posts: 86
Reputación: 17
chino150 Va por buen camino
Hola BlueSteel,

Yo estoy usando 3 Edit y 1 datepicker, 1 stringgrid el codigo

Codigo Delphi [-]


procedure TForm1.amortizacionClick(Sender: TObject);
begin
{inicializamos todo}
deu:=strtofloat(deuda.Text);
int:=strtofloat(interes.text);
ti:=strtofloat(tiempo.text);

{calculamos interes mensual}
if rg1.itemindex=0then
im:=int/100
else
im:=(int/100)/12;

{primer columna}
if rg2.itemindex=0then
mes:=ti
else
mes:=ti*12;

{Colocamos total de filas}
if rg2.itemindex=0then
tf:=strtoint(tiempo.text)
else
tf:=strtoint(tiempo.text)*12;

m.RowCount:=tf +1;
for fil:=1to tf do
m.cells[0,fil]:=floattostr(roundto(fil, -2));

{tercera columna}
pc:=deu/mes;
for fil:=1to tf do
m.cells[2,fil]:=floattostr(roundto(pc, -2));

{segunda columna}
si:=deu+pc;
for fil:=1to tf do
begin
si:=si-pc;
m.Cells[1,fil]:=floattostr(roundto(si, -2));
end;

{quinta columna}
sf:=deu;
for fil:=1to tf do
begin
sf:=sf-pc;
m.Cells[4,fil]:=floattostr(roundto(sf, -2));
end;

{cuarta columna}
si:=deu+pc;
for fil:=1to tf do
begin
si:=si-pc;
i:=si*im;
m.Cells[3,fil]:=floattostr(roundto(i, -2));
end;
{sexta columna}
pc:=deu/mes;
si:=deu+pc;
for fil:=1to tf do
begin
si:=si-pc;
i:=si*im;
pm:=pc+i;
m.Cells[5,fil]:=floattostr(roundto(pm, -2));
end;
{interes total}
ti:=0;
for fil:=1to tf do
ti:=ti+strtofloat(m.Cells[3,fil]);
it.Caption:=floattostr(roundto(ti,-2));

end;

end.
gracias
Responder Con Cita