Дипломная работа: Автоматизация процесса приема техники на ремонтные работы в ООО "Цифровой синдикат"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
86
BitBtn5: TBitBtn;
OpenDialog1: TOpenDialog;
Label3: TLabel;
ADOQuery1: TADOQuery;
produre BitBtn3Click(Send: TObject);
produre Edt1Change(Send: TObject);
produre Edt2Change(Send: TObject);
produre BitBtn1Click(Send: TObject);
produre BitBtn2Click(Send: TObject);
produre FrmClose(Send: TObject; var Action: TCloseAction);
produre BitBtn4Click(Send: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm2: TFrm2;
implementation
Uses main;
{$R *.dfm}
produre TFrm2.BitBtn3Click(Send: TObject);
begin
Frm2.Close;
end;
produre TFrm2.Edt1Change(Send: TObject);
begin
if not (copy(caption,length(caption)-1,1) = '*') then
caption:=caption+'*';
end;
produre TFrm2.Edt2Change(Send: TObject);
begin
if not (copy(caption,length(caption)-1,1) = '*') then
caption:=caption+'*';
end;
produre TFrm2.BitBtn1Click(Send: TObject);
begin
openDialog1.InitialDir := GetCurrentDir;
if opendialog1.Execute then
begin
if FileExists(opendialog1.FileName) then
begin
Edt2.Text:=Opendialog1.FileName;
87
end;
end;
end;
produre TFrm2.BitBtn2Click(Send: TObject);
begin
if Edt1.text='' then begin showmessage('Имя шаблона не может
быть пустым'); Edt1.SetFocus; exit; end;
if Edt2.text='' then begin showmessage('Необходимо выбрать
файл'); BitBtn1.SetFocus; exit; end;
if not
(FileExists(ExtractFilePath(ParamStr(0))+'shablon\'+Edt2.Text))
or (FileExists(Edt2.Text)) then begin showmessage('Указанный
файл шаблона не найден'); BitBtn1.SetFocus; exit; end;
if OpenDialog1.filename='' then
OpenDialog1.filename:=ExtractFilePath(ParamStr(0))+'shablon\'+Ed
t2.Text;
With AdoQuery1 do
begin
close;
SQl.clear;
SQL.add('UPDATE shablon SET caption = :caption, path = :path
WHERE id = :id');
Parameters.ParamByName('caption').value:=Edt1.text;
Parameters.ParamByName('path').value:=ExtractFileName(OpenDialog
1.Filename);
Parameters.ParamByName('id').value:=label3.caption;
execSQL;
end;
CopyFile(Pchar(Edt2.text),
Pchar(ExtractFilePath(ParamStr(0))+'shablon\'+ExtractFileName(Op
enDialog1.Filename)), true) ;
caption:=copy(caption,0,length(caption)-2);
close;
Frm1.N7.Click;
end;
produre TFrm2.FrmClose(Send: TObject; var Action: TCloseAction);
begin
if copy(caption,length(caption)-1,1) = '*' then
begin
If MessageBox(Handle,PChar('Данные были изменены. Сохранить
изменения?'),PChar('Подтверждение'),MB_ICONINFRMATION+MB_YESNO+M
B_DEFBUTTON2)=IdYes
then BitBtn2.Click;
end;
end;
produre TFrm2.BitBtn2Click(Send: TObject);
88
begin
if Edt1.text='' then begin showmessage('Имя шаблона не может
быть пустым'); Edt1.SetFocus; exit; end;
if Edt2.text='' then begin showmessage('Необходимо выбрать
файл'); BitBtn1.SetFocus; exit; end;
if not
(FileExists(ExtractFilePath(ParamStr(0))+'shablon\'+Edt2.Text))
or (FileExists(Edt2.Text)) then begin showmessage('Указанный
файл шаблона не найден'); BitBtn1.SetFocus; exit; end;
if OpenDialog1.filename='' then
OpenDialog1.filename:=ExtractFilePath(ParamStr(0))+'shablon\'+Ed
t2.Text;
With AdoQuery1 do
begin
close;
SQl.clear;
SQL.add('UPDATE shablon SET caption = :caption, path = :path
WHERE id = :id');
Parameters.ParamByName('caption').value:=Edt1.text;
Parameters.ParamByName('path').value:=ExtractFileName(OpenDialog
1.Filename);
Parameters.ParamByName('id').value:=label3.caption;
execSQL;
end;
produre TFrm2.BitBtn4Click(Send: TObject);
var
Word:Variant;
begin
if fileExists(Edt2.text) then
begin
Word := CreateOleObject('Word.Application');
Word.Documents.Add(Edt2.text);
if not (copy(caption,length(caption)-1,1) = '*') then
caption:=caption+'*';
Word.visible:=true;
end
else
begin
Showmessage(' Файл '+Edt2.text+' не
найден.'+#10+#13+'Проверьте правильность названия файла и его
наличие в указанной папке.');
end;
end;
end.
unit Connect;
89
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm5 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
Uses DataM;
{$R *.dfm}
procedure TForm5.BitBtn1Click(Sender: TObject);
var
SetF : TextFile;
s:array[1..9] of string;
i:integer;
begin
if Edit1.text='' then begin showmessage('Укажите имя сервера');
exit; end;
if Edit2.text='' then begin showmessage('Укажите логин'); exit;
end;
if Edit3.text='' then begin showmessage('Укажите пароль'); exit;
end;
if Edit4.text='' then begin showmessage('Укажите имя базы
данных'); exit; end;
AssignFile(SetF, ExtractFilePath(ParamStr(0))+'SetF.cfg');
90
reset(SetF);
For i:=1 to 4 do Readln(Setf,s[i]);
closeFile(SetF);
s[1]:=edit1.text;
s[2]:=edit2.text;
s[3]:=edit3.text;
s[4]:=edit4.text;
Rewrite(SetF);
For i:=1 to 9 do Writeln(Setf,s[i]);
closefile(Setf);
Close;
end;
end.
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms,
Dialogs, StdCtrls, DB, ADODB, ExtCtrls, Menus, ComObj;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N3: TMenuItem;
N18: TMenuItem;
N19: TMenuItem;
N20: TMenuItem;
Panel1: TPanel;
ADOConnection1: TADOConnection;
Sotr: TADOTable;
Label1: TLabel;
Label2: TLabel;
Источник: https://baza.diplomsite.ru/previewfile/2122