[829] | 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, fBase508Form, VA508AccessibilityManager;
|
---|
| 8 |
|
---|
| 9 | type
|
---|
| 10 | TfrmOptions = class(TfrmBase508Form)
|
---|
| 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 | procedure FormCreate(Sender: TObject);
|
---|
| 104 | procedure FormDestroy(Sender: TObject);
|
---|
| 105 | procedure btnCoverDaysClick(Sender: TObject);
|
---|
| 106 | procedure btnCoverRemindersClick(Sender: TObject);
|
---|
| 107 | procedure btnOtherParametersClick(Sender: TObject);
|
---|
| 108 | procedure btnPatientSelectionClick(Sender: TObject);
|
---|
| 109 | procedure btnPersonalListsClick(Sender: TObject);
|
---|
| 110 | procedure btnTeamsClick(Sender: TObject);
|
---|
| 111 | procedure btnNotificationsRemoveClick(Sender: TObject);
|
---|
| 112 | procedure btnApplyClick(Sender: TObject);
|
---|
| 113 | procedure chkNotificationsFlaggedClick(Sender: TObject);
|
---|
| 114 | procedure lvwNotificationsChange(Sender: TObject; Item: TListItem;
|
---|
| 115 | Change: TItemChange);
|
---|
| 116 | procedure lvwNotificationsColumnClick(Sender: TObject;
|
---|
| 117 | Column: TListColumn);
|
---|
| 118 | procedure lvwNotificationsCompare(Sender: TObject; Item1,
|
---|
| 119 | Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
| 120 | procedure lvwNotificationsDblClick(Sender: TObject);
|
---|
| 121 | procedure btnSurrogateClick(Sender: TObject);
|
---|
| 122 | procedure btnCombinationsClick(Sender: TObject);
|
---|
| 123 | procedure btnNotesNotesClick(Sender: TObject);
|
---|
| 124 | procedure btnNotesTitlesClick(Sender: TObject);
|
---|
| 125 | procedure btnReportsClick(Sender: TObject);
|
---|
| 126 | procedure btnReport1Click(Sender: TObject);
|
---|
| 127 | procedure lvwNotificationsEnter(Sender: TObject);
|
---|
| 128 | procedure lvwNotificationsMouseDown(Sender: TObject;
|
---|
| 129 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
| 130 | procedure btnDiagnosesClick(Sender: TObject);
|
---|
| 131 | procedure btnGraphSettingsClick(Sender: TObject);
|
---|
| 132 | procedure btnGraphViewsClick(Sender: TObject);
|
---|
| 133 | procedure pagOptionsEnter(Sender: TObject);
|
---|
| 134 | private
|
---|
| 135 | { Private declarations }
|
---|
| 136 | FdirtyNotifications: boolean; // used to determine edit changes to Notifications
|
---|
| 137 | FdirtyOrderChecks: boolean; // used to determine edit changes to Order Checks
|
---|
| 138 | FdirtyOtherStuff: boolean; // used to determine edit changes to misc settings
|
---|
| 139 | FuseCheckBoxes: boolean;
|
---|
| 140 | FsortCol: integer;
|
---|
| 141 | FsortAscending: boolean;
|
---|
| 142 | FLastClickedItem: TListItem;
|
---|
| 143 | FGiveMultiTabMessage: boolean;
|
---|
| 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 | VA508AccessibilityRouter;
|
---|
| 170 | //fTestDialog;
|
---|
| 171 |
|
---|
| 172 | {$R *.DFM}
|
---|
| 173 |
|
---|
| 174 | type
|
---|
| 175 | TRule = class
|
---|
| 176 | public
|
---|
| 177 | IEN: string;
|
---|
| 178 | OriginalValue: string;
|
---|
| 179 | ItemText: string;
|
---|
| 180 | end;
|
---|
| 181 |
|
---|
| 182 | procedure DialogOptions(var actiontype: Integer);
|
---|
| 183 | // create the form and make in modal, return an action
|
---|
| 184 | const
|
---|
| 185 | PixelGapBetweenButtons = 5;
|
---|
| 186 | var
|
---|
| 187 | frmOptions: TfrmOptions;
|
---|
| 188 | begin
|
---|
| 189 | frmOptions := TfrmOptions.Create(Application);
|
---|
| 190 | try
|
---|
| 191 | with frmOptions do
|
---|
| 192 | begin
|
---|
| 193 | with pagOptions do
|
---|
| 194 | begin
|
---|
| 195 | tsCoverSheet.TabVisible := false;
|
---|
| 196 | tsNotifications.TabVisible := false;
|
---|
| 197 | tsOrderChecks.TabVisible := false;
|
---|
| 198 | tsListsTeams.TabVisible := false;
|
---|
| 199 | case actiontype of
|
---|
| 200 | 1: begin
|
---|
| 201 | tsCoverSheet.TabVisible := true;
|
---|
| 202 | end;
|
---|
| 203 | 2: begin
|
---|
| 204 | tsNotifications.TabVisible := true;
|
---|
| 205 | end;
|
---|
| 206 | 3: begin
|
---|
| 207 | tsOrderChecks.TabVisible := true;
|
---|
| 208 | end;
|
---|
| 209 | 4: begin
|
---|
| 210 | tsListsTeams.TabVisible := true;
|
---|
| 211 | end;
|
---|
| 212 | else
|
---|
| 213 | begin
|
---|
| 214 | tsCoverSheet.TabVisible := true;
|
---|
| 215 | tsNotifications.TabVisible := true;
|
---|
| 216 | tsOrderChecks.TabVisible := true;
|
---|
| 217 | tsListsTeams.TabVisible := true;
|
---|
| 218 | ActivePage := tsCoverSheet;
|
---|
| 219 | memReports.Text := 'Change the default date range and occurrence limits for all reports on ' +
|
---|
| 220 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 221 | memReport1.Text := 'Change the individual date range and occurrence limits for each report on ' +
|
---|
| 222 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 223 | btnReports.caption := 'Set All Reports...';
|
---|
| 224 | btnReport1.caption := 'Set Individual Reports...';
|
---|
| 225 | if User.IsReportsOnly then // For "Reports Only" users.
|
---|
| 226 | begin
|
---|
| 227 | tsCoverSheet.TabVisible := false;
|
---|
| 228 | tsNotifications.TabVisible := false;
|
---|
| 229 | tsOrderChecks.TabVisible := false;
|
---|
| 230 | tsListsTeams.TabVisible := false;
|
---|
| 231 | tsNotes.TabVisible := false;
|
---|
| 232 | if (not User.ToolsRptEdit) then
|
---|
| 233 | begin
|
---|
| 234 | btnOK.visible := false;
|
---|
| 235 | btnApply.visible := false;
|
---|
| 236 | btnCancel.caption := 'Close';
|
---|
| 237 | end;
|
---|
| 238 | end;
|
---|
| 239 | if (not User.ToolsRptEdit) then // For users with Reports settings edit parameter not set.
|
---|
| 240 | begin
|
---|
| 241 | memReports.Text := 'View the default date range and occurrence limits for all reports on ' +
|
---|
| 242 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 243 | memReport1.Text := 'View the individual date range and occurrence limits for each report on ' +
|
---|
| 244 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 245 | btnReports.caption := 'View All Report Settings...';
|
---|
| 246 | btnReport1.caption := 'View Individual Report Settings...';
|
---|
| 247 | end;
|
---|
| 248 | end;
|
---|
| 249 | end;
|
---|
| 250 | end;
|
---|
| 251 | actiontype := 0;
|
---|
| 252 | ResizeAnchoredFormToFont(frmOptions);
|
---|
| 253 | btnApply.Left := pagOptions.Left + pagOptions.Width - btnApply.Width;
|
---|
| 254 | btnCancel.Left := btnApply.Left - btnCancel.Width - PixelGapBetweenButtons;
|
---|
| 255 | btnOK.Left := btnCancel.Left - btnOK.Width - PixelGapBetweenButtons;
|
---|
| 256 | ShowModal;
|
---|
| 257 | actiontype := btnOK.Tag;
|
---|
| 258 | end;
|
---|
| 259 | finally
|
---|
| 260 | frmOptions.Release;
|
---|
| 261 | end;
|
---|
| 262 | end;
|
---|
| 263 |
|
---|
| 264 | procedure TfrmOptions.FormCreate(Sender: TObject);
|
---|
| 265 | // initialize form
|
---|
| 266 | begin
|
---|
| 267 | LoadNotifications;
|
---|
| 268 | LoadOrderChecks;
|
---|
| 269 | FdirtyNotifications := false;
|
---|
| 270 | FdirtyOrderChecks := false;
|
---|
| 271 | FdirtyOtherStuff := false;
|
---|
| 272 | CheckApply;
|
---|
| 273 |
|
---|
| 274 | if (Encounter.Provider = 0) and not IsCIDCProvider(User.DUZ) then
|
---|
| 275 | btnDiagnoses.Enabled := False;
|
---|
| 276 | FGiveMultiTabMessage := ScreenReaderSystemActive;
|
---|
| 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.pagOptionsEnter(Sender: TObject);
|
---|
| 375 | begin
|
---|
| 376 | if FGiveMultiTabMessage then // CQ#15483
|
---|
| 377 | begin
|
---|
| 378 | FGiveMultiTabMessage := FALSE;
|
---|
| 379 | GetScreenReader.Speak('Multi Tab Form');
|
---|
| 380 | end;
|
---|
| 381 | end;
|
---|
| 382 |
|
---|
| 383 | procedure TfrmOptions.btnApplyClick(Sender: TObject);
|
---|
| 384 | // save actions without exiting
|
---|
| 385 | begin
|
---|
| 386 | if FdirtyNotifications then
|
---|
| 387 | ApplyNotifications;
|
---|
| 388 | if FdirtyOrderChecks then
|
---|
| 389 | ApplyOrderChecks;
|
---|
| 390 | if FdirtyOtherStuff then
|
---|
| 391 | ApplyOtherStuff;
|
---|
| 392 | CheckApply;
|
---|
| 393 | if Sender = btnOK then
|
---|
| 394 | Close;
|
---|
| 395 | end;
|
---|
| 396 |
|
---|
| 397 | procedure TfrmOptions.LoadNotifications;
|
---|
| 398 | // load Notification tab
|
---|
| 399 | var
|
---|
| 400 | notifydefaults, surrogateinfo, flag, enableerase: string;
|
---|
| 401 | begin
|
---|
| 402 | LoadListView(lvwNotifications, rpcGetNotifications);
|
---|
| 403 | lvwNotificationsColumnClick(lvwNotifications, lvwNotifications.Column[0]); // make sure sorted
|
---|
| 404 | notifydefaults := rpcGetNotificationDefaults;
|
---|
| 405 | flag := Piece(notifydefaults, '^', 2);
|
---|
| 406 | enableerase := Piece(notifydefaults, '^', 3);
|
---|
| 407 | chkNotificationsFlagged.Checked := flag = '1';
|
---|
| 408 | btnNotificationsRemove.Enabled := enableerase = '1';
|
---|
| 409 | surrogateinfo := rpcGetSurrogateInfo;
|
---|
| 410 | btnSurrogate.Hint := surrogateinfo;
|
---|
| 411 | LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText);
|
---|
| 412 | end;
|
---|
| 413 |
|
---|
| 414 | procedure TfrmOptions.LoadOrderChecks;
|
---|
| 415 | // load Order Check tab
|
---|
| 416 | begin
|
---|
| 417 | LoadListView(lvwOrderChecks, rpcGetOrderChecks);
|
---|
| 418 | lvwOrderChecks.Checkboxes := true;
|
---|
| 419 | end;
|
---|
| 420 |
|
---|
| 421 | procedure TfrmOptions.ApplyNotifications;
|
---|
| 422 | // save Notification changes
|
---|
| 423 | var
|
---|
| 424 | i: integer;
|
---|
| 425 | newonoff: string;
|
---|
| 426 | aRule: TRule;
|
---|
| 427 | aList: TStringList;
|
---|
| 428 | begin
|
---|
| 429 | aList := TStringList.Create;
|
---|
| 430 | for i := 0 to lvwNotifications.Items.Count - 1 do
|
---|
| 431 | begin
|
---|
| 432 | aRule := TRule(lvwNotifications.Items.Item[i].SubItems.Objects[2]);
|
---|
| 433 | if lvwNotifications.Items.Item[i].SubItems[1] <> 'Mandatory' then
|
---|
| 434 | begin
|
---|
| 435 | newonoff := Uppercase(lvwNotifications.Items.Item[i].SubItems[0]);
|
---|
| 436 | if aRule.OriginalValue <> newonoff then
|
---|
| 437 | begin
|
---|
| 438 | //***Show508Message(aRule.IEN + ' ' + aRule.OriginalValue + ' ' + newonoff);
|
---|
| 439 | aList.Add(aRule.IEN + '^' + newonoff);
|
---|
| 440 | aRule.OriginalValue := lvwNotifications.Items.Item[i].SubItems[0];
|
---|
| 441 | end;
|
---|
| 442 | end;
|
---|
| 443 | end;
|
---|
| 444 | rpcSetNotifications(aList);
|
---|
| 445 | aList.free;
|
---|
| 446 | FdirtyNotifications := false;
|
---|
| 447 | end;
|
---|
| 448 |
|
---|
| 449 | procedure TfrmOptions.ApplyOrderChecks;
|
---|
| 450 | // save Order Check changes
|
---|
| 451 | var
|
---|
| 452 | i: integer;
|
---|
| 453 | newonoff: string;
|
---|
| 454 | aRule: TRule;
|
---|
| 455 | aList: TStringList;
|
---|
| 456 | begin
|
---|
| 457 | aList := TStringList.Create;
|
---|
| 458 | for i := 0 to lvwOrderChecks.Items.Count - 1 do
|
---|
| 459 | begin
|
---|
| 460 | aRule := TRule(lvwOrderChecks.Items.Item[i].SubItems.Objects[2]);
|
---|
| 461 | newonoff := Uppercase(lvwOrderChecks.Items.Item[i].SubItems[0]);
|
---|
| 462 | if aRule.OriginalValue <> newonoff then
|
---|
| 463 | begin
|
---|
| 464 | aList.Add(aRule.IEN + '^' + newonoff);
|
---|
| 465 | aRule.OriginalValue := lvwOrderChecks.Items.Item[i].SubItems[0];
|
---|
| 466 | end;
|
---|
| 467 | end;
|
---|
| 468 | rpcSetOrderChecks(aList);
|
---|
| 469 | aList.free;
|
---|
| 470 | FdirtyOrderChecks := false;
|
---|
| 471 | end;
|
---|
| 472 |
|
---|
| 473 | procedure TfrmOptions.ApplyOtherStuff;
|
---|
| 474 | // save other changes
|
---|
| 475 | var
|
---|
| 476 | aString: string;
|
---|
| 477 | begin
|
---|
| 478 | aString := '';
|
---|
| 479 | if chkNotificationsFlagged.Checked then
|
---|
| 480 | aString := aString + '^1'
|
---|
| 481 | else
|
---|
| 482 | aString := aString + '^0';
|
---|
| 483 | rpcSetOtherStuff(aString);
|
---|
| 484 | FdirtyOtherStuff := false;
|
---|
| 485 | end;
|
---|
| 486 |
|
---|
| 487 | procedure TfrmOptions.CheckApply;
|
---|
| 488 | // determine if Apply button is enabled
|
---|
| 489 | begin
|
---|
| 490 | btnApply.Enabled := FdirtyOrderChecks or FdirtyNotifications or FdirtyOtherStuff;
|
---|
| 491 | end;
|
---|
| 492 |
|
---|
| 493 | procedure TfrmOptions.chkNotificationsFlaggedClick(Sender: TObject);
|
---|
| 494 | // set notification flagged status
|
---|
| 495 | begin
|
---|
| 496 | FdirtyOtherStuff := true;
|
---|
| 497 | CheckApply;
|
---|
| 498 | end;
|
---|
| 499 |
|
---|
| 500 | procedure TfrmOptions.LoadListView(aListView: TListView; aList: TStrings);
|
---|
| 501 | // load a list view with: name, on/off, comment
|
---|
| 502 | var
|
---|
| 503 | i: integer;
|
---|
| 504 | aListItem: TListItem;
|
---|
| 505 | aRule: TRule;
|
---|
| 506 | rulenum, ruletext, ruleonoff, rulecomment: string;
|
---|
| 507 | begin
|
---|
| 508 | FuseCheckBoxes := false;
|
---|
| 509 | aListView.Items.Clear;
|
---|
| 510 | aListView.SortType := stNone; // if Sorting during load then potential error
|
---|
| 511 | with aList do
|
---|
| 512 | begin
|
---|
| 513 | for i := 0 to aList.Count - 1 do
|
---|
| 514 | begin
|
---|
| 515 | rulenum := Piece(aList[i], '^', 1);
|
---|
| 516 | ruletext := Piece(aList[i], '^', 2);
|
---|
| 517 | ruleonoff := Piece(aList[i], '^', 3);
|
---|
| 518 | rulecomment := Piece(aList[i], '^', 4);
|
---|
| 519 | aListItem := aListView.Items.Add;
|
---|
| 520 | with aListItem do
|
---|
| 521 | begin
|
---|
| 522 | Caption := ruletext;
|
---|
| 523 | SubItems.Add(ruleonoff);
|
---|
| 524 | if ruleonoff = 'On' then Checked := true;
|
---|
| 525 | SubItems.Add(rulecomment);
|
---|
| 526 | end;
|
---|
| 527 | aRule := TRule.Create;
|
---|
| 528 | with aRule do
|
---|
| 529 | begin
|
---|
| 530 | IEN := rulenum;
|
---|
| 531 | OriginalValue := ruleonoff;
|
---|
| 532 | ItemText := ruletext;
|
---|
| 533 | end;
|
---|
| 534 | aListItem.SubItems.AddObject('rule object', aRule);
|
---|
| 535 | end;
|
---|
| 536 | end;
|
---|
| 537 | aListView.SortType := stBoth;
|
---|
| 538 | FuseCheckBoxes := true;
|
---|
| 539 | end;
|
---|
| 540 |
|
---|
| 541 | procedure TfrmOptions.lvwNotificationsChange(Sender: TObject;
|
---|
| 542 | Item: TListItem; Change: TItemChange);
|
---|
| 543 | // change on/off on checkmark
|
---|
| 544 | begin
|
---|
| 545 | if (Sender as TListView).ItemIndex = -1 then exit;
|
---|
| 546 | if not FuseCheckBoxes then exit;
|
---|
| 547 | if (Sender as TListView).Checkboxes = false then exit;
|
---|
| 548 | if (Item.SubItems[1] = 'Mandatory') and not Item.Checked then begin
|
---|
| 549 | Item.Checked := True;
|
---|
| 550 | exit;
|
---|
| 551 | end;
|
---|
| 552 | if Item.Checked then
|
---|
| 553 | begin
|
---|
| 554 | if Item.SubItems[0] <> 'On' then
|
---|
| 555 | ChangeOnOff(Sender as TListView, Item);
|
---|
| 556 | Item.SubItems[0] := 'On';
|
---|
| 557 | end
|
---|
| 558 | else
|
---|
| 559 | begin
|
---|
| 560 | if Item.SubItems[0] <> 'Off' then
|
---|
| 561 | ChangeOnOff(Sender as TListView, Item);
|
---|
| 562 | Item.SubItems[0] := 'Off';
|
---|
| 563 | end;
|
---|
| 564 | end;
|
---|
| 565 |
|
---|
| 566 | procedure TfrmOptions.lvwNotificationsColumnClick(Sender: TObject;
|
---|
| 567 | Column: TListColumn);
|
---|
| 568 | // toggle sort
|
---|
| 569 | begin
|
---|
| 570 | if FsortCol = Column.Index then
|
---|
| 571 | FsortAscending := not FsortAscending
|
---|
| 572 | else
|
---|
| 573 | FsortAscending := true;
|
---|
| 574 | FsortCol := Column.Index;
|
---|
| 575 | (Sender as TListView).AlphaSort;
|
---|
| 576 | end;
|
---|
| 577 |
|
---|
| 578 | procedure TfrmOptions.lvwNotificationsCompare(Sender: TObject; Item1,
|
---|
| 579 | Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
| 580 | // sort columns
|
---|
| 581 | begin
|
---|
| 582 | if not(Sender is TListView) then exit;
|
---|
| 583 | if FsortAscending then
|
---|
| 584 | begin
|
---|
| 585 | if FsortCol = 0 then
|
---|
| 586 | Compare := CompareStr(Item1.Caption, Item2.Caption)
|
---|
| 587 | else
|
---|
| 588 | Compare := CompareStr(Item1.SubItems[FsortCol - 1],
|
---|
| 589 | Item2.SubItems[FsortCol - 1]);
|
---|
| 590 | end
|
---|
| 591 | else
|
---|
| 592 | begin
|
---|
| 593 | if FsortCol = 0 then
|
---|
| 594 | Compare := CompareStr(Item2.Caption, Item1.Caption)
|
---|
| 595 | else
|
---|
| 596 | Compare := CompareStr(Item2.SubItems[FsortCol - 1],
|
---|
| 597 | Item1.SubItems[FsortCol - 1]);
|
---|
| 598 | end;
|
---|
| 599 | end;
|
---|
| 600 |
|
---|
| 601 | procedure TfrmOptions.lvwNotificationsDblClick(Sender: TObject);
|
---|
| 602 | // toggle check marks with double click
|
---|
| 603 | var
|
---|
| 604 | aListItem: TListItem;
|
---|
| 605 | begin
|
---|
| 606 | with (Sender as TListView) do
|
---|
| 607 | begin
|
---|
| 608 | if Checkboxes = false then exit;
|
---|
| 609 | if Selected = nil then exit;
|
---|
| 610 | if Selected.SubItems[1] = 'Mandatory' then exit;
|
---|
| 611 | if Selected <> FLastClickedItem then exit;
|
---|
| 612 | aListItem := Selected;
|
---|
| 613 | aListItem.Checked := not aListItem.Checked;
|
---|
| 614 | ChangeOnOff(Sender as TListView, aListItem);
|
---|
| 615 |
|
---|
| 616 | if aListItem.Checked then
|
---|
| 617 | aListItem.SubItems[0] := 'On'
|
---|
| 618 | else
|
---|
| 619 | aListItem.SubItems[0] := 'Off';
|
---|
| 620 | end;
|
---|
| 621 | end;
|
---|
| 622 |
|
---|
| 623 | procedure TfrmOptions.ChangeOnOff(aListView: TListView; aListItem: TListItem);
|
---|
| 624 | // check if list items were edited
|
---|
| 625 | begin
|
---|
| 626 | if aListView = lvwNotifications then FdirtyNotifications := true;
|
---|
| 627 | if aListView = lvwOrderChecks then FdirtyOrderChecks := true;
|
---|
| 628 | CheckApply;
|
---|
| 629 | end;
|
---|
| 630 |
|
---|
| 631 | procedure TfrmOptions.btnSurrogateClick(Sender: TObject);
|
---|
| 632 | // display Surrogate Options
|
---|
| 633 | var
|
---|
| 634 | topsize, leftsize: integer;
|
---|
| 635 | surrogateinfo: string;
|
---|
| 636 | begin
|
---|
| 637 | surrogateinfo := btnSurrogate.Hint;
|
---|
| 638 | Offset(topsize, -30, leftsize, -30);
|
---|
| 639 | DialogOptionsSurrogate(topsize, leftsize, Font.Size, surrogateinfo);
|
---|
| 640 | LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText);
|
---|
| 641 | btnSurrogate.Hint := surrogateinfo;
|
---|
| 642 | end;
|
---|
| 643 |
|
---|
| 644 | procedure TfrmOptions.btnCombinationsClick(Sender: TObject);
|
---|
| 645 | // display Combination List Options
|
---|
| 646 | var
|
---|
| 647 | topsize, leftsize, value: integer;
|
---|
| 648 | begin
|
---|
| 649 | value := 0;
|
---|
| 650 | Offset(topsize, -60, leftsize, -60);
|
---|
| 651 | DialogOptionsCombinations(topsize, leftsize, Font.Size, value);
|
---|
| 652 | end;
|
---|
| 653 |
|
---|
| 654 | procedure TfrmOptions.btnNotesNotesClick(Sender: TObject);
|
---|
| 655 | // display Notes Options
|
---|
| 656 | var
|
---|
| 657 | topsize, leftsize, value: integer;
|
---|
| 658 | begin
|
---|
| 659 | value := 0;
|
---|
| 660 | Offset(topsize, -60, leftsize, -60);
|
---|
| 661 | DialogOptionsNotes(topsize, leftsize, Font.Size, value);
|
---|
| 662 | end;
|
---|
| 663 |
|
---|
| 664 | procedure TfrmOptions.btnNotesTitlesClick(Sender: TObject);
|
---|
| 665 | // display Titles Options
|
---|
| 666 | var
|
---|
| 667 | topsize, leftsize, value: integer;
|
---|
| 668 | begin
|
---|
| 669 | value := 0;
|
---|
| 670 | Offset(topsize, -60, leftsize, -60);
|
---|
| 671 | DialogOptionsTitles(topsize, leftsize, Font.Size, value);
|
---|
| 672 | end;
|
---|
| 673 |
|
---|
| 674 | procedure TfrmOptions.btnReportsClick(Sender: TObject);
|
---|
| 675 | var
|
---|
| 676 | topsize, leftsize, value: integer;
|
---|
| 677 | begin
|
---|
| 678 | value := 0;
|
---|
| 679 | Offset(topsize, 90, leftsize, 23);
|
---|
| 680 | DialogOptionsHSDefault(topsize, leftsize, Font.Size, value);
|
---|
| 681 | end;
|
---|
| 682 |
|
---|
| 683 | procedure TfrmOptions.btnReport1Click(Sender: TObject);
|
---|
| 684 | var
|
---|
| 685 | topsize, leftsize, value: integer;
|
---|
| 686 | begin
|
---|
| 687 | value := 0;
|
---|
| 688 | Offset(topsize, -18, leftsize, -15);
|
---|
| 689 | DialogOptionsHSCustom(topsize, leftsize, Font.Size, value);
|
---|
| 690 | end;
|
---|
| 691 |
|
---|
| 692 | procedure TfrmOptions.lvwNotificationsEnter(Sender: TObject);
|
---|
| 693 | begin
|
---|
| 694 | with Sender as TListView do begin
|
---|
| 695 | if (Selected = nil) and (Items.Count > 0) then
|
---|
| 696 | Selected := Items[0];
|
---|
| 697 | end;
|
---|
| 698 | end;
|
---|
| 699 |
|
---|
| 700 | procedure TfrmOptions.lvwNotificationsMouseDown(Sender: TObject;
|
---|
| 701 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
| 702 | begin
|
---|
| 703 | FLastClickedItem := (Sender as TListView).GetItemAt(X,Y);
|
---|
| 704 | end;
|
---|
| 705 |
|
---|
| 706 | procedure TfrmOptions.btnDiagnosesClick(Sender: TObject);
|
---|
| 707 | // display Personal Diagnoses List
|
---|
| 708 | var
|
---|
| 709 | topsize, leftsize, value: integer;
|
---|
| 710 | begin
|
---|
| 711 | if IsCIDCProvider(User.DUZ) then //(hds7564)
|
---|
| 712 | begin
|
---|
| 713 | value := 0;
|
---|
| 714 | Offset(topsize, -60, leftsize, -60);
|
---|
| 715 | DialogOptionsDiagnoses(topsize, leftsize, Font.Size, value);
|
---|
| 716 | end;
|
---|
| 717 | end;
|
---|
| 718 |
|
---|
| 719 | procedure TfrmOptions.btnGraphSettingsClick(Sender: TObject);
|
---|
| 720 | // display GraphSettings
|
---|
| 721 | var
|
---|
| 722 | actiontype: boolean;
|
---|
| 723 | topsize, leftsize: integer;
|
---|
| 724 | begin
|
---|
| 725 | actiontype := false;
|
---|
| 726 | Offset(topsize, -60, leftsize, -60);
|
---|
| 727 | DialogOptionsGraphSettings(topsize, leftsize, Font.Size, actiontype);
|
---|
| 728 | end;
|
---|
| 729 |
|
---|
| 730 | procedure TfrmOptions.btnGraphViewsClick(Sender: TObject);
|
---|
| 731 | // display Graph Views
|
---|
| 732 | var
|
---|
| 733 | actiontype: boolean;
|
---|
| 734 | begin
|
---|
| 735 | actiontype := false;
|
---|
| 736 | DialogOptionsGraphProfiles(actiontype);
|
---|
| 737 | // if changes were made then view listing should be updated ***********
|
---|
| 738 | end;
|
---|
| 739 |
|
---|
| 740 | end.
|
---|
| 741 |
|
---|