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

Last change on this file since 828 was 456, checked in by Kevin Toppenberg, 16 years ago

Initial Upload of Official WV CPRS 1.0.26.76

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