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

 
Unit1.pas

unit Unit1;


interface


uses

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

  ExtCtrls, jpeg, StdCtrls;


type

  TForm1 = class(TForm)

    Panel1: TPanel;

    Label1: TLabel;

    Image1: TImage;

    Timer1: TTimer;

    procedure Timer1Timer(Sender: TObject);

    procedure FormCreate(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form1: TForm1;


implementation


uses Unit2;


{$R *.DFM}


procedure TForm1.Timer1Timer(Sender: TObject);

begin

With timer1 do begin

 Form1.visible:=false;

 Form2.visible:=true ;

 end;

end;


procedure TForm1.FormCreate(Sender: TObject);

begin

Form1.ShowModal;

end;


end.





Unit2.pas


unit Unit2;


interface


uses

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

  ComCtrls, ImgList, StdActns, ActnList, Menus, Db, DBTables, Grids,

  DBGrids, StdCtrls, Mask, DBCtrls, ExtCtrls;


type

  TForm2 = class(TForm)

    MainMenu1: TMainMenu;

    File1: TMenuItem;

    Save1: TMenuItem;

    N1: TMenuItem;

    Exit1: TMenuItem;

    Serch1: TMenuItem;

    Documents1: TMenuItem;

    Ispolnenie1: TMenuItem;

    Poruchenie1: TMenuItem;

    ActionList1: TActionList;

    FileNew1: TAction;

    FileOpen1: TAction;

    FileSave1: TAction;

    FileSaveAs1: TAction;

    FileExit1: TAction;

    EditCut1: TEditCut;

    EditCopy1: TEditCopy;

    EditPaste1: TEditPaste;

    HelpAbout1: TAction;

    ImageList1: TImageList;

    PageControl1: TPageControl;

    TabSheet1: TTabSheet;

    TabSheet2: TTabSheet;

    TabSheet3: TTabSheet;

    TabSheet4: TTabSheet;

    About1: TMenuItem;

    Table1: TTable;

    Table1IdDoc: TFloatField;

    Table1DataPost: TDateField;

    Table1NazDoc: TStringField;

    Table1VidDoc: TStringField;

    Table1Organ: TStringField;

    Table1Sostavil: TStringField;

    Table1Rukov: TStringField;

    Table1Naprav: TStringField;

    Table1Soder: TMemoField;

    DataSource1: TDataSource;

    StatusBar1: TStatusBar;

    Table2: TTable;

    Table2IdPor: TFloatField;

    Table2IdDoc: TFloatField;

    Table2Poruchenie: TMemoField;

    Table2Poruchitel: TStringField;

    Table2KomuPor: TStringField;

    Table2DataPor: TDateField;

    Table2DataIspol: TDateField;

    DataSource2: TDataSource;

    Table3: TTable;

    Table3IdDoc: TFloatField;

    Table3IdIspol: TFloatField;

    Table3Ispolnitel: TStringField;

    Table3DataFact: TDateField;

    Table3Otchet: TMemoField;

    DataSource3: TDataSource;

    Table4: TTable;

    Table4IdKon: TFloatField;

    Table4IdDoc: TFloatField;

    Table4DataKon: TDateField;

    Table4Vivod: TMemoField;

    DataSource4: TDataSource;

    Label1: TLabel;

    Label2: TLabel;

    Label3: TLabel;

    Label4: TLabel;

    Label5: TLabel;

    Label6: TLabel;

    Label7: TLabel;

    Label8: TLabel;

    Label9: TLabel;

    DBGrid1: TDBGrid;

    DBEdit1: TDBEdit;

    DBEdit2: TDBEdit;

    DBEdit3: TDBEdit;

    DBEdit4: TDBEdit;

    DBEdit5: TDBEdit;

    DBEdit6: TDBEdit;

    DBEdit7: TDBEdit;

    DBComboBox1: TDBComboBox;

    DBMemo1: TDBMemo;

    DBNavigator1: TDBNavigator;

    DBGrid2: TDBGrid;

    Label10: TLabel;

    Label11: TLabel;

    Label12: TLabel;

    Label13: TLabel;

    Label14: TLabel;

    Label15: TLabel;

    Label16: TLabel;

    DBEdit8: TDBEdit;

    DBEdit9: TDBEdit;

    DBEdit10: TDBEdit;

    DBEdit11: TDBEdit;

    DBEdit12: TDBEdit;

    DBEdit13: TDBEdit;

    DBMemo2: TDBMemo;

    DBNavigator2: TDBNavigator;

    DBGrid3: TDBGrid;

    Label17: TLabel;

    Label18: TLabel;

    Label19: TLabel;

    Label20: TLabel;

    Label21: TLabel;

    DBEdit14: TDBEdit;

    DBEdit15: TDBEdit;

    DBEdit16: TDBEdit;

    DBEdit17: TDBEdit;

    DBMemo3: TDBMemo;

    DBNavigator3: TDBNavigator;

    DBGrid4: TDBGrid;

    Label22: TLabel;

    Label23: TLabel;

    Label24: TLabel;

    Label25: TLabel;

    Label26: TLabel;

    DBEdit18: TDBEdit;

    DBEdit19: TDBEdit;

    DBEdit20: TDBEdit;

    DBMemo4: TDBMemo;

    DBNavigator4: TDBNavigator;

    Table4Kontrol: TStringField;

    DBEdit21: TDBEdit;

    procedure Documents1Click(Sender: TObject);

    procedure Ispolnenie1Click(Sender: TObject);

    procedure Poruchenie1Click(Sender: TObject);

    procedure Rezolution1Click(Sender: TObject);

    procedure Otchet1Click(Sender: TObject);

    procedure Rezultat1Click(Sender: TObject);

    procedure About1Click(Sender: TObject);

    procedure Save1Click(Sender: TObject);

    procedure Exit1Click(Sender: TObject);

    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);

  private

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form2: TForm2;


implementation


uses Unit1, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8, About;


{$R *.DFM}



procedure TForm2.Documents1Click(Sender: TObject);

begin

form3.showmodal;

refresh;

end;


procedure TForm2.Ispolnenie1Click(Sender: TObject);

begin

form4.showmodal;

refresh;

end;


procedure TForm2.Poruchenie1Click(Sender: TObject);

begin

form5.showmodal;

refresh;

end;


procedure TForm2.Rezolution1Click(Sender: TObject);

begin

form6.showmodal;

refresh;

end;


procedure TForm2.Otchet1Click(Sender: TObject);

begin

form7.showmodal;

refresh;

end;


procedure TForm2.Rezultat1Click(Sender: TObject);

begin

form8.showModal;

refresh;

end;


procedure TForm2.About1Click(Sender: TObject);

begin

aboutBox.ShowModal;

end;



procedure TForm2.Save1Click(Sender: TObject);

begin

if Table1.Modified then Table1.Post;

if Table2.Modified then Table2.Post;

if Table3.Modified then Table3.Post;

if Table4.Modified then Table4.Post;

end;


procedure TForm2.Exit1Click(Sender: TObject);

begin

close;

end;


procedure TForm2.FormCloseQuery(Sender: TObject; var CanClose: Boolean);

begin

CanClose:=MessageDlg('Вы действительно хотите закрыть базу?',mtConfirmation,[mbYes, mbNo],0)=mrYes;

end;


end.




Unit3.pas


unit Unit3;


interface


uses

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

  StdCtrls, DBCtrls, Grids, DBGrids, ExtCtrls, Db, DBTables;


type

  TForm3 = class(TForm)

    Panel1: TPanel;

    RadioButton1: TRadioButton;

    RadioButton2: TRadioButton;

    RadioButton3: TRadioButton;

    Edit1: TEdit;

    Button1: TButton;

    Button2: TButton;

    Table1: TTable;

    Table1IdDoc: TFloatField;

    Table1DataPost: TDateField;

    Table1NazDoc: TStringField;

    Table1VidDoc: TStringField;

    Table1Organ: TStringField;

    Table1Sostavil: TStringField;

    Table1Rukov: TStringField;

    Table1Naprav: TStringField;

    Table1Soder: TMemoField;

    DataSource1: TDataSource;

    DBGrid1: TDBGrid;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form3: TForm3;


implementation


{$R *.DFM}


procedure TForm3.Button1Click(Sender: TObject);

begin

if RadioButton1.Checked=true then Table1.Locate('Rukov', Edit1.Text, [loPartialKey]) else

if RadioButton2.Checked=true then Table1.Locate('VidDoc', Edit1.Text, [loPartialKey]) else

if RadioButton3.Checked=true then Table1.Locate('DataPost', Edit1.Text, [loPartialKey]) else

ShowMessage('Такие данные отсутствуют в таблице')

end;


procedure TForm3.Button2Click(Sender: TObject);

begin

with Table1 do

Next

end;


end.



Unit4.pas

unit Unit4;


interface


uses

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

  Grids, DBGrids, StdCtrls, ExtCtrls, Db, DBTables;


type

  TForm4 = class(TForm)

    Table2: TTable;

    Table2IdPor: TFloatField;

    Table2IdDoc: TFloatField;

    Table2Poruchenie: TMemoField;

    Table2Poruchitel: TStringField;

    Table2KomuPor: TStringField;

    Table2DataPor: TDateField;

    Table2DataIspol: TDateField;

    DataSource2: TDataSource;

    Panel1: TPanel;

    RadioButton1: TRadioButton;

    Button1: TButton;

    Edit1: TEdit;

    DBGrid1: TDBGrid;

    RadioButton2: TRadioButton;

    procedure Button1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form4: TForm4;


implementation


{$R *.DFM}


procedure TForm4.Button1Click(Sender: TObject);

begin

if RadioButton1.Checked=true then Table2.Locate('Poruchitel', Edit1.Text, [loPartialKey]) else

if RadioButton2.Checked=true then Table2.Locate('Datapor', Edit1.Text, [loPartialKey]) else

ShowMessage('Такие данные отсутствуют в таблице')

end;


end.



Unit5.pas

unit Unit5;


interface


uses

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

  StdCtrls, Grids, DBGrids, ExtCtrls, Db, DBTables;


type

  TForm5 = class(TForm)

    Table3: TTable;

    Table3IdDoc: TFloatField;

    Table3IdIspol: TFloatField;

    Table3Ispolnitel: TStringField;

    Table3DataFact: TDateField;

    Table3Otchet: TMemoField;

    DataSource3: TDataSource;

    Panel1: TPanel;

    RadioButton1: TRadioButton;

    Edit1: TEdit;

    DBGrid1: TDBGrid;

    Button1: TButton;

    RadioButton2: TRadioButton;

    procedure Button1Click(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;


var

  Form5: TForm5;


implementation


{$R *.DFM}


procedure TForm5.Button1Click(Sender: TObject);

begin

if RadioButton1.Checked=true then Table3.Locate('Ispolnitel', Edit1.Text, [loPartialKey]) else

if RadioButton2.Checked=true then Table3.Locate('DataFact', Edit1.Text, [loPartialKey]) else

ShowMessage('Такие данные отсутствуют в таблице')

end;


end.