| 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 | (*     Commented out until a further clarification    //kt  12/29/09
 | 
|---|
| 228 |     //vwpt remove other radio button selections
 | 
|---|
| 229 |  if assigned(frmPtSel) and (frmPtSel.radiogroup1.ItemIndex <> 0) then   //kt
 | 
|---|
| 230 |  begin      //elh
 | 
|---|
| 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 |   *)
 | 
|---|
| 260 |   cboList.Pieces := '2';
 | 
|---|
| 261 |   FSrcType := TControl(Sender).Tag;
 | 
|---|
| 262 |   FLastTopList := '';
 | 
|---|
| 263 |   HideDateRange;
 | 
|---|
| 264 |   FSetCaptionTop;
 | 
|---|
| 265 |   with cboList do
 | 
|---|
| 266 |   begin
 | 
|---|
| 267 |     Clear;
 | 
|---|
| 268 |     LongList := False;
 | 
|---|
| 269 |     Sorted := True;
 | 
|---|
| 270 |     case FSrcType of
 | 
|---|
| 271 |     TAG_SRC_TEAM: ListTeamAll(Items);
 | 
|---|
| 272 |     TAG_SRC_SPEC: ListSpecialtyAll(Items);
 | 
|---|
| 273 |     TAG_SRC_WARD: ListWardAll(Items);
 | 
|---|
| 274 |     end;
 | 
|---|
| 275 |     Visible := True;
 | 
|---|
| 276 |   end;
 | 
|---|
| 277 |   cboList.Caption := TRadioButton(Sender).Caption;
 | 
|---|
| 278 |  //kt end; //else
 | 
|---|
| 279 | end;
 | 
|---|
| 280 | 
 | 
|---|
| 281 | procedure TfrmPtSelOptns.radLongSrcClick(Sender: TObject);
 | 
|---|
| 282 | { called by radProviders, radClinics - switches to long list & shows items for the list source }
 | 
|---|
| 283 | begin
 | 
|---|
| 284 |   //vwpt remove other radio button selections
 | 
|---|
| 285 |  (*     Commented out until a further clarification    //kt  12/29/09
 | 
|---|
| 286 |  if frmPtSel.RadioGroup1.ItemIndex <> 0 then
 | 
|---|
| 287 |  begin
 | 
|---|
| 288 |       FSrcType := TControl(Sender).Tag;
 | 
|---|
| 289 |       case FSrcType of
 | 
|---|
| 290 |     TAG_SRC_PROV: begin
 | 
|---|
| 291 |                     radProviders.Checked := False;
 | 
|---|
| 292 |                     radProviders.Refresh;
 | 
|---|
| 293 |                     radAll.Checked := True;
 | 
|---|
| 294 |                     radAll.Refresh;
 | 
|---|
| 295 | 
 | 
|---|
| 296 |                   end;
 | 
|---|
| 297 |     TAG_SRC_CLIN: begin
 | 
|---|
| 298 |                     radClinics.Checked := False;
 | 
|---|
| 299 |                     radClinics.Refresh;
 | 
|---|
| 300 |                     radAll.Checked := True;
 | 
|---|
| 301 |                     radAll.Refresh;
 | 
|---|
| 302 |                   end;
 | 
|---|
| 303 |     end;
 | 
|---|
| 304 |   //frmPtSel.RadioGroup1.SetFocus;
 | 
|---|
| 305 |   //frmPtSel.RadioGroup1.Refresh;
 | 
|---|
| 306 |  end
 | 
|---|
| 307 |  else
 | 
|---|
| 308 |  begin
 | 
|---|
| 309 |   //end vwpt  *)
 | 
|---|
| 310 |   cboList.Pieces := '2';
 | 
|---|
| 311 |   FSrcType := TControl(Sender).Tag;
 | 
|---|
| 312 |   FLastTopList := '';
 | 
|---|
| 313 |   FSetCaptionTop;
 | 
|---|
| 314 |   with cboList do
 | 
|---|
| 315 |   begin
 | 
|---|
| 316 |     Sorted := False;
 | 
|---|
| 317 |     LongList := True;
 | 
|---|
| 318 |     Clear;
 | 
|---|
| 319 |     case FSrcType of
 | 
|---|
| 320 |     TAG_SRC_PROV: begin
 | 
|---|
| 321 |                     cboList.Pieces := '2,3';
 | 
|---|
| 322 |                     HideDateRange;
 | 
|---|
| 323 |                     ListProviderTop(Items);
 | 
|---|
| 324 |                   end;
 | 
|---|
| 325 |     TAG_SRC_CLIN: begin
 | 
|---|
| 326 |                     ShowDateRange;
 | 
|---|
| 327 |                     ListClinicTop(Items);
 | 
|---|
| 328 |                   end;
 | 
|---|
| 329 |     end;
 | 
|---|
| 330 |     InitLongList('');
 | 
|---|
| 331 |     Visible := True;
 | 
|---|
| 332 |   end;
 | 
|---|
| 333 |   cboList.Caption := TRadioButton(Sender).Caption;
 | 
|---|
| 334 |  //kt end; //else
 | 
|---|
| 335 | end;
 | 
|---|
| 336 | 
 | 
|---|
| 337 | procedure TfrmPtSelOptns.cboListExit(Sender: TObject);
 | 
|---|
| 338 | begin
 | 
|---|
| 339 |   with cboList do if ItemIEN > 0 then FSetPtListTop(ItemIEN);
 | 
|---|
| 340 | end;
 | 
|---|
| 341 | 
 | 
|---|
| 342 | procedure TfrmPtSelOptns.cboListKeyPause(Sender: TObject);
 | 
|---|
| 343 | begin
 | 
|---|
| 344 |   with cboList do if ItemIEN > 0 then FSetPtListTop(ItemIEN);
 | 
|---|
| 345 | end;
 | 
|---|
| 346 | 
 | 
|---|
| 347 | procedure TfrmPtSelOptns.cboListMouseClick(Sender: TObject);
 | 
|---|
| 348 | begin
 | 
|---|
| 349 |   with cboList do if ItemIEN > 0 then FSetPtListTop(ItemIEN);
 | 
|---|
| 350 | end;
 | 
|---|
| 351 | 
 | 
|---|
| 352 | procedure TfrmPtSelOptns.cboListNeedData(Sender: TObject; const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
| 353 | {CQ6363 Notes: This procedure was altered for CQ6363, but then changed back to its original form, as it is now.
 | 
|---|
| 354 | 
 | 
|---|
| 355 | The problem is that in LOM1T, there are numerous entries in the HOSPITAL LOCATION file (44) that are lower-case,
 | 
|---|
| 356 | resulting in a "B" xref that looks like this:
 | 
|---|
| 357 | 
 | 
|---|
| 358 | ^SC("B","module 1x",2897) = 
 | 
|---|
| 359 | ^SC("B","pt",3420) = 
 | 
|---|
| 360 | ^SC("B","read",3146) = 
 | 
|---|
| 361 | ^SC("B","zz GIM/WONG NEW",2902) = 
 | 
|---|
| 362 | ^SC("B","zz bhost/arm",3076) = 
 | 
|---|
| 363 | ^SC("B","zz bhost/day",2698) = 
 | 
|---|
| 364 | ^SC("B","zz bhost/eve/ornelas",2885) = 
 | 
|---|
| 365 | ^SC("B","zz bhost/resident",2710) = 
 | 
|---|
| 366 | ^SC("B","zz bhost/sws",2946) = 
 | 
|---|
| 367 | ^SC("B","zz c&P ortho/patel",3292) =
 | 
|---|
| 368 | ^SC("B","zz mhc md/kelley",320) = 
 | 
|---|
| 369 | ^SC("B","zz/mhc/p",1076) = 
 | 
|---|
| 370 | ^SC("B","zzMHC MD/THRASHER",1018) =
 | 
|---|
| 371 | ^SC("B","zztest clinic",3090) = 
 | 
|---|
| 372 | ^SC("B","zzz-hbpc-phone-jung",1830) = 
 | 
|---|
| 373 | ^SC("B","zzz-hbpcphone cocohran",1825) = 
 | 
|---|
| 374 | ^SC("B","zzz-home service",1428) = 
 | 
|---|
| 375 | ^SC("B","zzz-phone-deloye",1834) = 
 | 
|---|
| 376 | ^SC("B","zzz/gmonti impotence",2193) =
 | 
|---|
| 377 | 
 | 
|---|
| 378 | ASCII sort mode puts those entries at the end of the "B" xref, but when retrieved by CPRS and upper-cased, it
 | 
|---|
| 379 | messes up the logic of the combo box.  This problem has been around since there was a CPRS GUI, and the best
 | 
|---|
| 380 | possible fix is to require those entries to either be in all uppercase or be removed.  If that's cleaned up,
 | 
|---|
| 381 | the logic below will work correctly.
 | 
|---|
| 382 | }
 | 
|---|
| 383 | begin
 | 
|---|
| 384 |   case frmPtSelOptns.SrcType of
 | 
|---|
| 385 |   TAG_SRC_PROV: cboList.ForDataUse(SubSetOfProviders(StartFrom, Direction));
 | 
|---|
| 386 |   TAG_SRC_CLIN: cboList.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
| 387 |   end;
 | 
|---|
| 388 | end;
 | 
|---|
| 389 | 
 | 
|---|
| 390 | procedure TfrmPtSelOptns.HideDateRange;
 | 
|---|
| 391 | begin
 | 
|---|
| 392 |   lblDateRange.Hide;
 | 
|---|
| 393 |   cboDateRange.Hide;
 | 
|---|
| 394 |   cboList.Height := cboDateRange.Top - cboList.Top + cboDateRange.Height;
 | 
|---|
| 395 | end;
 | 
|---|
| 396 | 
 | 
|---|
| 397 | procedure TfrmPtSelOptns.ShowDateRange;
 | 
|---|
| 398 | var
 | 
|---|
| 399 |   DateString, DRStart, DREnd: string;
 | 
|---|
| 400 |   TStart, TEnd: boolean;
 | 
|---|
| 401 | begin
 | 
|---|
| 402 |   with cboDateRange do if Items.Count = 0 then
 | 
|---|
| 403 |   begin
 | 
|---|
| 404 |     ListDateRangeClinic(Items);
 | 
|---|
| 405 |     ItemIndex := 0;
 | 
|---|
| 406 |   end;
 | 
|---|
| 407 |   DateString := DfltDateRangeClinic; // Returns "^T" even if no settings.
 | 
|---|
| 408 |   DRStart := piece(DateString,U,1);
 | 
|---|
| 409 |   DREnd := piece(DateString,U,2);
 | 
|---|
| 410 |   if (DRStart <> ' ') then
 | 
|---|
| 411 |     begin
 | 
|---|
| 412 |       TStart := false;
 | 
|---|
| 413 |       TEnd := false;
 | 
|---|
| 414 |       if ((DRStart = 'T') or (DRStart = 'TODAY')) then
 | 
|---|
| 415 |         TStart := true;
 | 
|---|
| 416 |       if ((DREnd = 'T') or (DREnd = 'TODAY')) then
 | 
|---|
| 417 |         TEnd := true;
 | 
|---|
| 418 |       if not (TStart and TEnd) then
 | 
|---|
| 419 |         cboDateRange.ItemIndex := cboDateRange.Items.Add(DRStart + ';' +
 | 
|---|
| 420 | //        DREnd + U + DRStart + ' to ' + DREnd);  <-- original line.  //kt 9/5/2007
 | 
|---|
| 421 |           DREnd + U + DRStart + DKLangConstW('fPtSelOptns_to') + DREnd); //kt added 9/5/2007
 | 
|---|
| 422 |     end;
 | 
|---|
| 423 |   cboList.Height := lblDateRange.Top - cboList.Top - 4;
 | 
|---|
| 424 |   lblDateRange.Show;
 | 
|---|
| 425 |   cboDateRange.Show;
 | 
|---|
| 426 | end;
 | 
|---|
| 427 | 
 | 
|---|
| 428 | procedure TfrmPtSelOptns.cboDateRangeExit(Sender: TObject);
 | 
|---|
| 429 | begin
 | 
|---|
| 430 |   if cboDateRange.ItemIndex <> FLastDateIndex then cboDateRangeMouseClick(Self);
 | 
|---|
| 431 | end;
 | 
|---|
| 432 | 
 | 
|---|
| 433 | procedure TfrmPtSelOptns.cboDateRangeMouseClick(Sender: TObject);
 | 
|---|
| 434 | begin
 | 
|---|
| 435 |   if (cboDateRange.ItemID = 'S') then
 | 
|---|
| 436 |   begin
 | 
|---|
| 437 |     with calApptRng do if Execute
 | 
|---|
| 438 |       then cboDateRange.ItemIndex := cboDateRange.Items.Add(RelativeStart + ';' +
 | 
|---|
| 439 | //         RelativeStop + U + TextOfStart + ' to ' + TextOfStop)  <-- original line.  //kt 9/5/2007
 | 
|---|
| 440 |            RelativeStop + U + TextOfStart + DKLangConstW('fPtSelOptns_to') + TextOfStop) //kt added 9/5/2007
 | 
|---|
| 441 |       else cboDateRange.ItemIndex := -1;
 | 
|---|
| 442 |   end;
 | 
|---|
| 443 |   FLastDateIndex := cboDateRange.ItemIndex;
 | 
|---|
| 444 |   if cboList.ItemIEN > 0 then FSetPtListTop(cboList.ItemIEN);
 | 
|---|
| 445 | end;
 | 
|---|
| 446 | 
 | 
|---|
| 447 | procedure TfrmPtSelOptns.cmdSaveListClick(Sender: TObject);
 | 
|---|
| 448 | var
 | 
|---|
| 449 |   x: string;
 | 
|---|
| 450 | begin
 | 
|---|
| 451 |   x := '';
 | 
|---|
| 452 |   case FSrcType of
 | 
|---|
| 453 |   TAG_SRC_DFLT: InfoBox(TX_LS_DFLT, TC_LS_FAIL, MB_OK);
 | 
|---|
| 454 |   TAG_SRC_PROV: if cboList.ItemIEN <= 0
 | 
|---|
| 455 |                   then InfoBox(TX_LS_PROV, TC_LS_FAIL, MB_OK)
 | 
|---|
| 456 |                   else x := 'P^' + IntToStr(cboList.ItemIEN) + U + U +
 | 
|---|
| 457 | //                          'Provider = ' + cboList.Text;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 458 |                             DKLangConstW('fPtSelOptns_Provider_x') + cboList.Text; //kt added 9/5/2007
 | 
|---|
| 459 |   TAG_SRC_TEAM: if cboList.ItemIEN <= 0
 | 
|---|
| 460 |                   then InfoBox(TX_LS_TEAM, TC_LS_FAIL, MB_OK)
 | 
|---|
| 461 |                   else x := 'T^' + IntToStr(cboList.ItemIEN) + U + U +
 | 
|---|
| 462 | //                          'Team = ' + cboList.Text;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 463 |                             DKLangConstW('fPtSelOptns_Team_x') + cboList.Text; //kt added 9/5/2007
 | 
|---|
| 464 |   TAG_SRC_SPEC: if cboList.ItemIEN <= 0
 | 
|---|
| 465 |                   then InfoBox(TX_LS_SPEC, TC_LS_FAIL, MB_OK)
 | 
|---|
| 466 |                   else x := 'S^' + IntToStr(cboList.ItemIEN) + U + U +
 | 
|---|
| 467 | //                          'Specialty = ' + cboList.Text;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 468 |                             DKLangConstW('fPtSelOptns_Specialty_x') + cboList.Text; //kt added 9/5/2007
 | 
|---|
| 469 |   TAG_SRC_CLIN: if (cboList.ItemIEN <= 0) or (Pos(';', cboDateRange.ItemID) = 0)
 | 
|---|
| 470 |                   then InfoBox(TX_LS_CLIN, TC_LS_FAIL, MB_OK)
 | 
|---|
| 471 |                   else
 | 
|---|
| 472 |                     begin
 | 
|---|
| 473 | //                    clinDefaults := 'Clinic = ' + cboList.Text + ',  ' + cboDaterange.text;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 474 |                       clinDefaults := DKLangConstW('fPtSelOptns_Clinic') + ' = ' + cboList.Text + DKLangConstW('fPtSelOptns_x') + cboDaterange.text; //kt added 9/5/2007
 | 
|---|
| 475 |                       frmPtSelOptSave := TfrmPtSelOptSave.create(Application); // Calls dialogue form for user input.
 | 
|---|
| 476 |                       frmPtSelOptSave.showModal;
 | 
|---|
| 477 |                       frmPtSelOptSave.free;
 | 
|---|
| 478 |                       if (not clinDoSave) then
 | 
|---|
| 479 |                         Exit;
 | 
|---|
| 480 |                       if clinSaveToday then
 | 
|---|
| 481 |                         x := 'CT^' + IntToStr(cboList.ItemIEN) + U + cboDateRange.ItemID + U +
 | 
|---|
| 482 | //                          'Clinic = ' + cboList.Text + ',  ' +  cboDateRange.Text  <-- original line.  //kt 9/5/2007
 | 
|---|
| 483 |                             DKLangConstW('fPtSelOptns_Clinic') + ' = ' + cboList.Text + DKLangConstW('fPtSelOptns_x') +  cboDateRange.Text //kt added 9/5/2007
 | 
|---|
| 484 |                       else
 | 
|---|
| 485 |                         x := 'C^' + IntToStr(cboList.ItemIEN) + U + cboDateRange.ItemID + U +
 | 
|---|
| 486 | //                          'Clinic = ' + cboList.Text + ',  ' +  cboDateRange.Text;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 487 |                             DKLangConstW('fPtSelOptns_Clinic') + ' = ' + cboList.Text + DKLangConstW('fPtSelOptns_x') +  cboDateRange.Text; //kt added 9/5/2007
 | 
|---|
| 488 |                     end;
 | 
|---|
| 489 |   TAG_SRC_WARD: if cboList.ItemIEN <= 0
 | 
|---|
| 490 |                   then InfoBox(TX_LS_WARD, TC_LS_FAIL, MB_OK)
 | 
|---|
| 491 |                   else x := 'W^' + IntToStr(cboList.ItemIEN) + U + U +
 | 
|---|
| 492 | //                          'Ward = ' + cboList.Text;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 493 |                             DKLangConstW('fPtSelOptns_Ward_x') + cboList.Text; //kt added 9/5/2007
 | 
|---|
| 494 |   TAG_SRC_ALL : x := 'A';
 | 
|---|
| 495 |   end;
 | 
|---|
| 496 |   if (x <> '') then
 | 
|---|
| 497 |     begin
 | 
|---|
| 498 |       if not (FSrcType = TAG_SRC_CLIN) then // Clinics already have a "confirm" d-box.
 | 
|---|
| 499 |         begin
 | 
|---|
| 500 |           if (InfoBox(TX_LS_SAV1 + Piece(x, U, 4) + TX_LS_SAV2, TC_LS_SAVE, MB_YESNO) = IDYES) then
 | 
|---|
| 501 |             begin
 | 
|---|
| 502 |               SavePtListDflt(x);
 | 
|---|
| 503 |               UpdateDefault;
 | 
|---|
| 504 |             end;
 | 
|---|
| 505 |         end
 | 
|---|
| 506 |       else // Skip second confirmation box for clinics.
 | 
|---|
| 507 |         begin
 | 
|---|
| 508 |           SavePtListDflt(x);
 | 
|---|
| 509 |           UpdateDefault;
 | 
|---|
| 510 |         end;
 | 
|---|
| 511 |     end;
 | 
|---|
| 512 | end;
 | 
|---|
| 513 | 
 | 
|---|
| 514 | procedure TfrmPtSelOptns.FormCreate(Sender: TObject);
 | 
|---|
| 515 | begin
 | 
|---|
| 516 |   FLastDateIndex := -1;
 | 
|---|
| 517 | end;
 | 
|---|
| 518 | 
 | 
|---|
| 519 | procedure TfrmPtSelOptns.SetDefaultPtList(Dflt: string);
 | 
|---|
| 520 | begin
 | 
|---|
| 521 |   if Length(Dflt) > 0 then                   // if default patient list available, use it
 | 
|---|
| 522 |   begin
 | 
|---|
| 523 | //  radDflt.Caption := '&Default: ' + Dflt;  <-- original line.  //kt 9/5/2007
 | 
|---|
| 524 |     radDflt.Caption := DKLangConstW('fPtSelOptns_xDefaultx') + Dflt; //kt added 9/5/2007
 | 
|---|
| 525 |     radDflt.Checked := True;                 // causes radHideSrcClick to be called
 | 
|---|
| 526 |   end
 | 
|---|
| 527 |   else                                       // otherwise, select from all patients
 | 
|---|
| 528 |   begin
 | 
|---|
| 529 |     radDflt.Enabled := False;
 | 
|---|
| 530 |     radAll.Checked := True;                  // causes radHideSrcClick to be called
 | 
|---|
| 531 |   end;
 | 
|---|
| 532 | end;
 | 
|---|
| 533 | 
 | 
|---|
| 534 | procedure TfrmPtSelOptns.UpdateDefault;
 | 
|---|
| 535 | begin
 | 
|---|
| 536 |   FSrcType := TAG_SRC_DFLT;
 | 
|---|
| 537 |   fPtSel.FDfltSrc := DfltPtList; // Server side default setting: "DfltPtList" is in rCore.
 | 
|---|
| 538 |   fPtSel.FDfltSrcType := Piece(fPtSel.FDfltSrc, U, 2);
 | 
|---|
| 539 |   fPtSel.FDfltSrc := Piece(fPtSel.FDfltSrc, U, 1);
 | 
|---|
| 540 |   if (IsRPL = '1') then // Deal with restricted patient list users.
 | 
|---|
| 541 |     fPtSel.FDfltSrc := '';
 | 
|---|
| 542 |   SetDefaultPtList(fPtSel.FDfltSrc);
 | 
|---|
| 543 | end;
 | 
|---|
| 544 | 
 | 
|---|
| 545 | end.
 | 
|---|