Студопедия

Главная страница Случайная страница

КАТЕГОРИИ:

АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника






Листинг программного кода Delphi




unit Unit1;

interface

uses

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

Dialogs, Mask, StdCtrls, ComObj, jpeg, ExtCtrls;

type

TForm1 = class(TForm)

users: TCombobox;

Password: TEdit;

Label1: TLabel;

Label2: TLabel;

Button1: TButton;

Memo1: TMemo;

Memo2: TMemo;

Image1: TImage;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses unit2, unit5, unit3, unit4, unit6;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var

i:byte;

begin

if (users.Text = memo2.lines[0] ) and (password.text = memo1.lines[0]) or (users.Text = memo2.lines[1] ) and (password.text = memo1.lines[1]) or (users.Text = memo2.lines[2] ) and (password.text = memo1.lines[2])then

begin

form4.show;

form1.Hide;

end

else

begin

showmessage('Неверный пароль');

password.Clear;

end;

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);

begin

excel1.Workbooks.Close;

excel2.Workbooks.Close;

excel3.Workbooks.Close;

excel1.Application.Quit;

excel2.Application.Quit;

excel3.Application.Quit;

excel1 := Unassigned;

excel2 := Unassigned;

excel3 := Unassigned;

end;

procedure TForm1.FormCreate(Sender: TObject);

var

t1:textfile;

user, pass:string;

begin

memo1.Clear;

memo2.Clear;

assignfile(t1,GetCurrentDir() + '\Документы\Пользователи.txt');

reset(t1);

while not eof(t1) do begin

readln(t1, user);

readln(t1, pass);

users.Items.Add(user);

memo2.Lines.Add(user);

memo1.Lines.Add(pass);

end;

end;

end.

unit Unit2;

interface

uses

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

Dialogs, unit1, Menus, Grids, ComObj, StdCtrls, jpeg, ExtCtrls;

type

TForm2 = class(TForm)

MainMenu1: TMainMenu;

tovar: TMenuItem;

sg1: TStringGrid;

Button1: TButton;

Button3: TButton;

sell: TMenuItem;

stat: TMenuItem;

Label1: TLabel;

Label2: TLabel;

N1: TMenuItem;

Image1: TImage;

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure sellClick(Sender: TObject);

procedure FormShow(Sender: TObject);

procedure N1Click(Sender: TObject);

procedure statClick(Sender: TObject);



private

{ Private declarations }

public

{ Public declarations }

end;

var

Form2: TForm2;

excel1: Variant;

implementation

uses

unit3, unit4, unit5, unit6;

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);

begin

form3.show;

end;

procedure TForm2.Button3Click(Sender: TObject);

var

i:byte;

begin

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

excel1.ActiveSheet.cells[i+1,1]:=sg1.Cells[0,i];

excel1.ActiveSheet.cells[i+1,2]:=sg1.Cells[1,i];

excel1.ActiveSheet.cells[i+1,3]:=sg1.Cells[2,i];

excel1.ActiveSheet.cells[i+1,4]:=sg1.Cells[3,i];

excel1.ActiveSheet.cells[i+1,5]:=sg1.Cells[4,i];

excel1.ActiveSheet.cells[i+1,6]:=sg1.Cells[5,i];

end;

excel1.DisplayAlerts := False;

excel1.ActiveWorkBook.Saveas(GetCurrentDir() + '\Документы\товары.xls');

end;

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.close;

end;

procedure TForm2.FormCreate(Sender: TObject);

var

rows,i, k, k1, j, kmax:byte;

begin

sg1.Cells[0,0]:='Артикул';

sg1.Cells[1,0]:='Наименование';

sg1.Cells[2,0]:='Производитель';

sg1.Cells[3,0]:='Типтовара';

sg1.Cells[4,0]:='Количество';

sg1.Cells[5,0]:='Стоимость';

excel1 := CreateOleObject('excel.Application');

excel1.Workbooks.Open[GetCurrentDir() + '\Документы\товары.xls'];

rows:=excel1.ActiveSheet.UsedRange.Rows.Count-1;

for i := 1 to rows do

begin

sg1.Cells[0,i]:=excel1.ActiveSheet.cells[i+1,1];

sg1.Cells[1,i]:=excel1.ActiveSheet.cells[i+1,2];

sg1.Cells[2,i]:=excel1.ActiveSheet.cells[i+1,3];



sg1.Cells[3,i]:=excel1.ActiveSheet.cells[i+1,4];

sg1.Cells[4,i]:=excel1.ActiveSheet.cells[i+1,5];

sg1.Cells[5,i]:=excel1.ActiveSheet.cells[i+1,6];

sg1.RowCount:=sg1.RowCount +1;

end;

sg1.RowCount:=sg1.RowCount -1;

end;

procedure TForm2.FormShow(Sender: TObject);

begin

label2.caption:=form1.users.Text;

end;

procedure TForm2.N1Click(Sender: TObject);

begin

form1.Show;

form2.Hide;

end;

procedure TForm2.sellClick(Sender: TObject);

begin

form4.show;

form2.Hide;

end;

 

procedure TForm2.statClick(Sender: TObject);

begin

form6.show;

form2.Hide;

end;

end.

unit Unit3;

 

interface

 

uses

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

Dialogs, StdCtrls, jpeg, ExtCtrls;

 

type

TForm3 = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Edit1: TEdit;

Button1: TButton;

ComboBox5: TComboBox;

Label7: TLabel;

Edit3: TEdit;

Label8: TLabel;

Button2: TButton;

Edit5: TEdit;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

ComboBox3: TComboBox;

ComboBox4: TComboBox;

Label9: TLabel;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

Image1: TImage;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure FormShow(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

uses unit2, unit1;

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);

var

i:byte;

begin

for i := 1 to form2.sg1.RowCount-1 do begin

if combobox5.Text = form2.sg1.Cells[0,i] then

form2.sg1.Cells[4,i]:=inttostr(strtoint(form2.sg1.Cells[4,i])+strtoint(edit3.text));

end;

end;

procedure TForm3.Button2Click(Sender: TObject);

var

i:byte;

begin

form2.sg1.RowCount:=form2.sg1.RowCount+1;

form2.sg1.Cells[0,form2.sg1.RowCount-1]:=combobox1.Text;

form2.sg1.Cells[1,form2.sg1.RowCount-1]:=combobox2.Text;

form2.sg1.Cells[2,form2.sg1.RowCount-1]:=combobox3.Text;

form2.sg1.Cells[3,form2.sg1.RowCount-1]:=combobox4.Text;

form2.sg1.Cells[4,form2.sg1.RowCount-1]:=edit1.Text;

form2.sg1.Cells[5,form2.sg1.RowCount-1]:=edit5.Text;

end;

procedure TForm3.FormCreate(Sender: TObject);

var

i:byte;

sl: TStringList;

begin

for i := 1 to form2.sg1.rowcount - 1 do begin

combobox5.Items.Add(form2.sg1.cells[0,i])

end;

sl := TStringList.Create;

sl.Duplicates := dupIgnore;

sl.sorted := true;

sl.AddStrings(combobox5.Items);

Combobox5.Items := sl;

sl.Free;

for i := 1 to form2.sg1.rowcount - 1 do begin

combobox1.Items.Add(form2.sg1.cells[0,i])

end;

sl := TStringList.Create;

sl.Duplicates := dupIgnore;

sl.sorted := true;

sl.AddStrings(combobox1.Items);

Combobox1.Items := sl;

sl.Free;

for i := 1 to form2.sg1.rowcount - 1 do begin

combobox2.Items.Add(form2.sg1.cells[1,i])

end;

sl := TStringList.Create;

sl.Duplicates := dupIgnore;

sl.sorted := true;

sl.AddStrings(combobox2.Items);

Combobox2.Items := sl;

sl.Free;

for i := 1 to form2.sg1.rowcount - 1 do begin

combobox3.Items.Add(form2.sg1.cells[2,i])

end;

sl := TStringList.Create;

sl.Duplicates := dupIgnore;

sl.sorted := true;

sl.AddStrings(combobox3.Items);

Combobox3.Items := sl;

sl.Free;

for i := 1 to form2.sg1.rowcount - 1 do begin

combobox4.Items.Add(form2.sg1.cells[3,i])

end;

sl := TStringList.Create;

sl.Duplicates := dupIgnore;

sl.sorted := true;

sl.AddStrings(combobox4.Items);

Combobox4.Items := sl;

sl.Free;

end;

procedure TForm3.FormShow(Sender: TObject);

begin

label12.caption:=form1.users.Text;

end;

end.

unit Unit6;

interface

uses

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

Dialogs, Menus, StdCtrls, TeEngine, ExtCtrls, TeeProcs, Chart, Series, Grids, ComObj, DateUtils,

jpeg;

type

TForm6 = class(TForm)

MainMenu1: TMainMenu;

N1: TMenuItem;

Tovar: TMenuItem;

sell: TMenuItem;

stat: TMenuItem;

sg1: TStringGrid;

Button1: TButton;

Image1: TImage;

Button2: TButton;

Button3: TButton;

procedure TovarClick(Sender: TObject);

procedure sellClick(Sender: TObject);

procedure FormClose(Sender: TObject; var Action: TCloseAction);

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure N1Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form6: TForm6;

excel3: variant;

implementation

uses unit2, unit4, unit1;

{$R *.dfm}

procedure TForm6.Button1Click(Sender: TObject);

var

i , j:byte;

begin

for j := 1 to 12 do begin

for i := 1 to form4.sg1.RowCount-1 do begin

if monthof(strtodate(form4.sg1.Cells[0,i])) = strtoint(sg1.Cells[0,j]) then begin

sg1.Cells[2,j]:=inttostr((strtoint(sg1.Cells[2,j]))+strtoint(form4.sg1.Cells[6,i]));

end;

end;

if sg1.Cells[2,j]<>'0' then

sg1.Cells[3,j]:=inttostr(strtoint(sg1.Cells[2,j])-strtoint(sg1.Cells[1,j]));

end;

end;

procedure TForm6.Button2Click(Sender: TObject);

var

i:byte;

begin

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

excel3.ActiveSheet.cells[i+1,1]:=sg1.Cells[0,i];

excel3.ActiveSheet.cells[i+1,2]:=sg1.Cells[1,i];

excel3.ActiveSheet.cells[i+1,3]:=sg1.Cells[2,i];

excel3.ActiveSheet.cells[i+1,4]:=sg1.Cells[3,i];

end;

excel3.DisplayAlerts := False;

excel3.ActiveWorkBook.Saveas(GetCurrentDir() + '\Документы\План.xls');

end;

procedure TForm6.Button3Click(Sender: TObject);

begin

Excel3.ActiveWorkBook.Sheets.Item[2].Activate;

Excel3.visible:=true;

end;

procedure Tform6.FormClose(Sender: TObject; var Action: TCloseAction);

begin

form1.close;

end;

procedure TForm6.FormCreate(Sender: TObject);

var

rows, rows2, i:byte;

begin

sg1.Cells[0,0]:='Месяц';

sg1.Cells[1,0]:='Запланировано';

sg1.Cells[2,0]:='Выполнено';

sg1.Cells[3,0]:='Разница';

excel3 := CreateOleObject('excel.Application');

excel3.Workbooks.Open[GetCurrentDir() + '\Документы\План.xls'];

rows:=excel3.ActiveSheet.UsedRange.Rows.Count-1;

for i := 1 to rows do

begin

sg1.Cells[0,i]:=excel3.ActiveSheet.cells[i+1,1];

sg1.Cells[1,i]:=excel3.ActiveSheet.cells[i+1,2];

sg1.Cells[2,i]:=excel3.ActiveSheet.cells[i+1,3];

sg1.Cells[3,i]:=excel3.ActiveSheet.cells[i+1,4];

sg1.RowCount:=sg1.RowCount +1;

end;

sg1.RowCount:=sg1.RowCount -1;

end;

procedure TForm6.N1Click(Sender: TObject);

begin

form1.Show;

form6.Hide;

end;

procedure TForm6.sellClick(Sender: TObject);

begin

form4.show;

form6.Hide;

end;

procedure TForm6.TovarClick(Sender: TObject);

begin

form2.show;

form6.Hide;

end;

end.

Дипломный проект выполнен мной совершенно самостоятельно. Все использованные в работе материалы и концепции из опубликованных научной литературы и других источников отображены в списке использованных источников .

 

__________________/________________/Садиров Умеджон Асатулоевич

Дата Подпись Фамилия, Имя, Отчество

 


mylektsii.ru - Мои Лекции - 2015-2019 год. (0.022 сек.)Все материалы представленные на сайте исключительно с целью ознакомления читателями и не преследуют коммерческих целей или нарушение авторских прав Пожаловаться на материал