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