source: cprs/trunk/CPRS-Chart/fNoteBA.pas

Last change on this file was 830, checked in by Kevin Toppenberg, 14 years ago

Upgrading to version 27

File size: 3.2 KB
Line 
1unit fNoteBA;
2
3interface
4
5uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
7 ExtCtrls, ORCtrls, StdCtrls, ORFn, uTIU, fBase508Form,
8 VA508AccessibilityManager;
9
10type
11 TfrmNotesByAuthor = class(TfrmBase508Form)
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
36procedure SelectAuthor(FontSize: Integer; CurrentContext: TTIUContext; var AuthorContext: TAuthorContext);
37
38implementation
39
40{$R *.DFM}
41
42uses rTIU, rCore, uCore;
43
44const
45 TX_AUTH_TEXT = 'Select a progress note author or press Cancel.';
46 TX_AUTH_CAP = 'Missing Author';
47
48procedure SelectAuthor(FontSize: Integer; CurrentContext: TTIUContext; var AuthorContext: TAuthorContext);
49{ displays author select form for progress notes and returns a record of the selection }
50var
51 frmNotesByAuthor: TfrmNotesByAuthor;
52 W, H: integer;
53 CurrentAuthor: Int64;
54begin
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;
92end;
93
94procedure TfrmNotesByAuthor.cboAuthorNeedData(Sender: TObject; const StartFrom: string;
95 Direction, InsertAt: Integer);
96begin
97 cboAuthor.ForDataUse(SubSetOfActiveAndInactivePersons(StartFrom, Direction));
98end;
99
100procedure TfrmNotesByAuthor.cmdCancelClick(Sender: TObject);
101begin
102 Close;
103end;
104
105procedure TfrmNotesByAuthor.cmdOKClick(Sender: TObject);
106begin
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;
117end;
118
119end.
Note: See TracBrowser for help on using the repository browser.