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