| [459] | 1 | unit fOptionsPatientSelection;
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | interface
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | uses
 | 
|---|
 | 6 |   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 | 
|---|
 | 7 |   StdCtrls, ExtCtrls, ORCtrls, OrFn, ComCtrls;
 | 
|---|
 | 8 | 
 | 
|---|
 | 9 | type
 | 
|---|
 | 10 |   TfrmOptionsPatientSelection = class(TForm)
 | 
|---|
 | 11 |     pnlBottom: TPanel;
 | 
|---|
 | 12 |     btnOK: TButton;
 | 
|---|
 | 13 |     btnCancel: TButton;
 | 
|---|
 | 14 |     cboProvider: TORComboBox;
 | 
|---|
 | 15 |     cboTreating: TORComboBox;
 | 
|---|
 | 16 |     cboTeam: TORComboBox;
 | 
|---|
 | 17 |     cboWard: TORComboBox;
 | 
|---|
 | 18 |     cboMonday: TORComboBox;
 | 
|---|
 | 19 |     cboTuesday: TORComboBox;
 | 
|---|
 | 20 |     cboWednesday: TORComboBox;
 | 
|---|
 | 21 |     cboThursday: TORComboBox;
 | 
|---|
 | 22 |     cboFriday: TORComboBox;
 | 
|---|
 | 23 |     cboSaturday: TORComboBox;
 | 
|---|
 | 24 |     cboSunday: TORComboBox;
 | 
|---|
 | 25 |     txtVisitStart: TCaptionEdit;
 | 
|---|
 | 26 |     txtVisitStop: TCaptionEdit;
 | 
|---|
 | 27 |     spnVisitStart: TUpDown;
 | 
|---|
 | 28 |     spnVisitStop: TUpDown;
 | 
|---|
 | 29 |     lblClinicDays: TLabel;
 | 
|---|
 | 30 |     lblMonday: TLabel;
 | 
|---|
 | 31 |     lblTuesday: TLabel;
 | 
|---|
 | 32 |     lblWednesday: TLabel;
 | 
|---|
 | 33 |     lblThursday: TLabel;
 | 
|---|
 | 34 |     lblFriday: TLabel;
 | 
|---|
 | 35 |     lblSaturday: TLabel;
 | 
|---|
 | 36 |     lblSunday: TLabel;
 | 
|---|
 | 37 |     lblVisitStart: TLabel;
 | 
|---|
 | 38 |     lblVisitStop: TLabel;
 | 
|---|
 | 39 |     lblVisitDateRange: TMemo;
 | 
|---|
 | 40 |     lblInfo: TMemo;
 | 
|---|
 | 41 |     lbWard: TLabel;
 | 
|---|
 | 42 |     lblTeam: TLabel;
 | 
|---|
 | 43 |     lblTreating: TLabel;
 | 
|---|
 | 44 |     lblProvider: TLabel;
 | 
|---|
 | 45 |     radListSource: TRadioGroup;
 | 
|---|
 | 46 |     grpSortOrder: TGroupBox;
 | 
|---|
 | 47 |     radAlphabetical: TRadioButton;
 | 
|---|
 | 48 |     radRoomBed: TRadioButton;
 | 
|---|
 | 49 |     radAppointmentDate: TRadioButton;
 | 
|---|
 | 50 |     radTerminalDigit: TRadioButton;
 | 
|---|
 | 51 |     radSource: TRadioButton;
 | 
|---|
 | 52 |     bvlBottom: TBevel;
 | 
|---|
 | 53 |     procedure FormCreate(Sender: TObject);
 | 
|---|
 | 54 |     procedure FormShow(Sender: TObject);
 | 
|---|
 | 55 |     procedure spnVisitStartClick(Sender: TObject; Button: TUDBtnType);
 | 
|---|
 | 56 |     procedure spnVisitStopClick(Sender: TObject; Button: TUDBtnType);
 | 
|---|
 | 57 |     procedure btnOKClick(Sender: TObject);
 | 
|---|
 | 58 |     procedure txtVisitStartExit(Sender: TObject);
 | 
|---|
 | 59 |     procedure txtVisitStopExit(Sender: TObject);
 | 
|---|
 | 60 |     procedure txtVisitStartKeyUp(Sender: TObject; var Key: Word;
 | 
|---|
 | 61 |       Shift: TShiftState);
 | 
|---|
 | 62 |     procedure txtVisitStopKeyUp(Sender: TObject; var Key: Word;
 | 
|---|
 | 63 |       Shift: TShiftState);
 | 
|---|
 | 64 |     procedure cboProviderExit(Sender: TObject);
 | 
|---|
 | 65 |     procedure radListSourceClick(Sender: TObject);
 | 
|---|
 | 66 |     procedure cboMondayNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 67 |       Direction, InsertAt: Integer);
 | 
|---|
 | 68 |     procedure cboTuesdayNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 69 |       Direction, InsertAt: Integer);
 | 
|---|
 | 70 |     procedure cboWednesdayNeedData(Sender: TObject;
 | 
|---|
 | 71 |       const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 72 |     procedure cboThursdayNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 73 |       Direction, InsertAt: Integer);
 | 
|---|
 | 74 |     procedure cboFridayNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 75 |       Direction, InsertAt: Integer);
 | 
|---|
 | 76 |     procedure cboSaturdayNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 77 |       Direction, InsertAt: Integer);
 | 
|---|
 | 78 |     procedure cboSundayNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 79 |       Direction, InsertAt: Integer);
 | 
|---|
 | 80 |     procedure cboProviderNeedData(Sender: TObject; const StartFrom: String;
 | 
|---|
 | 81 |       Direction, InsertAt: Integer);
 | 
|---|
 | 82 |     procedure txtVisitStartKeyPress(Sender: TObject; var Key: Char);
 | 
|---|
 | 83 |     procedure txtVisitStopKeyPress(Sender: TObject; var Key: Char);
 | 
|---|
 | 84 |     procedure cboProviderKeyUp(Sender: TObject; var Key: Word;
 | 
|---|
 | 85 |       Shift: TShiftState);
 | 
|---|
 | 86 |   private
 | 
|---|
 | 87 |     { Private declarations }
 | 
|---|
 | 88 |     FStartEntered: boolean;
 | 
|---|
 | 89 |     FStopEntered: boolean;
 | 
|---|
 | 90 |     FProviderSpecial: boolean;   // used to avoid duplicate action on cboProviderKeyUp
 | 
|---|
 | 91 |   public
 | 
|---|
 | 92 |     { Public declarations }
 | 
|---|
 | 93 |     procedure NextControl(Key: Char);
 | 
|---|
 | 94 |   end;
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 | var
 | 
|---|
 | 97 |   frmOptionsPatientSelection: TfrmOptionsPatientSelection;
 | 
|---|
 | 98 | 
 | 
|---|
 | 99 | procedure DialogOptionsPatientSelection(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
 | 
|---|
 | 100 | 
 | 
|---|
 | 101 | implementation
 | 
|---|
 | 102 | 
 | 
|---|
 | 103 | uses rOptions, uOptions, rCore;
 | 
|---|
 | 104 | 
 | 
|---|
 | 105 | {$R *.DFM}
 | 
|---|
 | 106 | 
 | 
|---|
 | 107 | procedure DialogOptionsPatientSelection(topvalue, leftvalue, fontsize: integer; var actiontype: Integer);
 | 
|---|
 | 108 | // create the form and make it modal, return an action
 | 
|---|
 | 109 | var
 | 
|---|
 | 110 |   frmOptionsPatientSelection: TfrmOptionsPatientSelection;
 | 
|---|
 | 111 | begin
 | 
|---|
 | 112 |   frmOptionsPatientSelection := TfrmOptionsPatientSelection.Create(Application);
 | 
|---|
 | 113 |   actiontype := 0;
 | 
|---|
 | 114 |   try
 | 
|---|
 | 115 |     with frmOptionsPatientSelection do
 | 
|---|
 | 116 |     begin
 | 
|---|
 | 117 |       FProviderSpecial := false;
 | 
|---|
 | 118 |       if (topvalue < 0) or (leftvalue < 0) then
 | 
|---|
 | 119 |         Position := poScreenCenter
 | 
|---|
 | 120 |       else
 | 
|---|
 | 121 |       begin
 | 
|---|
 | 122 |         Position := poDesigned;
 | 
|---|
 | 123 |         Top := topvalue;
 | 
|---|
 | 124 |         Left := leftvalue;
 | 
|---|
 | 125 |       end;
 | 
|---|
 | 126 |       ResizeAnchoredFormToFont(frmOptionsPatientSelection);
 | 
|---|
 | 127 |       ShowModal;
 | 
|---|
 | 128 |       actiontype := btnOK.Tag;
 | 
|---|
 | 129 |     end;
 | 
|---|
 | 130 |   finally
 | 
|---|
 | 131 |     frmOptionsPatientSelection.Release;
 | 
|---|
 | 132 |   end;
 | 
|---|
 | 133 | end;
 | 
|---|
 | 134 | 
 | 
|---|
 | 135 | procedure TfrmOptionsPatientSelection.FormCreate(Sender: TObject);
 | 
|---|
 | 136 | begin
 | 
|---|
 | 137 |   FStartEntered := false;
 | 
|---|
 | 138 |   FStopEntered := false;
 | 
|---|
 | 139 |   cboMonday.InitLongList('');
 | 
|---|
 | 140 |   cboTuesday.InitLongList('');
 | 
|---|
 | 141 |   cboWednesday.InitLongList('');
 | 
|---|
 | 142 |   cboThursday.InitLongList('');
 | 
|---|
 | 143 |   cboFriday.InitLongList('');
 | 
|---|
 | 144 |   cboSaturday.InitLongList('');
 | 
|---|
 | 145 |   cboSunday.InitLongList('');
 | 
|---|
 | 146 |   cboProvider.InitLongList('');
 | 
|---|
 | 147 |   ListSpecialtyAll(cboTreating.Items);
 | 
|---|
 | 148 |   ListTeamAll(cboTeam.Items);
 | 
|---|
 | 149 |   ListWardAll(cboWard.Items);
 | 
|---|
 | 150 | end;
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 | procedure TfrmOptionsPatientSelection.FormShow(Sender: TObject);
 | 
|---|
 | 153 | var
 | 
|---|
 | 154 |   visitstart, visitstop: integer;
 | 
|---|
 | 155 |   mon, tues, wed, thurs, fri, sat, sun: integer;
 | 
|---|
 | 156 |   visitstartdef, visitstopdef: integer;
 | 
|---|
 | 157 |   defprovider, deftreating, deflist, defward: integer;
 | 
|---|
 | 158 | begin
 | 
|---|
 | 159 |   rpcGetClinicUserDays(visitstart, visitstop);
 | 
|---|
 | 160 |   visitstartdef := visitstart;
 | 
|---|
 | 161 |   visitstopdef := visitstop;
 | 
|---|
 | 162 |   txtVisitStart.Tag := visitstart - 1;
 | 
|---|
 | 163 |   txtVisitStop.Tag := visitstop - 1;
 | 
|---|
 | 164 |   spnVisitStart.Tag := visitstartdef;
 | 
|---|
 | 165 |   spnVisitStop.Tag := visitstopdef;
 | 
|---|
 | 166 |   spnVisitStartClick(self, btNext);
 | 
|---|
 | 167 |   spnVisitStopClick(self, btNext);
 | 
|---|
 | 168 | 
 | 
|---|
 | 169 |   rpcGetClinicDefaults(mon, tues, wed, thurs, fri, sat, sun);
 | 
|---|
 | 170 |   cboMonday.SelectByIEN(mon);
 | 
|---|
 | 171 |   if cboMonday.Text = '' then
 | 
|---|
 | 172 |     cboMonday.SetExactByIEN(mon, ExternalName(mon, 44));
 | 
|---|
 | 173 |   cboTuesday.SelectByIEN(tues);
 | 
|---|
 | 174 |   if cboTuesday.Text = '' then
 | 
|---|
 | 175 |     cboTuesday.SetExactByIEN(tues, ExternalName(tues, 44));
 | 
|---|
 | 176 |   cboWednesday.SelectByIEN(wed);
 | 
|---|
 | 177 |   if cboWednesday.Text = '' then
 | 
|---|
 | 178 |     cboWednesday.SetExactByIEN(wed, ExternalName(wed, 44));
 | 
|---|
 | 179 |   cboThursday.SelectByIEN(thurs);
 | 
|---|
 | 180 |   if cboThursday.Text = '' then
 | 
|---|
 | 181 |     cboThursday.SetExactByIEN(thurs, ExternalName(thurs, 44));
 | 
|---|
 | 182 |   cboFriday.SelectByIEN(fri);
 | 
|---|
 | 183 |   if cboFriday.Text = '' then
 | 
|---|
 | 184 |     cboFriday.SetExactByIEN(fri, ExternalName(fri, 44));
 | 
|---|
 | 185 |   cboSaturday.SelectByIEN(sat);
 | 
|---|
 | 186 |   if cboSaturday.Text = '' then
 | 
|---|
 | 187 |     cboSaturday.SetExactByIEN(sat, ExternalName(sat, 44));
 | 
|---|
 | 188 |   cboSunday.SelectByIEN(sun);
 | 
|---|
 | 189 |   if cboSunday.Text = '' then
 | 
|---|
 | 190 |     cboSunday.SetExactByIEN(sun, ExternalName(sun, 44));
 | 
|---|
 | 191 | 
 | 
|---|
 | 192 |   with radListSource do
 | 
|---|
 | 193 |     case DfltPtListSrc of
 | 
|---|
 | 194 |       'P': ItemIndex := 0;
 | 
|---|
 | 195 |       'S': ItemIndex := 1;
 | 
|---|
 | 196 |       'T': ItemIndex := 2;
 | 
|---|
 | 197 |       'W': ItemIndex := 3;
 | 
|---|
 | 198 |       'C': ItemIndex := 4;
 | 
|---|
 | 199 |       'M': ItemIndex := 5;
 | 
|---|
 | 200 |     end;
 | 
|---|
 | 201 |   radListSourceClick(self);
 | 
|---|
 | 202 | 
 | 
|---|
 | 203 |   case rpcGetListOrder of
 | 
|---|
 | 204 |     'A': radAlphabetical.Checked := true;
 | 
|---|
 | 205 |     'R':
 | 
|---|
 | 206 |       begin
 | 
|---|
 | 207 |         if radRoomBed.Enabled then
 | 
|---|
 | 208 |           radRoomBed.Checked := true
 | 
|---|
 | 209 |         else
 | 
|---|
 | 210 |           radAlphabetical.Checked := True;
 | 
|---|
 | 211 |       end;
 | 
|---|
 | 212 |     'P': 
 | 
|---|
 | 213 |       begin
 | 
|---|
 | 214 |         if radAppointmentDate.Enabled then
 | 
|---|
 | 215 |           radAppointmentDate.Checked := true
 | 
|---|
 | 216 |         else
 | 
|---|
 | 217 |           radAlphabetical.Checked := True;
 | 
|---|
 | 218 |       end;
 | 
|---|
 | 219 |     'T': radTerminalDigit.Checked := true;
 | 
|---|
 | 220 |     'S': radSource.Checked := true;
 | 
|---|
 | 221 |     else
 | 
|---|
 | 222 |        radAlphabetical.Checked := true;
 | 
|---|
 | 223 |   end;
 | 
|---|
 | 224 | 
 | 
|---|
 | 225 |   rpcGetListSourceDefaults(defprovider, deftreating, deflist, defward);
 | 
|---|
 | 226 |   cboProvider.SelectByIEN(defprovider);
 | 
|---|
 | 227 |   cboTreating.SelectByIEN(deftreating);
 | 
|---|
 | 228 |   cboTeam.SelectByIEN(deflist);
 | 
|---|
 | 229 |   cboWard.SelectByIEN(defward);
 | 
|---|
 | 230 | 
 | 
|---|
 | 231 |   radListSource.SetFocus;
 | 
|---|
 | 232 | end;
 | 
|---|
 | 233 | 
 | 
|---|
 | 234 | procedure TfrmOptionsPatientSelection.spnVisitStartClick(Sender: TObject;
 | 
|---|
 | 235 |   Button: TUDBtnType);
 | 
|---|
 | 236 | var
 | 
|---|
 | 237 |   tagnum: integer;
 | 
|---|
 | 238 | begin
 | 
|---|
 | 239 |   with txtVisitStart do
 | 
|---|
 | 240 |   begin
 | 
|---|
 | 241 |     if FStartEntered then
 | 
|---|
 | 242 |     begin
 | 
|---|
 | 243 |       if Hint = '' then Hint := 'T';
 | 
|---|
 | 244 |       tagnum := RelativeDate(Hint);
 | 
|---|
 | 245 |       if tagnum = INVALID_DAYS then
 | 
|---|
 | 246 |       begin
 | 
|---|
 | 247 |         Text := Hint;
 | 
|---|
 | 248 |         beep;
 | 
|---|
 | 249 |         InfoBox('Start Date entry was invalid', 'Warning', MB_OK or MB_ICONWARNING);
 | 
|---|
 | 250 |         ShowDisplay(txtVisitStart);
 | 
|---|
 | 251 |         FStartEntered := false;
 | 
|---|
 | 252 |         exit;
 | 
|---|
 | 253 |       end
 | 
|---|
 | 254 |       else
 | 
|---|
 | 255 |       begin
 | 
|---|
 | 256 |         DateLimits(SELECTION_LIMIT, tagnum);
 | 
|---|
 | 257 |         if tagnum <> INVALID_DAYS then
 | 
|---|
 | 258 |           Tag := tagnum;
 | 
|---|
 | 259 |       end;
 | 
|---|
 | 260 |     end;
 | 
|---|
 | 261 |     SetFocus;
 | 
|---|
 | 262 |     if Button = btNext then tagnum := Tag + 1
 | 
|---|
 | 263 |     else tagnum := Tag - 1;
 | 
|---|
 | 264 |     Text := Hint;
 | 
|---|
 | 265 |     DateLimits(SELECTION_LIMIT, tagnum);
 | 
|---|
 | 266 |     if tagnum <> INVALID_DAYS then
 | 
|---|
 | 267 |       Tag := tagnum;
 | 
|---|
 | 268 |     ShowDisplay(txtVisitStart);
 | 
|---|
 | 269 |   end;
 | 
|---|
 | 270 |   FStartEntered := false;
 | 
|---|
 | 271 | end;
 | 
|---|
 | 272 | 
 | 
|---|
 | 273 | procedure TfrmOptionsPatientSelection.spnVisitStopClick(Sender: TObject;
 | 
|---|
 | 274 |   Button: TUDBtnType);
 | 
|---|
 | 275 | var
 | 
|---|
 | 276 |   tagnum: integer;
 | 
|---|
 | 277 | begin
 | 
|---|
 | 278 |   with txtVisitStop do
 | 
|---|
 | 279 |   begin
 | 
|---|
 | 280 |     if FStopEntered then
 | 
|---|
 | 281 |     begin
 | 
|---|
 | 282 |       if Hint = '' then Hint := 'T';
 | 
|---|
 | 283 |       tagnum := RelativeDate(Hint);
 | 
|---|
 | 284 |       if tagnum = INVALID_DAYS then
 | 
|---|
 | 285 |       begin
 | 
|---|
 | 286 |         Text := Hint;
 | 
|---|
 | 287 |         beep;
 | 
|---|
 | 288 |         InfoBox('Stop Date entry was invalid', 'Warning', MB_OK or MB_ICONWARNING);
 | 
|---|
 | 289 |         ShowDisplay(txtVisitStop);
 | 
|---|
 | 290 |         FStopEntered := false;
 | 
|---|
 | 291 |         exit;
 | 
|---|
 | 292 |       end
 | 
|---|
 | 293 |       else
 | 
|---|
 | 294 |       begin
 | 
|---|
 | 295 |         DateLimits(SELECTION_LIMIT, tagnum);
 | 
|---|
 | 296 |         Tag := tagnum;
 | 
|---|
 | 297 |       end;
 | 
|---|
 | 298 |     end;
 | 
|---|
 | 299 |     SetFocus;
 | 
|---|
 | 300 |     if Button = btNext then tagnum := Tag + 1
 | 
|---|
 | 301 |     else tagnum := Tag - 1;
 | 
|---|
 | 302 |     Text := Hint;
 | 
|---|
 | 303 |     DateLimits(SELECTION_LIMIT, tagnum);
 | 
|---|
 | 304 |     Tag := tagnum;
 | 
|---|
 | 305 |     ShowDisplay(txtVisitStop);
 | 
|---|
 | 306 |   end;
 | 
|---|
 | 307 |   FStopEntered := false;
 | 
|---|
 | 308 | end;
 | 
|---|
 | 309 | 
 | 
|---|
 | 310 | procedure TfrmOptionsPatientSelection.btnOKClick(Sender: TObject);
 | 
|---|
 | 311 | var
 | 
|---|
 | 312 |   StartDays, StopDays, mon, tues, wed, thurs, fri, sat, sun: integer;
 | 
|---|
 | 313 |   PLSource, PLSort: Char;
 | 
|---|
 | 314 |   prov, spec, team, ward: integer;
 | 
|---|
 | 315 | begin
 | 
|---|
 | 316 |   StartDays := txtVisitStart.Tag;
 | 
|---|
 | 317 |   StopDays := txtVisitStop.Tag;
 | 
|---|
 | 318 |   mon := cboMonday.ItemIEN;
 | 
|---|
 | 319 |   tues := cboTuesday.ItemIEN;
 | 
|---|
 | 320 |   wed := cboWednesday.ItemIEN;
 | 
|---|
 | 321 |   thurs := cboThursday.ItemIEN;
 | 
|---|
 | 322 |   fri := cboFriday.ItemIEN;
 | 
|---|
 | 323 |   sat := cboSaturday.ItemIEN;
 | 
|---|
 | 324 |   sun := cboSunday.ItemIEN;
 | 
|---|
 | 325 |   rpcSetClinicDefaults(StartDays, StopDays, mon, tues, wed, thurs, fri, sat, sun);
 | 
|---|
 | 326 |   case radListSource.ItemIndex of
 | 
|---|
 | 327 |     0: PLSource := 'P';
 | 
|---|
 | 328 |     1: PLSource := 'S';
 | 
|---|
 | 329 |     2: PLSource := 'T';
 | 
|---|
 | 330 |     3: PLSource := 'W';
 | 
|---|
 | 331 |     4: PLSource := 'C';
 | 
|---|
 | 332 |     5: PLSource := 'M';
 | 
|---|
 | 333 |     else
 | 
|---|
 | 334 |        PLSource := 'P';
 | 
|---|
 | 335 |   end;
 | 
|---|
 | 336 |   if radAlphabetical.Checked then PLSort := 'A'
 | 
|---|
 | 337 |   else if radRoomBed.Checked then PLSort := 'R'
 | 
|---|
 | 338 |   else if radAppointmentDate.Checked then PLSort := 'P'
 | 
|---|
 | 339 |   else if radSource.Checked then PLSort := 'S'
 | 
|---|
 | 340 |   else PLSort := 'T';
 | 
|---|
 | 341 |   prov := cboProvider.ItemIEN;
 | 
|---|
 | 342 |   spec := cboTreating.ItemIEN;
 | 
|---|
 | 343 |   team := cboTeam.ItemIEN;
 | 
|---|
 | 344 |   ward := cboWard.ItemIEN;
 | 
|---|
 | 345 |   rpcSetPtListDefaults(PLSource, PLSort, prov, spec, team, ward);
 | 
|---|
 | 346 |   ResetDfltSort;
 | 
|---|
 | 347 | end;
 | 
|---|
 | 348 | 
 | 
|---|
 | 349 | procedure TfrmOptionsPatientSelection.txtVisitStartExit(Sender: TObject);
 | 
|---|
 | 350 | begin
 | 
|---|
 | 351 |   with txtVisitStart do
 | 
|---|
 | 352 |   if Text = '' then
 | 
|---|
 | 353 |   begin
 | 
|---|
 | 354 |     Text := 'T-1';
 | 
|---|
 | 355 |     Hint := 'T-1';
 | 
|---|
 | 356 |     spnVisitStartClick(self, btNext);
 | 
|---|
 | 357 |   end;
 | 
|---|
 | 358 |   TextExit(txtVisitStart, FStartEntered, SELECTION_LIMIT);
 | 
|---|
 | 359 | end;
 | 
|---|
 | 360 | 
 | 
|---|
 | 361 | procedure TfrmOptionsPatientSelection.txtVisitStopExit(Sender: TObject);
 | 
|---|
 | 362 | begin
 | 
|---|
 | 363 |   with txtVisitStop do
 | 
|---|
 | 364 |   if Text = '' then
 | 
|---|
 | 365 |   begin
 | 
|---|
 | 366 |     Text := 'T-1';
 | 
|---|
 | 367 |     Hint := 'T-1';
 | 
|---|
 | 368 |     spnVisitStopClick(self, btNext);
 | 
|---|
 | 369 |   end;
 | 
|---|
 | 370 |   TextExit(txtVisitStop, FStopEntered, SELECTION_LIMIT);
 | 
|---|
 | 371 | end;
 | 
|---|
 | 372 | 
 | 
|---|
 | 373 | procedure TfrmOptionsPatientSelection.txtVisitStartKeyUp(Sender: TObject;
 | 
|---|
 | 374 |   var Key: Word; Shift: TShiftState);
 | 
|---|
 | 375 | begin
 | 
|---|
 | 376 |   txtVisitStart.Hint := txtVisitStart.Text;   // put text in hint since text not available to spin
 | 
|---|
 | 377 |   FStartEntered := true;
 | 
|---|
 | 378 | end;
 | 
|---|
 | 379 | 
 | 
|---|
 | 380 | procedure TfrmOptionsPatientSelection.txtVisitStopKeyUp(Sender: TObject;
 | 
|---|
 | 381 |   var Key: Word; Shift: TShiftState);
 | 
|---|
 | 382 | begin
 | 
|---|
 | 383 |   txtVisitStop.Hint := txtVisitStop.Text;   // put text in hint since text not available to spin
 | 
|---|
 | 384 |   FStopEntered := true;
 | 
|---|
 | 385 | end;
 | 
|---|
 | 386 | 
 | 
|---|
 | 387 | procedure TfrmOptionsPatientSelection.cboProviderExit(Sender: TObject);
 | 
|---|
 | 388 | begin
 | 
|---|
 | 389 |   with (Sender as TORComboBox) do
 | 
|---|
 | 390 |   if ItemIndex < 0 then
 | 
|---|
 | 391 |     Text := '';
 | 
|---|
 | 392 | end;
 | 
|---|
 | 393 | 
 | 
|---|
 | 394 | procedure TfrmOptionsPatientSelection.radListSourceClick(Sender: TObject);
 | 
|---|
 | 395 | begin
 | 
|---|
 | 396 |   if radListSource.ItemIndex = 4 then
 | 
|---|
 | 397 |   begin
 | 
|---|
 | 398 |     if radRoomBed.Checked then
 | 
|---|
 | 399 |       radAlphabetical.Checked := true;
 | 
|---|
 | 400 |     radRoomBed.Enabled := false;
 | 
|---|
 | 401 |     radAppointmentDate.Enabled := true;
 | 
|---|
 | 402 |   end
 | 
|---|
 | 403 |   else
 | 
|---|
 | 404 |   begin
 | 
|---|
 | 405 |     if radAppointmentDate.Checked then
 | 
|---|
 | 406 |       radAlphabetical.Checked := true;
 | 
|---|
 | 407 |     radAppointmentDate.Enabled := false;
 | 
|---|
 | 408 |     radRoomBed.Enabled := true;
 | 
|---|
 | 409 |   end;
 | 
|---|
 | 410 |   if radListSource.ItemIndex = 5 then
 | 
|---|
 | 411 |   begin
 | 
|---|
 | 412 |     radSource.Enabled := true;
 | 
|---|
 | 413 |     radAppointmentDate.Enabled := true;
 | 
|---|
 | 414 |     radRoomBed.Enabled := false;
 | 
|---|
 | 415 |   end
 | 
|---|
 | 416 |   else
 | 
|---|
 | 417 |     radSource.Enabled := false;
 | 
|---|
 | 418 | end;
 | 
|---|
 | 419 | 
 | 
|---|
 | 420 | procedure TfrmOptionsPatientSelection.cboMondayNeedData(Sender: TObject;
 | 
|---|
 | 421 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 422 | begin
 | 
|---|
 | 423 |   cboMonday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 424 | end;
 | 
|---|
 | 425 | 
 | 
|---|
 | 426 | procedure TfrmOptionsPatientSelection.cboTuesdayNeedData(Sender: TObject;
 | 
|---|
 | 427 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 428 | begin
 | 
|---|
 | 429 |   cboTuesday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 430 | end;
 | 
|---|
 | 431 | 
 | 
|---|
 | 432 | procedure TfrmOptionsPatientSelection.cboWednesdayNeedData(Sender: TObject;
 | 
|---|
 | 433 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 434 | begin
 | 
|---|
 | 435 |   cboWednesday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 436 | end;
 | 
|---|
 | 437 | 
 | 
|---|
 | 438 | procedure TfrmOptionsPatientSelection.cboThursdayNeedData(Sender: TObject;
 | 
|---|
 | 439 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 440 | begin
 | 
|---|
 | 441 |   cboThursday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 442 | end;
 | 
|---|
 | 443 | 
 | 
|---|
 | 444 | procedure TfrmOptionsPatientSelection.cboFridayNeedData(Sender: TObject;
 | 
|---|
 | 445 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 446 | begin
 | 
|---|
 | 447 |   cboFriday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 448 | end;
 | 
|---|
 | 449 | 
 | 
|---|
 | 450 | procedure TfrmOptionsPatientSelection.cboSaturdayNeedData(Sender: TObject;
 | 
|---|
 | 451 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 452 | begin
 | 
|---|
 | 453 |   cboSaturday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 454 | end;
 | 
|---|
 | 455 | 
 | 
|---|
 | 456 | procedure TfrmOptionsPatientSelection.cboSundayNeedData(Sender: TObject;
 | 
|---|
 | 457 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 458 | begin
 | 
|---|
 | 459 |   cboSunday.ForDataUse(SubSetOfClinics(StartFrom, Direction));
 | 
|---|
 | 460 | end;
 | 
|---|
 | 461 | 
 | 
|---|
 | 462 | procedure TfrmOptionsPatientSelection.cboProviderNeedData(Sender: TObject;
 | 
|---|
 | 463 |   const StartFrom: String; Direction, InsertAt: Integer);
 | 
|---|
 | 464 | begin
 | 
|---|
 | 465 |   cboProvider.ForDataUse(SubSetOfProviders(StartFrom, Direction));
 | 
|---|
 | 466 | end;
 | 
|---|
 | 467 | 
 | 
|---|
 | 468 | procedure TfrmOptionsPatientSelection.NextControl(Key: Char);
 | 
|---|
 | 469 | begin
 | 
|---|
 | 470 |   if Key = #13 then Perform(WM_NextDlgCtl, 0, 0);
 | 
|---|
 | 471 | end;
 | 
|---|
 | 472 | 
 | 
|---|
 | 473 | procedure TfrmOptionsPatientSelection.txtVisitStartKeyPress(
 | 
|---|
 | 474 |   Sender: TObject; var Key: Char);
 | 
|---|
 | 475 | begin
 | 
|---|
 | 476 |   if Key = #13 then
 | 
|---|
 | 477 |   begin
 | 
|---|
 | 478 |     FStartEntered := true;
 | 
|---|
 | 479 |     Perform(WM_NextDlgCtl, 0, 0);
 | 
|---|
 | 480 |   end;
 | 
|---|
 | 481 | end;
 | 
|---|
 | 482 | 
 | 
|---|
 | 483 | procedure TfrmOptionsPatientSelection.txtVisitStopKeyPress(Sender: TObject;
 | 
|---|
 | 484 |   var Key: Char);
 | 
|---|
 | 485 | begin
 | 
|---|
 | 486 |   if Key = #13 then
 | 
|---|
 | 487 |   begin
 | 
|---|
 | 488 |     FStopEntered := true;
 | 
|---|
 | 489 |     FProviderSpecial := true;    // used to avoid duplicate action on cboProviderKeyUp
 | 
|---|
 | 490 |     Perform(WM_NextDlgCtl, 0, 0);
 | 
|---|
 | 491 |   end;
 | 
|---|
 | 492 | end;
 | 
|---|
 | 493 | 
 | 
|---|
 | 494 | procedure TfrmOptionsPatientSelection.cboProviderKeyUp(Sender: TObject;
 | 
|---|
 | 495 |   var Key: Word; Shift: TShiftState);
 | 
|---|
 | 496 | begin
 | 
|---|
 | 497 |   if not FProviderSpecial then NextControl(Char(Key));
 | 
|---|
 | 498 |   FProviderSpecial := false;
 | 
|---|
 | 499 | end;
 | 
|---|
 | 500 | 
 | 
|---|
 | 501 | end.
 | 
|---|