Разработка инвестиционного проекта ОАО "Завод по производству труб большого диаметра"

Дипломная работа - Экономика

Другие дипломы по предмету Экономика

bsp;

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

nRt:=n;

Rtkey:=false;

Form2.Close;

end;

 

end.

 

unit Formirmodul;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, Grids, StdCtrls, Menus;

 

type

TForm4 = class(TForm)

MainMenu1: TMainMenu;

N1: TMenuItem;

N2: TMenuItem;

N3: TMenuItem;

N4: TMenuItem;

N5: TMenuItem;

N6: TMenuItem;

N7: TMenuItem;

GroupBox1: TGroupBox;

Label1: TLabel;

StringGrid1: TStringGrid;

GroupBox2: TGroupBox;

StringGrid2: TStringGrid;

SaveDialog1: TSaveDialog;

OpenDialog1: TOpenDialog;

procedure FormCreate(Sender: TObject);

procedure N5Click(Sender: TObject);

procedure N6Click(Sender: TObject);

procedure N3Click(Sender: TObject);

procedure N2Click(Sender: TObject);

procedure N7Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

Form4: TForm4;

i,j,t : integer;

PlusSi,MinusSi : array[1..3,1..20] of real;

implementation

 

uses datamodul;

 

{$R *.dfm}

 

procedure TForm4.FormCreate(Sender: TObject);

begin

StringGrid1.ColCount:=n+1;

StringGrid2.ColCount:=n+1;

StringGrid1.Cells[0,1]:='Доходы от реализации продукции';

StringGrid1.Cells[0,2]:='Возмещение НДС по инвестиции';

StringGrid1.Cells[0,3]:='Амортизация';

StringGrid2.Cells[0,1]:='Инвестиции (включая НДС)';

StringGrid2.Cells[0,2]:='Прирост оборотных средств';

StringGrid2.Cells[0,3]:='Эксплутационные затраты';

StringGrid2.Cells[0,4]:='Налоги';

For i:=1 to n do begin

StringGrid1.Cells[i,0]:=IntToStr(i);

StringGrid2.Cells[i,0]:=IntToStr(i);

end;

end;

 

procedure TForm4.N5Click(Sender: TObject);

begin

if StringGrid1.Focused then StringGrid1.RowCount:=StringGrid1.RowCount+1;

if StringGrid2.Focused then StringGrid2.RowCount:=StringGrid2.RowCount+1;

end;

 

procedure TForm4.N6Click(Sender: TObject);

begin

if StringGrid1.Focused then StringGrid1.RowCount:=StringGrid1.RowCount-1;

if StringGrid2.Focused then StringGrid2.RowCount:=StringGrid2.RowCount-1;

end;

 

procedure TForm4.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(StringGrid1.RowCount);WriteLn(MyFile,Date);

Date:=IntToStr(StringGrid2.RowCount);WriteLn(MyFile,Date);

For j:=0 to n do begin

For i:=0 to StringGrid1.RowCount-1 do begin

Date:=StringGrid1.Cells[j,i];

WriteLn(Myfile,Date);

end;

end;

For j:=0 to n do begin

For i:=0 to StringGrid2.RowCount-1 do begin

Date:=StringGrid2.Cells[j,i];

WriteLn(Myfile,Date);

end;

end;

Closefile(myFile);

end

else Begin Showmessage('Ошибка!'); Exit;end;

end;

 

procedure TForm4.N2Click(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);StringGrid1.RowCount:=StrToInt(Date);

ReadLn(MyFile,Date);StringGrid2.RowCount:=StrToInt(Date);

For j:=0 to n do begin

For i:=0 to StringGrid1.RowCount-1 do begin

ReadLn(MyFile,Date);

StringGrid1.Cells[j,i]:=Date;

end;

end;

For j:=0 to n do begin

For i:=0 to StringGrid2.RowCount-1 do begin

ReadLn(MyFile,Date);

StringGrid2.Cells[j,i]:=Date;

end;

end;

Closefile(myFile);

end

else Begin Showmessage('Файл не найден!'); Exit;end;

end;

 

procedure TForm4.N7Click(Sender: TObject);

var

str,str2 : string;

k : integer;

begin

for t:=1 to n do begin

for j:=1 to 3 do begin

PlusSi[j,t]:=0;

end;

end;

 

for t:=1 to n do begin

for i:=1 to StringGrid1.RowCount-1 do begin

str:=StringGrid1.Cells[t,i];

if pos(';',str)<>0 then begin str2:='';k:=1;

for j:=1 to Length(str)do begin

if (str[j]<>';') then str2:=str2+str[j]

else begin

PlusSi[k,t]:=PlusSi[k,t]+StrToFloat(str2);

k:=k+1;str2:='';

end;

if j=Length(str) then PlusSi[k,t]:=PlusSi[k,t]+StrToFloat(str2);

end;

end else try