source: cprs/branches/foia-cprs/CPRS-Chart/Encounter/mVisitRelated.pas@ 1806

Last change on this file since 1806 was 463, checked in by Kevin Toppenberg, 16 years ago

Uploading 1.0.26.76, OR_30_277

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