-
Notifications
You must be signed in to change notification settings - Fork 9
/
grupperForm.pas
114 lines (98 loc) · 2.48 KB
/
grupperForm.pas
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
unit grupperForm;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
clientform, RzSndMsg, ActnList, DBCtrls, RzDBNav, ExtCtrls, RzDlgBtn,
StdCtrls, RzLabel, RzPanel, RzBckgnd, ComCtrls, RzListVw, data, RzTabs,
ImgList, RzButton;
type TfrmGrupper = class(TfrmClient)
RzPageControl1: TRzPageControl;
TabSheet1: TRzTabSheet;
nGroups: TRzListView;
ImageList1: TImageList;
btnNyGruppe: TRzBitBtn;
btnSlettGruppe: TRzBitBtn;
Label1: TLabel;
procedure FormShow(Sender: TObject);
procedure btnNyGruppeClick(Sender: TObject);
procedure nGroupsDblClick(Sender: TObject);
private
Procedure LoadGroups;
public
{ Public declarations }
end;
implementation
{$R *.DFM}
uses kundegruppeform, globalvalues;
procedure TfrmGrupper.FormShow(Sender: TObject);
begin
inherited;
(* read only mode? *)
If Appdata.KundeGrupper.ReadOnly then
Begin
BtnNyGruppe.Enabled:=False;
btnSlettGruppe.Enabled:=False;
end;
LoadGroups;
end;
procedure TfrmGrupper.LoadGroups;
Begin
nGroups.Items.Clear;
ngroups.Enabled:=False;
try
Appdata.KundeGrupper.first;
While not Appdata.kundegrupper.Eof do
begin
With nGroups.Items.Add do
Begin
Caption:=Appdata.KundeGrupperTittel.Value;
ImageIndex:=0;
end;
Appdata.kundegrupper.next;
end;
finally
if nGroups.Items.Count>0 then
nGroups.Enabled:=True;
end;
end;
procedure TfrmGrupper.btnNyGruppeClick(Sender: TObject);
begin
inherited;
With TfrmKundeGruppe.Create(self) do
Begin
try
RecordMode:=arAppend;
if ShowModal=mrOK then
LoadGroups;
finally
Free;
end;
end;
end;
procedure TfrmGrupper.nGroupsDblClick(Sender: TObject);
begin
inherited;
If (nGroups.Enabled=False)
or (nGroups.Items.Count=0)
or (ngroups.Selected=NIL) then
exit;
If Appdata.KundeGrupper.find('tittel',[nGroups.Selected.Caption],True)=True then
Begin
If (Appdata.KundeGrupperId.Value=1)
or (lowercase(Appdata.KundeGrupperTittel.Value)='ny kunde') then
Begin
ShowMessage('Denne gruppen kan ikke redigeres');
exit;
end;
With TfrmKundeGruppe.Create(self) do
Begin
try
RecordMode:=arEdit;
If ShowModal=mrOK then
LoadGroups;
finally
Free;
end;
end;
end;
end;
end.