var
FCalc: TFCalc;
procedure Annuite(summa, stavka, mesplatej: real; month: integer);
procedure Dif(summa, stavka, mesplatej: real; month: integer);
implementation
uses Unit1;
{$R *.dfm}
procedure Annuite(summa, stavka, mesplatej: real; month: integer);
var
i,j: integer;
ostn, ostk, vplpr, pgdolg: real;
total: array[0..5] of double ;
begin
FCalc.SG.RowCount := month + 1;
for i := 1 to month do
for j := 1 to 5 do
total[j]:= total[j] + strtofloat(FCalc.SG.Cells[j,i]);
begin
if i = 1 then ostn := summa else ostn := ostk;
vplpr := ostn * stavka / 12;
pgdolg := mesplatej - vplpr;
ostk := ostn - 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;
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,i,j: 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;
procedure TFCalc.FormCreate(Sender: TObject);
begin
SG.Cells[0,0]:='Месяц';
SG.Cells[1,0]:=Выплата процентов'';
SG.Cells[2,0]:='Погашение од';
SG.Cells[3,0]:='Ежемесячный платеж';
SG.Cells[4,0]:='ОД на начало';
SG.Cells[5,0]:='Од на конец';
end;