source: cprs/branches/tmg-cprs/CPRS-Chart/fPatientFlagMulti.pas@ 1743

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 6.4 KB
Line 
1//kt -- Modified with SourceScanner on 7/24/2007
2unit fPatientFlagMulti;
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, StdCtrls, fAutoSz, ORCtrls, ExtCtrls, ComCtrls, rMisc, DKLang;
9
10type
11 {This object holds a List of Notes Linked to a PRF as Returned VIA the RPCBroker}
12 TPRFNotes = class(TObject)
13 private
14 FPRFNoteList : TStringList;
15 public
16 //procedure to show the Notes in a ListView, requires a listview parameter
17 procedure ShowActionsOnList(DisplayList : TCaptionListView);
18 //procedure to load the notes, this will call the RPC
19 procedure Load(TitleIEN : Int64; DFN : String);
20 function getNoteIEN(index: integer): String;
21 constructor create;
22 destructor Destroy(); override;
23 end;
24
25 TfrmFlags = class(TForm)
26 Splitter1: TSplitter;
27 pnlTop: TORAutoPanel;
28 lblFlags: TLabel;
29 lstFlags: TORListBox;
30 memFlags: TRichEdit;
31 pnlNotes: TPanel;
32 lvPRF: TCaptionListView;
33 lblNoteTitle: TLabel;
34 Splitter2: TSplitter;
35 pnlBottom: TORAutoPanel;
36 btnClose: TButton;
37 DKLanguageController1: TDKLanguageController;
38 procedure lstFlagsClick(Sender: TObject);
39 procedure FormKeyDown(Sender: TObject; var Key: Word;
40 Shift: TShiftState);
41 procedure FormShow(Sender: TObject);
42 procedure FormCreate(Sender: TObject);
43 procedure FormClose(Sender: TObject; var Action: TCloseAction);
44 procedure FormDestroy(Sender: TObject);
45 procedure lvPRFClick(Sender: TObject);
46 procedure lvPRFKeyDown(Sender: TObject; var Key: Word;
47 Shift: TShiftState);
48 private
49 FFlagID: integer;
50 FPRFNotes : TPRFNotes;
51 FNoteTitle: String;
52 procedure GetNotes();
53 public
54 { Public declarations }
55 end;
56
57const
58 //HIDDEN_COL = 'Press enter or space bar to view this note:'; <-- original line. //kt 7/24/2007
59 //TIU GET LINKED PRF NOTES, return position constants
60 NOTE_IEN_POS = 1;
61 ACTION_POS = 2;
62 NOTE_DATE_POS = 3;
63 AUTHOR_POS = 4;
64 //TIU GET PRF TITLE, return position constants
65 NOTE_TITLE_IEN = 1;
66 NOTE_TITLE = 2;
67
68
69procedure ShowFlags(FlagId: integer = 0);
70function HIDDEN_COL : string; //kt
71
72implementation
73
74uses uCore,uOrPtf,ORFn, ORNet, uConst, fRptBox, rCover;
75{$R *.dfm}
76
77function HIDDEN_COL : string; //kt
78begin
79 Result := DKLangConstW('fPatientFlagMulti_Press_enter_or_space_bar_to_view_this_notex');
80end;
81
82
83procedure ShowFlags(FlagId: integer);
84var
85 frmFlags: TfrmFlags;
86begin
87 frmFlags := TFrmFlags.Create(Nil);
88 try
89 SetFormPosition(frmFlags);
90 if HasFlag then
91 begin
92 //SetFormPosition(frmFlags);
93 frmFlags.FFlagID := FlagId;
94 frmFlags.lstFlags.Items.Assign(FlagList);
95 frmFlags.memFlags.SelStart := 0;
96 ResizeFormToFont(TForm(frmFlags));
97 frmFlags.ShowModal;
98 end
99 finally
100 frmFlags.Release;
101 end;
102end;
103
104procedure TfrmFlags.lstFlagsClick(Sender: TObject);
105var
106 FlagArray: TStringList;
107begin
108 if lstFlags.ItemIndex >= 0 then
109 begin
110 FlagArray := TStringList.Create;
111 GetActiveFlg(FlagArray, Patient.DFN, lstFlags.ItemID);
112 if FlagArray.Count > 0 then
113 memFlags.Lines.Assign(FlagArray);
114 memFlags.SelStart := 0;
115 GetNotes;
116 end;
117end;
118
119procedure TfrmFlags.FormKeyDown(Sender: TObject; var Key: Word;
120 Shift: TShiftState);
121begin
122 if Key = VK_ESCAPE then
123 Close;
124end;
125
126
127procedure TfrmFlags.FormShow(Sender: TObject);
128var
129 idx: integer;
130begin
131 inherited;
132 SetFormPosition(Self);
133 idx := 0;
134 if FFlagID > 0 then idx := lstFlags.SelectByIEN(FFlagId);
135 lstFlags.ItemIndex := idx;
136 lstFlagsClick(Self);
137 ActiveControl := memFlags;
138 GetNotes;
139end;
140
141procedure TfrmFlags.FormCreate(Sender: TObject);
142begin
143 inherited;
144 FFlagID := 0;
145end;
146
147procedure TfrmFlags.FormClose(Sender: TObject; var Action: TCloseAction);
148begin
149 inherited;
150 SaveUserBounds(Self);
151end;
152
153procedure TfrmFlags.GetNotes;
154var
155 NoteTitleIEN, FlagID : Int64;
156begin
157 if FPRFNotes = nil then
158 FPRFNotes := TPRFNotes.Create;
159 FlagID := lstFlags.ItemID;
160 CallV('TIU GET PRF TITLE', [Patient.DFN,FlagID]);
161 FNoteTitle := Piece(RPCBrokerV.Results[0],U,NOTE_TITLE);
162// lblNoteTitle.Caption := 'Signed, Linked Notes of Title: '+ FNoteTitle; <-- original line. //kt 7/24/2007
163 lblNoteTitle.Caption := DKLangConstW('fPatientFlagMulti_Signedx_Linked_Notes_of_Titlex')+ FNoteTitle; //kt added 7/24/2007
164 NoteTitleIEN := StrToInt(Piece(RPCBrokerV.Results[0],U,NOTE_TITLE_IEN));
165 FPRFNotes.Load(NoteTitleIEN,Patient.DFN);
166 FPRFNotes.ShowActionsOnList(lvPRF);
167 with lvPRF do begin
168
169 Columns.BeginUpdate;
170 Columns.EndUpdate;
171 end;
172end;
173
174{ TPRFNotes }
175
176constructor TPRFNotes.create;
177begin
178 inherited;
179 FPRFNoteList := TStringList.create;
180end;
181
182destructor TPRFNotes.Destroy;
183begin
184 FPRFNoteList.Free;
185 inherited;
186end;
187
188function TPRFNotes.getNoteIEN(index: integer): String;
189begin
190 Result := Piece(FPRFNoteList[index],U,NOTE_IEN_POS);
191end;
192
193procedure TPRFNotes.Load(TitleIEN: Int64; DFN: String);
194const
195 REVERSE_CHRONO = 1;
196begin
197 CallV('TIU GET LINKED PRF NOTES', [DFN,TitleIEN,REVERSE_CHRONO]);
198 FPRFNoteList.Assign(RPCBrokerV.Results);
199end;
200
201procedure TPRFNotes.ShowActionsOnList(DisplayList: TCaptionListView);
202var
203 i : integer;
204 ListItem: TListItem;
205begin
206 DisplayList.Clear;
207 for i := 0 to FPRFNoteList.Count-1 do
208 begin
209 //Caption="Text for Screen Reader" SubItem1=Flag SubItem2=Date SubItem3=Action SubItem4=Note
210 ListItem := DisplayList.Items.Add;
211 ListItem.Caption := HIDDEN_COL; //Screen readers don't read the first column title on a listview.
212 ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,NOTE_DATE_POS));
213 ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,ACTION_POS));
214 ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,AUTHOR_POS));
215 end;
216end;
217
218procedure TfrmFlags.FormDestroy(Sender: TObject);
219begin
220 FPRFNotes.Free;
221end;
222
223procedure TfrmFlags.lvPRFClick(Sender: TObject);
224begin
225 if lvPRF.ItemIndex > -1 then
226 begin
227 NotifyOtherApps(NAE_REPORT, 'TIU^' + FPRFNotes.getNoteIEN(lvPRF.ItemIndex));
228 ReportBox(DetailPosting(FPRFNotes.getNoteIEN(lvPRF.ItemIndex)), FNoteTitle, True);
229 end;
230end;
231
232procedure TfrmFlags.lvPRFKeyDown(Sender: TObject; var Key: Word;
233 Shift: TShiftState);
234begin
235 if (Key = VK_SPACE) or (Key = VK_RETURN) then
236 lvPRFClick(Sender);
237end;
238
239end.
Note: See TracBrowser for help on using the repository browser.