unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,
DB, DBTables, StdCtrls, Buttons, DBCtrls, Mask, ExtCtrls,
ComCtrls, Menus, Grids, DBGrids, XPMenu, QuickRpt, ExtDlgs;
type
TForm1 =
class(TForm)
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Beenden1: TMenuItem;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
Panel1: TPanel;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Panel2: TPanel;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Panel3: TPanel;
BitBtn1: TBitBtn;
Table1: TTable;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
XPMenu1: TXPMenu;
QRCompositeReport1: TQRCompositeReport;
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Label8: TLabel;
Label9: TLabel;
GroupBox2: TGroupBox;
Edit3: TEdit;
Label10: TLabel;
CheckBox1: TCheckBox;
BitBtn2: TBitBtn;
DBNavigator1: TDBNavigator;
Drucken1: TMenuItem;
N1: TMenuItem;
Hilfe1: TMenuItem;
Mailanmich1: TMenuItem;
Label11: TLabel;
OpenPictureDialog1: TOpenPictureDialog;
Table1Firma: TStringField;
Table1PLZ: TStringField;
Table1Standort: TStringField;
Table1Adresse: TStringField;
Table1TelNr: TFloatField;
Table1Produktarten: TStringField;
Table1Preisklasse: TStringField;
BitBtn3: TBitBtn;
Table1File: TStringField;
Table1BMP: TGraphicField;
DBListBox1: TDBListBox;
procedure Beenden1Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure Mailanmich1Click(Sender: TObject);
procedure Drucken1Click(Sender: TObject);
procedure Table1BeforePost(DataSet: TDataSet);
procedure BitBtn3Click(Sender: TObject);
procedure DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
uses mail,Qr, Pic;
{$R *.dfm}
procedure TForm1.Beenden1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
var pfad :
String;
begin
if openpicturedialog1.Execute
then
begin
pfad:=openpicturedialog1.FileName;
Form4.DBImage1.Picture.LoadFromFile(pfad);
Table1.Append;
Table1File.AsString:=pfad;
Table1BMP.LoadFromFile(pfad);
DBlistbox1.Items.Add(pfad);
Table1.Post;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var anzahl :Integer;
begin
DBEdit1.Clear;
DBEdit2.Clear;
DBEdit3.Clear;
DBEdit4.Clear;
DBEdit5.Clear;
DBEdit6.Clear;
DBEdit7.Clear;
Anzahl:= DBGrid1.DataSource.DataSet.RecordCount;
Label11.Caption:= '
Anzahl der Einträge in der Datenbank: '+IntToStr(Anzahl);
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if Checkbox1.Checked
then
begin
Table1.Filter:= Edit3.Text;
Table1.Filtered:=True;
end
else
Table1.Filtered:=False;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Table1.Locate('
Firma',Edit1.Text,[loCaseInsensitive]);
Table1.Locate('
Produktarten',Edit2.Text,[loCaseInsensitive]);
Pagecontrol1.ActivePageIndex:=2;
Edit1.Clear;
Edit2.Clear;
end;
procedure TForm1.Mailanmich1Click(Sender: TObject);
begin
Form3.Showmodal;
end;
procedure TForm1.Drucken1Click(Sender: TObject);
begin
Form2.QuickRep1.Preview;
end;
procedure TForm1.Table1BeforePost(DataSet: TDataSet);
var
s : TBlobStream;
fs : TFileStream;
Field :
String;
BEGIN
{ IF OpenPictureDialog1.Execute Then
BEGIN
fs := TFileStream.Create(OpenPictureDialog1.FileName, fmOpenRead);
s := TBlobStream.create(Table1.FieldByName('Files') AS TBlobField, bmWrite);
s.CopyFrom(fs, fs.Size);
fs.free;
s.Free;
END;}
END;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
{var tmp : String;
jpg : TJPEGImage;
begin
DateTimeToString(tmp,'yyyymmddhhmmsszz',Now);
tmp:= IncludeTrailingBackslash(ExtractFilePath(Application.ExeName)) + tmp + '.jpg';
jpg:= TJPEGImage.Create;
jpg.LoadFromFile(tmp);
Form4.DBImage1.Picture.Graphic:= jpg;
jpg.Free;
end;
end;}
end;
procedure TForm1.DBGrid1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if FileExists(Table1.FieldbyName('
BMP').AsString)
then
Form4.DBImage1.Picture.LoadFromFile(Table1.FieldbyName('
BMP').AsString);
end;
end.