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