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