[459] | 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 | Image1: TImage;
|
---|
| 75 | imgTeams: TImage;
|
---|
| 76 | tsCprsReports: TTabSheet;
|
---|
| 77 | Label1: TStaticText;
|
---|
| 78 | Bevel1: TBevel;
|
---|
| 79 | Label3: TMemo;
|
---|
| 80 | Image2: TImage;
|
---|
| 81 | Button1: TButton;
|
---|
| 82 | Label2: TStaticText;
|
---|
| 83 | Image3: TImage;
|
---|
| 84 | Label4: TMemo;
|
---|
| 85 | Button2: TButton;
|
---|
| 86 | Bevel2: TBevel;
|
---|
| 87 | btnDiagnoses: TButton;
|
---|
| 88 | procedure FormCreate(Sender: TObject);
|
---|
| 89 | procedure FormDestroy(Sender: TObject);
|
---|
| 90 | procedure btnCoverDaysClick(Sender: TObject);
|
---|
| 91 | procedure btnCoverRemindersClick(Sender: TObject);
|
---|
| 92 | procedure btnOtherParametersClick(Sender: TObject);
|
---|
| 93 | procedure btnPatientSelectionClick(Sender: TObject);
|
---|
| 94 | procedure btnPersonalListsClick(Sender: TObject);
|
---|
| 95 | procedure btnTeamsClick(Sender: TObject);
|
---|
| 96 | procedure btnNotificationsRemoveClick(Sender: TObject);
|
---|
| 97 | procedure btnApplyClick(Sender: TObject);
|
---|
| 98 | procedure chkNotificationsFlaggedClick(Sender: TObject);
|
---|
| 99 | procedure lvwNotificationsChange(Sender: TObject; Item: TListItem;
|
---|
| 100 | Change: TItemChange);
|
---|
| 101 | procedure lvwNotificationsColumnClick(Sender: TObject;
|
---|
| 102 | Column: TListColumn);
|
---|
| 103 | procedure lvwNotificationsCompare(Sender: TObject; Item1,
|
---|
| 104 | Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
| 105 | procedure lvwNotificationsDblClick(Sender: TObject);
|
---|
| 106 | procedure btnSurrogateClick(Sender: TObject);
|
---|
| 107 | procedure btnCombinationsClick(Sender: TObject);
|
---|
| 108 | procedure btnNotesNotesClick(Sender: TObject);
|
---|
| 109 | procedure btnNotesTitlesClick(Sender: TObject);
|
---|
| 110 | procedure Button1Click(Sender: TObject);
|
---|
| 111 | procedure Button2Click(Sender: TObject);
|
---|
| 112 | procedure lvwNotificationsEnter(Sender: TObject);
|
---|
| 113 | procedure lvwNotificationsMouseDown(Sender: TObject;
|
---|
| 114 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
| 115 | procedure btnDiagnosesClick(Sender: TObject);
|
---|
| 116 | private
|
---|
| 117 | { Private declarations }
|
---|
| 118 | FdirtyNotifications: boolean; // used to determine edit changes to Notifications
|
---|
| 119 | FdirtyOrderChecks: boolean; // used to determine edit changes to Order Checks
|
---|
| 120 | FdirtyOtherStuff: boolean; // used to determine edit changes to misc settings
|
---|
| 121 | FuseCheckBoxes: boolean;
|
---|
| 122 | FsortCol: integer;
|
---|
| 123 | FsortAscending: boolean;
|
---|
| 124 | FLastClickedItem: TListItem;
|
---|
| 125 | procedure Offset(var topnum: integer; topoffset: integer; var leftnum: integer; leftoffset: integer);
|
---|
| 126 | procedure LoadNotifications;
|
---|
| 127 | procedure LoadOrderChecks;
|
---|
| 128 | procedure ApplyNotifications;
|
---|
| 129 | procedure ApplyOrderChecks;
|
---|
| 130 | procedure ApplyOtherStuff;
|
---|
| 131 | procedure CheckApply;
|
---|
| 132 | procedure LoadListView(aListView: TListView; aList: TStrings);
|
---|
| 133 | procedure ChangeOnOff(aListView: TListView; aListItem: TListItem);
|
---|
| 134 | public
|
---|
| 135 | { Public declarations }
|
---|
| 136 | end;
|
---|
| 137 |
|
---|
| 138 | var
|
---|
| 139 | frmOptions: TfrmOptions;
|
---|
| 140 |
|
---|
| 141 | procedure DialogOptions(var actiontype: Integer);
|
---|
| 142 |
|
---|
| 143 | implementation
|
---|
| 144 |
|
---|
| 145 | uses fOptionsDays, fOptionsReminders, fOptionsSurrogate,
|
---|
| 146 | fOptionsPatientSelection, fOptionsLists, fOptionsTeams, fOptionsCombinations,
|
---|
| 147 | fOptionsOther, fOptionsNotes, fOptionsTitles, fOptionsReportsCustom, fOptionsReportsDefault, rOptions, rCore, uCore, uOptions;
|
---|
| 148 | //fTestDialog;
|
---|
| 149 |
|
---|
| 150 | {$R *.DFM}
|
---|
| 151 |
|
---|
| 152 | type
|
---|
| 153 | TRule = class
|
---|
| 154 | public
|
---|
| 155 | IEN: string;
|
---|
| 156 | OriginalValue: string;
|
---|
| 157 | ItemText: string;
|
---|
| 158 | end;
|
---|
| 159 |
|
---|
| 160 | procedure DialogOptions(var actiontype: Integer);
|
---|
| 161 | // create the form and make in modal, return an action
|
---|
| 162 | const
|
---|
| 163 | PixelGapBetweenButtons = 5;
|
---|
| 164 | var
|
---|
| 165 | frmOptions: TfrmOptions;
|
---|
| 166 | begin
|
---|
| 167 | frmOptions := TfrmOptions.Create(Application);
|
---|
| 168 | try
|
---|
| 169 | with frmOptions do
|
---|
| 170 | begin
|
---|
| 171 | with pagOptions do
|
---|
| 172 | begin
|
---|
| 173 | tsCoverSheet.TabVisible := false;
|
---|
| 174 | tsNotifications.TabVisible := false;
|
---|
| 175 | tsOrderChecks.TabVisible := false;
|
---|
| 176 | tsListsTeams.TabVisible := false;
|
---|
| 177 | case actiontype of
|
---|
| 178 | 1: begin
|
---|
| 179 | tsCoverSheet.TabVisible := true;
|
---|
| 180 | end;
|
---|
| 181 | 2: begin
|
---|
| 182 | tsNotifications.TabVisible := true;
|
---|
| 183 | end;
|
---|
| 184 | 3: begin
|
---|
| 185 | tsOrderChecks.TabVisible := true;
|
---|
| 186 | end;
|
---|
| 187 | 4: begin
|
---|
| 188 | tsListsTeams.TabVisible := true;
|
---|
| 189 | end;
|
---|
| 190 | else
|
---|
| 191 | begin
|
---|
| 192 | tsCoverSheet.TabVisible := true;
|
---|
| 193 | tsNotifications.TabVisible := true;
|
---|
| 194 | tsOrderChecks.TabVisible := true;
|
---|
| 195 | tsListsTeams.TabVisible := true;
|
---|
| 196 | ActivePage := tsCoverSheet;
|
---|
| 197 | Label3.Text := 'Change the default date range and occurrence limits for all reports on ' +
|
---|
| 198 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 199 | Label4.Text := 'Change the individual date range and occurrence limits for each report on ' +
|
---|
| 200 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 201 | Button1.caption := 'Set All Reports...';
|
---|
| 202 | Button2.caption := 'Set Individual Reports...';
|
---|
| 203 | if User.IsReportsOnly then // For "Reports Only" users.
|
---|
| 204 | begin
|
---|
| 205 | tsCoverSheet.TabVisible := false;
|
---|
| 206 | tsNotifications.TabVisible := false;
|
---|
| 207 | tsOrderChecks.TabVisible := false;
|
---|
| 208 | tsListsTeams.TabVisible := false;
|
---|
| 209 | tsNotes.TabVisible := false;
|
---|
| 210 | if (not User.ToolsRptEdit) then
|
---|
| 211 | begin
|
---|
| 212 | btnOK.visible := false;
|
---|
| 213 | btnApply.visible := false;
|
---|
| 214 | btnCancel.caption := 'Close';
|
---|
| 215 | end;
|
---|
| 216 | end;
|
---|
| 217 | if (not User.ToolsRptEdit) then // For users with Reports settings edit parameter not set.
|
---|
| 218 | begin
|
---|
| 219 | Label3.Text := 'View the default date range and occurrence limits for all reports on ' +
|
---|
| 220 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 221 | Label4.Text := 'View the individual date range and occurrence limits for each report on ' +
|
---|
| 222 | 'the CPRS Reports tab (excluding health summary reports) .';
|
---|
| 223 | Button1.caption := 'View All Report Settings...';
|
---|
| 224 | Button2.caption := 'View Individual Report Settings...';
|
---|
| 225 | end;
|
---|
| 226 | end;
|
---|
| 227 | end;
|
---|
| 228 | end;
|
---|
| 229 | actiontype := 0;
|
---|
| 230 | ResizeAnchoredFormToFont(frmOptions);
|
---|
| 231 | btnApply.Left := pagOptions.Left + pagOptions.Width - btnApply.Width;
|
---|
| 232 | btnCancel.Left := btnApply.Left - btnCancel.Width - PixelGapBetweenButtons;
|
---|
| 233 | btnOK.Left := btnCancel.Left - btnOK.Width - PixelGapBetweenButtons;
|
---|
| 234 | ShowModal;
|
---|
| 235 | actiontype := btnOK.Tag;
|
---|
| 236 | end;
|
---|
| 237 | finally
|
---|
| 238 | frmOptions.Release;
|
---|
| 239 | end;
|
---|
| 240 | end;
|
---|
| 241 |
|
---|
| 242 | procedure TfrmOptions.FormCreate(Sender: TObject);
|
---|
| 243 | // initialize form
|
---|
| 244 | begin
|
---|
| 245 | LoadNotifications;
|
---|
| 246 | LoadOrderChecks;
|
---|
| 247 | FdirtyNotifications := false;
|
---|
| 248 | FdirtyOrderChecks := false;
|
---|
| 249 | FdirtyOtherStuff := false;
|
---|
| 250 | CheckApply;
|
---|
| 251 | if not BILLING_AWARE then btnDiagnoses.Enabled := False;
|
---|
| 252 | if (Encounter.Provider = 0) and not PersonHasKey(Encounter.Provider, 'PROVIDER') then
|
---|
| 253 | btnDiagnoses.Enabled := False;
|
---|
| 254 |
|
---|
| 255 | end;
|
---|
| 256 |
|
---|
| 257 | procedure TfrmOptions.FormDestroy(Sender: TObject);
|
---|
| 258 | // cleanup creation of objects
|
---|
| 259 | var
|
---|
| 260 | i: integer;
|
---|
| 261 | begin
|
---|
| 262 | for i := 0 to lvwOrderChecks.Items.Count - 1 do
|
---|
| 263 | lvwOrderChecks.Items.Item[i].SubItems.Objects[2].free;
|
---|
| 264 | for i := 0 to lvwNotifications.Items.Count - 1 do
|
---|
| 265 | lvwNotifications.Items.Item[i].SubItems.Objects[2].free;
|
---|
| 266 | end;
|
---|
| 267 |
|
---|
| 268 | procedure TfrmOptions.btnCoverDaysClick(Sender: TObject);
|
---|
| 269 | // display Date Range Defaults on Cover Sheet
|
---|
| 270 | var
|
---|
| 271 | topsize, leftsize, value: integer;
|
---|
| 272 | begin
|
---|
| 273 | value := 0;
|
---|
| 274 | Offset(topsize, -60, leftsize, -60);
|
---|
| 275 | DialogOptionsDays(topsize, leftsize, Font.Size, value);
|
---|
| 276 | end;
|
---|
| 277 |
|
---|
| 278 | procedure TfrmOptions.btnCoverRemindersClick(Sender: TObject);
|
---|
| 279 | // display Clinical Reminder Options
|
---|
| 280 | var
|
---|
| 281 | topsize, leftsize, value: integer;
|
---|
| 282 | begin
|
---|
| 283 | value := 0;
|
---|
| 284 | Offset(topsize, -60, leftsize, -60);
|
---|
| 285 | DialogOptionsReminders(topsize, leftsize, Font.Size, value);
|
---|
| 286 | end;
|
---|
| 287 |
|
---|
| 288 | procedure TfrmOptions.btnOtherParametersClick(Sender: TObject);
|
---|
| 289 | // display Other Parameters Options
|
---|
| 290 | var
|
---|
| 291 | topsize, leftsize, value: integer;
|
---|
| 292 | begin
|
---|
| 293 | value := 0;
|
---|
| 294 | Offset(topsize, 40, leftsize, 40);
|
---|
| 295 | DialogOptionsOther(topsize, leftsize, Font.Size, value);
|
---|
| 296 | end;
|
---|
| 297 |
|
---|
| 298 | procedure TfrmOptions.btnPatientSelectionClick(Sender: TObject);
|
---|
| 299 | // display Patient Selection Options
|
---|
| 300 | var
|
---|
| 301 | topsize, leftsize, value: integer;
|
---|
| 302 | begin
|
---|
| 303 | value := 0;
|
---|
| 304 | Offset(topsize, -60, leftsize, -60);
|
---|
| 305 | DialogOptionsPatientSelection(topsize, leftsize, Font.Size, value);
|
---|
| 306 | end;
|
---|
| 307 |
|
---|
| 308 | procedure TfrmOptions.btnPersonalListsClick(Sender: TObject);
|
---|
| 309 | // display Personal Lists Options
|
---|
| 310 | var
|
---|
| 311 | topsize, leftsize, value: integer;
|
---|
| 312 | begin
|
---|
| 313 | value := 0;
|
---|
| 314 | Offset(topsize, -60, leftsize, -60);
|
---|
| 315 | DialogOptionsLists(topsize, leftsize, Font.Size, value);
|
---|
| 316 | end;
|
---|
| 317 |
|
---|
| 318 | procedure TfrmOptions.btnTeamsClick(Sender: TObject);
|
---|
| 319 | // display Team Options
|
---|
| 320 | var
|
---|
| 321 | topsize, leftsize, value: integer;
|
---|
| 322 | begin
|
---|
| 323 | value := 0;
|
---|
| 324 | Offset(topsize, -60, leftsize, -60);
|
---|
| 325 | DialogOptionsTeams(topsize, leftsize, Font.Size, value);
|
---|
| 326 | end;
|
---|
| 327 |
|
---|
| 328 | procedure TfrmOptions.btnNotificationsRemoveClick(Sender: TObject);
|
---|
| 329 | // confirm before clearing notifications
|
---|
| 330 | begin
|
---|
| 331 | if InfoBox('CAUTION: This will clear all the current notifications you have pending.'
|
---|
| 332 | + #13 + 'If you say YES, these changes will take place immediately.'
|
---|
| 333 | + #13 + 'Are you sure you want to erase all of your notifications?',
|
---|
| 334 | 'Warning', MB_YESNO or MB_ICONWARNING) = IDYES then
|
---|
| 335 | begin
|
---|
| 336 | rpcClearNotifications;
|
---|
| 337 | end;
|
---|
| 338 | end;
|
---|
| 339 |
|
---|
| 340 | procedure TfrmOptions.Offset(var topnum: integer; topoffset: integer; var leftnum: integer; leftoffset: integer);
|
---|
| 341 | // get positions to display dialog
|
---|
| 342 | begin
|
---|
| 343 | // use these top and left values to display dialog
|
---|
| 344 | topnum := Top;
|
---|
| 345 | leftnum := Left;
|
---|
| 346 | topnum := topnum + topoffset;
|
---|
| 347 | if topnum < 0 then topnum := 0;
|
---|
| 348 | leftnum := leftnum + leftoffset;
|
---|
| 349 | if leftnum < 0 then leftnum := 0;
|
---|
| 350 | end;
|
---|
| 351 |
|
---|
| 352 | procedure TfrmOptions.btnApplyClick(Sender: TObject);
|
---|
| 353 | // save actions without exiting
|
---|
| 354 | begin
|
---|
| 355 | if FdirtyNotifications then
|
---|
| 356 | ApplyNotifications;
|
---|
| 357 | if FdirtyOrderChecks then
|
---|
| 358 | ApplyOrderChecks;
|
---|
| 359 | if FdirtyOtherStuff then
|
---|
| 360 | ApplyOtherStuff;
|
---|
| 361 | CheckApply;
|
---|
| 362 | if Sender = btnOK then
|
---|
| 363 | Close;
|
---|
| 364 | end;
|
---|
| 365 |
|
---|
| 366 | procedure TfrmOptions.LoadNotifications;
|
---|
| 367 | // load Notification tab
|
---|
| 368 | var
|
---|
| 369 | notifydefaults, surrogateinfo, flag, enableerase: string;
|
---|
| 370 | begin
|
---|
| 371 | LoadListView(lvwNotifications, rpcGetNotifications);
|
---|
| 372 | lvwNotificationsColumnClick(lvwNotifications, lvwNotifications.Column[0]); // make sure sorted
|
---|
| 373 | notifydefaults := rpcGetNotificationDefaults;
|
---|
| 374 | flag := Piece(notifydefaults, '^', 2);
|
---|
| 375 | enableerase := Piece(notifydefaults, '^', 3);
|
---|
| 376 | chkNotificationsFlagged.Checked := flag = '1';
|
---|
| 377 | btnNotificationsRemove.Enabled := enableerase = '1';
|
---|
| 378 | surrogateinfo := rpcGetSurrogateInfo;
|
---|
| 379 | btnSurrogate.Hint := surrogateinfo;
|
---|
| 380 | LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText);
|
---|
| 381 | end;
|
---|
| 382 |
|
---|
| 383 | procedure TfrmOptions.LoadOrderChecks;
|
---|
| 384 | // load Order Check tab
|
---|
| 385 | begin
|
---|
| 386 | LoadListView(lvwOrderChecks, rpcGetOrderChecks);
|
---|
| 387 | lvwOrderChecks.Checkboxes := true;
|
---|
| 388 | end;
|
---|
| 389 |
|
---|
| 390 | procedure TfrmOptions.ApplyNotifications;
|
---|
| 391 | // save Notification changes
|
---|
| 392 | var
|
---|
| 393 | i: integer;
|
---|
| 394 | newonoff: string;
|
---|
| 395 | aRule: TRule;
|
---|
| 396 | aList: TStringList;
|
---|
| 397 | begin
|
---|
| 398 | aList := TStringList.Create;
|
---|
| 399 | for i := 0 to lvwNotifications.Items.Count - 1 do
|
---|
| 400 | begin
|
---|
| 401 | aRule := TRule(lvwNotifications.Items.Item[i].SubItems.Objects[2]);
|
---|
| 402 | if lvwNotifications.Items.Item[i].SubItems[1] <> 'Mandatory' then
|
---|
| 403 | begin
|
---|
| 404 | newonoff := Uppercase(lvwNotifications.Items.Item[i].SubItems[0]);
|
---|
| 405 | if aRule.OriginalValue <> newonoff then
|
---|
| 406 | begin
|
---|
| 407 | //***showmessage(aRule.IEN + ' ' + aRule.OriginalValue + ' ' + newonoff);
|
---|
| 408 | aList.Add(aRule.IEN + '^' + newonoff);
|
---|
| 409 | aRule.OriginalValue := lvwNotifications.Items.Item[i].SubItems[0];
|
---|
| 410 | end;
|
---|
| 411 | end;
|
---|
| 412 | end;
|
---|
| 413 | rpcSetNotifications(aList);
|
---|
| 414 | aList.free;
|
---|
| 415 | FdirtyNotifications := false;
|
---|
| 416 | end;
|
---|
| 417 |
|
---|
| 418 | procedure TfrmOptions.ApplyOrderChecks;
|
---|
| 419 | // save Order Check changes
|
---|
| 420 | var
|
---|
| 421 | i: integer;
|
---|
| 422 | newonoff: string;
|
---|
| 423 | aRule: TRule;
|
---|
| 424 | aList: TStringList;
|
---|
| 425 | begin
|
---|
| 426 | aList := TStringList.Create;
|
---|
| 427 | for i := 0 to lvwOrderChecks.Items.Count - 1 do
|
---|
| 428 | begin
|
---|
| 429 | aRule := TRule(lvwOrderChecks.Items.Item[i].SubItems.Objects[2]);
|
---|
| 430 | newonoff := Uppercase(lvwOrderChecks.Items.Item[i].SubItems[0]);
|
---|
| 431 | if aRule.OriginalValue <> newonoff then
|
---|
| 432 | begin
|
---|
| 433 | aList.Add(aRule.IEN + '^' + newonoff);
|
---|
| 434 | aRule.OriginalValue := lvwOrderChecks.Items.Item[i].SubItems[0];
|
---|
| 435 | end;
|
---|
| 436 | end;
|
---|
| 437 | rpcSetOrderChecks(aList);
|
---|
| 438 | aList.free;
|
---|
| 439 | FdirtyOrderChecks := false;
|
---|
| 440 | end;
|
---|
| 441 |
|
---|
| 442 | procedure TfrmOptions.ApplyOtherStuff;
|
---|
| 443 | // save other changes
|
---|
| 444 | var
|
---|
| 445 | aString: string;
|
---|
| 446 | begin
|
---|
| 447 | aString := '';
|
---|
| 448 | if chkNotificationsFlagged.Checked then
|
---|
| 449 | aString := aString + '^1'
|
---|
| 450 | else
|
---|
| 451 | aString := aString + '^0';
|
---|
| 452 | rpcSetOtherStuff(aString);
|
---|
| 453 | FdirtyOtherStuff := false;
|
---|
| 454 | end;
|
---|
| 455 |
|
---|
| 456 | procedure TfrmOptions.CheckApply;
|
---|
| 457 | // determine if Apply button is enabled
|
---|
| 458 | begin
|
---|
| 459 | btnApply.Enabled := FdirtyOrderChecks or FdirtyNotifications or FdirtyOtherStuff;
|
---|
| 460 | end;
|
---|
| 461 |
|
---|
| 462 | procedure TfrmOptions.chkNotificationsFlaggedClick(Sender: TObject);
|
---|
| 463 | // set notification flagged status
|
---|
| 464 | begin
|
---|
| 465 | FdirtyOtherStuff := true;
|
---|
| 466 | CheckApply;
|
---|
| 467 | end;
|
---|
| 468 |
|
---|
| 469 | procedure TfrmOptions.LoadListView(aListView: TListView; aList: TStrings);
|
---|
| 470 | // load a list view with: name, on/off, comment
|
---|
| 471 | var
|
---|
| 472 | i: integer;
|
---|
| 473 | aListItem: TListItem;
|
---|
| 474 | aRule: TRule;
|
---|
| 475 | rulenum, ruletext, ruleonoff, rulecomment: string;
|
---|
| 476 | begin
|
---|
| 477 | FuseCheckBoxes := false;
|
---|
| 478 | aListView.Items.Clear;
|
---|
| 479 | aListView.SortType := stNone; // if Sorting during load then potential error
|
---|
| 480 | with aList do
|
---|
| 481 | begin
|
---|
| 482 | for i := 0 to aList.Count - 1 do
|
---|
| 483 | begin
|
---|
| 484 | rulenum := Piece(aList[i], '^', 1);
|
---|
| 485 | ruletext := Piece(aList[i], '^', 2);
|
---|
| 486 | ruleonoff := Piece(aList[i], '^', 3);
|
---|
| 487 | rulecomment := Piece(aList[i], '^', 4);
|
---|
| 488 | aListItem := aListView.Items.Add;
|
---|
| 489 | with aListItem do
|
---|
| 490 | begin
|
---|
| 491 | Caption := ruletext;
|
---|
| 492 | SubItems.Add(ruleonoff);
|
---|
| 493 | if ruleonoff = 'On' then Checked := true;
|
---|
| 494 | SubItems.Add(rulecomment);
|
---|
| 495 | end;
|
---|
| 496 | aRule := TRule.Create;
|
---|
| 497 | with aRule do
|
---|
| 498 | begin
|
---|
| 499 | IEN := rulenum;
|
---|
| 500 | OriginalValue := ruleonoff;
|
---|
| 501 | ItemText := ruletext;
|
---|
| 502 | end;
|
---|
| 503 | aListItem.SubItems.AddObject('rule object', aRule);
|
---|
| 504 | end;
|
---|
| 505 | end;
|
---|
| 506 | aListView.SortType := stBoth;
|
---|
| 507 | FuseCheckBoxes := true;
|
---|
| 508 | end;
|
---|
| 509 |
|
---|
| 510 | procedure TfrmOptions.lvwNotificationsChange(Sender: TObject;
|
---|
| 511 | Item: TListItem; Change: TItemChange);
|
---|
| 512 | // change on/off on checkmark
|
---|
| 513 | begin
|
---|
| 514 | if (Sender as TListView).ItemIndex = -1 then exit;
|
---|
| 515 | if not FuseCheckBoxes then exit;
|
---|
| 516 | if (Sender as TListView).Checkboxes = false then exit;
|
---|
| 517 | if (Item.SubItems[1] = 'Mandatory') and not Item.Checked then begin
|
---|
| 518 | Item.Checked := True;
|
---|
| 519 | exit;
|
---|
| 520 | end;
|
---|
| 521 | if Item.Checked then
|
---|
| 522 | begin
|
---|
| 523 | if Item.SubItems[0] <> 'On' then
|
---|
| 524 | ChangeOnOff(Sender as TListView, Item);
|
---|
| 525 | Item.SubItems[0] := 'On';
|
---|
| 526 | end
|
---|
| 527 | else
|
---|
| 528 | begin
|
---|
| 529 | if Item.SubItems[0] <> 'Off' then
|
---|
| 530 | ChangeOnOff(Sender as TListView, Item);
|
---|
| 531 | Item.SubItems[0] := 'Off';
|
---|
| 532 | end;
|
---|
| 533 | end;
|
---|
| 534 |
|
---|
| 535 | procedure TfrmOptions.lvwNotificationsColumnClick(Sender: TObject;
|
---|
| 536 | Column: TListColumn);
|
---|
| 537 | // toggle sort
|
---|
| 538 | begin
|
---|
| 539 | if FsortCol = Column.Index then
|
---|
| 540 | FsortAscending := not FsortAscending
|
---|
| 541 | else
|
---|
| 542 | FsortAscending := true;
|
---|
| 543 | FsortCol := Column.Index;
|
---|
| 544 | (Sender as TListView).AlphaSort;
|
---|
| 545 | end;
|
---|
| 546 |
|
---|
| 547 | procedure TfrmOptions.lvwNotificationsCompare(Sender: TObject; Item1,
|
---|
| 548 | Item2: TListItem; Data: Integer; var Compare: Integer);
|
---|
| 549 | // sort columns
|
---|
| 550 | begin
|
---|
| 551 | if not(Sender is TListView) then exit;
|
---|
| 552 | if FsortAscending then
|
---|
| 553 | begin
|
---|
| 554 | if FsortCol = 0 then
|
---|
| 555 | Compare := CompareStr(Item1.Caption, Item2.Caption)
|
---|
| 556 | else
|
---|
| 557 | Compare := CompareStr(Item1.SubItems[FsortCol - 1],
|
---|
| 558 | Item2.SubItems[FsortCol - 1]);
|
---|
| 559 | end
|
---|
| 560 | else
|
---|
| 561 | begin
|
---|
| 562 | if FsortCol = 0 then
|
---|
| 563 | Compare := CompareStr(Item2.Caption, Item1.Caption)
|
---|
| 564 | else
|
---|
| 565 | Compare := CompareStr(Item2.SubItems[FsortCol - 1],
|
---|
| 566 | Item1.SubItems[FsortCol - 1]);
|
---|
| 567 | end;
|
---|
| 568 | end;
|
---|
| 569 |
|
---|
| 570 | procedure TfrmOptions.lvwNotificationsDblClick(Sender: TObject);
|
---|
| 571 | // toggle check marks with double click
|
---|
| 572 | var
|
---|
| 573 | aListItem: TListItem;
|
---|
| 574 | begin
|
---|
| 575 | with (Sender as TListView) do
|
---|
| 576 | begin
|
---|
| 577 | if Checkboxes = false then exit;
|
---|
| 578 | if Selected = nil then exit;
|
---|
| 579 | if Selected.SubItems[1] = 'Mandatory' then exit;
|
---|
| 580 | if Selected <> FLastClickedItem then exit;
|
---|
| 581 | aListItem := Selected;
|
---|
| 582 | aListItem.Checked := not aListItem.Checked;
|
---|
| 583 | ChangeOnOff(Sender as TListView, aListItem);
|
---|
| 584 |
|
---|
| 585 | if aListItem.Checked then
|
---|
| 586 | aListItem.SubItems[0] := 'On'
|
---|
| 587 | else
|
---|
| 588 | aListItem.SubItems[0] := 'Off';
|
---|
| 589 | end;
|
---|
| 590 | end;
|
---|
| 591 |
|
---|
| 592 | procedure TfrmOptions.ChangeOnOff(aListView: TListView; aListItem: TListItem);
|
---|
| 593 | // check if list items were edited
|
---|
| 594 | begin
|
---|
| 595 | if aListView = lvwNotifications then FdirtyNotifications := true;
|
---|
| 596 | if aListView = lvwOrderChecks then FdirtyOrderChecks := true;
|
---|
| 597 | CheckApply;
|
---|
| 598 | end;
|
---|
| 599 |
|
---|
| 600 | procedure TfrmOptions.btnSurrogateClick(Sender: TObject);
|
---|
| 601 | // display Surrogate Options
|
---|
| 602 | var
|
---|
| 603 | topsize, leftsize: integer;
|
---|
| 604 | surrogateinfo: string;
|
---|
| 605 | begin
|
---|
| 606 | surrogateinfo := btnSurrogate.Hint;
|
---|
| 607 | Offset(topsize, -30, leftsize, -30);
|
---|
| 608 | DialogOptionsSurrogate(topsize, leftsize, Font.Size, surrogateinfo);
|
---|
| 609 | LabelSurrogate(surrogateinfo, lblNotificationsSurrogateText);
|
---|
| 610 | btnSurrogate.Hint := surrogateinfo;
|
---|
| 611 | end;
|
---|
| 612 |
|
---|
| 613 | procedure TfrmOptions.btnCombinationsClick(Sender: TObject);
|
---|
| 614 | // display Combination List Options
|
---|
| 615 | var
|
---|
| 616 | topsize, leftsize, value: integer;
|
---|
| 617 | begin
|
---|
| 618 | value := 0;
|
---|
| 619 | Offset(topsize, -60, leftsize, -60);
|
---|
| 620 | DialogOptionsCombinations(topsize, leftsize, Font.Size, value);
|
---|
| 621 | end;
|
---|
| 622 |
|
---|
| 623 | procedure TfrmOptions.btnNotesNotesClick(Sender: TObject);
|
---|
| 624 | // display Notes Options
|
---|
| 625 | var
|
---|
| 626 | topsize, leftsize, value: integer;
|
---|
| 627 | begin
|
---|
| 628 | value := 0;
|
---|
| 629 | Offset(topsize, -60, leftsize, -60);
|
---|
| 630 | DialogOptionsNotes(topsize, leftsize, Font.Size, value);
|
---|
| 631 | end;
|
---|
| 632 |
|
---|
| 633 | procedure TfrmOptions.btnNotesTitlesClick(Sender: TObject);
|
---|
| 634 | // display Titles Options
|
---|
| 635 | var
|
---|
| 636 | topsize, leftsize, value: integer;
|
---|
| 637 | begin
|
---|
| 638 | value := 0;
|
---|
| 639 | Offset(topsize, -60, leftsize, -60);
|
---|
| 640 | DialogOptionsTitles(topsize, leftsize, Font.Size, value);
|
---|
| 641 | end;
|
---|
| 642 |
|
---|
| 643 | procedure TfrmOptions.Button1Click(Sender: TObject);
|
---|
| 644 | var
|
---|
| 645 | topsize, leftsize, value: integer;
|
---|
| 646 | begin
|
---|
| 647 | value := 0;
|
---|
| 648 | Offset(topsize, 90, leftsize, 23);
|
---|
| 649 | DialogOptionsHSDefault(topsize, leftsize, Font.Size, value);
|
---|
| 650 | end;
|
---|
| 651 |
|
---|
| 652 | procedure TfrmOptions.Button2Click(Sender: TObject);
|
---|
| 653 | var
|
---|
| 654 | topsize, leftsize, value: integer;
|
---|
| 655 | begin
|
---|
| 656 | value := 0;
|
---|
| 657 | Offset(topsize, -18, leftsize, -15);
|
---|
| 658 | DialogOptionsHSCustom(topsize, leftsize, Font.Size, value);
|
---|
| 659 | end;
|
---|
| 660 |
|
---|
| 661 | procedure TfrmOptions.lvwNotificationsEnter(Sender: TObject);
|
---|
| 662 | begin
|
---|
| 663 | with Sender as TListView do begin
|
---|
| 664 | if (Selected = nil) and (Items.Count > 0) then
|
---|
| 665 | Selected := Items[0];
|
---|
| 666 | end;
|
---|
| 667 | end;
|
---|
| 668 |
|
---|
| 669 | procedure TfrmOptions.lvwNotificationsMouseDown(Sender: TObject;
|
---|
| 670 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
| 671 | begin
|
---|
| 672 | FLastClickedItem := (Sender as TListView).GetItemAt(X,Y);
|
---|
| 673 | end;
|
---|
| 674 |
|
---|
| 675 | procedure TfrmOptions.btnDiagnosesClick(Sender: TObject);
|
---|
| 676 | // display Personal Diagnoses List
|
---|
| 677 | var
|
---|
| 678 | topsize, leftsize, value: integer;
|
---|
| 679 | begin
|
---|
| 680 | if BILLING_AWARE then {BAV25 Code}
|
---|
| 681 | begin
|
---|
| 682 | value := 0;
|
---|
| 683 | Offset(topsize, -60, leftsize, -60);
|
---|
| 684 | DialogOptionsDiagnoses(topsize, leftsize, Font.Size, value);
|
---|
| 685 | end;
|
---|
| 686 | end;
|
---|
| 687 |
|
---|
| 688 | end.
|
---|
| 689 |
|
---|