[456] | 1 | unit fPtSelOptns;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | ORDtTmRng, ORCtrls, StdCtrls, ExtCtrls, ORFn;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TSetCaptionTopProc = procedure of object;
|
---|
| 11 | TSetPtListTopProc = procedure(IEN: Int64) of object;
|
---|
| 12 |
|
---|
| 13 | TfrmPtSelOptns = class(TForm)
|
---|
| 14 | orapnlMain: TORAutoPanel;
|
---|
| 15 | bvlPtList: TORAutoPanel;
|
---|
| 16 | lblPtList: TLabel;
|
---|
| 17 | lblDateRange: TLabel;
|
---|
| 18 | cboList: TORComboBox;
|
---|
| 19 | cboDateRange: TORComboBox;
|
---|
| 20 | calApptRng: TORDateRangeDlg;
|
---|
| 21 | radDflt: TRadioButton;
|
---|
| 22 | radProviders: TRadioButton;
|
---|
| 23 | radTeams: TRadioButton;
|
---|
| 24 | radSpecialties: TRadioButton;
|
---|
| 25 | radClinics: TRadioButton;
|
---|
| 26 | radWards: TRadioButton;
|
---|
| 27 | radAll: TRadioButton;
|
---|
| 28 | procedure radHideSrcClick(Sender: TObject);
|
---|
| 29 | procedure radShowSrcClick(Sender: TObject);
|
---|
| 30 | procedure radLongSrcClick(Sender: TObject);
|
---|
| 31 | procedure cboListExit(Sender: TObject);
|
---|
| 32 | procedure cboListKeyPause(Sender: TObject);
|
---|
| 33 | procedure cboListMouseClick(Sender: TObject);
|
---|
| 34 | procedure cboListNeedData(Sender: TObject; const StartFrom: String;
|
---|
| 35 | Direction, InsertAt: Integer);
|
---|
| 36 | procedure cboDateRangeExit(Sender: TObject);
|
---|
| 37 | procedure cboDateRangeMouseClick(Sender: TObject);
|
---|
| 38 | procedure FormCreate(Sender: TObject);
|
---|
| 39 | private
|
---|
| 40 | FLastTopList: string;
|
---|
| 41 | FLastDateIndex: Integer;
|
---|
| 42 | FSrcType: Integer;
|
---|
| 43 | FSetCaptionTop: TSetCaptionTopProc;
|
---|
| 44 | FSetPtListTop: TSetPtListTopProc;
|
---|
| 45 | procedure HideDateRange;
|
---|
| 46 | procedure ShowDateRange;
|
---|
| 47 | public
|
---|
| 48 | function IsLast5(x: string): Boolean;
|
---|
| 49 | function IsFullSSN(x: string): Boolean;
|
---|
| 50 | //vwpt voe
|
---|
| 51 | function IsEnhanced(x: String) : Boolean ;
|
---|
| 52 | function IsPatientName(x: String) :Boolean;
|
---|
| 53 | //end
|
---|
| 54 | procedure cmdSaveListClick(Sender: TObject);
|
---|
| 55 | procedure SetDefaultPtList(Dflt: string);
|
---|
| 56 | procedure UpdateDefault;
|
---|
| 57 |
|
---|
| 58 |
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | property LastTopList: string read FLastTopList write FLastTopList;
|
---|
| 62 | property SrcType: Integer read FSrcType write FSrcType;
|
---|
| 63 | property SetCaptionTopProc: TSetCaptionTopProc read FSetCaptionTop write FSetCaptionTop;
|
---|
| 64 | property SetPtListTopProc: TSetPtListTopProc read FSetPtListTop write FSetPtListTop;
|
---|
| 65 | end;
|
---|
| 66 |
|
---|
| 67 | const
|
---|
| 68 | { constants referencing the value of the tag property in components }
|
---|
| 69 | TAG_SRC_DFLT = 11; // default patient list
|
---|
| 70 | TAG_SRC_PROV = 12; // patient list by provider
|
---|
| 71 | TAG_SRC_TEAM = 13; // patient list by team
|
---|
| 72 | TAG_SRC_SPEC = 14; // patient list by treating specialty
|
---|
| 73 | TAG_SRC_CLIN = 16; // patient list by clinic
|
---|
| 74 | TAG_SRC_WARD = 17; // patient list by ward
|
---|
| 75 | TAG_SRC_ALL = 18; // all patients
|
---|
| 76 |
|
---|
| 77 | var
|
---|
| 78 | frmPtSelOptns: TfrmPtSelOptns;
|
---|
| 79 | //frmPtSelOptns: TfrmPtSelOptns;
|
---|
| 80 | clinDoSave, clinSaveToday: boolean;
|
---|
| 81 | clinDefaults: string;
|
---|
| 82 |
|
---|
| 83 | implementation
|
---|
| 84 |
|
---|
| 85 | {$R *.DFM}
|
---|
| 86 |
|
---|
| 87 | uses
|
---|
| 88 | rCore, fPtSelOptSave,fPtSel;
|
---|
| 89 |
|
---|
| 90 | const
|
---|
| 91 | TX_LS_DFLT = 'This is already saved as your default patient list settings.';
|
---|
| 92 | TX_LS_PROV = 'A provider must be selected to save patient list settings.';
|
---|
| 93 | TX_LS_TEAM = 'A team must be selected to save patient list settings.';
|
---|
| 94 | TX_LS_SPEC = 'A specialty must be selected to save patient list settings.';
|
---|
| 95 | TX_LS_CLIN = 'A clinic and a date range must be selected to save settings for a clinic.';
|
---|
| 96 | TX_LS_WARD = 'A ward must be selected to save patient list settings.';
|
---|
| 97 | TC_LS_FAIL = 'Unable to Save Patient List Settings';
|
---|
| 98 | TX_LS_SAV1 = 'Save ';
|
---|
| 99 | TX_LS_SAV2 = CRLF + 'as your default patient list setting?';
|
---|
| 100 | TC_LS_SAVE = 'Save Patient List Settings';
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | function TfrmPtSelOptns.IsLast5(x: string): Boolean;
|
---|
| 105 | { returns true if string matchs patterns: A9999 or 9999 (BS & BS5 xrefs for patient lookup) }
|
---|
| 106 | var
|
---|
| 107 | i: Integer;
|
---|
| 108 | begin
|
---|
| 109 | Result := False;
|
---|
| 110 | if not ((Length(x) = 4) or (Length(x) = 5)) then Exit;
|
---|
| 111 | if Length(x) = 5 then
|
---|
| 112 | begin
|
---|
| 113 | if not (x[1] in ['A'..'Z', 'a'..'z']) then Exit;
|
---|
| 114 | x := Copy(x, 2, 4);
|
---|
| 115 | end;
|
---|
| 116 | for i := 1 to 4 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
| 117 | Result := True;
|
---|
| 118 | end;
|
---|
| 119 | function TfrmPtSelOptns.IsPatientName(x: string):Boolean;
|
---|
| 120 | { returns true if string matchs patient name pattern: all alphabetic," ",",","-","." only }
|
---|
| 121 | var
|
---|
| 122 | i: Integer;
|
---|
| 123 | begin
|
---|
| 124 | Result := False;
|
---|
| 125 |
|
---|
| 126 | for i := 1 to Length(x) do if not (x[i] in ['A'..'Z', 'a'..'z', ' '..' ', ','..'.']) then Exit;
|
---|
| 127 |
|
---|
| 128 | Result := True;
|
---|
| 129 | end;
|
---|
| 130 | function TfrmPtSelOptns.IsEnhanced(x: String) : boolean ;
|
---|
| 131 | var
|
---|
| 132 | i: integer;
|
---|
| 133 | begin
|
---|
| 134 | //Result := True;
|
---|
| 135 | //for i:= 1 to Length(x) do if (x[i] in ['0'..'9']) then Exit;
|
---|
| 136 | //for i:= 1 to Length(x) do
|
---|
| 137 | //begin
|
---|
| 138 | // if ((x[i] = '(') or (x[i] = ')') or (x[i] = '-') or (x[i] = '/') or (x[i] = ',') or (x[i] = '\')) then Exit;
|
---|
| 139 | //end;
|
---|
| 140 | Result := True; //False;
|
---|
| 141 | if (frmPtSelOptns.radAll.Checked <> True)and (frmPtSelOptns.radDflt.Checked <> True) then Result := False;
|
---|
| 142 | end;
|
---|
| 143 | function TfrmPtSelOptns.IsFullSSN(x: string): boolean;
|
---|
| 144 | var
|
---|
| 145 | i: integer;
|
---|
| 146 | begin
|
---|
| 147 | Result := False;
|
---|
| 148 | if (Length(x) < 9) or (Length(x) > 12) then Exit;
|
---|
| 149 | case Length(x) of
|
---|
| 150 | 9: // no dashes, no 'P'
|
---|
| 151 | for i := 1 to 9 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
| 152 | 10: // no dashes, with 'P'
|
---|
| 153 | begin
|
---|
| 154 | for i := 1 to 9 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
| 155 | if (Uppercase(x[10]) <> 'P') then Exit;
|
---|
| 156 | end;
|
---|
| 157 | 11: // dashes, no 'P'
|
---|
| 158 | begin
|
---|
| 159 | if (x[4] <> '-') or (x[7] <> '-') then Exit;
|
---|
| 160 | x := Copy(x,1,3) + Copy(x,5,2) + Copy(x,8,4);
|
---|
| 161 | for i := 1 to 9 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
| 162 | end;
|
---|
| 163 | 12: // dashes, with 'P'
|
---|
| 164 | begin
|
---|
| 165 | if (x[4] <> '-') or (x[7] <> '-') then Exit;
|
---|
| 166 | x := Copy(x,1,3) + Copy(x,5,2) + Copy(x,8,5);
|
---|
| 167 | for i := 1 to 9 do if not (x[i] in ['0'..'9']) then Exit;
|
---|
| 168 | if UpperCase(x[10]) <> 'P' then Exit;
|
---|
| 169 | end;
|
---|
| 170 | end;
|
---|
| 171 | Result := True;
|
---|
| 172 | end;
|
---|
| 173 |
|
---|
| 174 | procedure TfrmPtSelOptns.radHideSrcClick(Sender: TObject);
|
---|
| 175 | { called by radDflt & radAll - hides list source combo box and refreshes patient list }
|
---|
| 176 | begin
|
---|
| 177 | cboList.Pieces := '2';
|
---|
| 178 | FSrcType := TControl(Sender).Tag;
|
---|
| 179 | FLastTopList := '';
|
---|
| 180 | HideDateRange;
|
---|
| 181 | cboList.Visible := False;
|
---|
| 182 | cboList.Caption := TRadioButton(Sender).Caption;
|
---|
| 183 | FSetCaptionTop;
|
---|
| 184 | FSetPtListTop(0);
|
---|
| 185 | end;
|
---|
| 186 |
|
---|
| 187 | procedure TfrmPtSelOptns.radShowSrcClick(Sender: TObject);
|
---|
| 188 | { called by radTeams, radSpecialties, radWards - shows items for the list source }
|
---|
| 189 | begin
|
---|
| 190 | //vwpt remove other radio button selections
|
---|
| 191 | if fPtSel.radiogrp1index <> 0 then
|
---|
| 192 | begin
|
---|
| 193 | FSrcType := TControl(Sender).Tag;
|
---|
| 194 | case FSrcType of
|
---|
| 195 | TAG_SRC_TEAM: begin
|
---|
| 196 | radTeams.Checked := False;
|
---|
| 197 | radTeams.Refresh;
|
---|
| 198 | radAll.Checked := True;
|
---|
| 199 | radAll.Refresh;
|
---|
| 200 | end;
|
---|
| 201 | TAG_SRC_SPEC: begin
|
---|
| 202 | radSpecialties.Checked := False;
|
---|
| 203 | radSpecialties.Refresh;
|
---|
| 204 | radAll.Checked := True;
|
---|
| 205 | radAll.Refresh;
|
---|
| 206 | end;
|
---|
| 207 | TAG_SRC_WARD: begin
|
---|
| 208 | radWards.Checked := False;
|
---|
| 209 | radWards.Refresh;
|
---|
| 210 | radAll.Checked := True;
|
---|
| 211 | radAll.Refresh;
|
---|
| 212 | end;
|
---|
| 213 | end;
|
---|
| 214 | //frmPtSel.RadioGroup1.SetFocus;
|
---|
| 215 | //frmPtSel.RadioGroup1.Refresh;
|
---|
| 216 | end
|
---|
| 217 | else
|
---|
| 218 | begin
|
---|
| 219 | //end vwpt
|
---|
| 220 | cboList.Pieces := '2';
|
---|
| 221 | FSrcType := TControl(Sender).Tag;
|
---|
| 222 | FLastTopList := '';
|
---|
| 223 | HideDateRange;
|
---|
| 224 | FSetCaptionTop;
|
---|
| 225 | with cboList do
|
---|
| 226 | begin
|
---|
| 227 | Clear;
|
---|
| 228 | LongList := False;
|
---|
| 229 | Sorted := True;
|
---|
| 230 | case FSrcType of
|
---|
| 231 | TAG_SRC_TEAM: ListTeamAll(Items);
|
---|
| 232 | TAG_SRC_SPEC: ListSpecialtyAll(Items);
|
---|
| 233 | TAG_SRC_WARD: ListWardAll(Items);
|
---|
| 234 | end;
|
---|
| 235 | Visible := True;
|
---|
| 236 | end;
|
---|
| 237 | cboList.Caption := TRadioButton(Sender).Caption;
|
---|
| 238 | end; //else
|
---|
| 239 | end;
|
---|
| 240 |
|
---|
| 241 | procedure TfrmPtSelOptns.radLongSrcClick(Sender: TObject);
|
---|
| 242 | { called by radProviders, radClinics - switches to long list & shows items for the list source }
|
---|
| 243 | begin
|
---|
| 244 | //vwpt remove other radio button selections
|
---|
| 245 | if fPtSel.radiogrp1index <> 0 then
|
---|
| 246 | begin
|
---|
| 247 | FSrcType := TControl(Sender).Tag;
|
---|
| 248 | case FSrcType of
|
---|
| 249 | TAG_SRC_PROV: begin
|
---|
| 250 | radProviders.Checked := False;
|
---|
| 251 | radProviders.Refresh;
|
---|
| 252 | radAll.Checked := True;
|
---|
| 253 | radAll.Refresh;
|
---|
| 254 |
|
---|
| 255 | end;
|
---|
| 256 | TAG_SRC_CLIN: begin
|
---|
| 257 | radClinics.Checked := False;
|
---|
| 258 | radClinics.Refresh;
|
---|
| 259 | radAll.Checked := True;
|
---|
| 260 | radAll.Refresh;
|
---|
| 261 | end;
|
---|
| 262 | end;
|
---|
| 263 | //frmPtSel.RadioGroup1.SetFocus;
|
---|
| 264 | //frmPtSel.RadioGroup1.Refresh;
|
---|
| 265 | end
|
---|
| 266 | else
|
---|
| 267 | begin
|
---|
| 268 | //end vwpt
|
---|
| 269 | cboList.Pieces := '2';
|
---|
| 270 | FSrcType := TControl(Sender).Tag;
|
---|
| 271 | FLastTopList := '';
|
---|
| 272 | FSetCaptionTop;
|
---|
| 273 | with cboList do
|
---|
| 274 | begin
|
---|
| 275 | Sorted := False;
|
---|
| 276 | LongList := True;
|
---|
| 277 | Clear;
|
---|
| 278 | case FSrcType of
|
---|
| 279 | TAG_SRC_PROV: begin
|
---|
| 280 | cboList.Pieces := '2,3';
|
---|
| 281 | HideDateRange;
|
---|
| 282 | ListProviderTop(Items);
|
---|
| 283 | end;
|
---|
| 284 | TAG_SRC_CLIN: begin
|
---|
| 285 | ShowDateRange;
|
---|
| 286 | ListClinicTop(Items);
|
---|
| 287 | end;
|
---|
| 288 | end;
|
---|
| 289 | InitLongList('');
|
---|
| 290 | Visible := True;
|
---|
| 291 | end;
|
---|
| 292 | cboList.Caption := TRadioButton(Sender).Caption;
|
---|
| 293 | end; //else
|
---|
| 294 | end;
|
---|
| 295 |
|
---|
| 296 | procedure TfrmPtSelOptns.cboListExit(Sender: TObject);
|
---|
| 297 | begin
|
---|
| 298 | with cboList do if ItemIEN > 0 then FSetPtListTop(ItemIEN);
|
---|
| 299 | end;
|
---|
| 300 |
|
---|
| 301 | procedure TfrmPtSelOptns.cboListKeyPause(Sender: TObject);
|
---|
| 302 | begin
|
---|
| 303 | with cboList do if ItemIEN > 0 then FSetPtListTop(ItemIEN);
|
---|
| 304 | end;
|
---|
| 305 |
|
---|
| 306 | procedure TfrmPtSelOptns.cboListMouseClick(Sender: TObject);
|
---|
| 307 | begin
|
---|
| 308 | with cboList do if ItemIEN > 0 then FSetPtListTop(ItemIEN);
|
---|
| 309 | end;
|
---|
| 310 |
|
---|
| 311 | procedure TfrmPtSelOptns.cboListNeedData(Sender: TObject; const StartFrom: String; Direction, InsertAt: Integer);
|
---|
| 312 | {CQ6363 Notes: This procedure was altered for CQ6363, but then changed back to its original form, as it is now.
|
---|
| 313 |
|
---|
| 314 | The problem is that in LOM1T, there are numerous entries in the HOSPITAL LOCATION file (44) that are lower-case,
|
---|
| 315 | resulting in a "B" xref that looks like this:
|
---|
| 316 |
|
---|
| 317 | ^SC("B","module 1x",2897) =
|
---|
| 318 | ^SC("B","pt",3420) =
|
---|
| 319 | ^SC("B","read",3146) =
|
---|
| 320 | ^SC("B","zz GIM/WONG NEW",2902) =
|
---|
| 321 | ^SC("B","zz bhost/arm",3076) =
|
---|
| 322 | ^SC("B","zz bhost/day",2698) =
|
---|
| 323 | ^SC("B","zz bhost/eve/ornelas",2885) =
|
---|
| 324 | ^SC("B","zz bhost/resident",2710) =
|
---|
| 325 | ^SC("B","zz bhost/sws",2946) =
|
---|
| 326 | ^SC("B","zz c&P ortho/patel",3292) =
|
---|
| 327 | ^SC("B","zz mhc md/kelley",320) =
|
---|
| 328 | ^SC("B","zz/mhc/p",1076) =
|
---|
| 329 | ^SC("B","zzMHC MD/THRASHER",1018) =
|
---|
| 330 | ^SC("B","zztest clinic",3090) =
|
---|
| 331 | ^SC("B","zzz-hbpc-phone-jung",1830) =
|
---|
| 332 | ^SC("B","zzz-hbpcphone cocohran",1825) =
|
---|
| 333 | ^SC("B","zzz-home service",1428) =
|
---|
| 334 | ^SC("B","zzz-phone-deloye",1834) =
|
---|
| 335 | ^SC("B","zzz/gmonti impotence",2193) =
|
---|
| 336 |
|
---|
| 337 | ASCII sort mode puts those entries at the end of the "B" xref, but when retrieved by CPRS and upper-cased, it
|
---|
| 338 | messes up the logic of the combo box. This problem has been around since there was a CPRS GUI, and the best
|
---|
| 339 | possible fix is to require those entries to either be in all uppercase or be removed. If that's cleaned up,
|
---|
| 340 | the logic below will work correctly.
|
---|
| 341 | }
|
---|
| 342 | begin
|
---|
| 343 | case frmPtSelOptns.SrcType of
|
---|
| 344 | TAG_SRC_PROV: cboList.ForDataUse(SubSetOfProviders(StartFrom, Direction));
|
---|
| 345 | TAG_SRC_CLIN: cboList.ForDataUse(SubSetOfClinics(StartFrom, Direction));
|
---|
| 346 | end;
|
---|
| 347 | end;
|
---|
| 348 |
|
---|
| 349 | procedure TfrmPtSelOptns.HideDateRange;
|
---|
| 350 | begin
|
---|
| 351 | lblDateRange.Hide;
|
---|
| 352 | cboDateRange.Hide;
|
---|
| 353 | cboList.Height := cboDateRange.Top - cboList.Top + cboDateRange.Height;
|
---|
| 354 | end;
|
---|
| 355 |
|
---|
| 356 | procedure TfrmPtSelOptns.ShowDateRange;
|
---|
| 357 | var
|
---|
| 358 | DateString, DRStart, DREnd: string;
|
---|
| 359 | TStart, TEnd: boolean;
|
---|
| 360 | begin
|
---|
| 361 | with cboDateRange do if Items.Count = 0 then
|
---|
| 362 | begin
|
---|
| 363 | ListDateRangeClinic(Items);
|
---|
| 364 | ItemIndex := 0;
|
---|
| 365 | end;
|
---|
| 366 | DateString := DfltDateRangeClinic; // Returns "^T" even if no settings.
|
---|
| 367 | DRStart := piece(DateString,U,1);
|
---|
| 368 | DREnd := piece(DateString,U,2);
|
---|
| 369 | if (DRStart <> ' ') then
|
---|
| 370 | begin
|
---|
| 371 | TStart := false;
|
---|
| 372 | TEnd := false;
|
---|
| 373 | if ((DRStart = 'T') or (DRStart = 'TODAY')) then
|
---|
| 374 | TStart := true;
|
---|
| 375 | if ((DREnd = 'T') or (DREnd = 'TODAY')) then
|
---|
| 376 | TEnd := true;
|
---|
| 377 | if not (TStart and TEnd) then
|
---|
| 378 | cboDateRange.ItemIndex := cboDateRange.Items.Add(DRStart + ';' +
|
---|
| 379 | DREnd + U + DRStart + ' to ' + DREnd);
|
---|
| 380 | end;
|
---|
| 381 | cboList.Height := lblDateRange.Top - cboList.Top - 4;
|
---|
| 382 | lblDateRange.Show;
|
---|
| 383 | cboDateRange.Show;
|
---|
| 384 | end;
|
---|
| 385 |
|
---|
| 386 | procedure TfrmPtSelOptns.cboDateRangeExit(Sender: TObject);
|
---|
| 387 | begin
|
---|
| 388 | if cboDateRange.ItemIndex <> FLastDateIndex then cboDateRangeMouseClick(Self);
|
---|
| 389 | end;
|
---|
| 390 |
|
---|
| 391 | procedure TfrmPtSelOptns.cboDateRangeMouseClick(Sender: TObject);
|
---|
| 392 | begin
|
---|
| 393 | if (cboDateRange.ItemID = 'S') then
|
---|
| 394 | begin
|
---|
| 395 | with calApptRng do if Execute
|
---|
| 396 | then cboDateRange.ItemIndex := cboDateRange.Items.Add(RelativeStart + ';' +
|
---|
| 397 | RelativeStop + U + TextOfStart + ' to ' + TextOfStop)
|
---|
| 398 | else cboDateRange.ItemIndex := -1;
|
---|
| 399 | end;
|
---|
| 400 | FLastDateIndex := cboDateRange.ItemIndex;
|
---|
| 401 | if cboList.ItemIEN > 0 then FSetPtListTop(cboList.ItemIEN);
|
---|
| 402 | end;
|
---|
| 403 |
|
---|
| 404 | procedure TfrmPtSelOptns.cmdSaveListClick(Sender: TObject);
|
---|
| 405 | var
|
---|
| 406 | x: string;
|
---|
| 407 | begin
|
---|
| 408 | x := '';
|
---|
| 409 | case FSrcType of
|
---|
| 410 | TAG_SRC_DFLT: InfoBox(TX_LS_DFLT, TC_LS_FAIL, MB_OK);
|
---|
| 411 | TAG_SRC_PROV: if cboList.ItemIEN <= 0
|
---|
| 412 | then InfoBox(TX_LS_PROV, TC_LS_FAIL, MB_OK)
|
---|
| 413 | else x := 'P^' + IntToStr(cboList.ItemIEN) + U + U +
|
---|
| 414 | 'Provider = ' + cboList.Text;
|
---|
| 415 | TAG_SRC_TEAM: if cboList.ItemIEN <= 0
|
---|
| 416 | then InfoBox(TX_LS_TEAM, TC_LS_FAIL, MB_OK)
|
---|
| 417 | else x := 'T^' + IntToStr(cboList.ItemIEN) + U + U +
|
---|
| 418 | 'Team = ' + cboList.Text;
|
---|
| 419 | TAG_SRC_SPEC: if cboList.ItemIEN <= 0
|
---|
| 420 | then InfoBox(TX_LS_SPEC, TC_LS_FAIL, MB_OK)
|
---|
| 421 | else x := 'S^' + IntToStr(cboList.ItemIEN) + U + U +
|
---|
| 422 | 'Specialty = ' + cboList.Text;
|
---|
| 423 | TAG_SRC_CLIN: if (cboList.ItemIEN <= 0) or (Pos(';', cboDateRange.ItemID) = 0)
|
---|
| 424 | then InfoBox(TX_LS_CLIN, TC_LS_FAIL, MB_OK)
|
---|
| 425 | else
|
---|
| 426 | begin
|
---|
| 427 | clinDefaults := 'Clinic = ' + cboList.Text + ', ' + cboDaterange.text;
|
---|
| 428 | frmPtSelOptSave := TfrmPtSelOptSave.create(Application); // Calls dialogue form for user input.
|
---|
| 429 | frmPtSelOptSave.showModal;
|
---|
| 430 | frmPtSelOptSave.free;
|
---|
| 431 | if (not clinDoSave) then
|
---|
| 432 | Exit;
|
---|
| 433 | if clinSaveToday then
|
---|
| 434 | x := 'CT^' + IntToStr(cboList.ItemIEN) + U + cboDateRange.ItemID + U +
|
---|
| 435 | 'Clinic = ' + cboList.Text + ', ' + cboDateRange.Text
|
---|
| 436 | else
|
---|
| 437 | x := 'C^' + IntToStr(cboList.ItemIEN) + U + cboDateRange.ItemID + U +
|
---|
| 438 | 'Clinic = ' + cboList.Text + ', ' + cboDateRange.Text;
|
---|
| 439 | end;
|
---|
| 440 | TAG_SRC_WARD: if cboList.ItemIEN <= 0
|
---|
| 441 | then InfoBox(TX_LS_WARD, TC_LS_FAIL, MB_OK)
|
---|
| 442 | else x := 'W^' + IntToStr(cboList.ItemIEN) + U + U +
|
---|
| 443 | 'Ward = ' + cboList.Text;
|
---|
| 444 | TAG_SRC_ALL : x := 'A';
|
---|
| 445 | end;
|
---|
| 446 | if (x <> '') then
|
---|
| 447 | begin
|
---|
| 448 | if not (FSrcType = TAG_SRC_CLIN) then // Clinics already have a "confirm" d-box.
|
---|
| 449 | begin
|
---|
| 450 | if (InfoBox(TX_LS_SAV1 + Piece(x, U, 4) + TX_LS_SAV2, TC_LS_SAVE, MB_YESNO) = IDYES) then
|
---|
| 451 | begin
|
---|
| 452 | SavePtListDflt(x);
|
---|
| 453 | UpdateDefault;
|
---|
| 454 | end;
|
---|
| 455 | end
|
---|
| 456 | else // Skip second confirmation box for clinics.
|
---|
| 457 | begin
|
---|
| 458 | SavePtListDflt(x);
|
---|
| 459 | UpdateDefault;
|
---|
| 460 | end;
|
---|
| 461 | end;
|
---|
| 462 | end;
|
---|
| 463 |
|
---|
| 464 | procedure TfrmPtSelOptns.FormCreate(Sender: TObject);
|
---|
| 465 | begin
|
---|
| 466 | FLastDateIndex := -1;
|
---|
| 467 | end;
|
---|
| 468 |
|
---|
| 469 | procedure TfrmPtSelOptns.SetDefaultPtList(Dflt: string);
|
---|
| 470 | begin
|
---|
| 471 | if Length(Dflt) > 0 then // if default patient list available, use it
|
---|
| 472 | begin
|
---|
| 473 | radDflt.Caption := '&Default: ' + Dflt;
|
---|
| 474 | radDflt.Checked := True; // causes radHideSrcClick to be called
|
---|
| 475 | end
|
---|
| 476 | else // otherwise, select from all patients
|
---|
| 477 | begin
|
---|
| 478 | radDflt.Enabled := False;
|
---|
| 479 | radAll.Checked := True; // causes radHideSrcClick to be called
|
---|
| 480 | end;
|
---|
| 481 | end;
|
---|
| 482 |
|
---|
| 483 | procedure TfrmPtSelOptns.UpdateDefault;
|
---|
| 484 | begin
|
---|
| 485 | FSrcType := TAG_SRC_DFLT;
|
---|
| 486 | fPtSel.FDfltSrc := DfltPtList; // Server side default setting: "DfltPtList" is in rCore.
|
---|
| 487 | fPtSel.FDfltSrcType := Piece(fPtSel.FDfltSrc, U, 2);
|
---|
| 488 | fPtSel.FDfltSrc := Piece(fPtSel.FDfltSrc, U, 1);
|
---|
| 489 | if (IsRPL = '1') then // Deal with restricted patient list users.
|
---|
| 490 | fPtSel.FDfltSrc := '';
|
---|
| 491 | SetDefaultPtList(fPtSel.FDfltSrc);
|
---|
| 492 | end;
|
---|
| 493 |
|
---|
| 494 | end.
|
---|