| 1 | unit fOptions; | 
|---|
| 2 |  | 
|---|
| 3 | interface | 
|---|
| 4 |  | 
|---|
| 5 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls, | 
|---|
| 6 | Buttons, ComCtrls, ExtCtrls, ORCtrls, OrFn, Dialogs, ORDtTmRng, fBAOptionsDiagnoses, | 
|---|
| 7 | uBAGlobals; | 
|---|
| 8 |  | 
|---|
| 9 | type | 
|---|
| 10 | TfrmOptions = class(TForm) | 
|---|
| 11 | pnlMain: TPanel; | 
|---|
| 12 | pnlBottom: TPanel; | 
|---|
| 13 | pagOptions: TPageControl; | 
|---|
| 14 | tsCoverSheet: TTabSheet; | 
|---|
| 15 | tsNotifications: TTabSheet; | 
|---|
| 16 | btnOK: TButton; | 
|---|
| 17 | btnCancel: TButton; | 
|---|
| 18 | btnApply: TButton; | 
|---|
| 19 | tsOrderChecks: TTabSheet; | 
|---|
| 20 | tsListsTeams: TTabSheet; | 
|---|
| 21 | lblCoverReminderDesc: TMemo; | 
|---|
| 22 | lblCoverReminders: TStaticText; | 
|---|
| 23 | lblCoverDaysDesc: TMemo; | 
|---|
| 24 | lblCoverDays: TStaticText; | 
|---|
| 25 | btnCoverDays: TButton; | 
|---|
| 26 | bvlCoverDays: TBevel; | 
|---|
| 27 | btnCoverReminders: TButton; | 
|---|
| 28 | bvlCoverReminders: TBevel; | 
|---|
| 29 | imgCoverDays: TImage; | 
|---|
| 30 | imgCoverReminders: TImage; | 
|---|
| 31 | lblPatientSelectionDesc: TMemo; | 
|---|
| 32 | lblPatientSelection: TStaticText; | 
|---|
| 33 | btnPatientSelection: TButton; | 
|---|
| 34 | bvlPatientSelection: TBevel; | 
|---|
| 35 | btnPersonalLists: TButton; | 
|---|
| 36 | imgPatientSelection: TImage; | 
|---|
| 37 | lblNotificationsOptions: TStaticText; | 
|---|
| 38 | lblNotifications: TStaticText; | 
|---|
| 39 | bvlNotifications: TBevel; | 
|---|
| 40 | imgNotifications: TImage; | 
|---|
| 41 | lblOrderChecksDesc: TLabel; | 
|---|
| 42 | lblOrderChecks: TStaticText; | 
|---|
| 43 | bvlOrderChecks: TBevel; | 
|---|
| 44 | imgOrderChecks: TImage; | 
|---|
| 45 | lblTeamsDesc: TMemo; | 
|---|
| 46 | lblTeams: TStaticText; | 
|---|
| 47 | btnTeams: TButton; | 
|---|
| 48 | bvlTeams: TBevel; | 
|---|
| 49 | lvwNotifications: TCaptionListView; | 
|---|
| 50 | lblNotificationView: TLabel; | 
|---|
| 51 | btnNotificationsRemove: TButton; | 
|---|
| 52 | chkNotificationsFlagged: TCheckBox; | 
|---|
| 53 | lvwOrderChecks: TCaptionListView; | 
|---|
| 54 | lblOrderChecksView: TLabel; | 
|---|
| 55 | btnSurrogate: TButton; | 
|---|
| 56 | lblNotificationsSurrogate: TStaticText; | 
|---|
| 57 | lblNotificationsSurrogateText: TStaticText; | 
|---|
| 58 | btnCombinations: TButton; | 
|---|
| 59 | bvlOtherParameters: TBevel; | 
|---|
| 60 | lblOtherParameters: TStaticText; | 
|---|
| 61 | imgOtherParameters: TImage; | 
|---|
| 62 | lblOtherParametersDesc: TMemo; | 
|---|
| 63 | btnOtherParameters: TButton; | 
|---|
| 64 | tsNotes: TTabSheet; | 
|---|
| 65 | lblNotesNotesDesc: TMemo; | 
|---|
| 66 | lblNotesNotes: TStaticText; | 
|---|
| 67 | bvlNotesNotes: TBevel; | 
|---|
| 68 | btnNotesNotes: TButton; | 
|---|
| 69 | lblNotesTitles: TStaticText; | 
|---|
| 70 | bvlNotesTitles: TBevel; | 
|---|
| 71 | lblNotesTitlesDesc: TMemo; | 
|---|
| 72 | btnNotesTitles: TButton; | 
|---|
| 73 | imgNotesNotes: TImage; | 
|---|
| 74 | imgNotes: TImage; | 
|---|
| 75 | imgTeams: TImage; | 
|---|
| 76 | tsCprsReports: TTabSheet; | 
|---|
| 77 | lblReports: TStaticText; | 
|---|
| 78 | bvlReports: TBevel; | 
|---|
| 79 | memReports: TMemo; | 
|---|
| 80 | imgReports: TImage; | 
|---|
| 81 | btnReports: TButton; | 
|---|
| 82 | lblReport1: TStaticText; | 
|---|
| 83 | memReport1: TMemo; | 
|---|
| 84 | btnReport1: TButton; | 
|---|
| 85 | bvlReport1: TBevel; | 
|---|
| 86 | btnDiagnoses: TButton; | 
|---|
| 87 | tsGraphs: TTabSheet; | 
|---|
| 88 | lblGraphSettings: TStaticText; | 
|---|
| 89 | bvlGraphSettings: TBevel; | 
|---|
| 90 | imgGraphSettings: TImage; | 
|---|
| 91 | btnGraphSettings: TButton; | 
|---|
| 92 | bvlGraphViews: TBevel; | 
|---|
| 93 | lblGraphViews: TStaticText; | 
|---|
| 94 | imgGraphViews: TImage; | 
|---|
| 95 | btnGraphViews: TButton; | 
|---|
| 96 | memGraphSettings: TMemo; | 
|---|
| 97 | memGraphViews: TMemo; | 
|---|
| 98 | bvlReport2: TBevel; | 
|---|
| 99 | lblReport2: TStaticText; | 
|---|
| 100 | memReport2: TMemo; | 
|---|
| 101 | imgReport1: TImage; | 
|---|
| 102 | imgReport2: TImage; | 
|---|
| 103 | rdoRDV: TRadioGroup; | 
|---|
| 104 | procedure FormCreate(Sender: TObject); | 
|---|
| 105 | procedure FormDestroy(Sender: TObject); | 
|---|
| 106 | procedure btnCoverDaysClick(Sender: TObject); | 
|---|
| 107 | procedure btnCoverRemindersClick(Sender: TObject); | 
|---|
| 108 | procedure btnOtherParametersClick(Sender: TObject); | 
|---|
| 109 | procedure btnPatientSelectionClick(Sender: TObject); | 
|---|
| 110 | procedure btnPersonalListsClick(Sender: TObject); | 
|---|
| 111 | procedure btnTeamsClick(Sender: TObject); | 
|---|
| 112 | procedure btnNotificationsRemoveClick(Sender: TObject); | 
|---|
| 113 | procedure btnApplyClick(Sender: TObject); | 
|---|
| 114 | procedure chkNotificationsFlaggedClick(Sender: TObject); | 
|---|
| 115 | procedure lvwNotificationsChange(Sender: TObject; Item: TListItem; | 
|---|
| 116 | Change: TItemChange); | 
|---|
| 117 | procedure lvwNotificationsColumnClick(Sender: TObject; | 
|---|
| 118 | Column: TListColumn); | 
|---|
| 119 | procedure lvwNotificationsCompare(Sender: TObject; Item1, | 
|---|
| 120 | Item2: TListItem; Data: Integer; var Compare: Integer); | 
|---|
| 121 | procedure lvwNotificationsDblClick(Sender: TObject); | 
|---|
| 122 | procedure btnSurrogateClick(Sender: TObject); | 
|---|
| 123 | procedure btnCombinationsClick(Sender: TObject); | 
|---|
| 124 | procedure btnNotesNotesClick(Sender: TObject); | 
|---|
| 125 | procedure btnNotesTitlesClick(Sender: TObject); | 
|---|
| 126 | procedure btnReportsClick(Sender: TObject); | 
|---|
| 127 | procedure btnReport1Click(Sender: TObject); | 
|---|
| 128 | procedure lvwNotificationsEnter(Sender: TObject); | 
|---|
| 129 | procedure lvwNotificationsMouseDown(Sender: TObject; | 
|---|
| 130 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
| 131 | procedure btnDiagnosesClick(Sender: TObject); | 
|---|
| 132 | procedure btnGraphSettingsClick(Sender: TObject); | 
|---|
| 133 | procedure btnGraphViewsClick(Sender: TObject); | 
|---|
| 134 | procedure rdoRDVClick(Sender: TObject); | 
|---|
| 135 | private | 
|---|
| 136 | { Private declarations } | 
|---|
| 137 | FdirtyNotifications: boolean;  // used to determine edit changes to Notifications | 
|---|
| 138 | FdirtyOrderChecks: boolean;    // used to determine edit changes to Order Checks | 
|---|
| 139 | FdirtyOtherStuff: boolean;     // used to determine edit changes to misc settings | 
|---|
| 140 | FuseCheckBoxes: boolean; | 
|---|
| 141 | FsortCol: integer; | 
|---|
| 142 | FsortAscending: boolean; | 
|---|
| 143 | FLastClickedItem: TListItem; | 
|---|
| 144 | procedure Offset(var topnum: integer; topoffset: integer; var leftnum: integer; leftoffset: integer); | 
|---|
| 145 | procedure LoadNotifications; | 
|---|
| 146 | procedure LoadOrderChecks; | 
|---|
| 147 | procedure ApplyNotifications; | 
|---|
| 148 | procedure ApplyOrderChecks; | 
|---|
| 149 | procedure ApplyOtherStuff; | 
|---|
| 150 | procedure CheckApply; | 
|---|
| 151 | procedure LoadListView(aListView: TListView; aList: TStrings); | 
|---|
| 152 | procedure ChangeOnOff(aListView: TListView; aListItem: TListItem); | 
|---|
| 153 | public | 
|---|
| 154 | { Public declarations } | 
|---|
| 155 | end; | 
|---|
| 156 |  | 
|---|
| 157 | var | 
|---|
| 158 | frmOptions: TfrmOptions; | 
|---|
| 159 |  | 
|---|
| 160 | procedure DialogOptions(var actiontype: Integer); | 
|---|
| 161 |  | 
|---|
| 162 | implementation | 
|---|
| 163 |  | 
|---|
| 164 | uses fOptionsDays, fOptionsReminders, fOptionsSurrogate, | 
|---|
| 165 | fOptionsPatientSelection, fOptionsLists, fOptionsTeams, fOptionsCombinations, | 
|---|
| 166 | fOptionsOther, fOptionsNotes, fOptionsTitles, fOptionsReportsCustom, fOptionsReportsDefault, | 
|---|
| 167 | fGraphs, fGraphSettings, fGraphProfiles, rGraphs, uGraphs, | 
|---|
| 168 | rOptions, rCore, uCore, uOptions, UBACore, fFrame; | 
|---|
| 169 | //fTestDialog; | 
|---|
| 170 |  | 
|---|
| 171 | {$R *.DFM} | 
|---|
| 172 |  | 
|---|
| 173 | type | 
|---|
| 174 | TRule = class | 
|---|
| 175 | public | 
|---|
| 176 | IEN: string; | 
|---|
| 177 | OriginalValue: string; | 
|---|
| 178 | ItemText: string; | 
|---|
| 179 | end; | 
|---|
| 180 |  | 
|---|
| 181 | procedure DialogOptions(var actiontype: Integer); | 
|---|
| 182 | // create the form and make in modal, return an action | 
|---|
| 183 | const | 
|---|
| 184 | PixelGapBetweenButtons = 5; | 
|---|
| 185 | var | 
|---|
| 186 | frmOptions: TfrmOptions; | 
|---|
| 187 | begin | 
|---|
| 188 | frmOptions := TfrmOptions.Create(Application); | 
|---|
| 189 | try | 
|---|
| 190 | with frmOptions do | 
|---|
| 191 | begin | 
|---|
| 192 | with pagOptions do | 
|---|
| 193 | begin | 
|---|
| 194 | tsCoverSheet.TabVisible := false; | 
|---|
| 195 | tsNotifications.TabVisible := false; | 
|---|
| 196 | tsOrderChecks.TabVisible := false; | 
|---|
| 197 | tsListsTeams.TabVisible := false; | 
|---|
| 198 | case actiontype of | 
|---|
| 199 | 1: begin | 
|---|
| 200 | tsCoverSheet.TabVisible := true; | 
|---|
| 201 | end; | 
|---|
| 202 | 2: begin | 
|---|
| 203 | tsNotifications.TabVisible := true; | 
|---|
| 204 | end; | 
|---|
| 205 | 3: begin | 
|---|
| 206 | tsOrderChecks.TabVisible := true; | 
|---|
| 207 | end; | 
|---|
| 208 | 4: begin | 
|---|
| 209 | tsListsTeams.TabVisible := true; | 
|---|
| 210 | end; | 
|---|
| 211 | else | 
|---|
| 212 | begin | 
|---|
| 213 | tsCoverSheet.TabVisible := true; | 
|---|
| 214 | tsNotifications.TabVisible := true; | 
|---|
| 215 | tsOrderChecks.TabVisible := true; | 
|---|
| 216 | tsListsTeams.TabVisible := true; | 
|---|
| 217 | ActivePage := tsCoverSheet; | 
|---|
| 218 | memReports.Text := 'Change the default date range and occurrence limits for all reports on ' + | 
|---|
| 219 | 'the CPRS Reports tab (excluding health summary reports) .'; | 
|---|
| 220 | memReport1.Text := 'Change the individual date range and occurrence limits for each report on ' + | 
|---|
| 221 | 'the CPRS Reports tab (excluding health summary reports) .'; | 
|---|
| 222 | btnReports.caption := 'Set All Reports...'; | 
|---|
| 223 | btnReport1.caption := 'Set Individual Reports...'; | 
|---|
| 224 | if User.IsReportsOnly then // For "Reports Only" users. | 
|---|
| 225 | begin | 
|---|
| 226 | tsCoverSheet.TabVisible := false; | 
|---|
| 227 | tsNotifications.TabVisible := false; | 
|---|
| 228 | tsOrderChecks.TabVisible := false; | 
|---|
| 229 | tsListsTeams.TabVisible := false; | 
|---|
| 230 | tsNotes.TabVisible := false; | 
|---|
| 231 | if (not User.ToolsRptEdit) then | 
|---|
| 232 | begin | 
|---|
| 233 | btnOK.visible := false; | 
|---|
| 234 | btnApply.visible := false; | 
|---|
| 235 | btnCancel.caption := 'Close'; | 
|---|
| 236 | end; | 
|---|
| 237 | end; | 
|---|
| 238 | if (not User.ToolsRptEdit) then // For users with Reports settings edit parameter not set. | 
|---|
| 239 | begin | 
|---|
| 240 | memReports.Text := 'View the default date range and occurrence limits for all reports on ' + | 
|---|
| 241 | 'the CPRS Reports tab (excluding health summary reports) .'; | 
|---|
| 242 | memReport1.Text := 'View the individual date range and occurrence limits for each report on ' + | 
|---|
| 243 | 'the CPRS Reports tab (excluding health summary reports) .'; | 
|---|
| 244 | btnReports.caption := 'View All Report Settings...'; | 
|---|
| 245 | btnReport1.caption := 'View Individual Report Settings...'; | 
|---|
| 246 | end; | 
|---|
| 247 | end; | 
|---|
| 248 | end; | 
|---|
| 249 | end; | 
|---|
| 250 | actiontype := 0; | 
|---|
| 251 | ResizeAnchoredFormToFont(frmOptions); | 
|---|
| 252 | btnApply.Left := pagOptions.Left + pagOptions.Width - btnApply.Width; | 
|---|
| 253 | btnCancel.Left := btnApply.Left - btnCancel.Width - PixelGapBetweenButtons; | 
|---|
| 254 | btnOK.Left := btnCancel.Left - btnOK.Width - PixelGapBetweenButtons; | 
|---|
| 255 | ShowModal; | 
|---|
| 256 | actiontype := btnOK.Tag; | 
|---|
| 257 | end; | 
|---|
| 258 | finally | 
|---|
| 259 | frmOptions.Release; | 
|---|
| 260 | end; | 
|---|
| 261 | end; | 
|---|
| 262 |  | 
|---|
| 263 | procedure TfrmOptions.FormCreate(Sender: TObject); | 
|---|
| 264 | // initialize form | 
|---|
| 265 | begin | 
|---|
| 266 | LoadNotifications; | 
|---|
| 267 | LoadOrderChecks; | 
|---|
| 268 | FdirtyNotifications := false; | 
|---|
| 269 | FdirtyOrderChecks := false; | 
|---|
| 270 | FdirtyOtherStuff := false; | 
|---|
| 271 | CheckApply; | 
|---|
| 272 |  | 
|---|
| 273 | if (Encounter.Provider = 0) and not IsCIDCProvider(User.DUZ) then | 
|---|
| 274 | btnDiagnoses.Enabled := False; | 
|---|
| 275 | if UseVistaWeb then rdoRDV.ItemIndex := 1; | 
|---|
| 276 |  | 
|---|
| 277 | end; | 
|---|
| 278 |  | 
|---|
| 279 | procedure TfrmOptions.FormDestroy(Sender: TObject); | 
|---|
| 280 | // cleanup creation of objects | 
|---|
| 281 | var | 
|---|
| 282 | i: integer; | 
|---|
| 283 | begin | 
|---|
| 284 | for i := 0 to lvwOrderChecks.Items.Count - 1 do | 
|---|
| 285 | lvwOrderChecks.Items.Item[i].SubItems.Objects[2].free; | 
|---|
| 286 | for i := 0 to lvwNotifications.Items.Count - 1 do | 
|---|
| 287 | lvwNotifications.Items.Item[i].SubItems.Objects[2].free; | 
|---|
| 288 | end; | 
|---|
| 289 |  | 
|---|
| 290 | procedure TfrmOptions.btnCoverDaysClick(Sender: TObject); | 
|---|
| 291 | // display Date Range Defaults on Cover Sheet | 
|---|
| 292 | var | 
|---|
| 293 | topsize, leftsize, value: integer; | 
|---|
| 294 | begin | 
|---|
| 295 | value := 0; | 
|---|
| 296 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 297 | DialogOptionsDays(topsize, leftsize, Font.Size, value); | 
|---|
| 298 | end; | 
|---|
| 299 |  | 
|---|
| 300 | procedure TfrmOptions.btnCoverRemindersClick(Sender: TObject); | 
|---|
| 301 | // display Clinical Reminder Options | 
|---|
| 302 | var | 
|---|
| 303 | topsize, leftsize, value: integer; | 
|---|
| 304 | begin | 
|---|
| 305 | value := 0; | 
|---|
| 306 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 307 | DialogOptionsReminders(topsize, leftsize, Font.Size, value); | 
|---|
| 308 | end; | 
|---|
| 309 |  | 
|---|
| 310 | procedure TfrmOptions.btnOtherParametersClick(Sender: TObject); | 
|---|
| 311 | // display Other Parameters Options | 
|---|
| 312 | var | 
|---|
| 313 | topsize, leftsize, value: integer; | 
|---|
| 314 | begin | 
|---|
| 315 | value := 0; | 
|---|
| 316 | Offset(topsize, 40, leftsize, 40); | 
|---|
| 317 | DialogOptionsOther(topsize, leftsize, Font.Size, value); | 
|---|
| 318 | end; | 
|---|
| 319 |  | 
|---|
| 320 | procedure TfrmOptions.btnPatientSelectionClick(Sender: TObject); | 
|---|
| 321 | // display Patient Selection Options | 
|---|
| 322 | var | 
|---|
| 323 | topsize, leftsize, value: integer; | 
|---|
| 324 | begin | 
|---|
| 325 | value := 0; | 
|---|
| 326 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 327 | DialogOptionsPatientSelection(topsize, leftsize, Font.Size, value); | 
|---|
| 328 | end; | 
|---|
| 329 |  | 
|---|
| 330 | procedure TfrmOptions.btnPersonalListsClick(Sender: TObject); | 
|---|
| 331 | // display Personal Lists Options | 
|---|
| 332 | var | 
|---|
| 333 | topsize, leftsize, value: integer; | 
|---|
| 334 | begin | 
|---|
| 335 | value := 0; | 
|---|
| 336 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 337 | DialogOptionsLists(topsize, leftsize, Font.Size, value); | 
|---|
| 338 | end; | 
|---|
| 339 |  | 
|---|
| 340 | procedure TfrmOptions.btnTeamsClick(Sender: TObject); | 
|---|
| 341 | // display Team Options | 
|---|
| 342 | var | 
|---|
| 343 | topsize, leftsize, value: integer; | 
|---|
| 344 | begin | 
|---|
| 345 | value := 0; | 
|---|
| 346 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 347 | DialogOptionsTeams(topsize, leftsize, Font.Size, value); | 
|---|
| 348 | end; | 
|---|
| 349 |  | 
|---|
| 350 | procedure TfrmOptions.btnNotificationsRemoveClick(Sender: TObject); | 
|---|
| 351 | // confirm before clearing notifications | 
|---|
| 352 | begin | 
|---|
| 353 | if InfoBox('CAUTION: This will clear all the current notifications you have pending.' | 
|---|
| 354 | + #13 + 'If you say YES, these changes will take place immediately.' | 
|---|
| 355 | + #13 + 'Are you sure you want to erase all of your notifications?', | 
|---|
| 356 | 'Warning', MB_YESNO or MB_ICONWARNING) = IDYES then | 
|---|
| 357 | begin | 
|---|
| 358 | rpcClearNotifications; | 
|---|
| 359 | end; | 
|---|
| 360 | end; | 
|---|
| 361 |  | 
|---|
| 362 | procedure TfrmOptions.Offset(var topnum: integer; topoffset: integer; var leftnum: integer; leftoffset: integer); | 
|---|
| 363 | // get positions to display dialog | 
|---|
| 364 | begin | 
|---|
| 365 | // use these top and left values to display dialog | 
|---|
| 366 | topnum := Top; | 
|---|
| 367 | leftnum := Left; | 
|---|
| 368 | topnum := topnum + topoffset; | 
|---|
| 369 | if topnum < 0 then topnum := 0; | 
|---|
| 370 | leftnum := leftnum + leftoffset; | 
|---|
| 371 | if leftnum < 0 then leftnum := 0; | 
|---|
| 372 | end; | 
|---|
| 373 |  | 
|---|
| 374 | procedure TfrmOptions.btnApplyClick(Sender: TObject); | 
|---|
| 375 | // save actions without exiting | 
|---|
| 376 | begin | 
|---|
| 377 | if FdirtyNotifications then | 
|---|
| 378 | ApplyNotifications; | 
|---|
| 379 | if FdirtyOrderChecks then | 
|---|
| 380 | ApplyOrderChecks; | 
|---|
| 381 | if FdirtyOtherStuff then | 
|---|
| 382 | ApplyOtherStuff; | 
|---|
| 383 | CheckApply; | 
|---|
| 384 | if Sender = btnOK then | 
|---|
| 385 | Close; | 
|---|
| 386 | end; | 
|---|
| 387 |  | 
|---|
| 388 | procedure TfrmOptions.LoadNotifications; | 
|---|
| 389 | // load Notification tab | 
|---|
| 390 | var | 
|---|
| 391 | notifydefaults, surrogateinfo, flag, enableerase: string; | 
|---|
| 392 | begin | 
|---|
| 393 | LoadListView(lvwNotifications, rpcGetNotifications); | 
|---|
| 394 | lvwNotificationsColumnClick(lvwNotifications, lvwNotifications.Column[0]); // make sure sorted | 
|---|
| 395 | notifydefaults := rpcGetNotificationDefaults; | 
|---|
| 396 | flag := Piece(notifydefaults, '^', 2); | 
|---|
| 397 | enableerase := Piece(notifydefaults, '^', 3); | 
|---|
| 398 | chkNotificationsFlagged.Checked := flag = '1'; | 
|---|
| 399 | btnNotificationsRemove.Enabled := enableerase = '1'; | 
|---|
| 400 | surrogateinfo := rpcGetSurrogateInfo; | 
|---|
| 401 | btnSurrogate.Hint := surrogateinfo; | 
|---|
| 402 | LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText); | 
|---|
| 403 | end; | 
|---|
| 404 |  | 
|---|
| 405 | procedure TfrmOptions.LoadOrderChecks; | 
|---|
| 406 | // load Order Check tab | 
|---|
| 407 | begin | 
|---|
| 408 | LoadListView(lvwOrderChecks, rpcGetOrderChecks); | 
|---|
| 409 | lvwOrderChecks.Checkboxes := true; | 
|---|
| 410 | end; | 
|---|
| 411 |  | 
|---|
| 412 | procedure TfrmOptions.ApplyNotifications; | 
|---|
| 413 | // save Notification changes | 
|---|
| 414 | var | 
|---|
| 415 | i: integer; | 
|---|
| 416 | newonoff: string; | 
|---|
| 417 | aRule: TRule; | 
|---|
| 418 | aList: TStringList; | 
|---|
| 419 | begin | 
|---|
| 420 | aList := TStringList.Create; | 
|---|
| 421 | for i := 0 to lvwNotifications.Items.Count - 1 do | 
|---|
| 422 | begin | 
|---|
| 423 | aRule := TRule(lvwNotifications.Items.Item[i].SubItems.Objects[2]); | 
|---|
| 424 | if lvwNotifications.Items.Item[i].SubItems[1] <> 'Mandatory' then | 
|---|
| 425 | begin | 
|---|
| 426 | newonoff := Uppercase(lvwNotifications.Items.Item[i].SubItems[0]); | 
|---|
| 427 | if aRule.OriginalValue <> newonoff then | 
|---|
| 428 | begin | 
|---|
| 429 | //***showmessage(aRule.IEN + ' ' + aRule.OriginalValue + ' ' + newonoff); | 
|---|
| 430 | aList.Add(aRule.IEN + '^' + newonoff); | 
|---|
| 431 | aRule.OriginalValue := lvwNotifications.Items.Item[i].SubItems[0]; | 
|---|
| 432 | end; | 
|---|
| 433 | end; | 
|---|
| 434 | end; | 
|---|
| 435 | rpcSetNotifications(aList); | 
|---|
| 436 | aList.free; | 
|---|
| 437 | FdirtyNotifications := false; | 
|---|
| 438 | end; | 
|---|
| 439 |  | 
|---|
| 440 | procedure TfrmOptions.ApplyOrderChecks; | 
|---|
| 441 | // save Order Check changes | 
|---|
| 442 | var | 
|---|
| 443 | i: integer; | 
|---|
| 444 | newonoff: string; | 
|---|
| 445 | aRule: TRule; | 
|---|
| 446 | aList: TStringList; | 
|---|
| 447 | begin | 
|---|
| 448 | aList := TStringList.Create; | 
|---|
| 449 | for i := 0 to lvwOrderChecks.Items.Count - 1 do | 
|---|
| 450 | begin | 
|---|
| 451 | aRule := TRule(lvwOrderChecks.Items.Item[i].SubItems.Objects[2]); | 
|---|
| 452 | newonoff := Uppercase(lvwOrderChecks.Items.Item[i].SubItems[0]); | 
|---|
| 453 | if aRule.OriginalValue <> newonoff then | 
|---|
| 454 | begin | 
|---|
| 455 | aList.Add(aRule.IEN + '^' + newonoff); | 
|---|
| 456 | aRule.OriginalValue := lvwOrderChecks.Items.Item[i].SubItems[0]; | 
|---|
| 457 | end; | 
|---|
| 458 | end; | 
|---|
| 459 | rpcSetOrderChecks(aList); | 
|---|
| 460 | aList.free; | 
|---|
| 461 | FdirtyOrderChecks := false; | 
|---|
| 462 | end; | 
|---|
| 463 |  | 
|---|
| 464 | procedure TfrmOptions.ApplyOtherStuff; | 
|---|
| 465 | // save other changes | 
|---|
| 466 | var | 
|---|
| 467 | aString: string; | 
|---|
| 468 | begin | 
|---|
| 469 | aString := ''; | 
|---|
| 470 | if chkNotificationsFlagged.Checked then | 
|---|
| 471 | aString := aString + '^1' | 
|---|
| 472 | else | 
|---|
| 473 | aString := aString + '^0'; | 
|---|
| 474 | rpcSetOtherStuff(aString); | 
|---|
| 475 | FdirtyOtherStuff := false; | 
|---|
| 476 | end; | 
|---|
| 477 |  | 
|---|
| 478 | procedure TfrmOptions.CheckApply; | 
|---|
| 479 | // determine if Apply button is enabled | 
|---|
| 480 | begin | 
|---|
| 481 | btnApply.Enabled :=  FdirtyOrderChecks or FdirtyNotifications or FdirtyOtherStuff; | 
|---|
| 482 | end; | 
|---|
| 483 |  | 
|---|
| 484 | procedure TfrmOptions.chkNotificationsFlaggedClick(Sender: TObject); | 
|---|
| 485 | // set notification flagged status | 
|---|
| 486 | begin | 
|---|
| 487 | FdirtyOtherStuff := true; | 
|---|
| 488 | CheckApply; | 
|---|
| 489 | end; | 
|---|
| 490 |  | 
|---|
| 491 | procedure TfrmOptions.LoadListView(aListView: TListView; aList: TStrings); | 
|---|
| 492 | // load a list view with: name, on/off, comment | 
|---|
| 493 | var | 
|---|
| 494 | i: integer; | 
|---|
| 495 | aListItem: TListItem; | 
|---|
| 496 | aRule: TRule; | 
|---|
| 497 | rulenum, ruletext, ruleonoff, rulecomment: string; | 
|---|
| 498 | begin | 
|---|
| 499 | FuseCheckBoxes := false; | 
|---|
| 500 | aListView.Items.Clear; | 
|---|
| 501 | aListView.SortType := stNone; // if Sorting during load then potential error | 
|---|
| 502 | with aList do | 
|---|
| 503 | begin | 
|---|
| 504 | for i := 0 to aList.Count - 1 do | 
|---|
| 505 | begin | 
|---|
| 506 | rulenum := Piece(aList[i], '^', 1); | 
|---|
| 507 | ruletext := Piece(aList[i], '^', 2); | 
|---|
| 508 | ruleonoff := Piece(aList[i], '^', 3); | 
|---|
| 509 | rulecomment := Piece(aList[i], '^', 4); | 
|---|
| 510 | aListItem := aListView.Items.Add; | 
|---|
| 511 | with aListItem do | 
|---|
| 512 | begin | 
|---|
| 513 | Caption := ruletext; | 
|---|
| 514 | SubItems.Add(ruleonoff); | 
|---|
| 515 | if ruleonoff = 'On' then Checked := true; | 
|---|
| 516 | SubItems.Add(rulecomment); | 
|---|
| 517 | end; | 
|---|
| 518 | aRule := TRule.Create; | 
|---|
| 519 | with aRule do | 
|---|
| 520 | begin | 
|---|
| 521 | IEN := rulenum; | 
|---|
| 522 | OriginalValue := ruleonoff; | 
|---|
| 523 | ItemText := ruletext; | 
|---|
| 524 | end; | 
|---|
| 525 | aListItem.SubItems.AddObject('rule object', aRule); | 
|---|
| 526 | end; | 
|---|
| 527 | end; | 
|---|
| 528 | aListView.SortType := stBoth; | 
|---|
| 529 | FuseCheckBoxes := true; | 
|---|
| 530 | end; | 
|---|
| 531 |  | 
|---|
| 532 | procedure TfrmOptions.lvwNotificationsChange(Sender: TObject; | 
|---|
| 533 | Item: TListItem; Change: TItemChange); | 
|---|
| 534 | // change on/off on checkmark | 
|---|
| 535 | begin | 
|---|
| 536 | if (Sender as TListView).ItemIndex = -1 then exit; | 
|---|
| 537 | if not FuseCheckBoxes then exit; | 
|---|
| 538 | if (Sender as TListView).Checkboxes = false then exit; | 
|---|
| 539 | if (Item.SubItems[1] = 'Mandatory') and not Item.Checked then begin | 
|---|
| 540 | Item.Checked := True; | 
|---|
| 541 | exit; | 
|---|
| 542 | end; | 
|---|
| 543 | if Item.Checked then | 
|---|
| 544 | begin | 
|---|
| 545 | if Item.SubItems[0] <> 'On' then | 
|---|
| 546 | ChangeOnOff(Sender as TListView, Item); | 
|---|
| 547 | Item.SubItems[0] := 'On'; | 
|---|
| 548 | end | 
|---|
| 549 | else | 
|---|
| 550 | begin | 
|---|
| 551 | if Item.SubItems[0] <> 'Off' then | 
|---|
| 552 | ChangeOnOff(Sender as TListView, Item); | 
|---|
| 553 | Item.SubItems[0] := 'Off'; | 
|---|
| 554 | end; | 
|---|
| 555 | end; | 
|---|
| 556 |  | 
|---|
| 557 | procedure TfrmOptions.lvwNotificationsColumnClick(Sender: TObject; | 
|---|
| 558 | Column: TListColumn); | 
|---|
| 559 | // toggle sort | 
|---|
| 560 | begin | 
|---|
| 561 | if FsortCol = Column.Index then | 
|---|
| 562 | FsortAscending := not FsortAscending | 
|---|
| 563 | else | 
|---|
| 564 | FsortAscending := true; | 
|---|
| 565 | FsortCol := Column.Index; | 
|---|
| 566 | (Sender as TListView).AlphaSort; | 
|---|
| 567 | end; | 
|---|
| 568 |  | 
|---|
| 569 | procedure TfrmOptions.lvwNotificationsCompare(Sender: TObject; Item1, | 
|---|
| 570 | Item2: TListItem; Data: Integer; var Compare: Integer); | 
|---|
| 571 | //  sort columns | 
|---|
| 572 | begin | 
|---|
| 573 | if not(Sender is TListView) then exit; | 
|---|
| 574 | if FsortAscending then | 
|---|
| 575 | begin | 
|---|
| 576 | if FsortCol = 0 then | 
|---|
| 577 | Compare := CompareStr(Item1.Caption, Item2.Caption) | 
|---|
| 578 | else | 
|---|
| 579 | Compare := CompareStr(Item1.SubItems[FsortCol - 1], | 
|---|
| 580 | Item2.SubItems[FsortCol - 1]); | 
|---|
| 581 | end | 
|---|
| 582 | else | 
|---|
| 583 | begin | 
|---|
| 584 | if FsortCol = 0 then | 
|---|
| 585 | Compare := CompareStr(Item2.Caption, Item1.Caption) | 
|---|
| 586 | else | 
|---|
| 587 | Compare := CompareStr(Item2.SubItems[FsortCol - 1], | 
|---|
| 588 | Item1.SubItems[FsortCol - 1]); | 
|---|
| 589 | end; | 
|---|
| 590 | end; | 
|---|
| 591 |  | 
|---|
| 592 | procedure TfrmOptions.lvwNotificationsDblClick(Sender: TObject); | 
|---|
| 593 | // toggle check marks with double click | 
|---|
| 594 | var | 
|---|
| 595 | aListItem: TListItem; | 
|---|
| 596 | begin | 
|---|
| 597 | with (Sender as TListView) do | 
|---|
| 598 | begin | 
|---|
| 599 | if Checkboxes = false then exit; | 
|---|
| 600 | if Selected = nil then exit; | 
|---|
| 601 | if Selected.SubItems[1] = 'Mandatory' then exit; | 
|---|
| 602 | if Selected <> FLastClickedItem then exit; | 
|---|
| 603 | aListItem := Selected; | 
|---|
| 604 | aListItem.Checked := not aListItem.Checked; | 
|---|
| 605 | ChangeOnOff(Sender as TListView, aListItem); | 
|---|
| 606 |  | 
|---|
| 607 | if aListItem.Checked then | 
|---|
| 608 | aListItem.SubItems[0] := 'On' | 
|---|
| 609 | else | 
|---|
| 610 | aListItem.SubItems[0] := 'Off'; | 
|---|
| 611 | end; | 
|---|
| 612 | end; | 
|---|
| 613 |  | 
|---|
| 614 | procedure TfrmOptions.ChangeOnOff(aListView: TListView; aListItem: TListItem); | 
|---|
| 615 | // check if list items were edited | 
|---|
| 616 | begin | 
|---|
| 617 | if aListView = lvwNotifications then FdirtyNotifications := true; | 
|---|
| 618 | if aListView = lvwOrderChecks then FdirtyOrderChecks := true; | 
|---|
| 619 | CheckApply; | 
|---|
| 620 | end; | 
|---|
| 621 |  | 
|---|
| 622 | procedure TfrmOptions.btnSurrogateClick(Sender: TObject); | 
|---|
| 623 | // display Surrogate Options | 
|---|
| 624 | var | 
|---|
| 625 | topsize, leftsize: integer; | 
|---|
| 626 | surrogateinfo: string; | 
|---|
| 627 | begin | 
|---|
| 628 | surrogateinfo := btnSurrogate.Hint; | 
|---|
| 629 | Offset(topsize, -30, leftsize, -30); | 
|---|
| 630 | DialogOptionsSurrogate(topsize, leftsize, Font.Size, surrogateinfo); | 
|---|
| 631 | LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText); | 
|---|
| 632 | btnSurrogate.Hint := surrogateinfo; | 
|---|
| 633 | end; | 
|---|
| 634 |  | 
|---|
| 635 | procedure TfrmOptions.btnCombinationsClick(Sender: TObject); | 
|---|
| 636 | // display Combination List Options | 
|---|
| 637 | var | 
|---|
| 638 | topsize, leftsize, value: integer; | 
|---|
| 639 | begin | 
|---|
| 640 | value := 0; | 
|---|
| 641 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 642 | DialogOptionsCombinations(topsize, leftsize, Font.Size, value); | 
|---|
| 643 | end; | 
|---|
| 644 |  | 
|---|
| 645 | procedure TfrmOptions.btnNotesNotesClick(Sender: TObject); | 
|---|
| 646 | // display Notes Options | 
|---|
| 647 | var | 
|---|
| 648 | topsize, leftsize, value: integer; | 
|---|
| 649 | begin | 
|---|
| 650 | value := 0; | 
|---|
| 651 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 652 | DialogOptionsNotes(topsize, leftsize, Font.Size, value); | 
|---|
| 653 | end; | 
|---|
| 654 |  | 
|---|
| 655 | procedure TfrmOptions.btnNotesTitlesClick(Sender: TObject); | 
|---|
| 656 | // display Titles Options | 
|---|
| 657 | var | 
|---|
| 658 | topsize, leftsize, value: integer; | 
|---|
| 659 | begin | 
|---|
| 660 | value := 0; | 
|---|
| 661 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 662 | DialogOptionsTitles(topsize, leftsize, Font.Size, value); | 
|---|
| 663 | end; | 
|---|
| 664 |  | 
|---|
| 665 | procedure TfrmOptions.btnReportsClick(Sender: TObject); | 
|---|
| 666 | var | 
|---|
| 667 | topsize, leftsize, value: integer; | 
|---|
| 668 | begin | 
|---|
| 669 | value := 0; | 
|---|
| 670 | Offset(topsize, 90, leftsize, 23); | 
|---|
| 671 | DialogOptionsHSDefault(topsize, leftsize, Font.Size, value); | 
|---|
| 672 | end; | 
|---|
| 673 |  | 
|---|
| 674 | procedure TfrmOptions.btnReport1Click(Sender: TObject); | 
|---|
| 675 | var | 
|---|
| 676 | topsize, leftsize, value: integer; | 
|---|
| 677 | begin | 
|---|
| 678 | value := 0; | 
|---|
| 679 | Offset(topsize, -18, leftsize, -15); | 
|---|
| 680 | DialogOptionsHSCustom(topsize, leftsize, Font.Size, value); | 
|---|
| 681 | end; | 
|---|
| 682 |  | 
|---|
| 683 | procedure TfrmOptions.lvwNotificationsEnter(Sender: TObject); | 
|---|
| 684 | begin | 
|---|
| 685 | with Sender as TListView do begin | 
|---|
| 686 | if (Selected = nil) and (Items.Count > 0) then | 
|---|
| 687 | Selected := Items[0]; | 
|---|
| 688 | end; | 
|---|
| 689 | end; | 
|---|
| 690 |  | 
|---|
| 691 | procedure TfrmOptions.lvwNotificationsMouseDown(Sender: TObject; | 
|---|
| 692 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer); | 
|---|
| 693 | begin | 
|---|
| 694 | FLastClickedItem := (Sender as TListView).GetItemAt(X,Y); | 
|---|
| 695 | end; | 
|---|
| 696 |  | 
|---|
| 697 | procedure TfrmOptions.btnDiagnosesClick(Sender: TObject); | 
|---|
| 698 | // display Personal Diagnoses List | 
|---|
| 699 | var | 
|---|
| 700 | topsize, leftsize, value: integer; | 
|---|
| 701 | begin | 
|---|
| 702 | if IsCIDCProvider(User.DUZ) then    //(hds7564) | 
|---|
| 703 | begin | 
|---|
| 704 | value := 0; | 
|---|
| 705 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 706 | DialogOptionsDiagnoses(topsize, leftsize, Font.Size, value); | 
|---|
| 707 | end; | 
|---|
| 708 | end; | 
|---|
| 709 |  | 
|---|
| 710 | procedure TfrmOptions.btnGraphSettingsClick(Sender: TObject); | 
|---|
| 711 | // display GraphSettings | 
|---|
| 712 | var | 
|---|
| 713 | actiontype: boolean; | 
|---|
| 714 | topsize, leftsize: integer; | 
|---|
| 715 | begin | 
|---|
| 716 | actiontype := false; | 
|---|
| 717 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 718 | DialogOptionsGraphSettings(topsize, leftsize, Font.Size, actiontype); | 
|---|
| 719 | end; | 
|---|
| 720 |  | 
|---|
| 721 | procedure TfrmOptions.btnGraphViewsClick(Sender: TObject); | 
|---|
| 722 | // display Graph Views | 
|---|
| 723 | var | 
|---|
| 724 | actiontype: boolean; | 
|---|
| 725 | topsize, leftsize: integer; | 
|---|
| 726 | begin | 
|---|
| 727 | actiontype := false; | 
|---|
| 728 | Offset(topsize, -60, leftsize, -60); | 
|---|
| 729 | DialogOptionsGraphProfiles(topsize, leftsize, Font.Size, actiontype); | 
|---|
| 730 | end; | 
|---|
| 731 |  | 
|---|
| 732 | procedure TfrmOptions.rdoRDVClick(Sender: TObject); | 
|---|
| 733 | var | 
|---|
| 734 | iIndex: integer; | 
|---|
| 735 | begin | 
|---|
| 736 | iIndex := rdoRDV.ItemIndex; | 
|---|
| 737 | with frmFrame do | 
|---|
| 738 | if iIndex = 0 then | 
|---|
| 739 | begin | 
|---|
| 740 | ChangeVistaWebParam('0'); | 
|---|
| 741 | lblCIRN.Caption := ' Remote'; | 
|---|
| 742 | lblCIRNData.Caption := 'Data'; | 
|---|
| 743 | lblCIRNAvail.Caption := ''; | 
|---|
| 744 | lblCIRN.Width := 43; | 
|---|
| 745 | lblCIRNData.Width := 43; | 
|---|
| 746 | lblCIRNData.Alignment := taCenter; | 
|---|
| 747 | lblCIRN.Alignment := taCenter; | 
|---|
| 748 | lstCIRNLocations.Clear; | 
|---|
| 749 | SetUpCIRN; | 
|---|
| 750 | end | 
|---|
| 751 | else | 
|---|
| 752 | begin | 
|---|
| 753 | ChangeVistaWebParam('1'); | 
|---|
| 754 | lblCIRN.Caption := 'Remote'; | 
|---|
| 755 | lblCIRNData.Caption := 'Data*';  //VistaWeb On | 
|---|
| 756 | lblCIRN.Width := 43; | 
|---|
| 757 | lblCIRNData.Width := 43; | 
|---|
| 758 | lblCIRNData.Alignment := taCenter; | 
|---|
| 759 | lblCIRN.Alignment := taCenter; | 
|---|
| 760 | lblCIRN.Enabled     := True; | 
|---|
| 761 | lblCIRNData.Enabled := True; | 
|---|
| 762 | pnlCIRN.TabStop     := True; | 
|---|
| 763 | if ColorToRGB(clWindowText) = ColorToRGB(clBlack) then | 
|---|
| 764 | begin | 
|---|
| 765 | lblCIRN.Font.Color  := clBlue; | 
|---|
| 766 | lblCIRNData.Font.Color  := clBlue; | 
|---|
| 767 | lblCIRNAvail.Font.Color := clBlue; | 
|---|
| 768 | lstCIRNLocations.Font.Color  := clBlue; | 
|---|
| 769 | end | 
|---|
| 770 | else | 
|---|
| 771 | begin | 
|---|
| 772 | lblCIRN.Font.Color  := clWindowText; | 
|---|
| 773 | lblCIRNData.Font.Color  := clWindowText; | 
|---|
| 774 | lblCIRNAvail.Font.Color := clWindowText; | 
|---|
| 775 | lstCIRNLocations.Font.Color  := clWindowText; | 
|---|
| 776 | end; | 
|---|
| 777 | end; | 
|---|
| 778 |  | 
|---|
| 779 | end; | 
|---|
| 780 |  | 
|---|
| 781 | end. | 
|---|
| 782 |  | 
|---|