| [456] | 1 | unit fEncnt; | 
|---|
|  | 2 |  | 
|---|
|  | 3 | //Modifed: 7/26/99 | 
|---|
|  | 4 | //By: Robert Bott | 
|---|
|  | 5 | //Location: ISL | 
|---|
|  | 6 | //Description of Mod: | 
|---|
|  | 7 | //  Moved asignment of historical visit category from the cboNewVisitChange event | 
|---|
|  | 8 | //   to the ckbHistoricalClick event. | 
|---|
|  | 9 |  | 
|---|
|  | 10 |  | 
|---|
|  | 11 | interface | 
|---|
|  | 12 |  | 
|---|
|  | 13 | uses | 
|---|
|  | 14 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, | 
|---|
| [830] | 15 | StdCtrls, ORCtrls, ORDtTm, ORFn, ExtCtrls, ComCtrls, ORDtTmRng, fAutoSz, rOptions, fBase508Form, | 
|---|
|  | 16 | VA508AccessibilityManager, fFrame; | 
|---|
| [456] | 17 |  | 
|---|
|  | 18 | type | 
|---|
| [830] | 19 | TfrmEncounter = class(TfrmBase508Form) | 
|---|
| [456] | 20 | cboPtProvider: TORComboBox; | 
|---|
|  | 21 | lblProvider: TLabel; | 
|---|
|  | 22 | cmdOK: TButton; | 
|---|
|  | 23 | cmdCancel: TButton; | 
|---|
|  | 24 | lblLocation: TLabel; | 
|---|
|  | 25 | txtLocation: TCaptionEdit; | 
|---|
|  | 26 | dlgDateRange: TORDateRangeDlg; | 
|---|
|  | 27 | cmdDateRange: TButton; | 
|---|
|  | 28 | lblInstruct: TLabel; | 
|---|
|  | 29 | Panel1: TPanel; | 
|---|
|  | 30 | pgeVisit: TPageControl; | 
|---|
|  | 31 | tabClinic: TTabSheet; | 
|---|
|  | 32 | lstClinic: TORListBox; | 
|---|
|  | 33 | tabAdmit: TTabSheet; | 
|---|
|  | 34 | lstAdmit: TORListBox; | 
|---|
|  | 35 | tabNewVisit: TTabSheet; | 
|---|
|  | 36 | lblVisitDate: TLabel; | 
|---|
|  | 37 | lblNewVisit: TLabel; | 
|---|
|  | 38 | calVisitDate: TORDateBox; | 
|---|
|  | 39 | ckbHistorical: TORCheckBox; | 
|---|
|  | 40 | cboNewVisit: TORComboBox; | 
|---|
|  | 41 | Panel2: TPanel; | 
|---|
|  | 42 | lblDateRange: TLabel; | 
|---|
|  | 43 | lblClinic: TLabel; | 
|---|
|  | 44 | Panel3: TPanel; | 
|---|
|  | 45 | lblAdmit: TLabel; | 
|---|
|  | 46 | procedure FormCreate(Sender: TObject); | 
|---|
|  | 47 | procedure pgeVisitChange(Sender: TObject); | 
|---|
|  | 48 | procedure cmdOKClick(Sender: TObject); | 
|---|
|  | 49 | procedure cmdCancelClick(Sender: TObject); | 
|---|
|  | 50 | procedure cboNewVisitNeedData(Sender: TObject; const StartFrom: String; | 
|---|
|  | 51 | Direction, InsertAt: Integer); | 
|---|
|  | 52 | procedure calVisitDateChange(Sender: TObject); | 
|---|
|  | 53 | procedure cboNewVisitChange(Sender: TObject); | 
|---|
|  | 54 | procedure calVisitDateExit(Sender: TObject); | 
|---|
|  | 55 | procedure cboPtProviderNeedData(Sender: TObject; | 
|---|
|  | 56 | const StartFrom: String; Direction, InsertAt: Integer); | 
|---|
|  | 57 | procedure ckbHistoricalClick(Sender: TObject); | 
|---|
|  | 58 | procedure cmdDateRangeClick(Sender: TObject); | 
|---|
|  | 59 | procedure FormDestroy(Sender: TObject); | 
|---|
|  | 60 | procedure FormClose(Sender: TObject; var Action: TCloseAction); | 
|---|
|  | 61 | procedure lstAdmitChange(Sender: TObject); | 
|---|
|  | 62 | procedure lstClinicChange(Sender: TObject); | 
|---|
|  | 63 | procedure FormResize(Sender: TObject); | 
|---|
|  | 64 | procedure FormShow(Sender: TObject); | 
|---|
| [830] | 65 | procedure pgeVisitMouseDown(Sender: TObject; Button: TMouseButton; | 
|---|
|  | 66 | Shift: TShiftState; X, Y: Integer); | 
|---|
| [456] | 67 | private | 
|---|
|  | 68 | CLINIC_TXT : String; | 
|---|
|  | 69 | FFilter: Int64; | 
|---|
|  | 70 | FPCDate: TFMDateTime; | 
|---|
|  | 71 | FProvider: Int64; | 
|---|
|  | 72 | FLocation: Integer; | 
|---|
|  | 73 | FLocationName: string; | 
|---|
|  | 74 | FDateTime: TFMDateTime; | 
|---|
|  | 75 | FVisitCategory: Char; | 
|---|
|  | 76 | FStandAlone: Boolean; | 
|---|
|  | 77 | FFromSelf: Boolean; | 
|---|
|  | 78 | FFromDate: TFMDateTime; | 
|---|
|  | 79 | FThruDate: TFMDateTIme; | 
|---|
|  | 80 | FEncFutureLimit: string; | 
|---|
|  | 81 | FFromCreate: Boolean; | 
|---|
|  | 82 | FOldHintEvent: TShowHintEvent; | 
|---|
|  | 83 | OKPressed: Boolean; | 
|---|
|  | 84 | procedure AppShowHint(var HintStr: string; var CanShow: Boolean; | 
|---|
|  | 85 | var HintInfo: THintInfo); | 
|---|
|  | 86 | procedure SetVisitCat; | 
|---|
| [830] | 87 | function AllowAutoFocusChange: Boolean; | 
|---|
| [456] | 88 | public | 
|---|
|  | 89 | { Public declarations } | 
|---|
|  | 90 | end; | 
|---|
|  | 91 |  | 
|---|
|  | 92 | procedure UpdateEncounter(PersonFilter: Int64; ADate: TFMDateTime = 0; TIULocation: integer = 0); | 
|---|
|  | 93 | procedure UpdateVisit(FontSize: Integer); overload; | 
|---|
|  | 94 | procedure UpdateVisit(FontSize: Integer; TIULocation: integer); overload; | 
|---|
|  | 95 |  | 
|---|
|  | 96 | implementation | 
|---|
|  | 97 |  | 
|---|
|  | 98 | {$R *.DFM} | 
|---|
|  | 99 |  | 
|---|
| [830] | 100 | uses rCore, uCore, uConst, fReview, uPCE, rPCE, VA508AccessibilityRouter, | 
|---|
|  | 101 | VAUtils; | 
|---|
| [456] | 102 |  | 
|---|
|  | 103 | const | 
|---|
|  | 104 | TC_MISSING = 'Incomplete Encounter Information'; | 
|---|
|  | 105 | TX_NO_DATE = 'A valid date/time has not been entered.'; | 
|---|
|  | 106 | TX_NO_TIME = 'A valid time has not been entered.'; | 
|---|
|  | 107 | TX_NO_LOC  = 'A visit location has not been selected.'; | 
|---|
|  | 108 | TC_LOCONLY = 'Location for Current Activities'; | 
|---|
|  | 109 | TX_FUTURE_WARNING = 'You have selected a visit with a date in the future.  Are you sure?'; | 
|---|
|  | 110 | TC_FUTURE_WARNING = 'Visit Is In Future'; | 
|---|
|  | 111 |  | 
|---|
|  | 112 | var | 
|---|
|  | 113 | uTIULocation: integer; | 
|---|
|  | 114 | uTIULocationName: string; | 
|---|
|  | 115 |  | 
|---|
|  | 116 | procedure UpdateVisit(FontSize: Integer); | 
|---|
|  | 117 | begin | 
|---|
|  | 118 | UpdateEncounter(NPF_SUPPRESS); | 
|---|
|  | 119 | end; | 
|---|
|  | 120 |  | 
|---|
|  | 121 | procedure UpdateVisit(FontSize: Integer; TIULocation: integer); | 
|---|
|  | 122 | begin | 
|---|
|  | 123 | UpdateEncounter(NPF_SUPPRESS, 0, TIULocation); | 
|---|
|  | 124 | end; | 
|---|
|  | 125 |  | 
|---|
|  | 126 | procedure UpdateEncounter(PersonFilter: Int64; ADate: TFMDateTime = 0;  TIULocation: integer = 0); | 
|---|
|  | 127 | const | 
|---|
|  | 128 | UP_SHIFT = 85; | 
|---|
|  | 129 | var | 
|---|
|  | 130 | frmEncounter: TfrmEncounter; | 
|---|
|  | 131 | CanChange: Boolean; | 
|---|
|  | 132 | TimedOut: Boolean; | 
|---|
|  | 133 | begin | 
|---|
|  | 134 | uTIULocation := TIULocation; | 
|---|
|  | 135 | if uTIULocation <> 0 then uTIULocationName := ExternalName(uTIULocation, FN_HOSPITAL_LOCATION); | 
|---|
|  | 136 | frmEncounter := TfrmEncounter.Create(Application); | 
|---|
|  | 137 | try | 
|---|
|  | 138 | TimedOut := False; | 
|---|
|  | 139 | ResizeAnchoredFormToFont(frmEncounter); | 
|---|
|  | 140 | with frmEncounter do | 
|---|
|  | 141 | begin | 
|---|
|  | 142 | FFilter := PersonFilter; | 
|---|
|  | 143 | FPCDate := ADate; | 
|---|
|  | 144 | if PersonFilter = NPF_SUPPRESS then           // not prompting for provider | 
|---|
|  | 145 | begin | 
|---|
|  | 146 | lblProvider.Visible := False; | 
|---|
|  | 147 | cboPtProvider.Visible := False; | 
|---|
|  | 148 | lblInstruct.Visible := True; | 
|---|
|  | 149 | Caption := TC_LOCONLY; | 
|---|
|  | 150 | Height := frmEncounter.Height - UP_SHIFT; | 
|---|
|  | 151 | end | 
|---|
|  | 152 | else                                          // also prompt for provider | 
|---|
|  | 153 | begin | 
|---|
|  | 154 | // InitLongList must be done AFTER FFilter is set | 
|---|
|  | 155 | cboPtProvider.InitLongList(Encounter.ProviderName); | 
|---|
|  | 156 | cboPtProvider.SelectByIEN(FProvider); | 
|---|
|  | 157 | end; | 
|---|
|  | 158 | ShowModal; | 
|---|
|  | 159 | if OKPressed then | 
|---|
|  | 160 | begin | 
|---|
|  | 161 | CanChange := True; | 
|---|
| [830] | 162 | // if (fframe.frmFrame.DoNotChangeEncWindow = true) and (encounter.Location <> frmEncounter.FLocation) then | 
|---|
|  | 163 | //    fframe.frmFrame.DoNotChangeEncWindow := false; | 
|---|
| [456] | 164 | if (PersonFilter <> NPF_SUPPRESS) and | 
|---|
|  | 165 | (((Encounter.Provider =  User.DUZ) and (FProvider <> User.DUZ)) or | 
|---|
|  | 166 | ((Encounter.Provider <> User.DUZ) and (FProvider =  User.DUZ))) | 
|---|
|  | 167 | then CanChange := ReviewChanges(TimedOut); | 
|---|
|  | 168 | if CanChange then | 
|---|
|  | 169 | begin | 
|---|
|  | 170 | if PersonFilter <> NPF_SUPPRESS then Encounter.Provider := FProvider; | 
|---|
|  | 171 | Encounter.Location      := FLocation; | 
|---|
|  | 172 | Encounter.DateTime      := FDateTime; | 
|---|
|  | 173 | Encounter.VisitCategory := FVisitCategory; | 
|---|
|  | 174 | Encounter.StandAlone    := FStandAlone; | 
|---|
|  | 175 | end; | 
|---|
|  | 176 | end; | 
|---|
|  | 177 | end; | 
|---|
|  | 178 | finally | 
|---|
|  | 179 | frmEncounter.Release; | 
|---|
|  | 180 | end; | 
|---|
|  | 181 | end; | 
|---|
|  | 182 |  | 
|---|
|  | 183 | procedure TfrmEncounter.FormCreate(Sender: TObject); | 
|---|
|  | 184 | var | 
|---|
|  | 185 | ADateFrom, ADateThru: TDateTime; | 
|---|
|  | 186 | BDateFrom, BDateThru: Integer; | 
|---|
|  | 187 | BDisplayFrom, BDisplayThru: String; | 
|---|
|  | 188 | begin | 
|---|
|  | 189 | inherited; | 
|---|
|  | 190 | FProvider      := Encounter.Provider; | 
|---|
|  | 191 | FLocation      := Encounter.Location; | 
|---|
|  | 192 | FLocationName  := Encounter.LocationName; | 
|---|
|  | 193 | FDateTime      := Encounter.DateTime; | 
|---|
|  | 194 | FVisitCategory := Encounter.VisitCategory; | 
|---|
|  | 195 | FStandAlone    := Encounter.StandAlone; | 
|---|
|  | 196 | rpcGetEncFutureDays(FEncFutureLimit); | 
|---|
|  | 197 | rpcGetRangeForEncs(BDateFrom, BDateThru, False); // Get user's current date range settings. | 
|---|
|  | 198 | if BDateFrom > 0 then | 
|---|
|  | 199 | BDisplayFrom := 'T-' + IntToStr(BDateFrom) | 
|---|
|  | 200 | else | 
|---|
|  | 201 | BDisplayFrom := 'T'; | 
|---|
|  | 202 | if BDateThru > 0 then | 
|---|
|  | 203 | BDisplayThru := 'T+' + IntToStr(BDateThru) | 
|---|
|  | 204 | else | 
|---|
|  | 205 | BDisplayThru := 'T'; | 
|---|
|  | 206 | lblDateRange.Caption := '(' + BDisplayFrom + ' thru ' + BDisplayThru + ')'; | 
|---|
|  | 207 | ADateFrom := (FMDateTimeToDateTime(FMToday) - BDateFrom); | 
|---|
|  | 208 | ADateThru := (FMDateTimeToDateTime(FMToday) + BDateThru); | 
|---|
|  | 209 | FFromDate      := DateTimeToFMDateTime(ADateFrom); | 
|---|
|  | 210 | FThruDate      := DateTimeToFMDateTime(ADateThru) + 0.2359; | 
|---|
|  | 211 | FFromCreate    := True; | 
|---|
|  | 212 | with txtLocation do if Length(FLocationName) > 0 then | 
|---|
|  | 213 | begin | 
|---|
|  | 214 | Text := FLocationName + '  '; | 
|---|
|  | 215 | if (FVisitCategory <> 'H') and (FDateTime <> 0) then | 
|---|
|  | 216 | Text := Text + FormatFMDateTime('mmm dd,yy hh:nn', FDateTime); | 
|---|
|  | 217 | end | 
|---|
|  | 218 | else Text := '< Select a location from the tabs below.... >'; | 
|---|
|  | 219 | OKPressed := False; | 
|---|
|  | 220 | pgeVisit.ActivePage := tabClinic; | 
|---|
|  | 221 | pgeVisitChange(Self); | 
|---|
|  | 222 | if lstClinic.Items.Count = 0 then | 
|---|
|  | 223 | begin | 
|---|
|  | 224 | pgeVisit.ActivePage := tabNewVisit; | 
|---|
|  | 225 | pgeVisitChange(Self); | 
|---|
|  | 226 | end; | 
|---|
|  | 227 | ckbHistorical.Hint := 'A historical visit or encounter is a visit that occurred at some time' + CRLF + | 
|---|
|  | 228 | 'in the past or at some other location (possibly non-VA).  Although these' + CRLF + | 
|---|
|  | 229 | 'are not used for workload credit, they can be used for setting up the' + CRLF + | 
|---|
|  | 230 | 'PCE reminder maintenance system, or other non-workload-related reasons.'; | 
|---|
|  | 231 | FOldHintEvent := Application.OnShowHint; | 
|---|
|  | 232 | Application.OnShowHint := AppShowHint; | 
|---|
|  | 233 | FFromCreate := False; | 
|---|
|  | 234 | //JAWS will read the second caption if 2 are displayed, so Combining Labels | 
|---|
|  | 235 | CLINIC_TXT := lblClinic.Caption+'  '; | 
|---|
|  | 236 | lblClinic.Caption := CLINIC_TXT + lblDateRange.Caption; | 
|---|
|  | 237 | lblDateRange.Hide; | 
|---|
|  | 238 | end; | 
|---|
|  | 239 |  | 
|---|
|  | 240 | procedure TfrmEncounter.cboPtProviderNeedData(Sender: TObject; const StartFrom: string; | 
|---|
|  | 241 | Direction, InsertAt: Integer); | 
|---|
|  | 242 | begin | 
|---|
|  | 243 | inherited; | 
|---|
|  | 244 | case FFilter of | 
|---|
|  | 245 | NPF_PROVIDER:  cboPtProvider.ForDataUse(SubSetOfProviders(StartFrom, Direction)); | 
|---|
|  | 246 | //    NPF_ENCOUNTER: cboPtProvider.ForDataUse(SubSetOfUsersWithClass(StartFrom, Direction, FloatToStr(FPCDate))); | 
|---|
|  | 247 | else cboPtProvider.ForDataUse(SubSetOfPersons(StartFrom, Direction)); | 
|---|
|  | 248 | end; | 
|---|
|  | 249 | end; | 
|---|
|  | 250 |  | 
|---|
|  | 251 | procedure TfrmEncounter.pgeVisitChange(Sender: TObject); | 
|---|
|  | 252 | begin | 
|---|
|  | 253 | inherited; | 
|---|
|  | 254 | cmdDateRange.Visible := pgeVisit.ActivePage = tabClinic; | 
|---|
|  | 255 | if (pgeVisit.ActivePage = tabClinic) and (lstClinic.Items.Count = 0) then | 
|---|
|  | 256 | begin | 
|---|
|  | 257 | ListApptAll(lstClinic.Items, Patient.DFN, FFromDate, FThruDate); | 
|---|
| [830] | 258 | if AllowAutoFocusChange then | 
|---|
|  | 259 | ActiveControl := lstClinic; | 
|---|
| [456] | 260 | end; | 
|---|
|  | 261 | if (pgeVisit.ActivePage = tabAdmit)    and (lstAdmit.Items.Count = 0) then | 
|---|
|  | 262 | begin | 
|---|
|  | 263 | ListAdmitAll(lstAdmit.Items, Patient.DFN); | 
|---|
| [830] | 264 | if AllowAutoFocusChange then | 
|---|
|  | 265 | ActiveControl := lstAdmit; | 
|---|
| [456] | 266 | end; | 
|---|
|  | 267 | if pgeVisit.ActivePage = tabNewVisit then | 
|---|
|  | 268 | begin | 
|---|
|  | 269 | if cboNewVisit.Items.Count = 0 then | 
|---|
|  | 270 | begin | 
|---|
|  | 271 | if FVisitCategory <> 'H' then | 
|---|
|  | 272 | begin | 
|---|
|  | 273 | if uTIULocation <> 0 then | 
|---|
|  | 274 | begin | 
|---|
|  | 275 | cboNewVisit.InitLongList(uTIULocationName); | 
|---|
|  | 276 | cboNewVisit.SelectByIEN(uTIULocation); | 
|---|
|  | 277 | cboNewVisitChange(Self); | 
|---|
|  | 278 | end | 
|---|
|  | 279 | else | 
|---|
|  | 280 | begin | 
|---|
|  | 281 | cboNewVisit.InitLongList(FLocationName); | 
|---|
|  | 282 | if Encounter.Location <> 0 then cboNewVisit.SelectByIEN(FLocation); | 
|---|
|  | 283 | end; | 
|---|
|  | 284 | FFromSelf := True; | 
|---|
|  | 285 | with calVisitDate do if FDateTime <> 0 then FMDateTime := FDateTime else Text := 'NOW'; | 
|---|
|  | 286 | FFromSelf := False; | 
|---|
| [830] | 287 | if AllowAutoFocusChange then | 
|---|
|  | 288 | ActiveControl := cboNewVisit; | 
|---|
| [456] | 289 | end | 
|---|
|  | 290 | else if FVisitCategory = 'E' then | 
|---|
|  | 291 | begin | 
|---|
|  | 292 | ckbHistorical.Checked := True; | 
|---|
| [830] | 293 | if AllowAutoFocusChange then | 
|---|
|  | 294 | ActiveControl := cboNewVisit; | 
|---|
| [456] | 295 | end | 
|---|
|  | 296 | else | 
|---|
|  | 297 | begin | 
|---|
|  | 298 | cboNewVisit.InitLongList(''); | 
|---|
|  | 299 | end; | 
|---|
|  | 300 | end; {if cboNewVisit} | 
|---|
|  | 301 | end; {if pgeVisit.ActivePage} | 
|---|
| [830] | 302 | if ScreenReaderSystemActive then | 
|---|
|  | 303 | ActiveControl := pgeVisit; | 
|---|
| [456] | 304 | end; | 
|---|
|  | 305 |  | 
|---|
| [830] | 306 | procedure TfrmEncounter.pgeVisitMouseDown(Sender: TObject; | 
|---|
|  | 307 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
|  | 308 | begin | 
|---|
|  | 309 | inherited; | 
|---|
|  | 310 | if pgeVisit.ActivePage = tabNewVisit then | 
|---|
|  | 311 | if cboNewVisit.CanFocus then | 
|---|
|  | 312 | cboNewVisit.SetFocus; | 
|---|
|  | 313 | end; | 
|---|
|  | 314 |  | 
|---|
| [456] | 315 | procedure TfrmEncounter.cboNewVisitNeedData(Sender: TObject; const StartFrom: string; | 
|---|
|  | 316 | Direction, InsertAt: Integer); | 
|---|
|  | 317 | begin | 
|---|
|  | 318 | inherited; | 
|---|
|  | 319 | cboNewVisit.ForDataUse(SubSetOfNewLocs(StartFrom, Direction)); | 
|---|
|  | 320 | end; | 
|---|
|  | 321 |  | 
|---|
|  | 322 | procedure TfrmEncounter.cmdDateRangeClick(Sender: TObject); | 
|---|
|  | 323 | begin | 
|---|
|  | 324 | dlgDateRange.FMDateStart := FFromDate; | 
|---|
|  | 325 | dlgDateRange.FMDateStop  := FThruDate; | 
|---|
|  | 326 | if dlgDateRange.Execute then | 
|---|
|  | 327 | begin | 
|---|
|  | 328 | FFromDate := dlgDateRange.FMDateStart; | 
|---|
|  | 329 | FThruDate := dlgDateRange.FMDateStop + 0.2359; | 
|---|
|  | 330 | lblDateRange.Caption := '(' + dlgDateRange.RelativeStart + ' thru ' | 
|---|
|  | 331 | + dlgDateRange.RelativeStop + ')'; | 
|---|
|  | 332 | //label | 
|---|
|  | 333 | lblClinic.Caption := CLINIC_TXT + lblDateRange.Caption; | 
|---|
|  | 334 | //list | 
|---|
|  | 335 | lstClinic.Caption := lblClinic.Caption + ' ' + lblDateRange.Caption; | 
|---|
|  | 336 | lstClinic.Items.Clear; | 
|---|
|  | 337 | ListApptAll(lstClinic.Items, Patient.DFN, FFromDate, FThruDate); | 
|---|
|  | 338 | end; | 
|---|
|  | 339 | end; | 
|---|
|  | 340 |  | 
|---|
|  | 341 | procedure TfrmEncounter.cboNewVisitChange(Sender: TObject); | 
|---|
|  | 342 | begin | 
|---|
|  | 343 | inherited; | 
|---|
|  | 344 | with cboNewVisit do | 
|---|
|  | 345 | begin | 
|---|
|  | 346 | FLocation := ItemIEN; | 
|---|
|  | 347 | FLocationName := DisplayText[ItemIndex]; | 
|---|
|  | 348 | FDateTime := calVisitDate.FMDateTime; | 
|---|
|  | 349 | SetVisitCat; | 
|---|
|  | 350 | with txtLocation do | 
|---|
|  | 351 | begin | 
|---|
|  | 352 | Text := FLocationName + '  '; | 
|---|
|  | 353 | if FDateTime <> 0 then Text := Text + FormatFMDateTime('mmm dd,yy hh:nn', FDateTime); | 
|---|
|  | 354 | end; | 
|---|
|  | 355 | end; | 
|---|
|  | 356 | end; | 
|---|
|  | 357 |  | 
|---|
|  | 358 | procedure TfrmEncounter.calVisitDateChange(Sender: TObject); | 
|---|
|  | 359 | begin | 
|---|
|  | 360 | inherited; | 
|---|
|  | 361 | // The FFromSelf was added because without it, a new visit (minus the seconds gets created. | 
|---|
|  | 362 | // Setting the text of calVisit caused the text to be re-evaluated & changed the FMDateTime property. | 
|---|
|  | 363 | if FFromSelf then Exit; | 
|---|
|  | 364 | with cboNewVisit do | 
|---|
|  | 365 | begin | 
|---|
|  | 366 | FLocation := ItemIEN; | 
|---|
|  | 367 | FLocationName := DisplayText[ItemIndex]; | 
|---|
|  | 368 | FDateTime := calVisitDate.FMDateTime; | 
|---|
|  | 369 | SetVisitCat; | 
|---|
|  | 370 | txtLocation.Text := FLocationName + '  ' + calVisitDate.Text; | 
|---|
|  | 371 | end; | 
|---|
|  | 372 | end; | 
|---|
|  | 373 |  | 
|---|
|  | 374 | procedure TfrmEncounter.calVisitDateExit(Sender: TObject); | 
|---|
|  | 375 | begin | 
|---|
|  | 376 | inherited; | 
|---|
|  | 377 | with cboNewVisit do if ItemIEN > 0 then | 
|---|
|  | 378 | begin | 
|---|
|  | 379 | FLocation := ItemIEN; | 
|---|
|  | 380 | FLocationName := DisplayText[ItemIndex]; | 
|---|
|  | 381 | FDateTime := calVisitDate.FMDateTime; | 
|---|
|  | 382 | SetVisitCat; | 
|---|
|  | 383 | with txtLocation do | 
|---|
|  | 384 | begin | 
|---|
|  | 385 | Text := FLocationName + '  '; | 
|---|
|  | 386 | if FDateTime <> 0 then Text := Text + FormatFMDateTime('mmm dd,yy hh:nn', FDateTime); | 
|---|
|  | 387 | end; | 
|---|
|  | 388 | end; | 
|---|
|  | 389 | end; | 
|---|
|  | 390 |  | 
|---|
|  | 391 | procedure TfrmEncounter.cmdOKClick(Sender: TObject); | 
|---|
|  | 392 | var | 
|---|
|  | 393 | msg: string; | 
|---|
|  | 394 | ADate, AMaxDate: TDateTime; | 
|---|
|  | 395 |  | 
|---|
|  | 396 | begin | 
|---|
|  | 397 | inherited; | 
|---|
|  | 398 | msg := ''; | 
|---|
|  | 399 | if FLocation = 0 then msg := TX_NO_LOC; | 
|---|
|  | 400 | if FDateTime <= 0 then msg := msg + CRLF + TX_NO_DATE | 
|---|
|  | 401 | else if(pos('.',FloatToStr(FDateTime)) = 0) then msg := msg + CRLF + TX_NO_TIME; | 
|---|
|  | 402 | if(msg <> '') then | 
|---|
|  | 403 | begin | 
|---|
|  | 404 | InfoBox(msg, TC_MISSING, MB_OK); | 
|---|
|  | 405 | Exit; | 
|---|
|  | 406 | end | 
|---|
|  | 407 | else | 
|---|
|  | 408 | begin | 
|---|
|  | 409 | ADate := FMDateTimeToDateTime(Trunc(FDateTime)); | 
|---|
|  | 410 | AMaxDate := FMDateTimeToDateTime(FMToday) + StrToIntDef(FEncFutureLimit, 0); | 
|---|
|  | 411 | if ADate > AMaxDate then | 
|---|
|  | 412 | if InfoBox(TX_FUTURE_WARNING, TC_FUTURE_WARNING, MB_YESNO or MB_ICONQUESTION) = MRNO then exit; | 
|---|
|  | 413 | end; | 
|---|
|  | 414 | if FFilter <> NPF_SUPPRESS then FProvider := cboPtProvider.ItemIEN; | 
|---|
|  | 415 | OKPressed := True; | 
|---|
|  | 416 | Close; | 
|---|
|  | 417 | end; | 
|---|
|  | 418 |  | 
|---|
|  | 419 | procedure TfrmEncounter.cmdCancelClick(Sender: TObject); | 
|---|
|  | 420 | begin | 
|---|
|  | 421 | inherited; | 
|---|
|  | 422 | Close; | 
|---|
|  | 423 | end; | 
|---|
|  | 424 |  | 
|---|
|  | 425 | procedure TfrmEncounter.ckbHistoricalClick(Sender: TObject); | 
|---|
|  | 426 | begin | 
|---|
|  | 427 | SetVisitCat; | 
|---|
|  | 428 | end; | 
|---|
|  | 429 |  | 
|---|
|  | 430 | { | 
|---|
|  | 431 | procedure TfrmEncounter.cboPtProviderChange(Sender: TObject); | 
|---|
|  | 432 | var | 
|---|
|  | 433 | txt: string; | 
|---|
|  | 434 | AIEN: Int64; | 
|---|
|  | 435 |  | 
|---|
|  | 436 | begin | 
|---|
|  | 437 | if(FFilter <> NPF_ENCOUNTER) then exit; | 
|---|
|  | 438 | AIEN := cboPtProvider.ItemIEN; | 
|---|
|  | 439 | if(AIEN <> 0) then | 
|---|
|  | 440 | begin | 
|---|
|  | 441 | txt := InvalidPCEProviderTxt(AIEN, FPCDate); | 
|---|
|  | 442 | if(txt <> '') then | 
|---|
|  | 443 | begin | 
|---|
|  | 444 | InfoBox(cboPtProvider.text + txt, TX_BAD_PROV, MB_OK); | 
|---|
|  | 445 | cboPtProvider.ItemIndex := -1; | 
|---|
|  | 446 | end; | 
|---|
|  | 447 | end; | 
|---|
|  | 448 | end; | 
|---|
|  | 449 | } | 
|---|
|  | 450 |  | 
|---|
|  | 451 | procedure TfrmEncounter.AppShowHint(var HintStr: string; | 
|---|
|  | 452 | var CanShow: Boolean; var HintInfo: THintInfo); | 
|---|
|  | 453 | const | 
|---|
|  | 454 | HistHintDelay = 30000; // 30 seconds | 
|---|
|  | 455 |  | 
|---|
|  | 456 | begin | 
|---|
|  | 457 | if (not Assigned(HintInfo.HintControl)) then exit; | 
|---|
|  | 458 | if(HintInfo.HintControl = ckbHistorical) then | 
|---|
|  | 459 | HintInfo.HideTimeout := HistHintDelay; | 
|---|
|  | 460 | if(assigned(FOldHintEvent)) then | 
|---|
|  | 461 | FOldHintEvent(HintStr, CanShow, HintInfo); | 
|---|
|  | 462 | end; | 
|---|
|  | 463 |  | 
|---|
|  | 464 | procedure TfrmEncounter.FormDestroy(Sender: TObject); | 
|---|
|  | 465 | begin | 
|---|
|  | 466 | //Application.OnShowHint := FOldHintEvent;     v22.11f - RV | 
|---|
|  | 467 | end; | 
|---|
|  | 468 |  | 
|---|
|  | 469 | procedure TfrmEncounter.SetVisitCat; | 
|---|
|  | 470 | begin | 
|---|
|  | 471 | if ckbHistorical.Checked then | 
|---|
|  | 472 | FVisitCategory := 'E' | 
|---|
|  | 473 | else | 
|---|
|  | 474 | FVisitCategory := GetVisitCat('A', FLocation, Patient.Inpatient); | 
|---|
|  | 475 | FStandAlone := (FVisitCategory = 'A'); | 
|---|
|  | 476 | end; | 
|---|
|  | 477 |  | 
|---|
| [830] | 478 | function TfrmEncounter.AllowAutoFocusChange: Boolean; | 
|---|
|  | 479 | begin | 
|---|
|  | 480 | if ScreenReaderSystemActive or | 
|---|
|  | 481 | Boolean(Hi(GetKeyState(VK_TAB))) or | 
|---|
|  | 482 | Boolean(Hi(GetKeyState(VK_LEFT))) or | 
|---|
|  | 483 | Boolean(Hi(GetKeyState(VK_RIGHT))) then | 
|---|
|  | 484 | Result := FALSE | 
|---|
|  | 485 | else | 
|---|
|  | 486 | Result := TRUE; | 
|---|
|  | 487 | end; | 
|---|
|  | 488 |  | 
|---|
| [456] | 489 | procedure TfrmEncounter.FormClose(Sender: TObject; | 
|---|
|  | 490 | var Action: TCloseAction); | 
|---|
|  | 491 | begin | 
|---|
|  | 492 | Application.OnShowHint := FOldHintEvent; | 
|---|
|  | 493 | end; | 
|---|
|  | 494 |  | 
|---|
|  | 495 | procedure TfrmEncounter.lstAdmitChange(Sender: TObject); | 
|---|
|  | 496 | begin | 
|---|
|  | 497 | inherited; | 
|---|
|  | 498 | with lstAdmit do | 
|---|
|  | 499 | begin | 
|---|
|  | 500 | FLocation := StrToIntDef(Piece(Items[ItemIndex], U, 2), 0); | 
|---|
|  | 501 | FLocationName := Piece(Items[ItemIndex], U, 3); | 
|---|
|  | 502 | FDateTime := MakeFMDateTime(ItemID); | 
|---|
|  | 503 | FVisitCategory := 'H'; | 
|---|
|  | 504 | FStandAlone := False; | 
|---|
|  | 505 | txtLocation.Text := FLocationName;  // don't show admit date (could confuse user) | 
|---|
|  | 506 | end; | 
|---|
|  | 507 | end; | 
|---|
|  | 508 |  | 
|---|
|  | 509 | procedure TfrmEncounter.lstClinicChange(Sender: TObject); | 
|---|
|  | 510 | // V|A;DateTime;LocIEN^DateTime^LocName^Status | 
|---|
|  | 511 | begin | 
|---|
|  | 512 | inherited; | 
|---|
|  | 513 | with lstClinic do | 
|---|
|  | 514 | begin | 
|---|
|  | 515 | FLocation := StrToIntDef(Piece(ItemID, ';', 3), 0); | 
|---|
|  | 516 | FLocationName := Piece(Items[ItemIndex], U, 3); | 
|---|
|  | 517 | FDateTime := MakeFMDateTime(Piece(ItemID,';', 2)); | 
|---|
|  | 518 | FVisitCategory := 'A'; | 
|---|
|  | 519 | FStandAlone := CharAt(ItemID, 1) = 'V'; | 
|---|
|  | 520 | with txtLocation do | 
|---|
|  | 521 | begin | 
|---|
|  | 522 | Text := FLocationName + '  '; | 
|---|
|  | 523 | if FDateTime <> 0 then Text := Text + FormatFMDateTime('mmm dd,yy hh:nn', FDateTime); | 
|---|
|  | 524 | end; | 
|---|
|  | 525 | end; | 
|---|
|  | 526 | end; | 
|---|
|  | 527 |  | 
|---|
|  | 528 | procedure TfrmEncounter.FormResize(Sender: TObject); | 
|---|
|  | 529 | begin | 
|---|
|  | 530 | //CQ7118 | 
|---|
|  | 531 | if cboPtProvider.Visible then | 
|---|
|  | 532 | begin | 
|---|
|  | 533 | cmdOK.Left := cboPtProvider.Left + cboPtProvider.Width + 1; | 
|---|
|  | 534 | cmdCancel.Left := cboPtProvider.Left + cboPtProvider.Width + 1; | 
|---|
|  | 535 | end | 
|---|
|  | 536 | else | 
|---|
|  | 537 | begin | 
|---|
|  | 538 | cmdOK.Left := cmdDateRange.Left; | 
|---|
|  | 539 | cmdCancel.Left := cmdDateRange.Left; | 
|---|
|  | 540 | end; | 
|---|
|  | 541 |  | 
|---|
|  | 542 | cmdCancel.Top := cmdDateRange.Top - cmdCancel.Height - 10; | 
|---|
|  | 543 | cmdOK.Top := cmdCancel.Top - cmdOK.Height - 1; | 
|---|
|  | 544 |  | 
|---|
|  | 545 | cmdCancel.Top := cmdOK.Top + cmdOK.Height + 1; | 
|---|
|  | 546 | cmdCancel.Width := cmdOK.Width; | 
|---|
|  | 547 | //end CQ7118 | 
|---|
|  | 548 | end; | 
|---|
|  | 549 |  | 
|---|
|  | 550 | procedure TfrmEncounter.FormShow(Sender: TObject); | 
|---|
|  | 551 | begin | 
|---|
|  | 552 | //CQ7118 | 
|---|
|  | 553 | if cboPtProvider.Visible then | 
|---|
|  | 554 | begin | 
|---|
|  | 555 | cmdOK.Left := cboPtProvider.Left + cboPtProvider.Width + 1; | 
|---|
|  | 556 | cmdCancel.Left := cboPtProvider.Left + cboPtProvider.Width + 1; | 
|---|
|  | 557 | end | 
|---|
|  | 558 | else | 
|---|
|  | 559 | begin | 
|---|
|  | 560 | cmdOK.Left := cmdDateRange.Left; | 
|---|
|  | 561 | cmdCancel.Left := cmdDateRange.Left; | 
|---|
|  | 562 | end; | 
|---|
|  | 563 |  | 
|---|
|  | 564 | cmdCancel.Top := cmdDateRange.Top - cmdCancel.Height - 10; | 
|---|
|  | 565 | cmdOK.Top := cmdCancel.Top - cmdOK.Height - 1; | 
|---|
|  | 566 | cmdCancel.Top := cmdOK.Top + cmdOK.Height + 1; | 
|---|
|  | 567 | //end CQ7118 | 
|---|
| [830] | 568 | if Not User.IsProvider then | 
|---|
|  | 569 | if cboPtProvider.CanFocus then | 
|---|
|  | 570 | cboPtProvider.SetFocus; | 
|---|
| [456] | 571 | end; | 
|---|
|  | 572 |  | 
|---|
|  | 573 | end. | 
|---|