unit DMU interface uses System SysUtils System Classes EhLibMTE MemTab

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
unit DMU;
interface
uses
System.SysUtils, System.Classes, EhLibMTE, MemTableDataEh, Data.DB,
MemTableEh, DataDriverEh, Data.Win.ADODB, MemDS, VirtualTable, Vcl.ImgList,
Vcl.Controls, acAlphaImageList, Vcl.Menus, Vcl.Dialogs, sDialogs,
ToolCtrlsEh, DBGridEhToolCtrls, ADODataDriverEh, DynVarsEh, sSkinManager,
PrnDbgeh, frxClass, frxDBSet, frxExportPDF, ADODB2010, comobj, ADOX_TLB;
type
TDM = class(TDataModule)
VPT: TVirtualTable;
VPS: TDataSource;
AOSS: TDataSource;
CabS: TDataSource;
OSS: TDataSource;
SotrS: TDataSource;
DevS: TDataSource;
CON: TADOConnection;
ITT: TADOTable;
CabT: TADOTable;
OST: TADOTable;
SotrT: TADOTable;
DevT: TADOTable;
DSD: TDataSetDriverEh;
AOST: TMemTableEh;
AOSTКод: TAutoIncField;
AOSTCOD: TIntegerField;
AOSTИНВ: TIntegerField;
AOSTУстройство: TIntegerField;
AOSTКабинет: TIntegerField;
AOSTОС: TIntegerField;
AOSTСотрудник: TIntegerField;
AOSTДатаучета: TDateTimeField;
AOSTUpgrade: TDateTimeField;
AOSTSN: TWideStringField;
AOSTКонфигурация: TWideMemoField;
AOSTDev: TStringField;
AOSTCab: TStringField;
AOSTOS: TStringField;
AOSTSotr: TStringField;
VPTКод: TAutoIncField;
VPTKabinet: TWideStringField;
VPTINB: TWideStringField;
VPTName: TWideStringField;
VPTQRCOD: TBlobField;
MImage: TsAlphaImageList;
ITTКод: TAutoIncField;
ITTCOD: TIntegerField;
ITTИНВ: TIntegerField;
ITTУстройство: TIntegerField;
ITTКабинет: TIntegerField;
ITTОС: TIntegerField;
ITTСотрудник: TIntegerField;
ITTДатаучета: TDateTimeField;
ITTUpgrade: TDateTimeField;
ITTSN: TWideStringField;
ITTКонфигурация: TWideMemoField;
CabTКод: TAutoIncField;
CabTКабинет: TWideStringField;
OSTКод: TAutoIncField;
OSTОС: TWideStringField;
SotrTКод: TAutoIncField;
SotrTСотрудник: TWideStringField;
DevTКод: TAutoIncField;
DevTУстройство: TWideStringField;
OpenDB: TsOpenDialog;
sSkinManager1: TsSkinManager;
SFile: TsSaveDialog;
AImage: TsAlphaImageList;
PGrid: TPrintDBGridEh;
QRDS: TfrxDBDataset;
QRPrint: TfrxReport;
frxPDFExport1: TfrxPDFExport;
SQL: TADODataDriverEh;
Query: TADOQuery;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DM: TDM;
procedure NewDB(FileName : String);
procedure Connect;
implementation
uses AOSU;
{ %CLASSGROUP 'Vcl.Controls.TControl' }
{$R *.dfm}
procedure NewDB(FileName : String);
begin
//
end;
procedure Connect;
var
FilePath: String;
begin
AOS.GRID.StartLoadingStatus('Загрузка БД...', -1);
if FileExists(ExtractFilePath(ParamStr(0))+ GetCurrentDir + '\db.mdb') then
FilePath := ExtractFilePath(ParamStr(0))+ GetCurrentDir + '\db.mdb'
else if FileExists(ExtractFilePath(ParamStr(0)) + GetCurrentDir + '\DB\db.mdb') then
FilePath := ExtractFilePath(ParamStr(0))+ GetCurrentDir + '\DB\db.mdb'
else if FileExists(ExtractFilePath(ParamStr(0))+ '..\..\DB\db.mdb') then
FilePath := ExtractFilePath(ParamStr(0)) + '..\..\DB\db.mdb'
else if FileExists(ExtractFilePath(ParamStr(0)) + '..\..\..\DB\db.mdb') then
FilePath := ExtractFilePath(ParamStr(0)) + '..\..\..\DB\db.mdb'
else if DM.OpenDB.Execute then
FilePath := DM.OpenDB.FileName else exit;
DM.CON.ConnectionString := ('Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;'
+ 'Data Source=' + FilePath + ';' +
'Mode=Share Deny None;Jet OLEDB:System database="";');
AOS.Caption := 'Инвентаризация оборудования';
DM.AOST.Active := True;
DM.ITT.Active := True;
DM.CabT.Active := True;
DM.OST.Active := True;
DM.SotrT.Active := True;
DM.DevT.Active := True;
DM.DSD.KeyFields:='Код';
DM.AOST.Refresh;
AOS.GRID.FinishLoadingStatus;
AOS.Show;
end;
procedure TDM.DataModuleCreate(Sender: TObject);
begin
CON.Connected:=False;
Connect;
CON.Connected:=True;
end;
end.