1 | //kt -- Modified with SourceScanner on 8/8/2007
|
---|
2 | unit mVisitRelated;
|
---|
3 |
|
---|
4 | interface
|
---|
5 |
|
---|
6 | uses
|
---|
7 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
8 | StdCtrls, ExtCtrls, rPCE, uPCE;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfraVisitRelated = class(TFrame)
|
---|
12 | lblSCYes: TStaticText;
|
---|
13 | lblSCNo: TStaticText;
|
---|
14 | lblSCSelect: TStaticText;
|
---|
15 | bvlSCFrame: TBevel;
|
---|
16 | chkSCYes: TCheckBox;
|
---|
17 | chkAOYes: TCheckBox;
|
---|
18 | chkIRYes: TCheckBox;
|
---|
19 | chkECYes: TCheckBox;
|
---|
20 | chkMSTYes: TCheckBox;
|
---|
21 | chkMSTNo: TCheckBox;
|
---|
22 | chkECNo: TCheckBox;
|
---|
23 | chkIRNo: TCheckBox;
|
---|
24 | chkAONo: TCheckBox;
|
---|
25 | chkSCNo: TCheckBox;
|
---|
26 | chkHNCYes: TCheckBox;
|
---|
27 | chkHNCNo: TCheckBox;
|
---|
28 | chkCVYes: TCheckBox;
|
---|
29 | chkCVNo: TCheckBox;
|
---|
30 | procedure chkClick(Sender: TObject);
|
---|
31 | private
|
---|
32 | FSCCond: TSCConditions;
|
---|
33 | procedure SetCheckEnable(CheckYes, CheckNo: TCheckBox; Allow: Boolean);
|
---|
34 | procedure SetCheckState(CheckYes, CheckNo: TCheckBox; CheckState: Integer);
|
---|
35 | function GetCheckState(CheckYes, CheckNo: TCheckBox): Integer;
|
---|
36 | public
|
---|
37 | constructor Create(AOwner: TComponent); override;
|
---|
38 | procedure GetRelated(PCEData: TPCEData); overload;
|
---|
39 | procedure GetRelated(var ASCRelated, AAORelated, AIRRelated,
|
---|
40 | AECRelated, AMSTRelated, AHNCRelated, ACVRelated: integer); overload;
|
---|
41 | procedure InitAllow(SCCond: TSCConditions);
|
---|
42 | procedure InitRelated(PCEData: TPCEData); overload;
|
---|
43 | procedure InitRelated(const ASCRelated, AAORelated, AIRRelated,
|
---|
44 | AECRelated, AMSTRelated, AHNCRelated, ACVRelated: integer); overload;
|
---|
45 | end;
|
---|
46 |
|
---|
47 | implementation
|
---|
48 |
|
---|
49 | {$R *.DFM}
|
---|
50 |
|
---|
51 | const
|
---|
52 | TAG_SCYES = 1;
|
---|
53 | TAG_AOYES = 2;
|
---|
54 | TAG_IRYES = 3;
|
---|
55 | TAG_ECYES = 4;
|
---|
56 | TAG_MSTYES = 5;
|
---|
57 | TAG_HNCYES = 6;
|
---|
58 | TAG_CVYES = 7;
|
---|
59 | TAG_SCNO = 11;
|
---|
60 | TAG_AONO = 12;
|
---|
61 | TAG_IRNO = 13;
|
---|
62 | TAG_ECNO = 14;
|
---|
63 | TAG_MSTNO = 15;
|
---|
64 | TAG_HNCNO = 16;
|
---|
65 | TAG_CVNO = 17;
|
---|
66 |
|
---|
67 |
|
---|
68 | procedure TfraVisitRelated.chkClick(Sender: TObject);
|
---|
69 |
|
---|
70 | procedure DisableCheck(ACheckBox: TCheckBox);
|
---|
71 | begin
|
---|
72 | ACheckBox.Checked := False; ACheckBox.Enabled := False;
|
---|
73 | end;
|
---|
74 |
|
---|
75 | begin
|
---|
76 | inherited;
|
---|
77 | if Sender is TCheckBox then with TCheckBox(Sender) do case Tag of
|
---|
78 | TAG_SCYES: if Checked then chkSCNo.Checked := False;
|
---|
79 | TAG_AOYES: if Checked then chkAONo.Checked := False;
|
---|
80 | TAG_IRYES: if Checked then chkIRNo.Checked := False;
|
---|
81 | TAG_ECYES: if Checked then chkECNo.Checked := False;
|
---|
82 | TAG_MSTYES: if Checked then chkMSTNo.Checked := False;
|
---|
83 | TAG_HNCYES: if Checked then chkHNCNo.Checked := False;
|
---|
84 | TAG_CVYES: if Checked then chkCVNo.Checked := False;
|
---|
85 | TAG_SCNO: if Checked then chkSCYes.Checked := False;
|
---|
86 | TAG_AONO: if Checked then chkAOYes.Checked := False;
|
---|
87 | TAG_IRNO: if Checked then chkIRYes.Checked := False;
|
---|
88 | TAG_ECNO: if Checked then chkECYes.Checked := False;
|
---|
89 | TAG_MSTNO: if Checked then chkMSTYes.Checked := False;
|
---|
90 | TAG_HNCNO: if Checked then chkHNCYes.Checked := False;
|
---|
91 | TAG_CVNO: if Checked then chkCVYes.Checked := False;
|
---|
92 | end;
|
---|
93 | if chkSCYes.Checked then
|
---|
94 | begin
|
---|
95 | DisableCheck(chkAOYes);
|
---|
96 | DisableCheck(chkIRYes);
|
---|
97 | DisableCheck(chkECYes);
|
---|
98 | // DisableCheck(chkMSTYes);
|
---|
99 | DisableCheck(chkAONo);
|
---|
100 | DisableCheck(chkIRNo);
|
---|
101 | DisableCheck(chkECNo);
|
---|
102 | // DisableCheck(chkMSTNo);
|
---|
103 | end else
|
---|
104 | begin
|
---|
105 | SetCheckEnable(chkSCYes, chkSCNo, FSCCond.SCAllow);
|
---|
106 | SetCheckEnable(chkAOYes, chkAONo, FSCCond.AOAllow);
|
---|
107 | SetCheckEnable(chkIRYes, chkIRNo, FSCCond.IRAllow);
|
---|
108 | SetCheckEnable(chkECYes, chkECNo, FSCCond.ECAllow);
|
---|
109 | end;
|
---|
110 | SetCheckEnable(chkMSTYes, chkMSTNo, FSCCond.MSTAllow);
|
---|
111 | SetCheckEnable(chkHNCYes, chkHNCNo, FSCCond.HNCAllow);
|
---|
112 | SetCheckEnable(chkCVYes, chkCVNo, FSCCond.CVAllow);
|
---|
113 | if chkAOYes.Checked or chkIRYes.Checked or chkECYes.Checked then //or chkMSTYes.Checked then
|
---|
114 | begin
|
---|
115 | chkSCYes.Checked := False;
|
---|
116 | chkSCNo.Checked := True;
|
---|
117 | end;
|
---|
118 | end;
|
---|
119 |
|
---|
120 | constructor TfraVisitRelated.Create(AOwner: TComponent);
|
---|
121 | begin
|
---|
122 | inherited;
|
---|
123 |
|
---|
124 | lblSCYes.Height := 13;
|
---|
125 | lblSCNo.Height := 13;
|
---|
126 | // chkHNCYes.Visible := HNCOK;
|
---|
127 | // chkHNCNo.Visible := HNCOK;
|
---|
128 | // if not HNCOK then
|
---|
129 | // begin
|
---|
130 | // height := height - chkHNCYes.height + 1;
|
---|
131 | // bvlSCFrame.height := bvlSCFrame.height - chkHNCYes.height + 1;
|
---|
132 | // end;
|
---|
133 | end;
|
---|
134 |
|
---|
135 | function TfraVisitRelated.GetCheckState(CheckYes, CheckNo: TCheckBox): Integer;
|
---|
136 | begin
|
---|
137 | Result := SCC_NA;
|
---|
138 | if CheckYes.Enabled and CheckYes.Checked then Result := SCC_YES;
|
---|
139 | if CheckNo.Enabled and CheckNo.Checked then Result := SCC_NO;
|
---|
140 | end;
|
---|
141 |
|
---|
142 | procedure TfraVisitRelated.GetRelated(PCEData: TPCEData);
|
---|
143 | begin
|
---|
144 | PCEData.SCRelated := GetCheckState(chkSCYes, chkSCNo);
|
---|
145 | PCEData.AORelated := GetCheckState(chkAOYes, chkAONo);
|
---|
146 | PCEData.IRRelated := GetCheckState(chkIRYes, chkIRNo);
|
---|
147 | PCEData.ECRelated := GetCheckState(chkECYes, chkECNo);
|
---|
148 | PCEData.MSTRelated := GetCheckState(chkMSTYes, chkMSTNo);
|
---|
149 | PCEData.HNCRelated := GetCheckState(chkHNCYes, chkHNCNo);
|
---|
150 | PCEData.CVRelated := GetCheckState(chkCVYes, chkCVNo);
|
---|
151 | end;
|
---|
152 |
|
---|
153 | procedure TfraVisitRelated.GetRelated(var ASCRelated, AAORelated,
|
---|
154 | AIRRelated, AECRelated, AMSTRelated, AHNCRelated, ACVRelated: integer);
|
---|
155 | begin
|
---|
156 | ASCRelated := GetCheckState(chkSCYes, chkSCNo);
|
---|
157 | AAORelated := GetCheckState(chkAOYes, chkAONo);
|
---|
158 | AIRRelated := GetCheckState(chkIRYes, chkIRNo);
|
---|
159 | AECRelated := GetCheckState(chkECYes, chkECNo);
|
---|
160 | AMSTRelated := GetCheckState(chkMSTYes, chkMSTNo);
|
---|
161 | AHNCRelated := GetCheckState(chkHNCYes, chkHNCNo);
|
---|
162 | ACVRelated := GetCheckState(chkCVYes, chkCVNo);
|
---|
163 | end;
|
---|
164 |
|
---|
165 | procedure TfraVisitRelated.InitAllow(SCCond: TSCConditions);
|
---|
166 | begin
|
---|
167 | FSCCond := SCCond;
|
---|
168 | with FSCCond do
|
---|
169 | begin
|
---|
170 | SetCheckEnable(chkSCYes, chkSCNo, SCAllow);
|
---|
171 | SetCheckEnable(chkAOYes, chkAONo, AOAllow);
|
---|
172 | SetCheckEnable(chkIRYes, chkIRNo, IRAllow);
|
---|
173 | SetCheckEnable(chkECYes, chkECNo, ECAllow);
|
---|
174 | SetCheckEnable(chkMSTYes, chkMSTNo, MSTAllow);
|
---|
175 | SetCheckEnable(chkHNCYes, chkHNCNo, HNCAllow);
|
---|
176 | SetCheckEnable(chkCVYes, chkCVNo, CVAllow);
|
---|
177 | end;
|
---|
178 | end;
|
---|
179 |
|
---|
180 | procedure TfraVisitRelated.InitRelated(PCEData: TPCEData);
|
---|
181 | begin
|
---|
182 | SetCheckState(chkSCYes, chkSCNo, PCEData.SCRelated);
|
---|
183 | SetCheckState(chkAOYes, chkAONo, PCEData.AORelated);
|
---|
184 | SetCheckState(chkIRYes, chkIRNo, PCEData.IRRelated);
|
---|
185 | SetCheckState(chkECYes, chkECNo, PCEData.ECRelated);
|
---|
186 | SetCheckState(chkMSTYes, chkMSTNo, PCEData.MSTRelated);
|
---|
187 | SetCheckState(chkHNCYes, chkHNCNo, PCEData.HNCRelated);
|
---|
188 | SetCheckState(chkCVYes, chkCVNo, PCEData.CVRelated);
|
---|
189 | end;
|
---|
190 |
|
---|
191 | procedure TfraVisitRelated.InitRelated(const ASCRelated, AAORelated, AIRRelated,
|
---|
192 | AECRelated, AMSTRelated, AHNCRelated, ACVRelated: integer);
|
---|
193 | begin
|
---|
194 | SetCheckState(chkSCYes, chkSCNo, ASCRelated);
|
---|
195 | SetCheckState(chkAOYes, chkAONo, AAORelated);
|
---|
196 | SetCheckState(chkIRYes, chkIRNo, AIRRelated);
|
---|
197 | SetCheckState(chkECYes, chkECNo, AECRelated);
|
---|
198 | SetCheckState(chkMSTYes, chkMSTNo, AMSTRelated);
|
---|
199 | SetCheckState(chkHNCYes, chkHNCNo, AHNCRelated);
|
---|
200 | SetCheckState(chkCVYes, chkCVNo, ACVRelated);
|
---|
201 | end;
|
---|
202 |
|
---|
203 | procedure TfraVisitRelated.SetCheckEnable(CheckYes, CheckNo: TCheckBox;
|
---|
204 | Allow: Boolean);
|
---|
205 | begin
|
---|
206 | CheckYes.Enabled := Allow;
|
---|
207 | CheckNo.Enabled := Allow;
|
---|
208 | end;
|
---|
209 |
|
---|
210 | procedure TfraVisitRelated.SetCheckState(CheckYes, CheckNo: TCheckBox; CheckState: Integer);
|
---|
211 | begin
|
---|
212 | if CheckYes.Enabled then
|
---|
213 | case CheckState of
|
---|
214 | SCC_NA: begin
|
---|
215 | CheckYes.Checked := False;
|
---|
216 | CheckNo.Checked := False;
|
---|
217 | end;
|
---|
218 | SCC_NO: begin
|
---|
219 | CheckYes.Checked := False;
|
---|
220 | CheckNo.Checked := True;
|
---|
221 | end;
|
---|
222 | SCC_YES: begin
|
---|
223 | CheckYes.Checked := True;
|
---|
224 | CheckNo.Checked := False;
|
---|
225 | end;
|
---|
226 | end; {case}
|
---|
227 | chkClick(Self);
|
---|
228 | end;
|
---|
229 |
|
---|
230 | end.
|
---|