{$R *. res}
begin
Application. Initialize;
Application. CreateForm (TfrmMain, frmMain);
Application. CreateForm (TfrmSotrudniki, frmSotrudniki);
Application. CreateForm (TfrmDataModule, frmDataModule);
Application. CreateForm (TfrmConnect, frmConnect);
Application. CreateForm (TfrmResultSQL1, frmResultSQL1);
Application. CreateForm (TfrmReport, frmReport);
Application. CreateForm (TfrmPeredachi, frmPeredachi);
Application. CreateForm (TfrmElementy, frmElementy);
Application. CreateForm (TfrmResultSQL2, frmResultSQL2);
Application. CreateForm (TfrmResultSQL3, frmResultSQL3);
Application. CreateForm (TfrmPostavshiki, frmPostavshiki);
Application.run;
end.
unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus, ExtCtrls, DBCtrls, Grids, DBGrids, ComCtrls, uDataModule,
Mask, uConnect, ShellAPI, uReport;
type
TfrmMain = class (TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
TabSheet5: TTabSheet;
DBGrid2: TDBGrid;
DBNavigator2: TDBNavigator;
DBGrid3: TDBGrid;
DBNavigator3: TDBNavigator;
DBGrid5: TDBGrid;
DBNavigator5: TDBNavigator;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N11: TMenuItem;
N21: TMenuItem;
N31: TMenuItem;
Label2: TLabel;
Edit2: TEdit;
Label3: TLabel;
Edit3: TEdit;
Label4: TLabel;
Edit4: TEdit;
N4: TMenuItem;
N5: TMenuItem;
N10: TMenuItem;
N12: TMenuItem;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox5: TCheckBox;
Button1: TButton;
MaskEdit2: TMaskEdit;
CheckBox7: TCheckBox;
N13: TMenuItem;
N14: TMenuItem;
N3: TMenuItem;
N15: TMenuItem;
TabSheet6: TTabSheet;
CheckBox8: TCheckBox;
MaskEdit3: TMaskEdit;
Button3: TButton;
CheckBox9: TCheckBox;
DBGrid6: TDBGrid;
DBNavigator6: TDBNavigator;
DBGrid4: TDBGrid;
Label1: TLabel;
Edit1: TEdit;
CheckBox4: TCheckBox;
DBNavigator4: TDBNavigator;
procedure N6Click (Sender: TObject);
procedure N7Click (Sender: TObject);
procedure N5Click (Sender: TObject);
procedure N10Click (Sender: TObject);
procedure N12Click (Sender: TObject);
procedure CheckBox1Click (Sender: TObject);
procedure CheckBox2Click (Sender: TObject);
procedure CheckBox3Click (Sender: TObject);
procedure CheckBox4Click (Sender: TObject);
procedure CheckBox5Click (Sender: TObject);
procedure Edit2Change (Sender: TObject);
procedure Edit4Change (Sender: TObject);
procedure Edit3Change (Sender: TObject);
procedure CheckBox7Click (Sender: TObject);
procedure Button1Click (Sender: TObject);
procedure N8Click (Sender: TObject);
procedure N9Click (Sender: TObject);
procedure N11Click (Sender: TObject);
procedure N13Click (Sender: TObject);
procedure N14Click (Sender: TObject);
procedure N21Click (Sender: TObject);
procedure N31Click (Sender: TObject);
procedure N3Click (Sender: TObject);
procedure CheckBox9Click (Sender: TObject);
procedure CheckBox8Click (Sender: TObject);
procedure Edit1Change (Sender: TObject);
procedure Button3Click (Sender: TObject);
procedure N15Click (Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmMain: TfrmMain;
implementation
uses uResultSQL1, uResultSQL2, uResultSQL3,uPeredachi, uElementy, uSotrudniki, uPostavshiki;
{$R *. dfm}
procedure TfrmMain. N6Click (Sender: TObject);
begin
if InputBox ('Аутентификация пользователя','Введите пароль! ','') ='12345' then
begin
frmDataModule. tbPeredachi. Active: =True;
frmDataModule. tbVkljuchenie. Active: =True;
frmDataModule. tbElementy. Active: =True;
frmDataModule. tbObrabotka. Active: =True;
frmDataModule. tbSotrudniki. Active: =True;
frmDataModule. tbPostavshiki. Active: =True;
end;
end;
procedure TfrmMain. N7Click (Sender: TObject);
begin
frmDataModule. tbPeredachi. Active: =False;
frmDataModule. tbVkljuchenie. Active: =False;
frmDataModule. tbElementy. Active: =False;
frmDataModule. tbObrabotka. Active: =False;
frmDataModule. tbSotrudniki. Active: =False;
frmDataModule. tbPostavshiki. Active: =False;
end;
procedure TfrmMain. N5Click (Sender: TObject);
begin
frmPeredachi. ShowModal;
end;
procedure TfrmMain. N10Click (Sender: TObject);
begin
frmElementy. ShowModal;
end;
procedure TfrmMain. N12Click (Sender: TObject);
begin
frmSotrudniki. ShowModal;
end;
procedure TfrmMain. N15Click (Sender: TObject);
begin
frmPostavshiki. ShowModal;
end;
procedure TfrmMain. CheckBox1Click (Sender: TObject);
begin
if CheckBox1. Checked=True
then
frmDataModule. tbPeredachi. IndexName: ='ixNaimen_Peredachi'
else
frmDataModule. tbPeredachi. IndexName: ='';
end;
procedure TfrmMain. CheckBox2Click (Sender: TObject);
begin
if CheckBox2. Checked=True
then
frmDataModule. tbElementy. IndexName: ='ixNaimen_Elementy'
else
frmDataModule. tbElementy. IndexName: ='';
end;
procedure TfrmMain. CheckBox3Click (Sender: TObject);
begin
if CheckBox3. Checked=True
then
frmDataModule. tbSotrudniki. IndexName: ='ixFIO_Sotrudniki'
else
frmDataModule. tbSotrudniki. IndexName: ='';
end;
procedure TfrmMain. CheckBox4Click (Sender: TObject);
begin
if CheckBox4. Checked=True
then
frmDataModule. tbPostavshiki. IndexName: ='ixNaimen_Postavshiki'
else
frmDataModule. tbPostavshiki. IndexName: ='';
end;
procedure TfrmMain. CheckBox5Click (Sender: TObject);
begin
if CheckBox5. Checked=True
then
frmDataModule. tbVkljuchenie. IndexName: ='ixDate_Vkljuchenie'
else
frmDataModule. tbVkljuchenie. IndexName: ='';
end;
procedure TfrmMain. CheckBox9Click (Sender: TObject);
begin
if CheckBox9. Checked=True
then
frmDataModule. tbObrabotka. IndexName: ='ixDate_Obrabotka'
else
frmDataModule. tbObrabotka. IndexName: ='';
end;
procedure TfrmMain. Edit2Change (Sender: TObject);
begin
CheckBox1. Checked: =True;
frmDataModule. tbPeredachi. IndexName: ='ixNaimen_Peredachi';
frmDataModule. tbPeredachi. FindNearest ([Edit2. Text]);
end;
procedure TfrmMain. Edit4Change (Sender: TObject);
begin
CheckBox2. Checked: =True;
frmDataModule. tbElementy. IndexName: ='ixNaimen_Elementy';
frmDataModule. tbElementy. FindNearest ([Edit4. Text]);
end;
procedure TfrmMain. Edit3Change (Sender: TObject);
begin
CheckBox3. Checked: =True;
frmDataModule. tbSotrudniki. IndexName: ='ixFIO_Sotrudniki';
frmDataModule. tbSotrudniki. FindNearest ([Edit3. Text]);
end;
procedure TfrmMain. Edit1Change (Sender: TObject);
begin
CheckBox4. Checked: =True;
frmDataModule. tbPostavshiki. IndexName: ='ixNaimen_Postavshiki';
frmDataModule. tbPostavshiki. FindNearest ([Edit1. Text]);
end;
procedure TfrmMain. CheckBox7Click (Sender: TObject);
begin
if CheckBox7. Checked=False then
begin
frmDataModule. tbVkljuchenie. Filter: ='';
frmDataModule. tbVkljuchenie. Filtered: =False;
Button1. Visible: =False;
MaskEdit2. Visible: =False;
end
else
begin
Button1. Visible: =True;
MaskEdit2. Visible: =True;
MaskEdit2. Text: ='';
end;
end;
procedure TfrmMain. CheckBox8Click (Sender: TObject);
begin
if CheckBox8. Checked=False then
begin
frmDataModule. tbObrabotka. Filter: ='';
frmDataModule. tbObrabotka. Filtered: =False;
Button3. Visible: =False;
MaskEdit3. Visible: =False;
end
else
begin
Button3. Visible: =True;
MaskEdit3. Visible: =True;
MaskEdit3. Text: ='';
end;
end;
procedure TfrmMain. Button1Click (Sender: TObject);
begin
try
StrToDate (MaskEdit2. Text);
frmDataModule. tbVkljuchenie. Filter: =' [Data_prinjatia] ='+''''+MaskEdit2. Text+'''';
frmDataModule. tbVkljuchenie. Filtered: =True;
except
ShowMessage ('Введите правильную дату! ');
end;
end;
procedure TfrmMain. Button3Click (Sender: TObject);
begin
try
StrToDate (MaskEdit3. Text);
frmDataModule. tbObrabotka. Filter: =' [Data_obrabotki] ='+''''+MaskEdit3. Text+'''';
frmDataModule. tbObrabotka. Filtered: =True;
except
ShowMessage ('Введите правильную дату! ');
end;
end;
procedure TfrmMain. N8Click (Sender: TObject);
begin
N7Click (Self);
CopyFile ('Peredachi. db','copyPeredachi. db', false);
CopyFile ('Peredachi. px','copyPeredachi. px', false);
CopyFile ('Peredachi. XG0','copyPeredachi. XG0', false);
CopyFile ('Peredachi. YG0','copyPeredachi. YG0', false);
CopyFile ('Vkljuchenie. db','copyVkljuchenie. db', false);
CopyFile ('Vkljuchenie. px','copyVkljuchenie. px', false);
CopyFile ('Vkljuchenie. XG0','copyVkljuchenie. XG0', false);
CopyFile ('Vkljuchenie. YG0','copyVkljuchenie. YG0', false);
CopyFile ('Elementy. db','copyElementy. db', false);
CopyFile ('Elementy. px','copyElementy. px', false);
CopyFile ('Elementy. XG0','copyElementy. XG0', false);
CopyFile ('Elementy. YG0','copyElementy. YG0', false);
CopyFile ('Postavshiki. db','copyPostavshiki. db', false);
CopyFile ('Postavshiki. px','copyPostavshiki. px', false);
CopyFile ('Postavshiki. XG0','copyPostavshiki. XG0', false);
CopyFile ('Postavshiki. YG0','copyPostavshiki. YG0', false);
CopyFile ('Obrabotka. db','copyObrabotka. db', false);
CopyFile ('Obrabotka. px','copyObrabotka. px', false);
CopyFile ('Obrabotka. XG0','copyObrabotka. XG0', false);
CopyFile ('Obrabotka. YG0','copyObrabotka. YG0', false);
CopyFile ('Sotrudniki. db','copySotrudniki. db', false);
CopyFile ('Sotrudniki. px','copySotrudniki. px', false);
CopyFile ('Sotrudniki. XG0','copySotrudniki. XG0', false);
CopyFile ('Sotrudniki. YG0','copySotrudniki. YG0', false);
ShowMessage ('Резервное копирование завершено! ');
end;
procedure TfrmMain. N9Click (Sender: TObject);
begin
N7Click (Self);
CopyFile ('copyPeredachi. db','Peredachi. db', false);
CopyFile ('copyPeredachi. px','Peredachi. px', false);
CopyFile ('copyPeredachi. XG0','Peredachi. XG0', false);
CopyFile ('copyPeredachi. YG0','Peredachi. YG0', false);
CopyFile ('copyVkljuchenie. db','Vkljuchenie. db', false);
CopyFile ('copyVkljuchenie. px','Vkljuchenie. px', false);
CopyFile ('copyVkljuchenie. XG0','Vkljuchenie. XG0', false);
CopyFile ('copyVkljuchenie. YG0','Vkljuchenie. YG0', false);
CopyFile ('copyElementy. db','Elementy. db', false);
CopyFile ('copyElementy. px','Elementy. px', false);
CopyFile ('copyElementy. XG0','Elementy. XG0', false);
CopyFile ('copyElementy. YG0','Elementy. YG0', false);
CopyFile ('copyPostavshiki. db','Postavshiki. db', false);
CopyFile ('copyPostavshiki. px','Postavshiki. px', false);
CopyFile ('copyPostavshiki. XG0','Postavshiki. XG0', false);
CopyFile ('copyPostavshiki. YG0','Postavshiki. YG0', false);
CopyFile ('copyObrabotka. db','Obrabotka. db', false);
CopyFile ('copyObrabotka. px','Obrabotka. px', false);
CopyFile ('copyObrabotka. XG0','Obrabotka. XG0', false);
CopyFile ('copyObrabotka. YG0','Obrabotka. YG0', false);
CopyFile ('copySotrudniki. db','Sotrudniki. db', false);
CopyFile ('copySotrudniki. px','Sotrudniki. px', false);
CopyFile ('copySotrudniki. XG0','Sotrudniki. XG0', false);
CopyFile ('copySotrudniki. YG0','Sotrudniki. YG0', false);
ShowMessage ('Восстановление прошло успешно! ');
end;
procedure TfrmMain. N11Click (Sender: TObject);
begin
frmResultSQL1. ShowModal;
end;
procedure TfrmMain. N13Click (Sender: TObject);
begin
frmConnect. ShowModal;
end;
procedure TfrmMain. N14Click (Sender: TObject);
begin
ShellExecute (Application. MainForm. Handle,'open','Справка по работе с приложением БД АРМ Радио. htm',nil,nil,SW_SHOWNORMAL);
end;
procedure TfrmMain. N21Click (Sender: TObject);
begin
frmResultSQL2. ShowModal;
end;
procedure TfrmMain. N31Click (Sender: TObject);
begin
frmResultSQL3. ShowModal;
end;
procedure TfrmMain. N3Click (Sender: TObject);
begin
frmReport. QuickRep1. Preview;
end;
end.
unit uDataModule;
interface
uses
SysUtils, Classes, DB, DBTables;
type
TfrmDataModule = class (TDataModule)
dsPeredachi: TDataSource;
dsVkljuchenie: TDataSource;
dsElementy: TDataSource;
dsPostavshiki: TDataSource;
dsObrabotka: TDataSource;
dsSotrudniki: TDataSource;
tbPeredachi: TTable;
tbPeredachiCod_peredachi: TAutoIncField;
tbPeredachiVid_peredachi: TStringField;
tbPeredachiNaimen_peredachi: TStringField;
tbPeredachiDlitelnoct: TIntegerField;
tbVkljuchenie: TTable;
tbVkljuchenieCod_peredachi: TIntegerField;
tbVkljuchenieCod_elementa: TIntegerField;
tbVkljuchenieNomer_documenta: TStringField;
tbVkljuchenieData_prinjatia: TDateField;
tbVkljuchenieDlitelnost_v_peredache: TIntegerField;
tbVkljuchenieNomer_po_porjadku: TSmallintField;
tbElementy: TTable;
tbPostavshiki: TTable;
tbPostavshikiCod_postavshika: TAutoIncField;
tbPostavshikiVid_postavshika: TStringField;
tbPostavshikiNaimen_postavshika: TStringField;
tbPostavshikiCharakteristiki: TStringField;
tbObrabotka: TTable;
tbObrabotkaCod_elementa: TIntegerField;
tbObrabotkaTab_nomer: TIntegerField;
tbObrabotkaNomer_narjada: TStringField;
tbObrabotkaData_obrabotki: TDateField;
tbObrabotkaVid_obrabotki: TStringField;
tbSotrudniki: TTable;
tbSotrudnikiTab_nomer: TAutoIncField;
tbSotrudnikiFIO: TStringField;
tbSotrudnikiDoljnost: TStringField;
tbSotrudnikiObrazovanie: TStringField;
tbSotrudnikiCharakteristiki: TStringField;
tbElementyCod_elementa: TAutoIncField;
tbElementyVid_elementa: TStringField;
tbElementyNaimen_elementa: TStringField;
tbElementyFormat_chranenia: TStringField;
tbElementyEd_izmerenia: TStringField;
tbElementyObjem: TIntegerField;
tbElementyCod_postashika: TIntegerField;
tbVkljuchenieNaimen_peredachi: TStringField;
tbVkljuchenieNaimen_elementa: TStringField;
tbElementyNaimen_postavshika: TStringField;
tbObrabotkaNaimen_elementa: TStringField;
tbObrabotkaFIO_sotrudnika: TStringField;
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmDataModule: TfrmDataModule;
implementation
{$R *. dfm}
end.
unit uConnect;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, Grids, DBGrids, ExtCtrls, uDataModule;
type
TfrmConnect = class (TForm)
Panel1: TPanel;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
Panel3: TPanel;
DBGrid3: TDBGrid;
DBNavigator3: TDBNavigator;
Panel5: TPanel;
DBGrid5: TDBGrid;
DBNavigator5: TDBNavigator;
Panel2: TPanel;
DBGrid2: TDBGrid;
DBNavigator2: TDBNavigator;
Panel4: TPanel;
DBGrid4: TDBGrid;
DBNavigator4: TDBNavigator;
procedure FormShow (Sender: TObject);
procedure FormDeactivate (Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmConnect: TfrmConnect;
implementation
{$R *. dfm}
procedure TfrmConnect. FormShow (Sender: TObject);
begin
frmDataModule. tbVkljuchenie. MasterSource: =frmDataModule. dsPeredachi;
frmDataModule. tbVkljuchenie. MasterFields: ='Cod_peredachi';
frmDataModule. tbElementy. MasterSource: =frmDataModule. dsVkljuchenie;
frmDataModule. tbElementy. MasterFields: ='Cod_elementa';
frmDataModule. tbObrabotka. MasterSource: =frmDataModule. dsElementy;
frmDataModule. tbObrabotka. MasterFields: ='Cod_elementa';
frmDataModule. tbSotrudniki. MasterSource: =frmDataModule. dsObrabotka;
frmDataModule. tbSotrudniki. MasterFields: ='Tab_nomer';
end;
procedure TfrmConnect. FormDeactivate (Sender: TObject);
begin
frmDataModule. tbVkljuchenie. MasterSource: =nil;
frmDataModule. tbVkljuchenie. MasterFields: ='';;
frmDataModule. tbElementy. MasterSource: =nil;
frmDataModule. tbElementy. MasterFields: ='';;
frmDataModule. tbObrabotka. MasterSource: =nil;
frmDataModule. tbObrabotka. MasterFields: ='';;
frmDataModule. tbSotrudniki. MasterSource: =nil;
frmDataModule. tbSotrudniki. MasterFields: ='';;
end;
end.