source: cprs/branches/tmg-cprs/CPRS-Chart/fNoteProps.pas@ 568

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

Initial upload of TMG-CPRS 1.0.26.69

File size: 45.8 KB
RevLine 
[453]1unit fNoteProps;
2//kt -- Modified with SourceScanner on 8/26/2007
3
4interface
5
6uses
7 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
8 StdCtrls, ORDtTm, ORCtrls, ExtCtrls, rTIU, uConst, uTIU, ORFn, ORNet,
9 ComCtrls, Buttons, DKLang;
10
11type
12 {This object holds a List of Actions as Returned VIA the RPCBroker}
13 TPRFActions = class(TObject)
14 private
15 FPRFActionList : TStringList;
16 public
17 //procedure to show the Action in a ListView, requires a listview parameter
18 procedure ShowActionsOnList(DisplayList : TCaptionListView);
19 //procedure to load the actions, this will call the RPC
20 procedure Load(TitleIEN : Int64; DFN : String);
21 //returns true if the Action at the Index passed is associated with a note
22 function SelActionHasNote(lstIndex : integer) : boolean;
23 //return the Action IEN at the Index passed
24 function GetActionIEN(lstIndex : integer) : String;
25 //return the PRF IEN at the Index passed
26 function GetPRF_IEN(lstIndex : integer) : integer;
27 constructor Create();
28 destructor Destroy(); override;
29 end;
30
31 TfrmNoteProperties = class(TForm)
32 lblNewTitle: TLabel;
33 cboNewTitle: TORComboBox;
34 lblDateTime: TLabel;
35 calNote: TORDateBox;
36 lblAuthor: TLabel;
37 cboAuthor: TORComboBox;
38 lblCosigner: TLabel;
39 cboCosigner: TORComboBox;
40 cmdOK: TButton;
41 cmdCancel: TButton;
42 pnlConsults: TORAutoPanel;
43 lblConsult1: TLabel;
44 lblConsult2: TLabel;
45 lblCsltDate: TLabel;
46 lblCsltServ: TLabel;
47 lblCsltProc: TLabel;
48 lblCsltStat: TLabel;
49 lblCsltNotes: TLabel;
50 lstRequests: TORListBox;
51 bvlConsult: TBevel;
52 pnlSurgery: TORAutoPanel;
53 lblSurgery1: TStaticText;
54 lblSurgery2: TStaticText;
55 lblSurgDate: TLabel;
56 lblSurgProc: TLabel;
57 lblSurgeon: TLabel;
58 lstSurgery: TORListBox;
59 bvlSurgery: TBevel;
60 cboProcSummCode: TORComboBox;
61 lblProcSummCode: TOROffsetLabel;
62 calProcDateTime: TORDateBox;
63 lblProcDateTime: TOROffsetLabel;
64 btnShowList: TButton;
65 pnlPRF: TORAutoPanel;
66 lblPRF: TLabel;
67 Bevel1: TBevel;
68 lvPRF: TCaptionListView;
69 btnDetails: TButton;
70 DKLanguageController1: TDKLanguageController;
71 procedure FormShow(Sender: TObject);
72 procedure cboNewTitleNeedData(Sender: TObject; const StartFrom: String;
73 Direction, InsertAt: Integer);
74 procedure NewPersonNeedData(Sender: TObject; const StartFrom: String;
75 Direction, InsertAt: Integer);
76 procedure cmdOKClick(Sender: TObject);
77 procedure cmdCancelClick(Sender: TObject);
78 procedure cboNewTitleExit(Sender: TObject);
79 procedure cboNewTitleMouseClick(Sender: TObject);
80 procedure cboNewTitleEnter(Sender: TObject);
81 procedure cboCosignerExit(Sender: TObject);
82 procedure cboAuthorExit(Sender: TObject);
83 procedure cboAuthorMouseClick(Sender: TObject);
84 procedure cboAuthorEnter(Sender: TObject);
85 procedure cboNewTitleDropDownClose(Sender: TObject);
86 procedure cboNewTitleDblClick(Sender: TObject);
87 procedure cboCosignerNeedData(Sender: TObject; const StartFrom: String;
88 Direction, InsertAt: Integer);
89 procedure btnShowListClick(Sender: TObject);
90 procedure FormResize(Sender: TObject);
91 procedure calNoteEnter(Sender: TObject);
92 procedure FormDestroy(Sender: TObject);
93 procedure btnDetailsClick(Sender: TObject);
94 procedure lstRequestsChange(Sender: TObject);
95 private
96 FCosignIEN: Int64; // store cosigner that was passed in
97 FCosignName: string; // store cosigner that was passed in
98 FDocType: Integer; // store document type that was passed in
99 FAddend: Integer; // store IEN of note being addended (if make addendum)
100 FLastAuthor: Int64; // set by mouseclick to avoid redundant call on exit
101 FLastTitle: Integer; // set by mouseclick to avoid redundant call on exit
102 //FFixCursor: Boolean; // to fix the problem where the list box is an I-bar
103 FLastCosigner: Int64; // holds cosigner from previous note (for defaulting)
104 FLastCosignerName: string; // holds cosigner from previous note (for defaulting)
105 FCallingTab: integer;
106 FIDNoteTitlesOnly: boolean;
107 FToday: string;
108 FClassName: string;
109 FIsClinProcNote: boolean;
110 FProcSummCode: integer;
111 FProcDateTime: TFMDateTime;
112 FCPStatusFlag: integer;
113 FPRFActions : TPRFActions;
114 FStarting: boolean;
115 procedure SetCosignerRequired(DoSetup: boolean);
116 procedure FormatRequestList;
117 procedure ShowRequestList(ShouldShow: Boolean);
118 procedure ShowSurgCaseList(ShouldShow: Boolean);
119 procedure ShowPRFList(ShouldShow: Boolean);
120 procedure ShowClinProcFields(YesNo: boolean);
121 procedure SetGenericFormSize;
122 procedure UMDelayEvent(var Message: TMessage); message UM_DELAYEVENT;
123 public
124 { Public declarations }
125
126 end;
127
128
129function ExecuteNoteProperties(var ANote: TEditNoteRec; CallingTab: integer; IDNoteTitlesOnly,
130 IsNewIDEntry: boolean; AClassName: string; CPStatusFlag: integer): Boolean;
131
132const
133
134//TX_USER_INACTIVE = 'This entry can be selected, however their system account has been' +CRLF + <-- original line. //kt 8/26/2007
135// ' temporarily inactivated and that person should be contacted to resolve the issue.'; <-- original line. //kt 8/26/2007
136
137//TC_INACTIVE_USER = 'Inactive User Alert'; <-- original line. //kt 8/26/2007
138
139 PIXEL_SPACE = 6;
140
141function TX_USER_INACTIVE : string;
142function TC_INACTIVE_USER : string;
143
144
145implementation
146
147{$R *.DFM}
148
149uses uCore, rCore, rConsults, uConsults, rSurgery, uAccessibleListBox, fRptBox;
150
151{ Initial values in ANote
152
153 Title Type Author DateTime Cosigner Location Consult NeedCPT
154 New Note dflt 3 DUZ NOW dflt Encnt 0 ?
155 New DCSumm dflt 244 DUZ NOW dflt Encnt 0 ?
156 Edit Note ien 3 ien DtTm ien ien ien fld
157 Edit DCSumm ien 244 ien DtTm ien ien ien fld
158 Addend Note ien 81 DUZ NOW 0 N/A N/A? no
159 Addend DCSumm ien 81 DUZ NOW 0 N/A N/A? no
160
161 New Note - setup as much as possible, then call ExecuteNoteProperties if necessary.
162
163}
164
165const
166//TX_CP_CAPTION = 'Clinical Procedure Document Properties'; <-- original line. //kt 8/26/2007
167//TX_CP_TITLE = 'Document Title:'; <-- original line. //kt 8/26/2007
168//TX_SR_CAPTION = 'Surgical Report Properties'; <-- original line. //kt 8/26/2007
169//TX_SR_TITLE = 'Report Title:'; <-- original line. //kt 8/26/2007
170//TC_REQ_FIELDS = 'Required Information'; <-- original line. //kt 8/26/2007
171//TX_REQ_TITLE = CRLF + 'A title must be selected.'; <-- original line. //kt 8/26/2007
172//TX_REQ_AUTHOR = CRLF + 'The author of the note must be identified.'; <-- original line. //kt 8/26/2007
173//TX_REQ_REFDATE = CRLF + 'A valid date/time for the note must be entered.'; <-- original line. //kt 8/26/2007
174//TX_REQ_COSIGNER = CRLF + 'A cosigner must be identified.'; <-- original line. //kt 8/26/2007
175//TX_REQ_REQUEST = CRLF + 'This title requires the selection of an associated consult request.'; <-- original line. //kt 8/26/2007
176//TX_REQ_SURGCASE = CRLF + 'This title requires the selection of an associated surgery case.'; <-- original line. //kt 8/26/2007
177//TX_REQ_PRF_ACTION = CRLF + 'Notes of this title require the selection of a patient record flag action.'; <-- original line. //kt 8/26/2007
178//TX_REQ_PRF_NOTE = CRLF + 'This action has already been assigned to another note.'; <-- original line. //kt 8/26/2007
179//TX_NO_FUTURE = CRLF + 'A reference date/time in the future is not allowed.'; <-- original line. //kt 8/26/2007
180//TX_COS_SELF = CRLF + 'You cannot make yourself a cosigner.'; <-- original line. //kt 8/26/2007
181//TX_COS_AUTH = CRLF + ' is not authorized to cosign this document.'; <-- original line. //kt 8/26/2007
182//TX_REQ_PROCSUMMCODE = CRLF + 'A procedure summary code for this procedure must be entered.'; <-- original line. //kt 8/26/2007
183//TX_REQ_PROCDATETIME = CRLF + 'A valid date/time for the procedure must be entered.'; <-- original line. //kt 8/26/2007
184//TX_INVALID_PROCDATETIME = CRLF + 'If entered, the date/time for the procedure must be in a valid format.'; <-- original line. //kt 8/26/2007
185//TX_NO_PROC_FUTURE = CRLF + 'A procedure date/time in the future is not allowed.'; <-- original line. //kt 8/26/2007
186//TX_NO_TITLE_CHANGE = 'Interdisciplinary entries may not have their titles changed.'; <-- original line. //kt 8/26/2007
187//TC_NO_TITLE_CHANGE = 'Title Change Not Allowed'; <-- original line. //kt 8/26/2007
188//TX_NO_NEW_SURGERY = 'New surgery reports can only be entered via the Surgery package.'; <-- original line. //kt 8/26/2007
189//TC_NO_NEW_SURGERY = 'Choose another title'; <-- original line. //kt 8/26/2007
190//TX_UNRESOLVED_CONSULTS = 'You currently have consults awaiting resolution for this patient.' + CRLF + <-- original line. //kt 8/26/2007
191// 'Would you like to see a list of these consults?'; <-- original line. //kt 8/26/2007
192//TX_ONE_NOTE_PER_VISIT1 = 'There is already a '; <-- original line. //kt 8/26/2007
193//TX_ONE_NOTE_PER_VISIT2 = CRLF + 'Only ONE record of this type per Visit is allowed...'+ <-- original line. //kt 8/26/2007
194// CRLF + CRLF + 'You can addend the existing record.'; <-- original line. //kt 8/26/2007
195
196
197 ACTIVE_STATUS = 'ACTIVE,PENDING,SCHEDULED';
198
199//PRF_LABEL = 'Which Patient Record Flag Action should this Note be linked to?'; <-- original line. //kt 8/26/2007
200
201 FLAG_NAME = 1;
202 PRF_IEN = 2;
203 ACTION_NAME = 3;
204 ACTION_IEN = 4;
205 ACTION_DATE_I = 5;
206 ACTION_DATE = 6;
207 NOTE_IEN = 7;
208
209var
210 TX_CP_CAPTION : string; //kt
211 TX_CP_TITLE : string; //kt
212 TX_SR_CAPTION : string; //kt
213 TX_SR_TITLE : string; //kt
214 TC_REQ_FIELDS : string; //kt
215 TX_REQ_TITLE : string; //kt
216 TX_REQ_AUTHOR : string; //kt
217 TX_REQ_REFDATE : string; //kt
218 TX_REQ_COSIGNER : string; //kt
219 TX_REQ_REQUEST : string; //kt
220 TX_REQ_SURGCASE : string; //kt
221 TX_REQ_PRF_ACTION : string; //kt
222 TX_REQ_PRF_NOTE : string; //kt
223 TX_NO_FUTURE : string; //kt
224 TX_COS_SELF : string; //kt
225 TX_COS_AUTH : string; //kt
226 TX_REQ_PROCSUMMCODE : string; //kt
227 TX_REQ_PROCDATETIME : string; //kt
228 TX_INVALID_PROCDATETIME : string; //kt
229 TX_NO_PROC_FUTURE : string; //kt
230 TX_NO_TITLE_CHANGE : string; //kt
231 TC_NO_TITLE_CHANGE : string; //kt
232 TX_NO_NEW_SURGERY : string; //kt
233 TC_NO_NEW_SURGERY : string; //kt
234 TX_UNRESOLVED_CONSULTS : string; //kt
235 TX_ONE_NOTE_PER_VISIT1 : string; //kt
236 TX_ONE_NOTE_PER_VISIT2 : string; //kt
237 PRF_LABEL : string; //kt
238
239
240procedure SetupVars;
241//kt Added entire function to replace constant declarations 8/26/2007
242begin
243 TX_CP_CAPTION := DKLangConstW('fNoteProps_Clinical_Procedure_Document_Properties');
244 TX_CP_TITLE := DKLangConstW('fNoteProps_Document_Titlex');
245 TX_SR_CAPTION := DKLangConstW('fNoteProps_Surgical_Report_Properties');
246 TX_SR_TITLE := DKLangConstW('fNoteProps_Report_Titlex');
247 TC_REQ_FIELDS := DKLangConstW('fNoteProps_Required_Information');
248 TX_REQ_TITLE := CRLF + DKLangConstW('fNoteProps_A_title_must_be_selectedx');
249 TX_REQ_AUTHOR := CRLF + DKLangConstW('fNoteProps_The_author_of_the_note_must_be_identifiedx');
250 TX_REQ_REFDATE := CRLF + DKLangConstW('fNoteProps_A_valid_datextime_for_the_note_must_be_enteredx');
251 TX_REQ_COSIGNER := CRLF + DKLangConstW('fNoteProps_A_cosigner_must_be_identifiedx');
252 TX_REQ_REQUEST := CRLF + DKLangConstW('fNoteProps_This_title_requires_the_selection_of_an_associated_consult_requestx');
253 TX_REQ_SURGCASE := CRLF + DKLangConstW('fNoteProps_This_title_requires_the_selection_of_an_associated_surgery_casex');
254 TX_REQ_PRF_ACTION := CRLF + DKLangConstW('fNoteProps_Notes_of_this_title_require_the_selection_of_a_patient_record_flag_actionx');
255 TX_REQ_PRF_NOTE := CRLF + DKLangConstW('fNoteProps_This_action_has_already_been_assigned_to_another_notex');
256 TX_NO_FUTURE := CRLF + DKLangConstW('fNoteProps_A_reference_datextime_in_the_future_is_not_allowedx');
257 TX_COS_SELF := CRLF + DKLangConstW('fNoteProps_You_cannot_make_yourself_a_cosignerx');
258 TX_COS_AUTH := CRLF + DKLangConstW('fNoteProps_is_not_authorized_to_cosign_this_documentx');
259 TX_REQ_PROCSUMMCODE := CRLF + DKLangConstW('fNoteProps_A_procedure_summary_code_for_this_procedure_must_be_enteredx');
260 TX_REQ_PROCDATETIME := CRLF + DKLangConstW('fNoteProps_A_valid_datextime_for_the_procedure_must_be_enteredx');
261 TX_INVALID_PROCDATETIME := CRLF + DKLangConstW('fNoteProps_If_enteredx_the_datextime_for_the_procedure_must_be_in_a_valid_formatx');
262 TX_NO_PROC_FUTURE := CRLF + DKLangConstW('fNoteProps_A_procedure_datextime_in_the_future_is_not_allowedx');
263 TX_NO_TITLE_CHANGE := DKLangConstW('fNoteProps_Interdisciplinary_entries_may_not_have_their_titles_changedx');
264 TC_NO_TITLE_CHANGE := DKLangConstW('fNoteProps_Title_Change_Not_Allowed');
265 TX_NO_NEW_SURGERY := DKLangConstW('fNoteProps_New_surgery_reports_can_only_be_entered_via_the_Surgery_packagex');
266 TC_NO_NEW_SURGERY := DKLangConstW('fNoteProps_Choose_another_title');
267 TX_UNRESOLVED_CONSULTS := DKLangConstW('fNoteProps_You_currently_have_consults_awaiting_resolution_for_this_patientx') + CRLF +
268 DKLangConstW('fNoteProps_Would_you_like_to_see_a_list_of_these_consultsx');
269 TX_ONE_NOTE_PER_VISIT1 := DKLangConstW('fNoteProps_There_is_already_a');
270 TX_ONE_NOTE_PER_VISIT2 := CRLF + DKLangConstW('fNoteProps_Only_ONE_record_of_this_type_per_Visit_is_allowedxxx')+
271 CRLF + CRLF + DKLangConstW('fNoteProps_You_can_addend_the_existing_recordx');
272 PRF_LABEL := DKLangConstW('fNoteProps_Which_Patient_Record_Flag_Action_should_this_Note_be_linked_tox');
273end;
274
275function TX_USER_INACTIVE : string;
276begin Result := DKLangConstW('fNoteProps_This_entry_can_be_selectedx_however_their_system_account_has_been') +CRLF +
277 DKLangConstW('fNoteProps_temporarily_inactivated_and_that_person_should_be_contacted_to_resolve_the_issuex');
278end;
279
280function TC_INACTIVE_USER : string;
281begin Result := DKLangConstW('fNoteProps_Inactive_User_Alert');
282end;
283
284var
285 uConsultsList: TStringList;
286 uShowUnresolvedOnly: boolean;
287
288function ExecuteNoteProperties(var ANote: TEditNoteRec; CallingTab: integer; IDNoteTitlesOnly,
289 IsNewIDEntry: boolean; AClassName: string; CPStatusFlag: integer): Boolean;
290var
291 frmNoteProperties: TfrmNoteProperties;
292begin
293 SetupVars; //kt added 8/26/2007 to replace constants with vars.
294 SetupVars; //kt added 8/26/2007 to replace constants with vars.
295 SetupVars; //kt added 8/26/2007 to replace constants with vars.
296 frmNoteProperties := TfrmNoteProperties.Create(Application);
297 uConsultsList := TStringList.Create;
298 try
299 ResizeAnchoredFormToFont(frmNoteProperties);
300 with frmNoteProperties do
301 begin
302 // setup common fields (title, reference date, author)
303 FToday := FloatToStr(FMToday);
304 FCallingTab := CallingTab;
305 FIDNoteTitlesOnly := IDNoteTitlesOnly;
306 FClassName := AClassName;
307 FIsClinProcNote := (AClassName = DCL_CLINPROC);
308 FCPStatusFlag := CPStatusFlag;
309 //uShowUnresolvedOnly := False; //v26.5 (RV)
310 uShowUnresolvedOnly := True; //v26.5 (RV)
311 if ANote.DocType <> TYP_ADDENDUM then
312 begin
313 case FCallingTab of
314 CT_CONSULTS: begin
315// Caption := 'Consult Note Properties'; <-- original line. //kt 8/26/2007
316 Caption := DKLangConstW('fNoteProps_Consult_Note_Properties'); //kt added 8/26/2007
317 cboNewTitle.InitLongList('');
318 if FIsClinProcNote then
319 begin
320 Caption := TX_CP_CAPTION;
321 lblNewTitle.Caption := TX_CP_TITLE;
322 ListClinProcTitlesShort(cboNewTitle.Items);
323 cboAuthor.InitLongList(User.Name);
324 cboAuthor.SelectByIEN(User.DUZ);
325 cboProcSummCode.SelectByIEN(ANote.ClinProcSummCode);
326 calProcDateTime.FMDateTime := ANote.ClinProcDateTime;
327 end
328 else // not CP note
329 begin
330 ListConsultTitlesShort(cboNewTitle.Items);
331 cboAuthor.InitLongList(ANote.AuthorName);
332 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
333 end;
334 end ;
335 CT_SURGERY: begin
336 Caption := TX_SR_CAPTION;
337 lblNewTitle.Caption := TX_SR_TITLE;
338 cboNewTitle.InitLongList('');
339 cboAuthor.InitLongList(ANote.AuthorName);
340 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
341 ListSurgeryTitlesShort(cboNewTitle.Items, FClassName);
342 end;
343 CT_NOTES: begin
344// Caption := 'Progress Note Properties'; <-- original line. //kt 8/26/2007
345 Caption := DKLangConstW('fNoteProps_Progress_Note_Properties'); //kt added 8/26/2007
346 if ANote.IsNewNote then
347 begin
348 GetUnresolvedConsultsInfo; // v26.5 (RV) removed nag screen
349 end;
350 cboNewTitle.InitLongList('');
351 cboAuthor.InitLongList(ANote.AuthorName);
352 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
353 ListNoteTitlesShort(cboNewTitle.Items);
354 // HOW TO PREVENT TITLE CHANGE ON ID CHILD, BUT NOT ON INITIAL CREATE?????
355 cboNewTitle.Enabled := not ((ANote.IDParent > 0) and (ANote.Title > 0) and (not IsNewIDEntry));
356 if not cboNewTitle.Enabled then
357 begin
358 cboNewTitle.Color := clBtnFace;
359 InfoBox(TX_NO_TITLE_CHANGE, TC_NO_TITLE_CHANGE, MB_OK);
360 end;
361 end;
362 end;
363 end
364 else //if addendum
365 begin
366// Caption := 'Addendum Properties'; <-- original line. //kt 8/26/2007
367 Caption := DKLangConstW('fNoteProps_Addendum_Properties'); //kt added 8/26/2007
368 cboNewTitle.Items.Insert(0, IntToStr(ANote.Title) + U + ANote.TitleName);
369 cboAuthor.InitLongList(ANote.AuthorName);
370 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
371 end;
372 ShowClinProcFields(FIsClinProcNote);
373 FStarting := True;
374 if ANote.Title > 0 then cboNewTitle.SelectByIEN(ANote.Title);
375 if (ANote.Title > 0) and (cboNewTitle.ItemIndex < 0)
376 then cboNewTitle.SetExactByIEN(ANote.Title, ANote.TitleName);
377 FStarting := False;
378 calNote.FMDateTime := ANote.DateTime;
379 // setup cosigner fields
380 FAddend := ANote.Addend;
381 FCosignIEN := ANote.Cosigner;
382 FCosignName := ANote.CosignerName;
383 FDocType := ANote.DocType;
384 FLastCosigner := ANote.LastCosigner;
385 FLastCosignerName := ANote.LastCosignerName;
386 SetCosignerRequired(True);
387 // setup package fields
388 SetGenericFormSize;
389 case FCallingTab of
390 CT_CONSULTS: begin
391 ShowRequestList(False);
392 ShowSurgCaseList(False);
393 ShowPRFList(False);
394 end;
395 CT_SURGERY : begin
396 ShowRequestList(False);
397 ShowSurgCaseList(False);
398 ShowPRFList(False);
399 end;
400 CT_NOTES : begin
401 with uUnresolvedConsults do // v26.5 (RV)
402 ShowRequestList(IsConsultTitle(ANote.Title) or
403 (UnresolvedConsultsExist and ShowNagScreen)); // v26.5 (RV)
404 ShowSurgCaseList(IsSurgeryTitle(ANote.Title));
405 ShowPRFList(IsPRFTitle(ANote.Title));
406 end;
407 end;
408 // restrict edit of title if addendum
409 if FDocType = TYP_ADDENDUM then
410 begin
411// lblNewTitle.Caption := 'Addendum to:'; <-- original line. //kt 8/26/2007
412 lblNewTitle.Caption := DKLangConstW('fNoteProps_Addendum_tox'); //kt added 8/26/2007
413 cboNewTitle.Enabled := False;
414 cboNewTitle.Color := clBtnFace;
415 end;
416 cboNewTitle.Caption := lblNewTitle.Caption;
417 FStarting := True;
418 cboNewTitleExit(frmNoteProperties); // force display of request/case list
419 FStarting := False;
420 if uShowUnresolvedOnly then // override previous display if SHOW ME clicked on entrance
421 begin
422 //cboNewTitle.ItemIndex := -1; CQ#7587, v26.25 - RV
423 uShowUnresolvedOnly := not uShowUnresolvedOnly;
424 FormatRequestList;
425 end ;
426 TAccessibleListBox.WrapControl(cboNewTitle);
427 try
428 Result := ShowModal = idOK; // display the form
429 finally
430 TAccessibleListBox.UnwrapControl(cboNewTitle);
431 end;
432 if Result then with ANote do
433 begin
434 if FDocType <> TYP_ADDENDUM then
435 begin
436 Title := cboNewTitle.ItemIEN;
437 TitleName := PrintNameForTitle(Title);
438 end;
439 IsNewNote := False;
440 DateTime := calNote.FMDateTime;
441 Author := cboAuthor.ItemIEN;
442 AuthorName := Piece(cboAuthor.Items[cboAuthor.ItemIndex], U, 2);
443 if cboCosigner.Visible then
444 begin
445 Cosigner := cboCosigner.ItemIEN;
446 CosignerName := Piece(cboCosigner.Items[cboCosigner.ItemIndex], U, 2);
447 // The LastCosigner fields are used to default the cosigner in subsequent notes.
448 // These fields are not reset with new notes & not passed into TIU.
449 LastCosigner := Cosigner;
450 LastCosignerName := CosignerName;
451 end else
452 begin
453 Cosigner := 0;
454 CosignerName := '';
455 end;
456 if FIsClinProcNote then
457 begin
458 ClinProcSummCode := FProcSummCode;
459 ClinProcDateTime := FProcDateTime;
460 if Location <= 0 then
461 begin
462 Location := Encounter.Location;
463 LocationName := Encounter.LocationName;
464 end;
465 if VisitDate <= 0 then VisitDate := Encounter.DateTime;
466 end;
467 case FCallingTab of
468 CT_CONSULTS: ;// no action required
469 CT_SURGERY : ;// no action required
470 (*begin
471 PkgIEN := lstSurgery.ItemIEN;
472 PkgPtr := PKG_SURGERY;
473 PkgRef := IntToStr(PkgIEN) + ';' + PkgPtr;
474 end;*)
475 CT_NOTES : begin
476 if pnlConsults.Visible then
477 begin
478 PkgIEN := lstRequests.ItemIEN;
479 PkgPtr := PKG_CONSULTS;
480 PkgRef := IntToStr(PkgIEN) + ';' + PkgPtr;
481 end
482 else if pnlSurgery.Visible then
483 begin
484 PkgIEN := lstSurgery.ItemIEN;
485 PkgPtr := PKG_SURGERY;
486 PkgRef := IntToStr(PkgIEN) + ';' + PkgPtr;
487 end
488 else if pnlPRF.Visible then //PRF
489 begin
490 PRF_IEN := FPRFActions.GetPRF_IEN(lvPRF.ItemIndex);
491 ActionIEN := FPRFActions.GetActionIEN(lvPRF.ItemIndex);
492 end;
493 end;
494 end;
495 end;
496 end;
497 finally
498 if Assigned(uConsultsList) then uConsultsList.Free;
499 frmNoteProperties.Free;
500 end;
501end;
502
503{ Form events }
504
505procedure TfrmNoteProperties.FormShow(Sender: TObject);
506begin
507 //if cboNewTitle.Text = '' then PostMessage(Handle, UM_DELAYEVENT, 0, 0);
508end;
509
510procedure TfrmNoteProperties.UMDelayEvent(var Message: TMessage);
511{ let the window finish displaying before dropping list box, otherwise listbox drop
512 in the design position rather then new windows position (ORCtrls bug?) }
513begin
514// Screen.Cursor := crArrow;
515// FFixCursor := TRUE;
516// cboNewTitle.DroppedDown := True;
517// lblDateTime.Visible := False;
518// lblAuthor.Visible := False;
519// lblCosigner.Visible := False;
520end;
521
522{ General calls }
523
524procedure TfrmNoteProperties.SetCosignerRequired(DoSetup: boolean);
525{ called initially & whenever title or author changes }
526begin
527 if FDocType = TYP_ADDENDUM then
528 begin
529 lblCosigner.Visible := AskCosignerForDocument(FAddend, cboAuthor.ItemIEN)
530 end else
531 begin
532 if cboNewTitle.ItemIEN = 0
533 then lblCosigner.Visible := AskCosignerForTitle(FDocType, cboAuthor.ItemIEN, calNote.FMDateTime)
534 else lblCosigner.Visible := AskCosignerForTitle(cboNewTitle.ItemIEN, cboAuthor.ItemIEN, calNote.FMDateTime);
535 end;
536 cboCosigner.Visible := lblCosigner.Visible;
537 if DoSetup then
538 begin
539 if lblCosigner.Visible then
540 begin
541 if FCosignIEN = 0 then
542 begin
543 FCosignIEN := FLastCosigner;
544 FCosignName := FLastCosignerName;
545 end;
546 if FCosignIEN = 0 then DefaultCosigner(FCosignIEN, FCosignName);
547 cboCosigner.InitLongList(FCosignName);
548 if FCosignIEN > 0 then cboCosigner.SelectByIEN(FCosignIEN);
549 end
550 else // if lblCosigner not visible, clear values {v19.10 - RV}
551 begin
552 FCosignIEN := 0;
553 FCosignName := '';
554 cboCosigner.ItemIndex := -1;
555 end;
556 end;
557end;
558
559procedure TfrmNoteProperties.ShowRequestList(ShouldShow: Boolean);
560{ called initially & whenever title changes }
561//const
562//ALL_CONSULTS = 'The following consults are currently available for selection:'; <-- original line. //kt 8/26/2007
563//UNRESOLVED_CONSULTS = 'The following consults are currently awaiting resolution:'; <-- original line. //kt 8/26/2007
564var
565 i: Integer;
566 SavedIEN: integer;
567 ALL_CONSULTS : string;
568 UNRESOLVED_CONSULTS : string;
569begin
570 ALL_CONSULTS := DKLangConstW('fNoteProps_The_following_consults_are_currently_available_for_selectionx'); //kt added 8/26/2007
571 UNRESOLVED_CONSULTS := DKLangConstW('fNoteProps_The_following_consults_are_currently_awaiting_resolutionx'); //kt added 8/26/2007
572 ShouldShow := ShouldShow and (FCallingTab = CT_NOTES);
573 if FDocType = TYP_ADDENDUM then ShouldShow := False;
574 pnlConsults.Visible := ShouldShow;
575 if ShouldShow then
576 begin
577 SavedIEN := lstRequests.ItemIEN;
578 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE + pnlConsults.Height;
579 lstRequests.Items.Clear;
580 if uConsultsList.Count = 0 then ListConsultRequests(uConsultsList);
581 if uShowUnresolvedOnly then
582 begin
583 for i := 0 to uConsultsList.Count - 1 do
584 if Pos(Piece(uConsultsList[i], U, 5), ACTIVE_STATUS) > 0 then
585 lstRequests.Items.Add(uConsultsList[i]);
586 lblConsult2.Caption := UNRESOLVED_CONSULTS;
587 end
588 else
589 begin
590 lblConsult2.Caption := ALL_CONSULTS;
591 lstRequests.Items.Assign(uConsultsList);
592 end;
593 lblConsult1.Visible := (cboNewTitle.ItemIndex > -1);
594 lstRequests.SelectByIEN(SavedIEN);
595 btnDetails.Enabled := (lstRequests.ItemIndex > -1);
596 end
597end;
598
599procedure TfrmNoteProperties.ShowSurgCaseList(ShouldShow: Boolean);
600{ called initially & whenever title changes }
601begin
602 pnlSurgery.Visible := ShouldShow;
603 if FDocType = TYP_ADDENDUM then ShouldShow := False;
604 if ShouldShow then
605 begin
606 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE + pnlSurgery.Height;
607 if lstSurgery.Items.Count = 0 then ListSurgeryCases(lstSurgery.Items);
608 end
609end;
610
611{ cboNewTitle events }
612
613procedure TfrmNoteProperties.cboNewTitleNeedData(Sender: TObject; const StartFrom: string;
614 Direction, InsertAt: Integer);
615begin
616 case FCallingTab of
617 CT_CONSULTS: begin
618 if FIsClinProcNote then
619 cboNewTitle.ForDataUse(SubSetOfClinProcTitles(StartFrom, Direction, FIDNoteTitlesOnly))
620 else
621 cboNewTitle.ForDataUse(SubSetOfConsultTitles(StartFrom, Direction, FIDNoteTitlesOnly));
622 end;
623 CT_SURGERY: cboNewTitle.ForDataUse(SubSetOfSurgeryTitles(StartFrom, Direction, FClassName));
624 CT_NOTES: cboNewTitle.ForDataUse(SubSetOfNoteTitles(StartFrom, Direction, FIDNoteTitlesOnly));
625 end;
626end;
627
628procedure TfrmNoteProperties.cboNewTitleEnter(Sender: TObject);
629begin
630 FLastTitle := 0;
631end;
632
633procedure TfrmNoteProperties.cboNewTitleMouseClick(Sender: TObject);
634//const
635//TX_NEED_CONSULT_TITLE = 'You currently have unresolved consults awaiting completion.' + CRLF + <-- original line. //kt 8/26/2007
636// 'The selected title cannot be used to complete consults.' + CRLF + <-- original line. //kt 8/26/2007
637// 'You must select a Consults title to complete a consult.' + CRLF + CRLF + <-- original line. //kt 8/26/2007
638// 'Answer "YES" to continue with this title and not complete a consult.' + CRLF + <-- original line. //kt 8/26/2007
639// 'Answer "NO" to select a different title.' + CRLF + CRLF + <-- original line. //kt 8/26/2007
640// 'Do you want to use this title and continue?'; <-- original line. //kt 8/26/2007
641//TC_NOT_CONSULT_TITLE = 'Not a consult title'; <-- original line. //kt 8/26/2007
642var
643 WantsToCompleteConsult: boolean;
644 ConsultTitle: boolean;
645 TX_NEED_CONSULT_TITLE : string;
646 TC_NOT_CONSULT_TITLE : string;
647begin
648 TX_NEED_CONSULT_TITLE := DKLangConstW('fNoteProps_You_currently_have_unresolved_consults_awaiting_completionx') + CRLF + //kt added 8/26/2007
649 DKLangConstW('fNoteProps_The_selected_title_cannot_be_used_to_complete_consultsx') + CRLF + //kt added 8/26/2007
650 DKLangConstW('fNoteProps_You_must_select_a_Consults_title_to_complete_a_consultx') + CRLF + CRLF + //kt added 8/26/2007
651 DKLangConstW('fNoteProps_Answer_xYESx_to_continue_with_this_title_and_not_complete_a_consultx') + CRLF + //kt added 8/26/2007
652 DKLangConstW('fNoteProps_Answer_xNOx_to_select_a_different_titlex') + CRLF + CRLF + //kt added 8/26/2007
653 DKLangConstW('fNoteProps_Do_you_want_to_use_this_title_and_continuex'); //kt added 8/26/2007
654 TC_NOT_CONSULT_TITLE := DKLangConstW('fNoteProps_Not_a_consult_title'); //kt added 8/26/2007
655 with cboNewTitle do
656 if (ItemIEN > 0) and (ItemIEN = FLastTitle) then Exit
657 else if ItemIEN = 0 then
658 begin
659 if FLastTitle > 0 then SelectByIEN(FLastTitle)
660 else ItemIndex := -1;
661 //Exit;
662 end;
663 case FCallingTab of
664 CT_CONSULTS: ; // no action
665 CT_SURGERY : ; // no action
666 CT_NOTES : begin // v26.5 (RV) main changes here
667 WantsToCompleteConsult := False;
668 ConsultTitle := IsConsultTitle(cboNewTitle.ItemIEN);
669 if (pnlConsults.Visible) and
670 (lstRequests.Items.Count > 0) and
671 (not FStarting) and
672 (*(lstRequests.ItemID <> '') and*)
673 (not ConsultTitle) then
674 WantsToCompleteConsult := (InfoBox(TX_NEED_CONSULT_TITLE,
675 TC_NOT_CONSULT_TITLE,
676 MB_ICONWARNING or MB_YESNO or MB_DEFBUTTON2) = IDNO);
677 if WantsToCompleteConsult and (not ConsultTitle) then cboNewTitle.ItemIndex := -1;
678 SetGenericFormSize;
679 ShowRequestList(WantsToCompleteConsult or ConsultTitle);
680 ShowSurgCaseList(IsSurgeryTitle(cboNewTitle.ItemIEN));
681 ShowPRFList(IsPRFTitle(cboNewTitle.ItemIEN));
682 end;
683 end;
684 SetCosignerRequired(True);
685 FLastTitle := cboNewTitle.ItemIEN;
686end;
687
688procedure TfrmNoteProperties.cboNewTitleExit(Sender: TObject);
689begin
690 if cboNewTitle.ItemIEN <> FLastTitle then cboNewTitleMouseClick(Self);
691end;
692
693procedure TfrmNoteProperties.cboNewTitleDblClick(Sender: TObject);
694begin
695 cmdOKClick(Self);
696end;
697
698{ cboAuthor & cboCosigner events }
699
700procedure TfrmNoteProperties.NewPersonNeedData(Sender: TObject; const StartFrom: String;
701 Direction, InsertAt: Integer);
702begin
703 (Sender as TORComboBox).ForDataUse(SubSetOfPersons(StartFrom, Direction));
704end;
705
706procedure TfrmNoteProperties.cboAuthorEnter(Sender: TObject);
707begin
708 FLastAuthor := 0;
709end;
710
711procedure TfrmNoteProperties.cboAuthorMouseClick(Sender: TObject);
712begin
713 SetCosignerRequired(True);
714 FLastAuthor := cboAuthor.ItemIEN;
715end;
716
717procedure TfrmNoteProperties.cboAuthorExit(Sender: TObject);
718begin
719 if cboAuthor.ItemIEN <> FLastAuthor then cboAuthorMouseClick(Self);
720end;
721
722procedure TfrmNoteProperties.cboCosignerExit(Sender: TObject);
723{ make sure FCosign fields stay up to date in case SetCosigner gets called again }
724//var x: string;
725begin
726 with cboCosigner do if ((Text = '') or (ItemIEN = 0)) then
727 begin
728 ItemIndex := -1;
729 FCosignIEN := 0;
730 FCosignName := '';
731 exit;
732 end;
733 FCosignIEN := cboCosigner.ItemIEN;
734 FCosignName := Piece(cboCosigner.Items[cboCosigner.ItemIndex], U, 2);
735end;
736
737{ Command Button events }
738
739procedure TfrmNoteProperties.cmdOKClick(Sender: TObject);
740var
741 ErrMsg, WhyNot, AlertMsg: string;
742begin
743 SetupVars; //kt added 8/26/2007 to replace constants with vars.
744 cmdOK.SetFocus; // make sure cbo exit events fire
745 Application.ProcessMessages;
746(* case FCallingTab of
747 CT_CONSULTS: ; //no action
748 CT_SURGERY : ; //no action
749 CT_NOTES : if IsConsultTitle(cboNewTitle.ItemIEN) then
750 ShowRequestList(True)
751 else if IsSurgeryTitle(cboNewTitle.ItemIEN) then
752{ TODO -oRich V. -cSurgery/TIU : Disallow new surgery notes here - MUST be business rule for "BE ENTERED": }
753 // New TIU RPC required, to check user and title against business rules.
754 // Must allow OK button click if surgery title on edit of surgery original.
755 // Can't pre-screen titles because need to allow change on edit.
756 // May need additional logic here to distinguish between NEW or EDITED document.
757 ShowSurgCaseList(True)
758 else
759 begin
760 ShowRequestList(False);
761 ShowSurgCaseList(False);
762 ShowPRFList(False);
763 end;
764 end;*)
765 SetCosignerRequired(False);
766 ErrMsg := '';
767 if cboNewTitle.ItemIEN = 0 then
768 ErrMsg := ErrMsg + TX_REQ_TITLE ;
769 if ErrMsg = '' then
770 begin
771 if FDocType = TYP_ADDENDUM then
772 begin
773 if OneNotePerVisit(TYP_ADDENDUM, Patient.DFN, Encounter.VisitStr)then
774 ErrMsg := ErrMsg + TX_ONE_NOTE_PER_VISIT1
775// + 'Addendum to ' + Piece(cboNewTitle.Items[cboNewTitle.ItemIndex],U,2) <-- original line. //kt 8/26/2007
776 + DKLangConstW('fNoteProps_Addendum_to') + Piece(cboNewTitle.Items[cboNewTitle.ItemIndex],U,2) //kt added 8/26/2007
777 + TX_ONE_NOTE_PER_VISIT2;
778 end
779 //code added 12/2002 check note parm - one per visit GRE
780 else if OneNotePerVisit(CboNewTitle.ItemIEN, Patient.DFN, Encounter.VisitStr)then
781 ErrMsg := ErrMsg + TX_ONE_NOTE_PER_VISIT1
782 + Piece(cboNewTitle.Items[cboNewTitle.ItemIndex],U,2)
783 + TX_ONE_NOTE_PER_VISIT2;
784 end;
785 if ErrMsg = '' then
786 begin
787 if FIDNoteTitlesOnly then
788 begin
789 if (not CanTitleBeIDChild(cboNewTitle.ItemIEN, WhyNot)) then
790 ErrMsg := ErrMsg + CRLF + WhyNot;
791 end
792 else
793 begin
794 if ((pnlConsults.Visible) and (lstRequests.ItemIndex < 0)) then
795 ErrMsg := ErrMsg + TX_REQ_REQUEST
796 else if ((pnlSurgery.Visible) and (lstSurgery.ItemIndex < 0)) then
797 ErrMsg := ErrMsg + TX_REQ_SURGCASE
798 else if (pnlPRF.Visible) then
799 begin
800 if (lvPRF.ItemIndex < 0) then
801 ErrMsg := ErrMsg + TX_REQ_PRF_ACTION
802 else if FPRFActions.SelActionHasNote(lvPRF.ItemIndex) then
803 ErrMsg := ErrMsg + TX_REQ_PRF_NOTE;
804 end;
805 end;
806 end;
807 if cboAuthor.ItemIEN = 0 then ErrMsg := ErrMsg + TX_REQ_AUTHOR;
808 if not calNote.IsValid then ErrMsg := ErrMsg + TX_REQ_REFDATE;
809 if calNote.IsValid and (calNote.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_FUTURE;
810 if cboCosigner.Visible then
811 begin
812 if (cboCosigner.ItemIEN = 0) then ErrMsg := ErrMsg + TX_REQ_COSIGNER;
813 //if (cboCosigner.ItemIEN = User.DUZ) then ErrMsg := TX_COS_SELF; // (CanCosign will do this check)
814 if (cboCosigner.ItemIEN > 0) and not CanCosign(cboNewTitle.ItemIEN, FDocType, cboCosigner.ItemIEN, calNote.FMDateTime)
815 then ErrMsg := cboCosigner.Text + TX_COS_AUTH;
816 //code added 02/2003 check if User is Inactive GRE
817 if UserInactive(IntToStr(cboCosigner.ItemIEN)) then
818 if (InfoBox(fNoteProps.TX_USER_INACTIVE, TC_INACTIVE_USER, MB_OKCANCEL)= IDCANCEL) then exit;
819 end;
820 if FIsClinProcNote then
821 begin
822 if (FCPStatusFlag = CP_INSTR_INCOMPLETE) then
823 begin
824 if cboProcSummCode.ItemIEN = 0 then ErrMsg := ErrMsg + TX_REQ_PROCSUMMCODE
825 else FProcSummCode := cboProcSummCode.ItemIEN;
826 if not calProcDateTime.IsValid then ErrMsg := ErrMsg + TX_REQ_PROCDATETIME
827 else if calProcDateTime.IsValid and (calProcDateTime.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_PROC_FUTURE
828 else FProcDateTime := calProcDateTime.FMDateTime;
829 end
830 else
831 begin
832 FProcSummCode := cboProcSummCode.ItemIEN;
833 if (calProcDateTime.FMDateTime > 0) then
834 begin
835 if (not calProcDateTime.IsValid) then ErrMsg := ErrMsg + TX_INVALID_PROCDATETIME
836 else if calProcDateTime.IsValid and (calProcDateTime.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_PROC_FUTURE
837 else FProcDateTime := calProcDateTime.FMDateTime;
838 end;
839 end;
840 end;
841 if ShowMsgOn(Length(ErrMsg) > 0, ErrMsg, TC_REQ_FIELDS)
842 then Exit
843 else ModalResult := mrOK;
844
845 //Code added to handle inactive users. 2/26/03
846 if ShowMsgOn(Length(AlertMsg) > 0, AlertMsg, TC_INACTIVE_USER ) then
847 ModalResult := mrOK;
848end;
849
850procedure TfrmNoteProperties.cmdCancelClick(Sender: TObject);
851begin
852 ModalResult := mrCancel;
853 //Close;
854end;
855
856procedure TfrmNoteProperties.cboNewTitleDropDownClose(Sender: TObject);
857begin
858// if FFixCursor then
859// begin
860// Screen.Cursor := crDefault;
861// FFixCursor := FALSE;
862// end;
863// lblDateTime.Visible := True;
864// lblAuthor.Visible := True;
865// lblCosigner.Visible := True;
866end;
867
868procedure TfrmNoteProperties.cboCosignerNeedData(Sender: TObject;
869 const StartFrom: String; Direction, InsertAt: Integer);
870begin
871 (Sender as TORComboBox).ForDataUse(SubSetOfUsersWithClass(StartFrom, Direction, FToday));
872end;
873
874procedure TfrmNoteProperties.ShowClinProcFields(YesNo: boolean);
875begin
876 lblProcSummCode.Visible := YesNo;
877 cboProcSummCode.Visible := YesNo;
878 lblProcDateTime.Visible := YesNo;
879 calProcDateTime.Visible := YesNo;
880end;
881
882procedure TfrmNoteProperties.btnShowListClick(Sender: TObject);
883begin
884 FormatRequestList;
885end;
886
887procedure TfrmNoteProperties.FormatRequestList;
888//const
889//SHOW_UNRESOLVED = 'Show Unresolved'; <-- original line. //kt 8/26/2007
890//SHOW_ALL = 'Show All'; <-- original line. //kt 8/26/2007
891var
892 SHOW_UNRESOLVED : string;
893 SHOW_ALL : string;
894begin
895 SHOW_UNRESOLVED := DKLangConstW('fNoteProps_Show_Unresolved'); //kt added 8/26/2007
896 SHOW_ALL := DKLangConstW('fNoteProps_Show_All'); //kt added 8/26/2007
897 uShowUnresolvedOnly := not uShowUnresolvedOnly;
898 with btnShowList do
899 if uShowUnresolvedOnly then
900 Caption := SHOW_ALL
901 else
902 Caption := SHOW_UNRESOLVED;
903 with uUnresolvedConsults do if (UnresolvedConsultsExist and ShowNagScreen) then pnlConsults.Visible := TRUE; //v26.27 (RV)
904 ShowRequestList(pnlConsults.Visible); //v26.5 (RV)
905 //ShowRequestList(True); //v26.5 (RV)
906end;
907
908procedure TfrmNoteProperties.FormResize(Sender: TObject);
909const
910 SPACE: integer = 10;
911begin
912 cboNewTitle.Width := Self.ClientWidth - cboNewTitle.Left - cmdOK.Width - SPACE * 2;
913 cmdOK.Left := Self.ClientWidth - cmdOK.Width - SPACE;
914 cmdCancel.Left := Self.ClientWidth - cmdCancel.Width - SPACE;
915 if (cboAuthor.Width + cboAuthor.Left) > Self.ClientWidth then
916 cboAuthor.Width := Self.ClientWidth - cboAuthor.Left - SPACE;
917end;
918
919procedure TfrmNoteProperties.calNoteEnter(Sender: TObject);
920begin
921 if Sender is TORDateBox then
922 (Sender as TORDateBox).SelectAll;
923end;
924
925procedure TfrmNoteProperties.ShowPRFList(ShouldShow: Boolean);
926begin
927 SetupVars; //kt added 8/26/2007 to replace constants with vars.
928 pnlPRF.Visible := ShouldShow and not (FDocType = TYP_ADDENDUM);
929 if pnlPRF.Visible then
930 begin
931 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE + pnlPRF.Height;
932 if FPRFActions = nil then
933 FPRFActions := TPRFActions.Create;
934 FPRFActions.Load(cboNewTitle.ItemIEN,Patient.DFN);
935 if RPCBrokerV.Results.Count <> 0 then
936 lblPRF.Caption := PRF_LABEL
937 else
938// lblPRF.Caption := 'No Linkable Actions for this Patient and/or Title.'; <-- original line. //kt 8/26/2007
939 lblPRF.Caption := DKLangConstW('fNoteProps_No_Linkable_Actions_for_this_Patient_andxor_Titlex'); //kt added 8/26/2007
940 FPRFActions.ShowActionsOnList(lvPRF);
941 //Fix for CQ: 6926
942 lvPRF.Columns.BeginUpdate;
943 lvPRF.Columns.EndUpdate;
944 //End Fix for CQ: 6926
945 end
946end;
947
948procedure TfrmNoteProperties.SetGenericFormSize;
949begin
950 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE;
951end;
952
953{ TPRFActions }
954
955constructor TPRFActions.Create;
956begin
957 inherited;
958 FPRFActionList := TStringList.Create;
959end;
960
961destructor TPRFActions.Destroy;
962begin
963 FPRFActionList.Free;
964 inherited;
965end;
966
967function TPRFActions.GetActionIEN(lstIndex: integer): String;
968begin
969 Result := Piece(FPRFActionList[lstIndex],U,ACTION_IEN);
970end;
971
972function TPRFActions.GetPRF_IEN(lstIndex: integer): integer;
973begin
974 Result := StrToInt(Piece(FPRFActionList[lstIndex],U,PRF_IEN));
975end;
976
977procedure TPRFActions.Load(TitleIEN : Int64; DFN : String);
978begin
979 CallV('TIU GET PRF ACTIONS', [TitleIEN,DFN]);
980 FPRFActionList.Assign(RPCBrokerV.Results);
981end;
982
983function TPRFActions.SelActionHasNote(lstIndex: integer): boolean;
984begin
985 Result := false;
986 if Piece(FPRFActionList[lstIndex],U,NOTE_IEN) <> '' then
987 Result := true;
988end;
989
990procedure TPRFActions.ShowActionsOnList(DisplayList: TCaptionListView);
991var
992 i : integer;
993 ListItem: TListItem;
994begin
995 SetupVars; //kt added 8/26/2007 to replace constants with vars.
996 DisplayList.Clear;
997 for i := 0 to FPRFActionList.Count-1 do
998 begin
999 //Caption="Text for Screen Reader" SubItem1=Flag SubItem2=Date SubItem3=Action SubItem4=Note
1000 ListItem := DisplayList.Items.Add;
1001 ListItem.Caption := PRF_LABEL; //Screen readers don't read the first column title on a listview.
1002 ListItem.SubItems.Add(Piece(FPRFActionList[i],U,FLAG_NAME));
1003 ListItem.SubItems.Add(Piece(FPRFActionList[i],U,ACTION_DATE));
1004 ListItem.SubItems.Add(Piece(FPRFActionList[i],U,ACTION_NAME));
1005 if SelActionHasNote(i) then
1006// ListItem.SubItems.Add('Yes') <-- original line. //kt 8/26/2007
1007 ListItem.SubItems.Add(DKLangConstW('fNoteProps_Yes')) //kt added 8/26/2007
1008 else
1009 ListItem.SubItems.Add('No');
1010 end;
1011end;
1012
1013procedure TfrmNoteProperties.FormDestroy(Sender: TObject);
1014begin
1015 FPRFActions.Free;
1016end;
1017
1018procedure TfrmNoteProperties.btnDetailsClick(Sender: TObject);
1019var
1020 ConsultDetail: TStringList;
1021begin
1022 if lstRequests.ItemIEN <= 0 then exit;
1023 ConsultDetail := TStringList.Create;
1024 try
1025 LoadConsultDetail(ConsultDetail, lstRequests.ItemIEN) ;
1026// ReportBox(ConsultDetail, 'Consult Details: #' + lstRequests.ItemID + ' - ' + <-- original line. //kt 8/26/2007
1027 ReportBox(ConsultDetail, DKLangConstW('fNoteProps_Consult_Detailsx_x') + lstRequests.ItemID + DKLangConstW('fNoteProps_x') + //kt added 8/26/2007
1028 Piece(lstRequests.Items[lstRequests.ItemIndex], U, 3), TRUE);
1029 finally
1030 ConsultDetail.Free;
1031 end;
1032end;
1033
1034procedure TfrmNoteProperties.lstRequestsChange(Sender: TObject);
1035begin
1036 btnDetails.Enabled := (lstRequests.ItemIEN > 0);
1037end;
1038
1039end.
Note: See TracBrowser for help on using the repository browser.