if i=Length(str) then Ip[k]:=StrToFloat(str2);
end;
end else begin
try
Ip[1]:=StrToFloat(str); Ip[2]:=StrToFloat(str); Ip[3]:=StrToFloat(str);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèÿ ïåðâîíà÷àëüíûõ êàïèòàëîâëîæåíèé!'); FocusControl(Edit1);
end;
end;
//------------------------------ââîä ìàññèâà äåíåæíûõ ïîòîêîâ:
for j:=0 to n-1 do begin
str:=StringGrid1.Cells[j,1];
if pos(';',str)<>0 then begin str2:='';k:=1;
for i:=1 to Length(str)do begin
if (str[i]<>';') then str2:=str2+str[i]
else begin
Svar[k,j+1]:=StrToFloat(str2);
k:=k+1;str2:='';
end;
if i=Length(str) then Svar[k,j+1]:=StrToFloat(str2);
end;
end else try
Svar[1,j+1]:=StrToFloat(str); Svar[2,j+1]:=StrToFloat(str); Svar[3,j+1]:=StrToFloat(str);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèé èíòåðâàëîâ äåíåæíûõ ïîòîêîâ!'); FocusControl(Stringgrid1);
end;
end;
//----------------------------ââîä ìàññèâà ñîá.è çàåì. ñðåäñòâ
for j:=0 to n-1 do begin
str:=StringGrid2.Cells[j,1];
str3:=StringGrid3.Cells[j,1];
if pos(';',str)<>0 then begin str2:='';k:=1;
for i:=1 to Length(str)do begin
if (str[i]<>';') then str2:=str2+str[i]
else begin
At[k,j+1]:=StrToFloat(str2);
k:=k+1;str2:='';
end;
if i=Length(str) then At[k,j+1]:=StrToFloat(str2);
end;
end else try
At[1,j+1]:=StrToFloat(str);
At[2,j+1]:=StrToFloat(str);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèé ñîáñòâåííûõ ñðåäñòâ!');
FocusControl(StringGrid2);
end;
if pos(';',str3)<>0 then begin str2:='';k:=1;
for i:=1 to Length(str3)do begin
if (str3[i]<>';') then str2:=str2+str3[i]
else begin
Zt[k,j+1]:=StrToFloat(str2);
k:=k+1;str2:='';
end;
if i=Length(str3) then Zt[k,j+1]:=StrToFloat(str2);
end;
end else try
Zt[1,j+1]:=StrToFloat(str3);
Zt[2,j+1]:=StrToFloat(str3);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèé çàåìíûõ ñðåäñòâ!');
FocusControl(StringGrid3);
end;
end;
//------------------------Ââîä ìàññèâà áåçðèñê.% ñòàâêè
case CheckBox1.State of
cbChecked: begin
str:=StringGrid4.Cells[0,0];
if pos(';',str)<>0 then begin str2:='';k:=1;
for i:=1 to Length(str)do begin
if (str[i]<>';') then str2:=str2+str[i]
else begin
dvar[k,1]:=StrToFloat(str2);
k:=k+1;str2:='';
end;
if i=Length(str) then dvar[k,1]:=StrToFloat(str2);
end;
end else begin try
dvar[1,1]:=StrToFloat(str);
dvar[2,1]:=StrToFloat(str);
dvar[3,1]:=StrToFloat(str);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèÿ áåçðèñêîâîé ïðîöåíòíîé ñòàâêè!');
FocusControl(Stringgrid4);
end; end;
for i:=2 to n do begin
dvar[1,i]:=dvar[1,1];
dvar[2,i]:=dvar[2,1];
dvar[3,i]:=dvar[2,1];
end;
end;
cbUnchecked: begin
for j:=0 to n-1 do begin
str:=StringGrid4.Cells[j,1];
if pos(';',str)<>0 then begin str2:='';k:=1;
for i:=1 to Length(str)do begin
if (str[i]<>';') then str2:=str2+str[i]
else begin
dvar[k,j+1]:=StrToFloat(str2);
k:=k+1;str2:='';
end;
if i=Length(str) then dvar[k,j+1]:=StrToFloat(str2);
end;
end else try
dvar[1,j+1]:=StrToFloat(str);
dvar[2,j+1]:=StrToFloat(str);
dvar[3,j+1]:=StrToFloat(str);
except
showmessage('Îøèáêà ïðè ââîäå çíà÷åíèé áåçðèñêîâîé ïðîöåíòíîé ñòàâêè!');
FocusControl(Stringgrid4);
end;
end;
end;end;
//------------------------------Ðàññ÷åò çíà÷åíèÿ êîýô-òà ïîêðûòèÿ Ñt
for i:=1 to n do begin
Ct[1,i]:=1;
Ct[2,i]:=1;
end;
for i:=1 to n do begin
if Zt[2,i]<>0 then Ct[1,i]:=At[1,i]/Zt[2,i];
if Zt[1,i]<>0 then Ct[2,i]:=At[2,i]/Zt[1,i];
j:=3;
if (Ct[1,i]*Ct[2,i])<=(kCt[1]*kCt[1]) then Cto[i]:=(Ct[1,i]*Ct[2,i])/(kCt[1]*kCt[1]);
if ((Ct[1,i]*Ct[2,i])>(kCt[1]*kCt[1]))and (Ct[1,i]*Ct[2,i]<=(kCt[2]*kCt[2]))then j:=0;
if ((Ct[1,i]*Ct[2,i])>(kCt[2]*kCt[2]))and (Ct[1,i]*Ct[2,i]<=(kCt[3]*kCt[3])) then j:=1;
if ((Ct[1,i]*Ct[2,i])>(kCt[3]*kCt[3]))and (Ct[1,i]*Ct[2,i]<1) then j:=2;
if (Ct[1,i]*Ct[2,i]>=1) then Cto[i]:=1;
if (j = 0) or (j = 1) then
Cto[i]:=kCt[1+j]+((((Ct[1,i]*Ct[2,i])-(kCt[1+j]*kCt[1+j]))*(kCt[2+j]-kCt[1+j]))/((kCt[2+j]*kCt[2+j])-(kCt[1+j]*kCt[1+j])));
if j = 2 then
Cto[i]:=kCt[1+j]+((((Ct[1,i]*Ct[2,i])-(kCt[1+j]*kCt[1+j]))*(1-kCt[1+j]))/(1-(kCt[1+j]*kCt[1+j])));
end;
for i:=1 to n do begin
for j:=1 to 3 do begin
NPVvar[j,i]:=0;
end;
end;
//------------------------------Ðàññ÷åò èíåðâàëîâ NPVt
if Rtkey=false then begin
for ii:=1 to n do begin
for i:=1 to ii do begin
smin:=1;smax:=1;sav:=1;
for j:=1 to i do begin smax:=smax*dvar[1,i];
smin:=smin*dvar[3,i];
sav:=sav*dvar[2,i];
end;
NPVvar[3,ii]:=NPVvar[3,ii]+(Svar[3,i]/smax);
NPVvar[1,ii]:=NPVvar[1,ii]+(Svar[1,i]/smin);
NPVvar[2,ii]:=NPVvar[2,ii]+(Svar[2,i]/sav);
end;
NPVvar[1,ii]:=NPVvar[1,ii]-Ip[3];
NPVvar[2,ii]:=NPVvar[2,ii]-Ip[2];
NPVvar[3,ii]:=NPVvar[3,ii]-Ip[1];
end;
end else begin
for ii:=1 to nRt do begin
for i:=1 to ii do begin
smax:=1;
for j:=1 to i do begin smax:=smax*Rdvar[i];end;
NPVvar[3,ii]:=NPVvar[3,ii]+(RSvar[i]/smax);
end;
NPVvar[1,ii]:=NPVvar[3,ii]-Ir;
NPVvar[2,ii]:=NPVvar[3,ii]-Ir;
NPVvar[3,ii]:=NPVvar[3,ii]-Ir;
end;
for ii:=nRt+1 to n do begin
for i:=1 to nRt do begin
smax:=1;
for j:=1 to i do begin smax:=smax*Rdvar[i];end;
NPVvar[3,ii]:=NPVvar[3,ii]+(RSvar[i]/smax);
end;
NPVvar[2,ii]:=NPVvar[3,ii];
NPVvar[1,ii]:=NPVvar[3,ii];
for i:=nRt+1 to ii do begin
smin:=1;smax:=1;sav:=1;
Ñòðàíèöû: 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