Дипломная работа: Автоматизация и обеспечение безопасности учета посещений клиентов в организации "Чудо Доктор"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
108
begin
Getdir(0,MyDir);
Wordapp:=CreateOleObject('Word.Application');
WordApp.Documents.Open(MyDir + '\1.doc');
Wordapp.Visible:=true;
// Печатаем заголовок
WordApp.Selection.TypeParagraph;
WordApp.Selection.Paragraphs.Alignment:=1;
WordApp.Selection.Font.Size:=20;
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Отчет по дате поставки'+#13+#10);
// Изменяем стиль текущего абзаца,
// потому что он будет в таблице
WordApp.Selection.Font.Size:=12;
WordApp.Selection.Paragraphs.Alignment:=3;
WordApp.Selection.Font.Bold:=false;
// Создание таблицы
WordApp.ActiveDocument.Tables.Add(Range:=WordApp.Selection.Range,
NumRows:=2, NumColumns:=6,
DefaultTableBehavior:=1,
AutoFitBehavior:= 0);
// Заполнение таблицы
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Код_Пост');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Ном_нак');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Дата_пост');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Шифр');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Кол_во');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Надбавка');
WordApp.Selection.MoveRight(12.1);
DataModule3.ADOQuery5.First;
while not DataModule3.ADOQuery4.eof do begin
WordApp.Selection.TypeText
(DataModule3.ADOQuery4.FieldByName('Код_Пост').asstring);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery4.FieldByName('Ном_нак').as
string);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery4.FieldByName('Дата_пост').a
sstring);
WordApp.Selection.MoveRight(12.1);
109
WordApp.Selection.TypeText(DataModule3.ADOQuery4.FieldByName('Шифр').asstri
ng);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery4.FieldByName('Кол_во').asst
ring);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText
(DataModule3.ADOQuery4.FieldByName('Надбавка').asstring);
WordApp.Selection.MoveRight(12.1);
DataModule3.ADOQuery4.Next;
end;
end;
procedure TForm5.Button5Click(Sender: TObject);
var
MyDir:String;
begin
Getdir(0,MyDir);
Wordapp:=CreateOleObject('Word.Application');
WordApp.Documents.Open(MyDir + '\2.doc');
Wordapp.Visible:=true;
// Печатаем заголовок
WordApp.Selection.TypeParagraph;
WordApp.Selection.Paragraphs.Alignment:=1;
WordApp.Selection.Font.Size:=20;
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Отчет по дате Реализации'+#13+#10);
// Изменяем стиль текущего абзаца,
// потому что он будет в таблице
WordApp.Selection.Font.Size:=12;
WordApp.Selection.Paragraphs.Alignment:=3;
WordApp.Selection.Font.Bold:=false;
// Создание таблицы
WordApp.ActiveDocument.Tables.Add(Range:=WordApp.Selection.Range,
NumRows:=2, NumColumns:=5,
DefaultTableBehavior:=1,
AutoFitBehavior:= 0);
// Заполнение таблицы
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('№ Чека');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Шифр товара');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Поставщик');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
WordApp.Selection.TypeText('Кол-во');
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.Font.Bold:=true;
110
WordApp.Selection.TypeText('Дата реал');
WordApp.Selection.MoveRight(12.1);
DataModule3.ADOQuery9.First;
while not DataModule3.ADOQuery9.eof do begin
WordApp.Selection.TypeText
(DataModule3.ADOQuery9.FieldByName('№_Чека').asstring);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery9.FieldByName('Шифр').asstri
ng);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery9.FieldByName('Поставщик').
asstring);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery9.FieldByName('Кол_во').asst
ring);
WordApp.Selection.MoveRight(12.1);
WordApp.Selection.TypeText(DataModule3.ADOQuery9.FieldByName('Дата_реал').a
sstring);
WordApp.Selection.MoveRight(12.1);
DataModule3.ADOQuery9.Next;
end;
end;
procedure TForm5.Button6Click(Sender: TObject);
var mydir:string;
k:byte;
begin
Getdir(0,MyDir);
XLApp:= CreateOleObject('Excel.Application');
XLApp.WorkBooks.Add(MyDir + '\2.xls');
xlAPP.visible:=true;
DataModule3.ADOQuery6.First;
k:=1;
while not DataModule3.ADOQuery6.eof do begin
XLApp.WorkBooks[1].WorkSheets[1].Cells[4+k,1]:=DataModule3.ADOQuery6.Field
ByName('Шифр_доставки').asstring;
XLApp.WorkBooks[1].WorkSheets[1].Cells[4+k,2]:=DataModule3.ADOQuery6.Field
ByName('Поставщик').asstring;
XLApp.WorkBooks[1].WorkSheets[1].Cells[4+k,3]:=DataModule3.ADOQuery6.Field
ByName('Стоимость').asstring;
k:=k+1;
DataModule3.ADOQuery6.Next;
XLApp.WorkBooks[1].WorkSheets[1].Cells[2,3]:=Datetostr(date);
end;
end;
procedure TForm5.Edit4Change(Sender: TObject);
begin
DataModule3.ADOQuery6.Close;
DataModule3.ADOQuery6.Parameters[0].Value:=edit4.Text+'%';
111
DataModule3.ADOQuery6.Open;
end;
end.
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QuickRpt, ExtCtrls, ComCtrls, QRCtrls;
type
TForm6 = class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRBand2: TQRBand;
QRBand3: TQRBand;
QRBand4: TQRBand;
QRSysData1: TQRSysData;
QRLabel1: TQRLabel;
QRSysData2: TQRSysData;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel6: TQRLabel;
QRDBText1: TQRDBText;
QRDBText4: TQRDBText;
QuickRep2: TQuickRep;
QRBand5: TQRBand;
QRBand6: TQRBand;
QRBand7: TQRBand;
QRBand8: TQRBand;
QRSysData3: TQRSysData;
QRLabel7: TQRLabel;
QRSysData4: TQRSysData;
QRLabel8: TQRLabel;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRLabel12: TQRLabel;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRLabel15: TQRLabel;
QRLabel16: TQRLabel;
QRDBText5: TQRDBText;
112
QRDBText6: TQRDBText;
QRDBText7: TQRDBText;
QRDBText8: TQRDBText;
QRDBText9: TQRDBText;
QRDBText10: TQRDBText;
QRDBText11: TQRDBText;
QRDBText12: TQRDBText;
QuickRep3: TQuickRep;
QRBand9: TQRBand;
QRBand10: TQRBand;
QRBand11: TQRBand;
QRBand12: TQRBand;
QRSysData5: TQRSysData;
QRSysData6: TQRSysData;
QRLabel17: TQRLabel;
QRLabel18: TQRLabel;
QRLabel19: TQRLabel;
QRLabel20: TQRLabel;
QRLabel21: TQRLabel;
QRLabel22: TQRLabel;
QRDBText13: TQRDBText;
QRDBText14: TQRDBText;
QRDBText15: TQRDBText;
QRDBText16: TQRDBText;
QuickRep4: TQuickRep;
QRBand13: TQRBand;
QRBand14: TQRBand;
QRBand15: TQRBand;
QRBand16: TQRBand;
QRSysData7: TQRSysData;
QRSysData8: TQRSysData;
QRLabel23: TQRLabel;
QRLabel24: TQRLabel;
QRLabel25: TQRLabel;
QRLabel26: TQRLabel;
QRDBText17: TQRDBText;
QRDBText18: TQRDBText;
QuickRep5: TQuickRep;
QRBand17: TQRBand;
QRBand18: TQRBand;
QRBand19: TQRBand;
QRBand20: TQRBand;
QRSysData9: TQRSysData;
QRSysData10: TQRSysData;
QRLabel29: TQRLabel;
QRLabel30: TQRLabel;
QRLabel32: TQRLabel;
QRLabel33: TQRLabel;
QRLabel34: TQRLabel;
QRLabel35: TQRLabel;
QRDBText21: TQRDBText;
QRDBText22: TQRDBText;
Источник: https://baza.diplomsite.ru/previewfile/1765