unit KGform;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, FIBQuery, pFIBQuery, StdCtrls, Mask, DBCtrls,
ComCtrls;
type
TForm1 = class(TForm)
Label2: TLabel;
KGlistBox: TDBListBox;
KuAnrede: TDBedit;
KuName: TDBEdit;
KuStrasse: TDBEdit;
KuOrt : TDBedit;
KuNr: TEdit;
KGnr: TEdit;
Label1: TLabel;
procedure FormShow(Sender: TObject);
procedure KUnrExit(Sender: TObject);
procedure KGnrEnter(Sender: TObject);
procedure KGnrExit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
USES DataMod;
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
begin
KGlistBox.Hide;
KuNr.SetFocus;
end;
procedure TForm1.KUnrExit(Sender: TObject);
begin
IF KuNr.Text <> '' THEN BEGIN
WITH DataModul.KuDatensatz DO BEGIN
active := false;
SelectSQL [0] := 'SELECT * FROM KUNDE8 WHERE NR = ' + KuNr.text;
active := true;
IF IsEmpty THEN BEGIN
ShowMessage ('Kunde existiert nicht !');
KuNr.SetFocus;
END
ELSE BEGIN
KuNr.enabled := false; // Kunden-Nr. nicht editierbar
{
WITH DataModul.KGdatensatz DO BEGIN
Active := false;
SelectSQL [0] := 'SELECT * FROM KG8 WHERE ID = ' +
FieldByName('IDKGH').AsString;
Active := true;
IF NOT IsEmpty THEN
Label1.Caption := '(' + FieldByName('BEZ').AsString + ')';
END;
}
KuAnrede.SetFocus; // erstes editierbares Feld
END;
END
END
ELSE BEGIN
ShowMessage ('Kunden-Nr. muß eingegeben werden !');
KuNr.SetFocus;
END
end;
procedure TForm1.KGnrEnter(Sender: TObject);
begin
KGlistBox.Show;
WITH DataModul.KGdatensatz DO BEGIN
Active := false;
SelectSQL [0] := 'SELECT * FROM KG8';
Active := true;
while not EOF do begin
KGlistBox.Items.Add(FieldByName('NR').AsString + ' ' +
FieldByName('BEZ').AsString);
next;
end;
end;
end;
procedure TForm1.KGnrExit(Sender: TObject);
begin
KGlistBox.Clear;
KGlistBox.Hide;
IF KGnr.Text <> '' THEN WITH DataModul.KGdatensatz DO BEGIN
Active := false;
SelectSQL [0] := 'SELECT * FROM KG8 WHERE NR = ' + KGnr.text;
Active := true;
IF NOT IsEmpty THEN
Label1.Caption := '(' + FieldByName('BEZ').AsString + ')';
END;
end;
end.