[456] | 1 | unit fNoteBA;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
[830] | 7 | ExtCtrls, ORCtrls, StdCtrls, ORFn, uTIU, fBase508Form,
|
---|
| 8 | VA508AccessibilityManager;
|
---|
[456] | 9 |
|
---|
| 10 | type
|
---|
[830] | 11 | TfrmNotesByAuthor = class(TfrmBase508Form)
|
---|
[456] | 12 | pnlBase: TORAutoPanel;
|
---|
| 13 | lblAuthor: TLabel;
|
---|
| 14 | radSort: TRadioGroup;
|
---|
| 15 | cboAuthor: TORComboBox;
|
---|
| 16 | cmdOK: TButton;
|
---|
| 17 | cmdCancel: TButton;
|
---|
| 18 | procedure cboAuthorNeedData(Sender: TObject; const StartFrom: string;
|
---|
| 19 | Direction, InsertAt: Integer);
|
---|
| 20 | procedure cmdCancelClick(Sender: TObject);
|
---|
| 21 | procedure cmdOKClick(Sender: TObject);
|
---|
| 22 | private
|
---|
| 23 | FChanged: Boolean;
|
---|
| 24 | FAuthor: Int64;
|
---|
| 25 | FAuthorName: string;
|
---|
| 26 | FAscending: Boolean;
|
---|
| 27 | end;
|
---|
| 28 |
|
---|
| 29 | TAuthorContext = record
|
---|
| 30 | Changed: Boolean;
|
---|
| 31 | Author: Int64;
|
---|
| 32 | AuthorName: string;
|
---|
| 33 | Ascending: Boolean;
|
---|
| 34 | end;
|
---|
| 35 |
|
---|
| 36 | procedure SelectAuthor(FontSize: Integer; CurrentContext: TTIUContext; var AuthorContext: TAuthorContext);
|
---|
| 37 |
|
---|
| 38 | implementation
|
---|
| 39 |
|
---|
| 40 | {$R *.DFM}
|
---|
| 41 |
|
---|
| 42 | uses rTIU, rCore, uCore;
|
---|
| 43 |
|
---|
| 44 | const
|
---|
| 45 | TX_AUTH_TEXT = 'Select a progress note author or press Cancel.';
|
---|
| 46 | TX_AUTH_CAP = 'Missing Author';
|
---|
| 47 |
|
---|
| 48 | procedure SelectAuthor(FontSize: Integer; CurrentContext: TTIUContext; var AuthorContext: TAuthorContext);
|
---|
| 49 | { displays author select form for progress notes and returns a record of the selection }
|
---|
| 50 | var
|
---|
| 51 | frmNotesByAuthor: TfrmNotesByAuthor;
|
---|
| 52 | W, H: integer;
|
---|
| 53 | CurrentAuthor: Int64;
|
---|
| 54 | begin
|
---|
| 55 | frmNotesByAuthor := TfrmNotesByAuthor.Create(Application);
|
---|
| 56 | try
|
---|
| 57 | with frmNotesByAuthor do
|
---|
| 58 | begin
|
---|
| 59 | Font.Size := FontSize;
|
---|
| 60 | W := ClientWidth;
|
---|
| 61 | H := ClientHeight;
|
---|
| 62 | ResizeToFont(FontSize, W, H);
|
---|
| 63 | ClientWidth := W; pnlBase.Width := W;
|
---|
| 64 | ClientHeight := H; pnlBase.Height := W;
|
---|
| 65 | FChanged := False;
|
---|
| 66 | CurrentAuthor := CurrentContext.Author;
|
---|
| 67 | with cboAuthor do
|
---|
| 68 | if CurrentAuthor > 0 then
|
---|
| 69 | begin
|
---|
| 70 | InitLongList(ExternalName(CurrentAuthor, 200));
|
---|
| 71 | SelectByIEN(CurrentAuthor);
|
---|
| 72 | end
|
---|
| 73 | else
|
---|
| 74 | begin
|
---|
| 75 | InitLongList(User.Name);
|
---|
| 76 | SelectByIEN(User.DUZ);
|
---|
| 77 | end;
|
---|
| 78 | FAscending := CurrentContext.TreeAscending;
|
---|
| 79 | with radSort do if FAscending then ItemIndex := 0 else ItemIndex := 1;
|
---|
| 80 | ShowModal;
|
---|
| 81 | with AuthorContext do
|
---|
| 82 | begin
|
---|
| 83 | Changed := FChanged;
|
---|
| 84 | Author := FAuthor;
|
---|
| 85 | AuthorName := FAuthorName;
|
---|
| 86 | Ascending := FAscending;
|
---|
| 87 | end; {with AuthorContext}
|
---|
| 88 | end; {with frmNotesByAuthor}
|
---|
| 89 | finally
|
---|
| 90 | frmNotesByAuthor.Release;
|
---|
| 91 | end;
|
---|
| 92 | end;
|
---|
| 93 |
|
---|
| 94 | procedure TfrmNotesByAuthor.cboAuthorNeedData(Sender: TObject; const StartFrom: string;
|
---|
| 95 | Direction, InsertAt: Integer);
|
---|
| 96 | begin
|
---|
| 97 | cboAuthor.ForDataUse(SubSetOfActiveAndInactivePersons(StartFrom, Direction));
|
---|
| 98 | end;
|
---|
| 99 |
|
---|
| 100 | procedure TfrmNotesByAuthor.cmdCancelClick(Sender: TObject);
|
---|
| 101 | begin
|
---|
| 102 | Close;
|
---|
| 103 | end;
|
---|
| 104 |
|
---|
| 105 | procedure TfrmNotesByAuthor.cmdOKClick(Sender: TObject);
|
---|
| 106 | begin
|
---|
| 107 | if cboAuthor.ItemIEN = 0 then
|
---|
| 108 | begin
|
---|
| 109 | InfoBox(TX_AUTH_TEXT, TX_AUTH_CAP, MB_OK or MB_ICONWARNING);
|
---|
| 110 | Exit;
|
---|
| 111 | end;
|
---|
| 112 | FChanged := True;
|
---|
| 113 | FAuthor := cboAuthor.ItemIEN;
|
---|
| 114 | FAuthorName := cboAuthor.DisplayText[cboAuthor.ItemIndex];
|
---|
| 115 | FAscending := radSort.ItemIndex = 0;
|
---|
| 116 | Close;
|
---|
| 117 | end;
|
---|
| 118 |
|
---|
| 119 | end.
|
---|