178587 (Разработка инвестиционного проекта ОАО "Завод по производству труб большого диаметра"), страница 13
Описание файла
Документ из архива "Разработка инвестиционного проекта ОАО "Завод по производству труб большого диаметра"", который расположен в категории "". Всё это находится в предмете "экономика" из , которые можно найти в файловом архиве . Не смотря на прямую связь этого архива с , его также можно найти и в других разделах. Архив можно найти в разделе "остальное", в предмете "экономика" в общих файлах.
Онлайн просмотр документа "178587"
Текст 13 страницы из документа "178587"
smin:=(G-NPVvar[1,i])/(NPVvar[3,i]-NPVvar[1,i]);
if G if (G>=NPVvar[1,i]) and (G smax:=(G-NPVvar[1,i])/(NPVvar[2,i]-NPVvar[1,i]); Vt[i]:=smin*(1+((1-smax)/smax)*Ln(1-smax)); end; if (G>=NPVvar[2,i]) and (G if G=NPVvar[2,i] then smax:=1 else smax:=(NPVvar[3,i]-G)/(NPVvar[3,i]-NPVvar[2,i]); Vt[i]:=1-((1-smin)*(1+((1-smax)/smax)*Ln(1-smax))); end; if G>=NPVvar[3,i] then Vt[i]:=1; end; end; //-----------------------------Рассчет значения коэ-та ликвидности Rt For i:=1 to n do begin Rt[1,i]:=1;Rto[i]:=1; Rt[2,i]:=1; end; //-----------------------------рассчет прогнозного занчения NPV и Rt if Rtkey=true then begin for ii:=1 to n do begin NPVpmin:=0;NPVpmax:=0;NPVpav:=0; for i:=1 to ii do begin smin:=1;smax:=1;sav:=1; for j:=1 to i do begin smin:=smin*dvar[3,i];smax:=smax*dvar[1,i];sav:=sav*dvar[2,i];end; NPVpmax:=NPVpmax+(Svar[3,i]/smax); NPVpmin:=NPVpmin+(Svar[1,i]/smin); NPVpav:=NPVpav+(Svar[2,i]/sav); end; NPVpmin:=NPVpmin-Ip[3]; if NPVpmin<>0 then Rt[1,ii]:=NPVvar[1,ii]/NPVpmin; NPVpmax:=NPVpmax-Ip[1]; if NPVpmax<>0 then Rt[3,ii]:=NPVvar[3,ii]/NPVpmax; NPVpav:=NPVpav-Ip[2]; if NPVpav<>0 then Rt[2,ii]:=NPVvar[2,ii]/NPVpav; if (NPVpmin=0) then Rt[1,ii]:=1; if (NPVpmax=0) then Rt[3,ii]:=1; if (NPVpav=0) then Rt[2,ii]:=1; if (NPVpmin>=0) and (NPVvar[1,ii]<0) then Rt[1,ii]:=0; if (NPVpmax>=0) and (NPVvar[3,ii]<0) then Rt[3,ii]:=0; if (NPVpav>=0) and (NPVvar[2,ii]<0) then Rt[2,ii]:=0; end; for i:=1 to n do begin j:=3; if (Rt[1,i]*Rt[2,i]*Rt[3,i])<=(kRt[1]*kRt[1]*kRt[1]) then Rto[i]:=(Rt[1,i]*Rt[2,i]*Rt[3,i])/(kRt[1]*kRt[1]); if ((Rt[1,i]*Rt[2,i]*Rt[3,i])>(kRt[1]*kRt[1]*kRt[1]))and (Rt[1,i]*Rt[2,i]*Rt[3,i]<=(kRt[2]*kRt[2]*kRt[2]))then j:=0; if ((Rt[1,i]*Rt[2,i]*Rt[3,i])>(kRt[2]*kRt[2]*kRt[2]))and (Rt[1,i]*Rt[2,i]*Rt[3,i]<=(kRt[3]*kRt[3]*kRt[3])) then j:=1; if ((Rt[1,i]*Rt[2,i]*Rt[3,i])>(kRt[3]*kRt[3]*kRt[3]))and (Rt[1,i]*Rt[2,i]*Rt[3,i]<1) then j:=2; if (Rt[1,i]*Rt[2,i]*Rt[3,i]>=1) then Rto[i]:=1; if (j = 0) or (j = 1) then Rto[i]:=kRt[1+j]+((((Rt[1,i]*Rt[2,i]*Rt[3,i])-(kRt[1+j]*kRt[1+j]*kRt[1+j]))*(kRt[2+j]-kRt[1+j]))/((kRt[2+j]*kRt[2+j]*kRt[2+j])-(kRt[1+j]*kRt[1+j]*kRt[1+j]))); if j = 2 then Rto[i]:=kRt[1+j]+((((Rt[1,i]*Rt[2,i]*Rt[3,i])-(kRt[1+j]*kRt[1+j]*kRt[1+j]))*(1-kRt[1+j]))/(1-(kRt[1+j]*kRt[1+j]*kRt[1+j]))); end; end; for i:=1 to n do begin //----------------------------------Значения ф. принадлежности для Сt if Cto[i]<=((kCt[2]+kCt[3])/2) then mCt[1,i]:=0; if (Cto[i]>((kCt[2]+kCt[3])/2)) and (Cto[i] if Cto[i]>=kCt[3] then mCt[1,i]:=1; if (Cto[i]=((kCt[3]+1)/2)) then mCt[2,i]:=0; if (Cto[i]>((kCt[1]+kCt[2])/2)) and (Cto[i]<((kCt[2]+kCt[3])/2)) then mCt[2,i]:=(2*Cto[i]-kCt[1]-kCt[2])/(kCt[3]-kCt[1]); if (Cto[i]>=((kCt[2]+kCt[3])/2)) and (Cto[i]<=((kCt[3]+1)/2)) then mCt[2,i]:=1-((2*Cto[i]-kCt[2]-kCt[3])/(1-kCt[2])); if (Cto[i]((kCt[2]+kCt[3])/2)) then mCt[3,i]:=0; if (Cto[i]>(kCt[1]/2)) and (Cto[i]<((kCt[1]+kCt[2])/2)) then mCt[3,i]:=(2*Cto[i]-kCt[1])/(kCt[2]); if (Cto[i]>=((kCt[1]+kCt[2])/2)) and (Cto[i]<=((kCt[2]+kCt[3])/2)) then mCt[3,i]:=1-(2*Cto[i]-kCt[1]-kCt[2])/(kCt[3]-kCt[1]); if Cto[i]>=((kCt[1]+kCt[2])/2) then mCt[4,i]:=0; if (Cto[i]kCt[1]) then mCt[4,i]:=1-(2*(Cto[i]-kCt[1])/(kCt[2]-kCt[1])); if Cto[i]<=kCt[1] then mCt[4,i]:=1; //----------------------------------Значения ф. принадлежности для Rt if Rto[i]<=((kRt[2]+kRt[3])/2) then mRt[1,i]:=0; if (Rto[i]>((kRt[2]+kRt[3])/2)) and (Rto[i] if Rto[i]>=kRt[3] then mRt[1,i]:=1; if (Rto[i]=((kRt[3]+1)/2)) then mRt[2,i]:=0; if (Rto[i]>((kRt[1]+kRt[2])/2)) and (Rto[i]<((kRt[2]+kRt[3])/2)) then mRt[2,i]:=(2*Rto[i]-kRt[1]-kRt[2])/(kRt[3]-kRt[1]); if (Rto[i]>=((kRt[2]+kRt[3])/2)) and (Rto[i]<=((kRt[3]+1)/2)) then mRt[2,i]:=1-((2*Rto[i]-kRt[2]-kRt[3])/(1-kRt[2])); if (Rto[i]=((kRt[2]+kRt[3])/2)) then mRt[3,i]:=0; if (Rto[i]>=(kRt[1]/2)) and (Rto[i]<((kRt[1]+kRt[2])/2)) then mRt[3,i]:=(2*Rto[i]-kRt[1])/(kRt[2]); if (Rto[i]>=((kRt[1]+kRt[2])/2)) and (Rto[i]<((kRt[2]+kRt[3])/2)) then mRt[3,i]:=1-((2*Rto[i]-kRt[1]-kRt[2])/(kRt[3]-kRt[1])); if Rto[i]>=((kRt[1]+kRt[2])/2) then mRt[4,i]:=0; if (Rto[i]kRt[1]) then mRt[4,i]:=1-(2*(Rto[i]-kRt[1])/(kRt[2]-kRt[1])); if Rto[i]<=kRt[1] then mRt[4,i]:=1; //----------------------------------Значения ф. принадлежности для Vt if Vt[i]<=((kVt[2]+kVt[3])/2) then mVt[4,i]:=0; if (Vt[i]>((kVt[2]+kVt[3])/2)) and (Vt[i] if Vt[i]>=kVt[3] then mVt[4,i]:=1; if (Vt[i]=((kVt[3]+1)/2)) then mVt[3,i]:=0; if (Vt[i]>((kVt[1]+kVt[2])/2)) and (Vt[i]<((kVt[2]+kVt[3])/2)) then mVt[3,i]:=(2*Vt[i]-kVt[1]-kVt[2])/(kVt[3]-kVt[1]); if (Vt[i]((kVt[2]+kVt[3])/2)) then mVt[3,i]:=1-((2*Vt[i]-kVt[2]-kVt[3])/(1-kVt[2])); if (Vt[i]=((kVt[2]+kVt[3])/2)) then mVt[2,i]:=0; if (Vt[i]>(kVt[1]/2)) and (Vt[i]<((kVt[1]+kVt[2])/2)) then mVt[2,i]:=(2*Vt[i]-kVt[1])/(kVt[2]); if (Vt[i]>=((kVt[1]+kVt[2])/2)) and (Vt[i]<=((kVt[2]+kVt[3])/2)) then mVt[2,i]:=1-((2*Vt[i]-kVt[1]-kVt[2])/(kVt[3]-kVt[1])); if Vt[i]>=((kVt[1]+kVt[2])/2) then mVt[1,i]:=0; if (Vt[i]kVt[1]) then mVt[1,i]:=1-(2*(Vt[i]-kVt[1])/(kVt[2]-kVt[1])); if Vt[i]<=kVt[1] then mVt[1,i]:=1; end; //-----------------------------Вывод значений For i:=1 to n do begin str:='('+FloatToStrF(Ct[1,i],ffFixed,9,2)+'; '+FloatToStrF(Ct[2,i],ffFixed,9,2)+')'; Form3.StringGrid1.Cells[1,i]:=str; Form3.StringGrid1.Cells[4,i]:=FloatToStrF(Vt[i],ffFixed,9,2); str:='('+FloatToStrF(NPVvar[1,i],ffFixed,9,2)+'; '+FloatToStrF(NPVvar[2,i],ffFixed,9,2)+'; '+FloatToStrF(NPVvar[3,i],ffFixed,9,2)+')'; Form3.StringGrid1.Cells[2,i]:=str; str:='('+FloatToStrF(Rt[1,i],ffFixed,9,2)+'; '+FloatToStrF(Rt[2,i],ffFixed,9,2)+'; '+FloatToStrF(Rt[3,i],ffFixed,9,2)+')'; Form3.StringGrid1.Cells[3,i]:=str; end; for j:=1 to n do begin // Form3.StringGrid2.Cells[1,j]:=FloatToStr(Cto[j]); // Form3.StringGrid2.Cells[2,j]:=FloatToStr(Rto[j]); k:=1; ii:=1;iv:=1; for i:=2 to 4 do begin if mCt[i-1,j] if mRt[i-1,j] if mVt[i-1,j] end; if k=1 then Form3.StringGrid2.Cells[1,j]:=FloatToStrF(mCt[k,j],ffFixed,9,2)+'-минимальный'; if k=2 then Form3.StringGrid2.Cells[1,j]:=FloatToStrF(mCt[k,j],ffFixed,9,2)+'-повышенный'; if k=3 then Form3.StringGrid2.Cells[1,j]:=FloatToStrF(mCt[k,j],ffFixed,9,2)+'-критический'; if k=4 then Form3.StringGrid2.Cells[1,j]:=FloatToStrF(mCt[k,j],ffFixed,9,2)+'-недопустимый'; if ii=1 then Form3.StringGrid2.Cells[2,j]:=FloatToStrF(mRt[ii,j],ffFixed,9,2)+'-минимальный'; if ii=2 then Form3.StringGrid2.Cells[2,j]:=FloatToStrF(mRt[ii,j],ffFixed,9,2)+'-повышенный'; if ii=3 then Form3.StringGrid2.Cells[2,j]:=FloatToStrF(mRt[ii,j],ffFixed,9,2)+'-критический'; if ii=4 then Form3.StringGrid2.Cells[2,j]:=FloatToStrF(mRt[ii,j],ffFixed,9,2)+'-недопустимый'; if iv=1 then Form3.StringGrid2.Cells[3,j]:=FloatToStrF(mVt[iv,j],ffFixed,9,2)+'-минимальный'; if iv=2 then Form3.StringGrid2.Cells[3,j]:=FloatToStrF(mVt[iv,j],ffFixed,9,2)+'-повышенный'; if iv=3 then Form3.StringGrid2.Cells[3,j]:=FloatToStrF(mVt[iv,j],ffFixed,9,2)+'-критический'; if iv=4 then Form3.StringGrid2.Cells[3,j]:=FloatToStrF(mVt[iv,j],ffFixed,9,2)+'-недопустимый'; //----------------------------------Рассчет общего риска проекта re:=TR[iv,k,ii]; min:=mVt[iv,j]; if mRt[ii,j] if mCt[k,j] if re=1 then begin A1:=0;B1:=0;K1:=0;C1:=0; C2:=(((1-min)*(kre[2]-kre[1]))+2*kre[1])/2; K2:=(kre[1]+kre[2])/2; A2:=(-2/(kre[2]-kre[1])); B2:=1+((2*kre[1])/(kre[2]-kre[1])); end; if re=2 then begin A1:=2/kre[2]; B1:=-kre[1]/kre[2]; K1:=kre[1]/2; C1:=((min*kre[2])+kre[1])/2; C2:=(((1-min)*kre[3])+kre[2]+(min*kre[1]))/2; K2:=(kre[2]+kre[3])/2; A2:=(-2/(kre[3]-kre[1])); B2:=1+((kre[1]+kre[2])/(kre[3]-kre[1])); end; if re=3 then begin A1:=2/(kre[3]-kre[1]); B1:=-(kre[1]+kre[2])/(kre[3]-kre[1]); K1:=(kre[1]+kre[2])/2; C1:=((min*(kre[3]-kre[1]))+kre[1]+kre[2])/2; C2:=(((1-min)*(1-kre[2]))+kre[3]+kre[2])/2; K2:=(kre[3]+1)/2; A2:=(-2/(1-kre[2])); B2:=1-((kre[2]+kre[3])/(1-kre[2])); end; if re=4 then begin A1:=(2/(kre[3]-kre[2])); B1:=-(kre[2]+kre[3])/(kre[3]-kre[2]); K1:=(kre[2]+kre[3])/2; C1:=((min*(kre[3]-kre[2]))+kre[2]+kre[3])/2; C2:=1;K2:=0;A2:=0;B2:=0; end; vrch:=(A1*((C1*C1*C1)-(K1*K1*K1))/3); vrch:=vrch+((B1*((C1*C1)-(K1*K1)))/2); vrch:=vrch+(min*((C2*C2)-(C1*C1))/2); vrch:=vrch+(A2*(((K2*K2*K2)-(C2*C2*C2)))/3)+(B2*((K2*K2)-(C2*C2))/2); vrz:=(A1*((C1*C1)-(K1*K1))/2); vrz:=vrz+(B1*(C1-K1)); vrz:=vrz+(min*(C2-C1)); vrz:=vrz+(A2*((K2*K2)-(C2*C2))/2)+(B2*(K2-C2)); vr:=vrch/vrz; //---------------------- if TR[iv,k,ii]=1 then begin if (vr=((kre[2]+kre[3])/2)) then mvr2:=0; if (vr>(kre[1]/2)) and (vr<((kre[1]+kre[2])/2)) then mvr2:=(2*vr-kre[1])/(kre[2]); if (vr>=((kre[1]+kre[2])/2)) and (vr<=((kre[2]+kre[3])/2)) then mvr2:=1-((2*vr-kre[1]-kre[2])/(kre[3]-kre[1])); if vr>=((kre[1]+kre[2])/2) then mvr1:=0; if (vrC2) then mvr1:=1-(2*(vr-kre[1])/(kre[2]-kre[1])); if vr<=C2 then mvr1:=min; if mvr2>mvr1 then re:=2; end; if TR[iv,k,ii]=2 then begin if (vr=((kre[3]+1)/2)) then mvr3:=0; if (vr>((kre[1]+kre[2])/2)) and (vr<((kre[2]+kre[3])/2)) then mvr3:=(2*vr-kre[1]-kre[2])/(kre[3]-kre[1]); if (vr((kre[2]+kre[3])/2)) then mvr3:=1-((2*vr-kre[2]-kre[3])/(1-kre[2])); if (vr=((kre[2]+kre[3])/2)) then mvr2:=0; if (vr>(kre[1]/2)) and (vr if (vr>=C1) and (vr<=C2) then mvr2:=min; if (vr>=C2) and (vr<((kre[2]+kre[3])/2)) then mvr2:=1-((2*vr-kre[1]-kre[2])/(kre[3]-kre[1])); if vr>=((kre[1]+kre[2])/2) then mvr1:=0; if (vrkre[1]) then mvr1:=1-(2*(vr-kre[1])/(kre[2]-kre[1])); if vr<=kre[1] then mvr1:=1; if mvr1>mvr2 then re:=1; if mvr3>mvr2 then re:=3; end; if TR[iv,k,ii]=3 then begin if vr<=((kre[2]+kre[3])/2) then mvr4:=0; if (vr>((kre[2]+kre[3])/2)) and (vr if vr>=kre[3] then mvr4:=1; if (vr=((kre[3]+1)/2)) then mvr3:=0; if (vr>((kre[1]+kre[2])/2)) and (vr if (vr>=C1) and (vr<=C2) then mvr3:=min; if (vrC2) then mvr3:=1-((2*vr-kre[2]-kre[3])/(1-kre[2])); if (vr=((kre[2]+kre[3])/2)) then mvr2:=0; if (vr>(kre[1]/2)) and (vr<((kre[1]+kre[2])/2)) then mvr2:=(2*vr-kre[1])/(kre[2]); if (vr>=((kre[1]+kre[2])/2)) and (vr<=((kre[2]+kre[3])/2)) then mvr2:=1-((2*vr-kre[1]-kre[2])/(kre[3]-kre[1])); if mvr4>mvr3 then re:=4; if mvr2>mvr3 then re:=2; end; if TR[iv,k,ii]=4 then begin if vr<=((kre[2]+kre[3])/2) then mvr4:=0; if (vr>((kre[2]+kre[3])/2)) and (Vt[i] if vr>=C1 then mvr4:=min; if (vr=((kre[3]+1)/2)) then mvr3:=0; if (vr>((kre[1]+kre[2])/2)) and (vr<((kre[2]+kre[3])/2)) then mvr3:=(2*vr-kre[1]-kre[2])/(kre[3]-kre[1]); if (vr((kre[2]+kre[3])/2)) then mvr3:=1-((2*vr-kre[2]-kre[3])/(1-kre[2])); if mvr3>mvr4 then re:=3; end; //--------------------- if re=1 then begin Form3.StringGrid2.Cells[4,j]:=FloatToStrF(vr,ffFixed,9,2)+'-минимальный'; Edit4.Text:='минимальный'; end; if re=2 then begin Form3.StringGrid2.Cells[4,j]:=FloatToStrF(vr,ffFixed,9,2)+'-повышенный'; Edit4.Text:='повышенный'; end; if re=3 then begin Form3.StringGrid2.Cells[4,j]:=FloatToStrF(vr,ffFixed,9,2)+'-критический'; Edit4.Text:='критический'; end; if re=4 then begin Form3.StringGrid2.Cells[4,j]:=FloatToStrF(vr,ffFixed,9,2)+'-недопустимый'; Edit4.Text:='недопустимый'; end; end; Edit3.Text:=FloatToStrF(vr,ffFixed,9,2); end; procedure TForm1.N7Click(Sender: TObject); begin Form2.Show; end; procedure TForm1.N3Click(Sender: TObject); Var Myfile : Textfile; Date : String; begin If (saveDialog1.Execute) then begin AssignFile(Myfile,Savedialog1.FileName); Try Rewrite(myFile); Except Showmessage('Ошибка при чтении файла!'); Exit; end; Date:=IntToStr(SpinEdit1.Value);WriteLn(MyFile,Date); Date:=Edit1.Text;WriteLn(MyFile,Date); Date:=Edit2.Text;WriteLn(MyFile,Date); For i:=0 to n-1 do begin Date:=StringGrid1.Cells[i,1]; WriteLn(Myfile,Date); end; For i:=0 to n-1 do begin Date:=StringGrid2.Cells[i,1]; WriteLn(Myfile,Date); End; For i:=0 to n-1 do begin Date:=StringGrid3.Cells[i,1]; WriteLn(Myfile,Date); End; Date:=IntToStr(StringGrid4.ColCount);WriteLn(Myfile,Date); For i:=0 to StringGrid4.ColCount-1 do begin Date:=StringGrid4.Cells[i,1]; WriteLn(Myfile,Date); End; With Form2 do begin Date:=IntToStr(SpinEdit1.Value);WriteLn(Myfile,Date); Date:=Edit1.Text;WriteLn(Myfile,Date); For i:=0 to nRt-1 do begin Date:=StringGrid1.Cells[i,1]; WriteLn(Myfile,Date); end; For i:=0 to nRt-1 do begin Date:=StringGrid2.Cells[i,1]; WriteLn(Myfile,Date); end; end; Closefile(myFile); end else Begin Showmessage('Ошибка!'); Exit;end; end; procedure TForm1.N4Click(Sender: TObject); Var Myfile : Textfile; Date : String; begin If (OpenDialog1.Execute) then begin AssignFile(Myfile,Opendialog1.FileName); Try Reset(myFile); Except Showmessage('Ошибка при чтении файла!'); Exit; end; ReadLn(MyFile,Date);SpinEdit1.Value:=StrToInt(Date);n:=StrToInt(Date); ReadLn(MyFile,Date);Edit1.Text:=Date; ReadLn(MyFile,Date);Edit2.Text:=Date; For i:=0 to n-1 do begin ReadLn(MyFile,Date); StringGrid1.Cells[i,1]:=Date; end; For i:=0 to n-1 do begin ReadLn(MyFile,Date); StringGrid2.Cells[i,1]:=Date; End; For i:=0 to n-1 do begin ReadLn(MyFile,Date); StringGrid3.Cells[i,1]:=Date; End; ReadLn(MyFile,Date);StringGrid4.ColCount:=StrToInt(Date); For i:=0 to StringGrid4.ColCount-1 do begin ReadLn(MyFile,Date); StringGrid4.Cells[i,1]:=Date; End; With Form2 do begin ReadLn(MyFile,Date);SpinEdit1.Value:=StrToInt(Date); nRt:=StrToInt(Date);StringGrid1.ColCount:=nRt;StringGrid2.ColCount:=nRt; ReadLn(MyFile,Date);Edit1.Text:=Date; For i:=0 to nRt-1 do begin ReadLn(MyFile,Date); StringGrid1.Cells[i,1]:=Date; end; For i:=0 to nRt-1 do begin ReadLn(MyFile,Date); StringGrid2.Cells[i,1]:=Date; end; end; Closefile(myFile); if StringGrid4.ColCount=1 then CheckBox1.Checked:=true; end else Begin Showmessage('Файл не найден!'); Exit;end; end; procedure TForm1.N6Click(Sender: TObject); begin Form4.Show; end; procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char); begin Case key of chr(45),chr(48),chr(49),chr(50),chr(51),chr(52),chr(53),chr(54), chr(55),chr(56),chr(57),chr(44),chr(8):; else key:=chr(0); end; end; procedure TForm1.N5Click(Sender: TObject); begin Form5.show; end; procedure TForm1.N9Click(Sender: TObject); begin Form6.show; end; procedure TForm1.Button1Click(Sender: TObject); begin Form3.Show; end; end. unit Rtmodul; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Spin; type TForm2 = class(TForm) GroupBox1: TGroupBox; Label1: TLabel; SpinEdit1: TSpinEdit; Label2: TLabel; Edit1: TEdit; GroupBox2: TGroupBox; StringGrid1: TStringGrid; GroupBox3: TGroupBox; StringGrid2: TStringGrid; Panel1: TPanel; BitBtn1: TBitBtn; BitBtn2: TBitBtn; procedure SpinEdit1Change(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure FormCreate(Sender: TObject); procedure StringGrid1KeyPress(Sender: TObject; var Key: Char); procedure StringGrid2KeyPress(Sender: TObject; var Key: Char); procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form2: TForm2; Rtkey : boolean; i,j,ii : integer; NPVpmin,NPVpmax,NPVpav,smin,smax : real;{прогнозное значение NPV для интервала} implementation uses datamodul; {$R *.dfm} procedure TForm2.SpinEdit1Change(Sender: TObject); begin nRt:=SpinEdit1.Value; StringGrid1.ColCount:=nRt; StringGrid2.ColCount:=nRt; for i:=1 to nRt do begin StringGrid1.Cells[i-1,0]:=IntToStr(i); StringGrid2.Cells[i-1,0]:=IntToStr(i); end; end; procedure TForm2.Edit1KeyPress(Sender: TObject; var Key: Char); begin Case key of chr(45),chr(48),chr(49),chr(50),chr(51),chr(52),chr(53),chr(54), chr(55),chr(56),chr(57),chr(44),chr(8):; else key:=chr(0); end; end; procedure TForm2.FormCreate(Sender: TObject); begin nRt:=n; StringGrid1.ColCount:=nRt; StringGrid2.ColCount:=nRt; for j:=0 to nRt-1 do begin StringGrid1.Cells[j,0]:=IntToStr(j+1); StringGrid2.Cells[j,0]:=IntToStr(j+1); end; For i:=1 to n do begin RSvar[i]:=0; Rdvar[i]:=0; end; end; procedure TForm2.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin Case key of chr(45),chr(48),chr(49),chr(50),chr(51),chr(52),chr(53),chr(54), chr(55),chr(56),chr(57),chr(44),chr(8):; else key:=chr(0); end; end; procedure TForm2.StringGrid2KeyPress(Sender: TObject; var Key: Char); begin Case key of chr(45),chr(48),chr(49),chr(50),chr(51),chr(52),chr(53),chr(54), chr(55),chr(56),chr(57),chr(44),chr(8):; else key:=chr(0); end; end; procedure TForm2.BitBtn1Click(Sender: TObject); begin //----------------------------- Ввод значений в массив для рассчета коэф-та ликвидности Rt try Ir:=StrToFloat(Edit1.Text); Except Ir:=0; Edit1.Text:=IntToStr(0); end; for i:=1 to nRt do begin try RSvar[i]:=StrToFloat(StringGrid2.Cells[i-1,1]); Except StringGrid2.Cells[i-1,1]:=IntToStr(0); end; try Rdvar[i]:=StrToFloat(StringGrid1.Cells[i-1,1]); Except StringGrid1.Cells[i-1,1]:=IntToStr(0); end; end; Rtkey:=true; Form2.Hide; Form1.Show; end; procedure TForm2.BitBtn2Click(Sender: TObject); begin