Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
trpo.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
1.66 Mб
Скачать

Приложение а Листинг программы

unit Unit1;

interface

uses

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

Dialogs, ActnList, XPStyleActnCtrls, ActnMan, ImgList, ActnCtrls,

ToolWin, ActnMenus, ActnColorMaps, ExtCtrls, DBCtrls, Grids, DBGrids, DB,

ComCtrls, jpeg, ADODB, StdCtrls;

type

TForm1 = class(TForm)

ActionMainMenuBar1: TActionMainMenuBar;

ImageList1: TImageList;

ActionManager1: TActionManager;

Action1: TAction;

Action2: TAction;

Action3: TAction;

Action4: TAction;

Action5: TAction;

Action8: TAction;

Action9: TAction;

ActionToolBar1: TActionToolBar;

TwilightColorMap2: TTwilightColorMap;

PageControl1: TPageControl;

TabSheet1: TTabSheet;

Image1: TImage;

DBGrid1: TDBGrid;

DBNavigator1: TDBNavigator;

TabSheet3: TTabSheet;

Image3: TImage;

DBGrid3: TDBGrid;

DBNavigator2: TDBNavigator;

TabSheet4: TTabSheet;

Image4: TImage;

DBGrid4: TDBGrid;

DBNavigator3: TDBNavigator;

TabSheet5: TTabSheet;

Image5: TImage;

DBGrid5: TDBGrid;

DBNavigator5: TDBNavigator;

Action11: TAction;

Action12: TAction;

Action13: TAction;

Action14: TAction;

Action7: TAction;

Action10: TAction;

Action15: TAction;

Action16: TAction;

Action17: TAction;

Button1: TButton;

GroupBox1: TGroupBox;

RadioButton1: TRadioButton;

RadioButton2: TRadioButton;

Edit1: TEdit;

ComboBox1: TComboBox;

Button2: TButton;

Edit3: TEdit;

Button4: TButton;

ComboBox3: TComboBox;

GroupBox3: TGroupBox;

Edit4: TEdit;

Button5: TButton;

GroupBox4: TGroupBox;

RadioButton3: TRadioButton;

RadioButton4: TRadioButton;

ComboBox4: TComboBox;

GroupBox5: TGroupBox;

RadioButton5: TRadioButton;

RadioButton6: TRadioButton;

Button6: TButton;

Edit5: TEdit;

ComboBox5: TComboBox;

RadioButton9: TRadioButton;

Panel1: TPanel;

Label1: TLabel;

Timer1: TTimer;

TabSheet2: TTabSheet;

Image2: TImage;

DBGrid2: TDBGrid;

DBNavigator4: TDBNavigator;

Edit2: TEdit;

ComboBox2: TComboBox;

Button3: TButton;

GroupBox2: TGroupBox;

RadioButton7: TRadioButton;

RadioButton8: TRadioButton;

FindEdit: TEdit;

Action6: TAction;

procedure Action8Execute(Sender: TObject);

procedure Action9Execute(Sender: TObject);

procedure Action3Execute(Sender: TObject);

procedure Action5Execute(Sender: TObject);

procedure Action6Execute(Sender: TObject);

procedure Action7Execute(Sender: TObject);

procedure Action1Execute(Sender: TObject);

procedure Action2Execute(Sender: TObject);

procedure Action11Execute(Sender: TObject);

procedure Action12Execute(Sender: TObject);

procedure Action13Execute(Sender: TObject);

procedure Action14Execute(Sender: TObject);

procedure Action10Execute(Sender: TObject);

procedure Action15Execute(Sender: TObject);

procedure Action16Execute(Sender: TObject);

procedure Action17Execute(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure RadioButton1Click(Sender: TObject);

procedure RadioButton2Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

procedure Button4Click(Sender: TObject);

procedure Button5Click(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

procedure RadioButton3Click(Sender: TObject);

procedure RadioButton4Click(Sender: TObject);

procedure RadioButton9Click(Sender: TObject);

procedure RadioButton7Click(Sender: TObject);

procedure RadioButton8Click(Sender: TObject);

procedure RadioButton5Click(Sender: TObject);

procedure RadioButton6Click(Sender: TObject);

procedure FindEditChange(Sender: TObject);

procedure Action4Execute(Sender: TObject);

procedure Button7Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

uses Unit2, Unit3, Unit4, Unit5, Unit6, Unit7;

{$R *.dfm}

procedure TForm1.Action8Execute(Sender: TObject);

begin

Winhelp(Form1.Handle,'Копия Helpi.hlp',HELP_CONTEXT,1); / / Вызов справки

end;

procedure TForm1.Action9Execute(Sender: TObject);

begin

Form3.Show; // Открытие новой формы

end;

procedure TForm1.Action3Execute(Sender: TObject);

begin

DataModule2.BookTable1.Cancel; // отмена ввода в поле

DataModule2.BookTable2.Cancel;

DataModule2.BookTable3.Cancel;

DataModule2.BookTable4.Cancel;

DataModule2.BookTable5.Cancel;

end;

procedure TForm1.Action5Execute(Sender: TObject);

begin

DataModule2.BookTable1.Insert; //Добавить строку в таблицу

DBGrid1.SetFocus;

Form6.Show;

end;

procedure TForm1.Action6Execute(Sender: TObject);

begin

Form5.QuickRep1.PreviewModal;

end;

procedure TForm1.Action7Execute(Sender: TObject);

begin

DataModule2.BookTable1.Delete; //Удалить строку

end;

procedure TForm1.Action1Execute(Sender: TObject);

begin

Form4.QuickRep1.PreviewModal;

end;

procedure TForm1.Action2Execute(Sender: TObject);

begin

if DataModule2.BookTable1.Modified then

DataModule2.BookTable1.Post; //Сохранить введённые данные

if DataModule2.BookTable2.Modified then

DataModule2.BookTable2.Post;

if DataModule2.BookTable3.Modified then

DataModule2.BookTable3.Post;

if DataModule2.BookTable4.Modified then

DataModule2.BookTable4.Post;

if DataModule2.BookTable5.Modified then

DataModule2.BookTable5.Post;

Form1.close;

end;

procedure TForm1.Action11Execute(Sender: TObject);

begin

DataModule2.BookTable2.Insert;

DBGrid1.SetFocus;

Form7.Show;

end;

procedure TForm1.Action12Execute(Sender: TObject);

begin

DataModule2.BookTable3.Insert;

DBGrid1.SetFocus;

end;

procedure TForm1.Action13Execute(Sender: TObject);

begin

DataModule2.BookTable4.Insert;

DBGrid1.SetFocus;

end;

procedure TForm1.Action14Execute(Sender: TObject);

begin

DataModule2.BookTable5.Insert;

DBGrid1.SetFocus;

end;

procedure TForm1.Action10Execute(Sender: TObject);

begin

DataModule2.BookTable2.Delete;

end;

procedure TForm1.Action15Execute(Sender: TObject);

begin

DataModule2.BookTable3.Delete;

end;

procedure TForm1.Action16Execute(Sender: TObject);

begin

DataModule2.BookTable4.Delete;

end;

procedure TForm1.Action17Execute(Sender: TObject);

begin

DataModule2.BookTable5.Delete;

end;

procedure TForm1.Button1Click(Sender: TObject);

begin

if DataModule2.BookTable1.Modified then

DataModule2.BookTable1.Post;

if DataModule2.BookTable2.Modified then

DataModule2.BookTable2.Post;

if DataModule2.BookTable3.Modified then

DataModule2.BookTable3.Post;

if DataModule2.BookTable4.Modified then

DataModule2.BookTable4.Post;

if DataModule2.BookTable5.Modified then

DataModule2.BookTable5.Post;

end;

procedure TForm1.RadioButton1Click(Sender: TObject);

begin

DataModule2 . BookTable1 . IndexFieldNames := ' Фамилия ' ; // Сортировка

end;

procedure TForm1.RadioButton2Click(Sender: TObject);

begin

DataModule2 . BookTable1 . IndexFieldNames := ' Дата ' ;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

//Поиск

DataModule2.BookTable1.Locate(combobox1.Text,edit1.Text,[locaseinsensitive]);

DataModule2.BookTable1.Locate(combobox1.Text,edit1.Text,[lopartialkey]);

DataModule2.BookTable1.Locate(combobox1.Text,edit1.Text,[locaseinsensitive,lopartialkey]);

end;

procedure TForm1.Button3Click(Sender: TObject);

begin

DataModule2.BookTable2.Locate(combobox2.Text,edit2.Text,[locaseinsensitive]);

DataModule2.BookTable2.Locate(combobox2.Text,edit2.Text,[lopartialkey]);

DataModule2.BookTable2.Locate(combobox2.Text,edit2.Text,[locaseinsensitive,lopartialkey]);

end;

procedure TForm1.Button4Click(Sender: TObject);

begin

DataModule2.BookTable3.Locate(combobox3.Text,edit3.Text,[locaseinsensitive]);

DataModule2.BookTable3.Locate(combobox3.Text,edit3.Text,[lopartialkey]);

DataModule2.BookTable3.Locate(combobox3.Text,edit3.Text,[locaseinsensitive,lopartialkey]);

end;

procedure TForm1.Button5Click(Sender: TObject);

begin

DataModule2.BookTable4.Locate(combobox4.Text,edit4.Text,[locaseinsensitive]);

DataModule2.BookTable4.Locate(combobox4.Text,edit4.Text,[lopartialkey]);

DataModule2.BookTable4.Locate(combobox4.Text,edit4.Text,[locaseinsensitive,lopartialkey]);

end;

procedure TForm1.Button6Click(Sender: TObject);

begin

DataModule2.BookTable5.Locate(combobox5.Text,edit5.Text,[locaseinsensitive]);

DataModule2.BookTable5.Locate(combobox5.Text,edit5.Text,[lopartialkey]);

DataModule2.BookTable5.Locate(combobox5.Text,edit5.Text,[locaseinsensitive,lopartialkey]);

end;

procedure TForm1.Timer1Timer(Sender: TObject);

begin

Label1.caption:=timetostr(time) // отображение системного времени

end;

procedure TForm1.RadioButton3Click(Sender: TObject);

begin

DataModule2 . BookTable4. IndexFieldNames := ' Стоимость '

end;

procedure TForm1.RadioButton4Click(Sender: TObject);

begin

DataModule2. BookTable4 . IndexFieldNames := ' Перечень '

end;

procedure TForm1.RadioButton9Click(Sender: TObject);

begin

DataModule2 . BookTable3 . IndexFieldNames := ' Фамилия '

end;

procedure TForm1.RadioButton7Click(Sender: TObject);

begin

DataModule2 . BookTable2. IndexFieldNames := ' Фамилия '

end;

procedure TForm1.RadioButton8Click(Sender: TObject);

begin

DataModule2 . BookTable2 . IndexFieldNames := ' Дата '

end;

procedure TForm1.RadioButton5Click(Sender: TObject);

begin

DataModule2 . BookTable5 . IndexFieldNames := ' Фамилия ' ;

end;

procedure TForm1.RadioButton6Click(Sender: TObject);

begin

DataModule2 . BookTable5 . IndexFieldNames := ' Специальность ' ;

end;

procedure TForm1.FindEditChange(Sender: TObject);

begin

//Фильтрация данных

if Length (FindEdit.Text)>0 then

DataModule2.BookTable1.Filtered:=true

else

DataModule2.BookTable1.Filtered:=false;

DataModule2.BookTable1.Filter:='Фамилия >'''+FindEdit.Text+'''';

if Length (FindEdit.Text)>0 then

DataModule2.BookTable2.Filtered:=true

else

DataModule2.BookTable2.Filtered:=false;

DataModule2.BookTable2.Filter:='Фамилия >'''+FindEdit.Text+'''';

if Length (FindEdit.Text)>0 then

DataModule2.BookTable3.Filtered:=true

else

DataModule2.BookTable3.Filtered:=false;

DataModule2.BookTable3.Filter:='Фамилия >'''+FindEdit.Text+'''';

if Length (FindEdit.Text)>0 then

DataModule2.BookTable5.Filtered:=true

else

DataModule2.BookTable5.Filtered:=false;

DataModule2.BookTable5.Filter:='Фамилия >'''+FindEdit.Text+'''';

end;

procedure TForm1.Action4Execute(Sender: TObject);

begin

//

end;

procedure TForm1.Button7Click(Sender: TObject);

begin

DataModule2.BookTable2.Insert;

DBGrid1.SetFocus;

Form7.Show;

end;

end.

unit Unit2;

interface

uses

SysUtils, Classes, DB, ADODB;

type

TDataModule2 = class(TDataModule)

BookTable1: TADOTable;

DataSource1: TDataSource;

ADOConnection1: TADOConnection;

BookTable2: TADOTable;

DataSource2: TDataSource;

BookTable3: TADOTable;

DataSource3: TDataSource;

DataSource4: TDataSource;

DataSource5: TDataSource;

BookTable4: TADOTable;

BookTable5: TADOTable;

BookTable1DSDesigner2: TIntegerField;

BookTable1DSDesigner3: TWideStringField;

BookTable1DSDesigner4: TWideStringField;

BookTable1DSDesigner5: TBooleanField;

BookTable1DSDesigner6: TIntegerField;

BookTable1DSDesigner7: TWideStringField;

BookTable1DSDesigner8: TBCDField;

BookTable1DSDesigner9: TBCDField;

BookTable1DSDesigner10: TDateTimeField;

BookTable1DSDesigner: TWideStringField;

BookTable2DSDesigner: TIntegerField;

BookTable2DSDesigner2: TWideStringField;

BookTable2DSDesigner3: TWideStringField;

BookTable2DSDesigner4: TWideStringField;

BookTable2DSDesigner5: TDateTimeField;

BookTable2DSDesigner6: TWideStringField;

BookTable2DSDesigner7: TDateTimeField;

BookTable2DSDesigner8: TWideStringField;

BookTable3DSDesigner: TIntegerField;

BookTable3DSDesigner2: TWideStringField;

BookTable3DSDesigner3: TWideStringField;

BookTable3DSDesigner4: TWideStringField;

BookTable3DSDesigner5: TIntegerField;

BookTable3DSDesigner6: TIntegerField;

BookTable3DSDesigner7: TBooleanField;

BookTable5DSDesigner: TIntegerField;

BookTable5DSDesigner2: TWideStringField;

BookTable5DSDesigner3: TWideStringField;

BookTable5DSDesigner4: TWideStringField;

BookTable5DSDesigner5: TWideStringField;

BookTable5DSDesigner6: TWideStringField;

BookTable5DSDesigner7: TWideStringField;

procedure BookTable1FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

procedure BookTable2FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

procedure BookTable3FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

procedure BookTable5FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

private

{ Private declarations }

public

{ Public declarations }

end;

var

DataModule2: TDataModule2;

implementation

uses Unit1, Unit3, Unit5;

{$R *.dfm}

procedure TDataModule2.BookTable1FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

begin

//Для фильтрации данных

Accept:=false;

if copy (BookTable1DSDesigner.AsString,1,Length (Form1.FindEdit.Text))= Form1.FindEdit.Text then

Accept:=true;

end;

procedure TDataModule2.BookTable2FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

begin

Accept:=false;

if copy (BookTable2DSDesigner2.AsString,1,Length (Form1.FindEdit.Text))= Form1.FindEdit.Text then

Accept:=true;

end;

procedure TDataModule2.BookTable3FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

begin

Accept:=false;

if copy (BookTable3DSDesigner2.AsString,1,Length (Form1.FindEdit.Text))= Form1.FindEdit.Text then

Accept:=true;

end;

procedure TDataModule2.BookTable5FilterRecord(DataSet: TDataSet;

var Accept: Boolean);

begin

Accept:=false;

if copy (BookTable5DSDesigner2.AsString,1,Length (Form1.FindEdit.Text))= Form1.FindEdit.Text then

Accept:=true;

end;

end.

unit Unit3;

interface

uses

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

Dialogs, StdCtrls;

type

TForm3 = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Button1: TButton;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form3: TForm3;

implementation

{$R *.dfm}

procedure TForm3.FormCreate(Sender: TObject);

begin

Close;

end;

procedure TForm3.Button1Click(Sender: TObject);

begin

Form3.Close; // закрыть форму

end;

end.

unit Unit4;

interface

uses

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

Dialogs, QRCtrls, QuickRpt, ExtCtrls;

type

TForm4 = class(TForm)

QuickRep1: TQuickRep;

ColumnHeaderBand1: TQRBand;

DetailBand1: TQRBand;

TitleBand1: TQRBand;

QRLabel1: TQRLabel;

QRLabel2: TQRLabel;

QRLabel3: TQRLabel;

QRLabel4: TQRLabel;

QRLabel5: TQRLabel;

QRLabel6: TQRLabel;

QRLabel7: TQRLabel;

QRLabel8: TQRLabel;

QRLabel9: TQRLabel;

QRLabel10: TQRLabel;

QRLabel11: TQRLabel;

QRDBText1: TQRDBText;

QRDBText2: TQRDBText;

QRDBText3: TQRDBText;

QRDBText4: TQRDBText;

QRDBText5: TQRDBText;

QRDBText6: TQRDBText;

QRDBText7: TQRDBText;

QRDBText8: TQRDBText;

QRDBText9: TQRDBText;

QRDBText10: TQRDBText;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form4: TForm4;

implementation

uses Unit2;

{$R *.dfm}

end.

unit Unit5;

interface

uses

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

Dialogs, QRCtrls, QuickRpt, ExtCtrls;

type

TForm5 = class(TForm)

QuickRep1: TQuickRep;

ColumnHeaderBand1: TQRBand;

DetailBand1: TQRBand;

TitleBand1: TQRBand;

QRLabel1: TQRLabel;

QRDBText1: TQRDBText;

QRDBText2: TQRDBText;

QRDBText3: TQRDBText;

QRDBText4: TQRDBText;

QRDBText5: TQRDBText;

QRDBText6: TQRDBText;

QRDBText7: TQRDBText;

QRLabel2: TQRLabel;

QRLabel3: TQRLabel;

QRLabel4: TQRLabel;

QRLabel5: TQRLabel;

QRLabel6: TQRLabel;

QRLabel7: TQRLabel;

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form5: TForm5;

implementation

uses Unit2;

{$R *.dfm}

end.

unit Unit6;

interface

uses

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

Dialogs, jpeg, ExtCtrls, StdCtrls, DBCtrls, Mask;

type

TForm6 = class(TForm)

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

DBEdit7: TDBEdit;

DBEdit8: TDBEdit;

DBEdit9: TDBEdit;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

DBCheckBox1: TDBCheckBox;

Button1: TButton;

Button2: TButton;

Label10: TLabel;

Image1: TImage;

Button3: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

procedure Button3Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form6: TForm6;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm6.Button1Click(Sender: TObject);

begin

DataModule2.BookTable1.Cancel; // отмена

end;

procedure TForm6.Button2Click(Sender: TObject);

begin

if DataModule2.BookTable1.Modified then

DataModule2.BookTable1.Post;

Form6.Close ; // сохранение и выход

end;

procedure TForm6.Button3Click(Sender: TObject);

begin

Form6.Close;

end;

end.

unit Unit7;

interface

uses

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

Dialogs, StdCtrls, Mask, DBCtrls, jpeg, ExtCtrls;

type

TForm7 = class(TForm)

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label9: TLabel;

Label10: TLabel;

Image1: TImage;

DBEdit1: TDBEdit;

DBEdit2: TDBEdit;

DBEdit3: TDBEdit;

DBEdit4: TDBEdit;

DBEdit5: TDBEdit;

DBEdit6: TDBEdit;

DBEdit7: TDBEdit;

DBEdit8: TDBEdit;

Button1: TButton;

Button2: TButton;

Button3: TButton;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

procedure Button3Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form7: TForm7;

implementation

uses Unit2, Unit1;

{$R *.dfm}

procedure TForm7.Button3Click(Sender: TObject);

begin

Form7.Close;

end;

procedure TForm7.Button1Click(Sender: TObject);

begin

DataModule2.BookTable2.Cancel;

end;

procedure TForm7.Button2Click(Sender: TObject);

begin

if DataModule2.BookTable2.Modified then

DataModule2.BookTable2.Post;

Form7.Close;

end;

end.

35

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]