procedure Dif(summa, stavka, mesplatej: real; month: integer);
var
i: integer;
ostn, ostk, vplpr, pgdolg: real;
begin
FCalc.SG.RowCount := month + 1;
for i := 1 to month do begin
if i = 1 then ostn := summa else ostn := ostk;
vplpr := ostn * stavka / 12;
pgdolg := summa/month;
ostk := ostn - pgdolg;
mesplatej:=vplpr+pgdolg;
FCalc.SG.Cells[0,i]:= inttostr(i);
FCalc.SG.Cells[1,i]:= floattostrf(vplpr,ffFixed,6,2);
FCalc.SG.Cells[2,i]:= floattostrf(pgdolg,ffFixed,6,2);
FCalc.SG.Cells[3,i]:= floattostrf(mesplatej,ffFixed,6,2);
FCalc.SG.Cells[4,i]:= floattostrf(ostn,ffFixed,8,2);
FCalc.SG.Cells[5,i]:= floattostrf(ostk,ffFixed,8,2);
end;
end;
procedure TFCalc.BRaschClick(Sender: TObject);
function PMT(IR, NP, PV: real): real;
begin
result := (PV * IR) / (1 - power(1 + IR, -NP));
end;
var
sum, stavka: extended;
month: integer;
Ejrasch: extended;
begin
if (EMonth.Text='') or (EStavka.Text='') or (Esum.Text='') then ShowMessage ('Íåîáõîäèìî çàïîëíèòü âñå ïîëÿ')
else
begin SG.visible:=True ;
sum := StrToFloat(ESum.Text);
stavka := StrToFloat(EStavka.Text) * 0.01;
month := StrToInt(Emonth.Text);
if RBAn.Checked=true then begin
Ejrasch := Pmt(stavka / 12, month, sum);
Annuite(sum, stavka, Ejrasch, month);
end
else begin
Ejrasch := Pmt(stavka / 12, month, sum);
Dif(sum, stavka, Ejrasch, month);
end;
end;
end;