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

Last change on this file since 1593 was 877, checked in by Kevin Toppenberg, 14 years ago

Dual sync of source code enabled: SVN + BZR

File size: 45.7 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 frmNoteProperties := TfrmNoteProperties.Create(Application);
295 uConsultsList := TStringList.Create;
296 try
297 ResizeAnchoredFormToFont(frmNoteProperties);
298 with frmNoteProperties do
299 begin
300 // setup common fields (title, reference date, author)
301 FToday := FloatToStr(FMToday);
302 FCallingTab := CallingTab;
303 FIDNoteTitlesOnly := IDNoteTitlesOnly;
304 FClassName := AClassName;
305 FIsClinProcNote := (AClassName = DCL_CLINPROC);
306 FCPStatusFlag := CPStatusFlag;
307 //uShowUnresolvedOnly := False; //v26.5 (RV)
308 uShowUnresolvedOnly := True; //v26.5 (RV)
309 if ANote.DocType <> TYP_ADDENDUM then
310 begin
311 case FCallingTab of
312 CT_CONSULTS: begin
313// Caption := 'Consult Note Properties'; <-- original line. //kt 8/26/2007
314 Caption := DKLangConstW('fNoteProps_Consult_Note_Properties'); //kt added 8/26/2007
315 cboNewTitle.InitLongList('');
316 if FIsClinProcNote then
317 begin
318 Caption := TX_CP_CAPTION;
319 lblNewTitle.Caption := TX_CP_TITLE;
320 ListClinProcTitlesShort(cboNewTitle.Items);
321 cboAuthor.InitLongList(User.Name);
322 cboAuthor.SelectByIEN(User.DUZ);
323 cboProcSummCode.SelectByIEN(ANote.ClinProcSummCode);
324 calProcDateTime.FMDateTime := ANote.ClinProcDateTime;
325 end
326 else // not CP note
327 begin
328 ListConsultTitlesShort(cboNewTitle.Items);
329 cboAuthor.InitLongList(ANote.AuthorName);
330 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
331 end;
332 end ;
333 CT_SURGERY: begin
334 Caption := TX_SR_CAPTION;
335 lblNewTitle.Caption := TX_SR_TITLE;
336 cboNewTitle.InitLongList('');
337 cboAuthor.InitLongList(ANote.AuthorName);
338 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
339 ListSurgeryTitlesShort(cboNewTitle.Items, FClassName);
340 end;
341 CT_NOTES: begin
342// Caption := 'Progress Note Properties'; <-- original line. //kt 8/26/2007
343 Caption := DKLangConstW('fNoteProps_Progress_Note_Properties'); //kt added 8/26/2007
344 if ANote.IsNewNote then
345 begin
346 GetUnresolvedConsultsInfo; // v26.5 (RV) removed nag screen
347 end;
348 cboNewTitle.InitLongList('');
349 cboAuthor.InitLongList(ANote.AuthorName);
350 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
351 ListNoteTitlesShort(cboNewTitle.Items);
352 // HOW TO PREVENT TITLE CHANGE ON ID CHILD, BUT NOT ON INITIAL CREATE?????
353 cboNewTitle.Enabled := not ((ANote.IDParent > 0) and (ANote.Title > 0) and (not IsNewIDEntry));
354 if not cboNewTitle.Enabled then
355 begin
356 cboNewTitle.Color := clBtnFace;
357 InfoBox(TX_NO_TITLE_CHANGE, TC_NO_TITLE_CHANGE, MB_OK);
358 end;
359 end;
360 end;
361 end
362 else //if addendum
363 begin
364// Caption := 'Addendum Properties'; <-- original line. //kt 8/26/2007
365 Caption := DKLangConstW('fNoteProps_Addendum_Properties'); //kt added 8/26/2007
366 cboNewTitle.Items.Insert(0, IntToStr(ANote.Title) + U + ANote.TitleName);
367 cboAuthor.InitLongList(ANote.AuthorName);
368 if ANote.Author > 0 then cboAuthor.SelectByIEN(ANote.Author);
369 end;
370 ShowClinProcFields(FIsClinProcNote);
371 FStarting := True;
372 if ANote.Title > 0 then cboNewTitle.SelectByIEN(ANote.Title);
373 if (ANote.Title > 0) and (cboNewTitle.ItemIndex < 0)
374 then cboNewTitle.SetExactByIEN(ANote.Title, ANote.TitleName);
375 FStarting := False;
376 calNote.FMDateTime := ANote.DateTime;
377 // setup cosigner fields
378 FAddend := ANote.Addend;
379 FCosignIEN := ANote.Cosigner;
380 FCosignName := ANote.CosignerName;
381 FDocType := ANote.DocType;
382 FLastCosigner := ANote.LastCosigner;
383 FLastCosignerName := ANote.LastCosignerName;
384 SetCosignerRequired(True);
385 // setup package fields
386 SetGenericFormSize;
387 case FCallingTab of
388 CT_CONSULTS: begin
389 ShowRequestList(False);
390 ShowSurgCaseList(False);
391 ShowPRFList(False);
392 end;
393 CT_SURGERY : begin
394 ShowRequestList(False);
395 ShowSurgCaseList(False);
396 ShowPRFList(False);
397 end;
398 CT_NOTES : begin
399 with uUnresolvedConsults do // v26.5 (RV)
400 ShowRequestList(IsConsultTitle(ANote.Title) or
401 (UnresolvedConsultsExist and ShowNagScreen)); // v26.5 (RV)
402 ShowSurgCaseList(IsSurgeryTitle(ANote.Title));
403 ShowPRFList(IsPRFTitle(ANote.Title));
404 end;
405 end;
406 // restrict edit of title if addendum
407 if FDocType = TYP_ADDENDUM then
408 begin
409// lblNewTitle.Caption := 'Addendum to:'; <-- original line. //kt 8/26/2007
410 lblNewTitle.Caption := DKLangConstW('fNoteProps_Addendum_tox'); //kt added 8/26/2007
411 cboNewTitle.Enabled := False;
412 cboNewTitle.Color := clBtnFace;
413 end;
414 cboNewTitle.Caption := lblNewTitle.Caption;
415 FStarting := True;
416 cboNewTitleExit(frmNoteProperties); // force display of request/case list
417 FStarting := False;
418 if uShowUnresolvedOnly then // override previous display if SHOW ME clicked on entrance
419 begin
420 //cboNewTitle.ItemIndex := -1; CQ#7587, v26.25 - RV
421 uShowUnresolvedOnly := not uShowUnresolvedOnly;
422 FormatRequestList;
423 end ;
424 TAccessibleListBox.WrapControl(cboNewTitle);
425 try
426 Result := ShowModal = idOK; // display the form
427 finally
428 TAccessibleListBox.UnwrapControl(cboNewTitle);
429 end;
430 if Result then with ANote do
431 begin
432 if FDocType <> TYP_ADDENDUM then
433 begin
434 Title := cboNewTitle.ItemIEN;
435 TitleName := PrintNameForTitle(Title);
436 end;
437 IsNewNote := False;
438 DateTime := calNote.FMDateTime;
439 Author := cboAuthor.ItemIEN;
440 AuthorName := Piece(cboAuthor.Items[cboAuthor.ItemIndex], U, 2);
441 if cboCosigner.Visible then
442 begin
443 Cosigner := cboCosigner.ItemIEN;
444 CosignerName := Piece(cboCosigner.Items[cboCosigner.ItemIndex], U, 2);
445 // The LastCosigner fields are used to default the cosigner in subsequent notes.
446 // These fields are not reset with new notes & not passed into TIU.
447 LastCosigner := Cosigner;
448 LastCosignerName := CosignerName;
449 end else
450 begin
451 Cosigner := 0;
452 CosignerName := '';
453 end;
454 if FIsClinProcNote then
455 begin
456 ClinProcSummCode := FProcSummCode;
457 ClinProcDateTime := FProcDateTime;
458 if Location <= 0 then
459 begin
460 Location := Encounter.Location;
461 LocationName := Encounter.LocationName;
462 end;
463 if VisitDate <= 0 then VisitDate := Encounter.DateTime;
464 end;
465 case FCallingTab of
466 CT_CONSULTS: ;// no action required
467 CT_SURGERY : ;// no action required
468 (*begin
469 PkgIEN := lstSurgery.ItemIEN;
470 PkgPtr := PKG_SURGERY;
471 PkgRef := IntToStr(PkgIEN) + ';' + PkgPtr;
472 end;*)
473 CT_NOTES : begin
474 if pnlConsults.Visible then
475 begin
476 PkgIEN := lstRequests.ItemIEN;
477 PkgPtr := PKG_CONSULTS;
478 PkgRef := IntToStr(PkgIEN) + ';' + PkgPtr;
479 end
480 else if pnlSurgery.Visible then
481 begin
482 PkgIEN := lstSurgery.ItemIEN;
483 PkgPtr := PKG_SURGERY;
484 PkgRef := IntToStr(PkgIEN) + ';' + PkgPtr;
485 end
486 else if pnlPRF.Visible then //PRF
487 begin
488 PRF_IEN := FPRFActions.GetPRF_IEN(lvPRF.ItemIndex);
489 ActionIEN := FPRFActions.GetActionIEN(lvPRF.ItemIndex);
490 end;
491 end;
492 end;
493 end;
494 end;
495 finally
496 if Assigned(uConsultsList) then uConsultsList.Free;
497 frmNoteProperties.Free;
498 end;
499end;
500
501{ Form events }
502
503procedure TfrmNoteProperties.FormShow(Sender: TObject);
504begin
505 //if cboNewTitle.Text = '' then PostMessage(Handle, UM_DELAYEVENT, 0, 0);
506end;
507
508procedure TfrmNoteProperties.UMDelayEvent(var Message: TMessage);
509{ let the window finish displaying before dropping list box, otherwise listbox drop
510 in the design position rather then new windows position (ORCtrls bug?) }
511begin
512// Screen.Cursor := crArrow;
513// FFixCursor := TRUE;
514// cboNewTitle.DroppedDown := True;
515// lblDateTime.Visible := False;
516// lblAuthor.Visible := False;
517// lblCosigner.Visible := False;
518end;
519
520{ General calls }
521
522procedure TfrmNoteProperties.SetCosignerRequired(DoSetup: boolean);
523{ called initially & whenever title or author changes }
524begin
525 if FDocType = TYP_ADDENDUM then
526 begin
527 lblCosigner.Visible := AskCosignerForDocument(FAddend, cboAuthor.ItemIEN)
528 end else
529 begin
530 if cboNewTitle.ItemIEN = 0
531 then lblCosigner.Visible := AskCosignerForTitle(FDocType, cboAuthor.ItemIEN, calNote.FMDateTime)
532 else lblCosigner.Visible := AskCosignerForTitle(cboNewTitle.ItemIEN, cboAuthor.ItemIEN, calNote.FMDateTime);
533 end;
534 cboCosigner.Visible := lblCosigner.Visible;
535 if DoSetup then
536 begin
537 if lblCosigner.Visible then
538 begin
539 if FCosignIEN = 0 then
540 begin
541 FCosignIEN := FLastCosigner;
542 FCosignName := FLastCosignerName;
543 end;
544 if FCosignIEN = 0 then DefaultCosigner(FCosignIEN, FCosignName);
545 cboCosigner.InitLongList(FCosignName);
546 if FCosignIEN > 0 then cboCosigner.SelectByIEN(FCosignIEN);
547 end
548 else // if lblCosigner not visible, clear values {v19.10 - RV}
549 begin
550 FCosignIEN := 0;
551 FCosignName := '';
552 cboCosigner.ItemIndex := -1;
553 end;
554 end;
555end;
556
557procedure TfrmNoteProperties.ShowRequestList(ShouldShow: Boolean);
558{ called initially & whenever title changes }
559//const
560//ALL_CONSULTS = 'The following consults are currently available for selection:'; <-- original line. //kt 8/26/2007
561//UNRESOLVED_CONSULTS = 'The following consults are currently awaiting resolution:'; <-- original line. //kt 8/26/2007
562var
563 i: Integer;
564 SavedIEN: integer;
565 ALL_CONSULTS : string;
566 UNRESOLVED_CONSULTS : string;
567begin
568 ALL_CONSULTS := DKLangConstW('fNoteProps_The_following_consults_are_currently_available_for_selectionx'); //kt added 8/26/2007
569 UNRESOLVED_CONSULTS := DKLangConstW('fNoteProps_The_following_consults_are_currently_awaiting_resolutionx'); //kt added 8/26/2007
570 ShouldShow := ShouldShow and (FCallingTab = CT_NOTES);
571 if FDocType = TYP_ADDENDUM then ShouldShow := False;
572 pnlConsults.Visible := ShouldShow;
573 if ShouldShow then
574 begin
575 SavedIEN := lstRequests.ItemIEN;
576 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE + pnlConsults.Height;
577 lstRequests.Items.Clear;
578 if uConsultsList.Count = 0 then ListConsultRequests(uConsultsList);
579 if uShowUnresolvedOnly then
580 begin
581 for i := 0 to uConsultsList.Count - 1 do
582 if Pos(Piece(uConsultsList[i], U, 5), ACTIVE_STATUS) > 0 then
583 lstRequests.Items.Add(uConsultsList[i]);
584 lblConsult2.Caption := UNRESOLVED_CONSULTS;
585 end
586 else
587 begin
588 lblConsult2.Caption := ALL_CONSULTS;
589 lstRequests.Items.Assign(uConsultsList);
590 end;
591 lblConsult1.Visible := (cboNewTitle.ItemIndex > -1);
592 lstRequests.SelectByIEN(SavedIEN);
593 btnDetails.Enabled := (lstRequests.ItemIndex > -1);
594 end
595end;
596
597procedure TfrmNoteProperties.ShowSurgCaseList(ShouldShow: Boolean);
598{ called initially & whenever title changes }
599begin
600 pnlSurgery.Visible := ShouldShow;
601 if FDocType = TYP_ADDENDUM then ShouldShow := False;
602 if ShouldShow then
603 begin
604 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE + pnlSurgery.Height;
605 if lstSurgery.Items.Count = 0 then ListSurgeryCases(lstSurgery.Items);
606 end
607end;
608
609{ cboNewTitle events }
610
611procedure TfrmNoteProperties.cboNewTitleNeedData(Sender: TObject; const StartFrom: string;
612 Direction, InsertAt: Integer);
613begin
614 case FCallingTab of
615 CT_CONSULTS: begin
616 if FIsClinProcNote then
617 cboNewTitle.ForDataUse(SubSetOfClinProcTitles(StartFrom, Direction, FIDNoteTitlesOnly))
618 else
619 cboNewTitle.ForDataUse(SubSetOfConsultTitles(StartFrom, Direction, FIDNoteTitlesOnly));
620 end;
621 CT_SURGERY: cboNewTitle.ForDataUse(SubSetOfSurgeryTitles(StartFrom, Direction, FClassName));
622 CT_NOTES: cboNewTitle.ForDataUse(SubSetOfNoteTitles(StartFrom, Direction, FIDNoteTitlesOnly));
623 end;
624end;
625
626procedure TfrmNoteProperties.cboNewTitleEnter(Sender: TObject);
627begin
628 FLastTitle := 0;
629end;
630
631procedure TfrmNoteProperties.cboNewTitleMouseClick(Sender: TObject);
632//const
633//TX_NEED_CONSULT_TITLE = 'You currently have unresolved consults awaiting completion.' + CRLF + <-- original line. //kt 8/26/2007
634// 'The selected title cannot be used to complete consults.' + CRLF + <-- original line. //kt 8/26/2007
635// 'You must select a Consults title to complete a consult.' + CRLF + CRLF + <-- original line. //kt 8/26/2007
636// 'Answer "YES" to continue with this title and not complete a consult.' + CRLF + <-- original line. //kt 8/26/2007
637// 'Answer "NO" to select a different title.' + CRLF + CRLF + <-- original line. //kt 8/26/2007
638// 'Do you want to use this title and continue?'; <-- original line. //kt 8/26/2007
639//TC_NOT_CONSULT_TITLE = 'Not a consult title'; <-- original line. //kt 8/26/2007
640var
641 WantsToCompleteConsult: boolean;
642 ConsultTitle: boolean;
643 TX_NEED_CONSULT_TITLE : string;
644 TC_NOT_CONSULT_TITLE : string;
645begin
646 TX_NEED_CONSULT_TITLE := DKLangConstW('fNoteProps_You_currently_have_unresolved_consults_awaiting_completionx') + CRLF + //kt added 8/26/2007
647 DKLangConstW('fNoteProps_The_selected_title_cannot_be_used_to_complete_consultsx') + CRLF + //kt added 8/26/2007
648 DKLangConstW('fNoteProps_You_must_select_a_Consults_title_to_complete_a_consultx') + CRLF + CRLF + //kt added 8/26/2007
649 DKLangConstW('fNoteProps_Answer_xYESx_to_continue_with_this_title_and_not_complete_a_consultx') + CRLF + //kt added 8/26/2007
650 DKLangConstW('fNoteProps_Answer_xNOx_to_select_a_different_titlex') + CRLF + CRLF + //kt added 8/26/2007
651 DKLangConstW('fNoteProps_Do_you_want_to_use_this_title_and_continuex'); //kt added 8/26/2007
652 TC_NOT_CONSULT_TITLE := DKLangConstW('fNoteProps_Not_a_consult_title'); //kt added 8/26/2007
653 with cboNewTitle do
654 if (ItemIEN > 0) and (ItemIEN = FLastTitle) then Exit
655 else if ItemIEN = 0 then
656 begin
657 if FLastTitle > 0 then SelectByIEN(FLastTitle)
658 else ItemIndex := -1;
659 //Exit;
660 end;
661 case FCallingTab of
662 CT_CONSULTS: ; // no action
663 CT_SURGERY : ; // no action
664 CT_NOTES : begin // v26.5 (RV) main changes here
665 WantsToCompleteConsult := False;
666 ConsultTitle := IsConsultTitle(cboNewTitle.ItemIEN);
667 if (pnlConsults.Visible) and
668 (lstRequests.Items.Count > 0) and
669 (not FStarting) and
670 (*(lstRequests.ItemID <> '') and*)
671 (not ConsultTitle) then
672 WantsToCompleteConsult := (InfoBox(TX_NEED_CONSULT_TITLE,
673 TC_NOT_CONSULT_TITLE,
674 MB_ICONWARNING or MB_YESNO or MB_DEFBUTTON2) = IDNO);
675 if WantsToCompleteConsult and (not ConsultTitle) then cboNewTitle.ItemIndex := -1;
676 SetGenericFormSize;
677 ShowRequestList(WantsToCompleteConsult or ConsultTitle);
678 ShowSurgCaseList(IsSurgeryTitle(cboNewTitle.ItemIEN));
679 ShowPRFList(IsPRFTitle(cboNewTitle.ItemIEN));
680 end;
681 end;
682 SetCosignerRequired(True);
683 FLastTitle := cboNewTitle.ItemIEN;
684end;
685
686procedure TfrmNoteProperties.cboNewTitleExit(Sender: TObject);
687begin
688 if cboNewTitle.ItemIEN <> FLastTitle then cboNewTitleMouseClick(Self);
689end;
690
691procedure TfrmNoteProperties.cboNewTitleDblClick(Sender: TObject);
692begin
693 cmdOKClick(Self);
694end;
695
696{ cboAuthor & cboCosigner events }
697
698procedure TfrmNoteProperties.NewPersonNeedData(Sender: TObject; const StartFrom: String;
699 Direction, InsertAt: Integer);
700begin
701 (Sender as TORComboBox).ForDataUse(SubSetOfPersons(StartFrom, Direction));
702end;
703
704procedure TfrmNoteProperties.cboAuthorEnter(Sender: TObject);
705begin
706 FLastAuthor := 0;
707end;
708
709procedure TfrmNoteProperties.cboAuthorMouseClick(Sender: TObject);
710begin
711 SetCosignerRequired(True);
712 FLastAuthor := cboAuthor.ItemIEN;
713end;
714
715procedure TfrmNoteProperties.cboAuthorExit(Sender: TObject);
716begin
717 if cboAuthor.ItemIEN <> FLastAuthor then cboAuthorMouseClick(Self);
718end;
719
720procedure TfrmNoteProperties.cboCosignerExit(Sender: TObject);
721{ make sure FCosign fields stay up to date in case SetCosigner gets called again }
722//var x: string;
723begin
724 with cboCosigner do if ((Text = '') or (ItemIEN = 0)) then
725 begin
726 ItemIndex := -1;
727 FCosignIEN := 0;
728 FCosignName := '';
729 exit;
730 end;
731 FCosignIEN := cboCosigner.ItemIEN;
732 FCosignName := Piece(cboCosigner.Items[cboCosigner.ItemIndex], U, 2);
733end;
734
735{ Command Button events }
736
737procedure TfrmNoteProperties.cmdOKClick(Sender: TObject);
738var
739 ErrMsg, WhyNot, AlertMsg: string;
740begin
741 SetupVars; //kt added 8/26/2007 to replace constants with vars.
742 cmdOK.SetFocus; // make sure cbo exit events fire
743 Application.ProcessMessages;
744(* case FCallingTab of
745 CT_CONSULTS: ; //no action
746 CT_SURGERY : ; //no action
747 CT_NOTES : if IsConsultTitle(cboNewTitle.ItemIEN) then
748 ShowRequestList(True)
749 else if IsSurgeryTitle(cboNewTitle.ItemIEN) then
750{ TODO -oRich V. -cSurgery/TIU : Disallow new surgery notes here - MUST be business rule for "BE ENTERED": }
751 // New TIU RPC required, to check user and title against business rules.
752 // Must allow OK button click if surgery title on edit of surgery original.
753 // Can't pre-screen titles because need to allow change on edit.
754 // May need additional logic here to distinguish between NEW or EDITED document.
755 ShowSurgCaseList(True)
756 else
757 begin
758 ShowRequestList(False);
759 ShowSurgCaseList(False);
760 ShowPRFList(False);
761 end;
762 end;*)
763 SetCosignerRequired(False);
764 ErrMsg := '';
765 if cboNewTitle.ItemIEN = 0 then
766 ErrMsg := ErrMsg + TX_REQ_TITLE ;
767 if ErrMsg = '' then
768 begin
769 if FDocType = TYP_ADDENDUM then
770 begin
771 if OneNotePerVisit(TYP_ADDENDUM, Patient.DFN, Encounter.VisitStr)then
772 ErrMsg := ErrMsg + TX_ONE_NOTE_PER_VISIT1
773// + 'Addendum to ' + Piece(cboNewTitle.Items[cboNewTitle.ItemIndex],U,2) <-- original line. //kt 8/26/2007
774 + DKLangConstW('fNoteProps_Addendum_to') + Piece(cboNewTitle.Items[cboNewTitle.ItemIndex],U,2) //kt added 8/26/2007
775 + TX_ONE_NOTE_PER_VISIT2;
776 end
777 //code added 12/2002 check note parm - one per visit GRE
778 else if OneNotePerVisit(CboNewTitle.ItemIEN, Patient.DFN, Encounter.VisitStr)then
779 ErrMsg := ErrMsg + TX_ONE_NOTE_PER_VISIT1
780 + Piece(cboNewTitle.Items[cboNewTitle.ItemIndex],U,2)
781 + TX_ONE_NOTE_PER_VISIT2;
782 end;
783 if ErrMsg = '' then
784 begin
785 if FIDNoteTitlesOnly then
786 begin
787 if (not CanTitleBeIDChild(cboNewTitle.ItemIEN, WhyNot)) then
788 ErrMsg := ErrMsg + CRLF + WhyNot;
789 end
790 else
791 begin
792 if ((pnlConsults.Visible) and (lstRequests.ItemIndex < 0)) then
793 ErrMsg := ErrMsg + TX_REQ_REQUEST
794 else if ((pnlSurgery.Visible) and (lstSurgery.ItemIndex < 0)) then
795 ErrMsg := ErrMsg + TX_REQ_SURGCASE
796 else if (pnlPRF.Visible) then
797 begin
798 if (lvPRF.ItemIndex < 0) then
799 ErrMsg := ErrMsg + TX_REQ_PRF_ACTION
800 else if FPRFActions.SelActionHasNote(lvPRF.ItemIndex) then
801 ErrMsg := ErrMsg + TX_REQ_PRF_NOTE;
802 end;
803 end;
804 end;
805 if cboAuthor.ItemIEN = 0 then ErrMsg := ErrMsg + TX_REQ_AUTHOR;
806 if not calNote.IsValid then ErrMsg := ErrMsg + TX_REQ_REFDATE;
807 if calNote.IsValid and (calNote.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_FUTURE;
808 if cboCosigner.Visible then
809 begin
810 if (cboCosigner.ItemIEN = 0) then ErrMsg := ErrMsg + TX_REQ_COSIGNER;
811 //if (cboCosigner.ItemIEN = User.DUZ) then ErrMsg := TX_COS_SELF; // (CanCosign will do this check)
812 if (cboCosigner.ItemIEN > 0) and not CanCosign(cboNewTitle.ItemIEN, FDocType, cboCosigner.ItemIEN, calNote.FMDateTime)
813 then ErrMsg := cboCosigner.Text + TX_COS_AUTH;
814 //code added 02/2003 check if User is Inactive GRE
815 if UserInactive(IntToStr(cboCosigner.ItemIEN)) then
816 if (InfoBox(fNoteProps.TX_USER_INACTIVE, TC_INACTIVE_USER, MB_OKCANCEL)= IDCANCEL) then exit;
817 end;
818 if FIsClinProcNote then
819 begin
820 if (FCPStatusFlag = CP_INSTR_INCOMPLETE) then
821 begin
822 if cboProcSummCode.ItemIEN = 0 then ErrMsg := ErrMsg + TX_REQ_PROCSUMMCODE
823 else FProcSummCode := cboProcSummCode.ItemIEN;
824 if not calProcDateTime.IsValid then ErrMsg := ErrMsg + TX_REQ_PROCDATETIME
825 else if calProcDateTime.IsValid and (calProcDateTime.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_PROC_FUTURE
826 else FProcDateTime := calProcDateTime.FMDateTime;
827 end
828 else
829 begin
830 FProcSummCode := cboProcSummCode.ItemIEN;
831 if (calProcDateTime.FMDateTime > 0) then
832 begin
833 if (not calProcDateTime.IsValid) then ErrMsg := ErrMsg + TX_INVALID_PROCDATETIME
834 else if calProcDateTime.IsValid and (calProcDateTime.FMDateTime > FMNow) then ErrMsg := ErrMsg + TX_NO_PROC_FUTURE
835 else FProcDateTime := calProcDateTime.FMDateTime;
836 end;
837 end;
838 end;
839 if ShowMsgOn(Length(ErrMsg) > 0, ErrMsg, TC_REQ_FIELDS)
840 then Exit
841 else ModalResult := mrOK;
842
843 //Code added to handle inactive users. 2/26/03
844 if ShowMsgOn(Length(AlertMsg) > 0, AlertMsg, TC_INACTIVE_USER ) then
845 ModalResult := mrOK;
846end;
847
848procedure TfrmNoteProperties.cmdCancelClick(Sender: TObject);
849begin
850 ModalResult := mrCancel;
851 //Close;
852end;
853
854procedure TfrmNoteProperties.cboNewTitleDropDownClose(Sender: TObject);
855begin
856// if FFixCursor then
857// begin
858// Screen.Cursor := crDefault;
859// FFixCursor := FALSE;
860// end;
861// lblDateTime.Visible := True;
862// lblAuthor.Visible := True;
863// lblCosigner.Visible := True;
864end;
865
866procedure TfrmNoteProperties.cboCosignerNeedData(Sender: TObject;
867 const StartFrom: String; Direction, InsertAt: Integer);
868begin
869 (Sender as TORComboBox).ForDataUse(SubSetOfUsersWithClass(StartFrom, Direction, FToday));
870end;
871
872procedure TfrmNoteProperties.ShowClinProcFields(YesNo: boolean);
873begin
874 lblProcSummCode.Visible := YesNo;
875 cboProcSummCode.Visible := YesNo;
876 lblProcDateTime.Visible := YesNo;
877 calProcDateTime.Visible := YesNo;
878end;
879
880procedure TfrmNoteProperties.btnShowListClick(Sender: TObject);
881begin
882 FormatRequestList;
883end;
884
885procedure TfrmNoteProperties.FormatRequestList;
886//const
887//SHOW_UNRESOLVED = 'Show Unresolved'; <-- original line. //kt 8/26/2007
888//SHOW_ALL = 'Show All'; <-- original line. //kt 8/26/2007
889var
890 SHOW_UNRESOLVED : string;
891 SHOW_ALL : string;
892begin
893 SHOW_UNRESOLVED := DKLangConstW('fNoteProps_Show_Unresolved'); //kt added 8/26/2007
894 SHOW_ALL := DKLangConstW('fNoteProps_Show_All'); //kt added 8/26/2007
895 uShowUnresolvedOnly := not uShowUnresolvedOnly;
896 with btnShowList do
897 if uShowUnresolvedOnly then
898 Caption := SHOW_ALL
899 else
900 Caption := SHOW_UNRESOLVED;
901 with uUnresolvedConsults do if (UnresolvedConsultsExist and ShowNagScreen) then pnlConsults.Visible := TRUE; //v26.27 (RV)
902 ShowRequestList(pnlConsults.Visible); //v26.5 (RV)
903 //ShowRequestList(True); //v26.5 (RV)
904end;
905
906procedure TfrmNoteProperties.FormResize(Sender: TObject);
907const
908 SPACE: integer = 10;
909begin
910 cboNewTitle.Width := Self.ClientWidth - cboNewTitle.Left - cmdOK.Width - SPACE * 2;
911 cmdOK.Left := Self.ClientWidth - cmdOK.Width - SPACE;
912 cmdCancel.Left := Self.ClientWidth - cmdCancel.Width - SPACE;
913 if (cboAuthor.Width + cboAuthor.Left) > Self.ClientWidth then
914 cboAuthor.Width := Self.ClientWidth - cboAuthor.Left - SPACE;
915end;
916
917procedure TfrmNoteProperties.calNoteEnter(Sender: TObject);
918begin
919 if Sender is TORDateBox then
920 (Sender as TORDateBox).SelectAll;
921end;
922
923procedure TfrmNoteProperties.ShowPRFList(ShouldShow: Boolean);
924begin
925 SetupVars; //kt added 8/26/2007 to replace constants with vars.
926 pnlPRF.Visible := ShouldShow and not (FDocType = TYP_ADDENDUM);
927 if pnlPRF.Visible then
928 begin
929 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE + pnlPRF.Height;
930 if FPRFActions = nil then
931 FPRFActions := TPRFActions.Create;
932 FPRFActions.Load(cboNewTitle.ItemIEN,Patient.DFN);
933 if RPCBrokerV.Results.Count <> 0 then
934 lblPRF.Caption := PRF_LABEL
935 else
936// lblPRF.Caption := 'No Linkable Actions for this Patient and/or Title.'; <-- original line. //kt 8/26/2007
937 lblPRF.Caption := DKLangConstW('fNoteProps_No_Linkable_Actions_for_this_Patient_andxor_Titlex'); //kt added 8/26/2007
938 FPRFActions.ShowActionsOnList(lvPRF);
939 //Fix for CQ: 6926
940 lvPRF.Columns.BeginUpdate;
941 lvPRF.Columns.EndUpdate;
942 //End Fix for CQ: 6926
943 end
944end;
945
946procedure TfrmNoteProperties.SetGenericFormSize;
947begin
948 ClientHeight := cboCosigner.Top + cboCosigner.Height + PIXEL_SPACE;
949end;
950
951{ TPRFActions }
952
953constructor TPRFActions.Create;
954begin
955 inherited;
956 FPRFActionList := TStringList.Create;
957end;
958
959destructor TPRFActions.Destroy;
960begin
961 FPRFActionList.Free;
962 inherited;
963end;
964
965function TPRFActions.GetActionIEN(lstIndex: integer): String;
966begin
967 Result := Piece(FPRFActionList[lstIndex],U,ACTION_IEN);
968end;
969
970function TPRFActions.GetPRF_IEN(lstIndex: integer): integer;
971begin
972 Result := StrToInt(Piece(FPRFActionList[lstIndex],U,PRF_IEN));
973end;
974
975procedure TPRFActions.Load(TitleIEN : Int64; DFN : String);
976begin
977 CallV('TIU GET PRF ACTIONS', [TitleIEN,DFN]);
978 FPRFActionList.Assign(RPCBrokerV.Results);
979end;
980
981function TPRFActions.SelActionHasNote(lstIndex: integer): boolean;
982begin
983 Result := false;
984 if Piece(FPRFActionList[lstIndex],U,NOTE_IEN) <> '' then
985 Result := true;
986end;
987
988procedure TPRFActions.ShowActionsOnList(DisplayList: TCaptionListView);
989var
990 i : integer;
991 ListItem: TListItem;
992begin
993 SetupVars; //kt added 8/26/2007 to replace constants with vars.
994 DisplayList.Clear;
995 for i := 0 to FPRFActionList.Count-1 do
996 begin
997 //Caption="Text for Screen Reader" SubItem1=Flag SubItem2=Date SubItem3=Action SubItem4=Note
998 ListItem := DisplayList.Items.Add;
999 ListItem.Caption := PRF_LABEL; //Screen readers don't read the first column title on a listview.
1000 ListItem.SubItems.Add(Piece(FPRFActionList[i],U,FLAG_NAME));
1001 ListItem.SubItems.Add(Piece(FPRFActionList[i],U,ACTION_DATE));
1002 ListItem.SubItems.Add(Piece(FPRFActionList[i],U,ACTION_NAME));
1003 if SelActionHasNote(i) then
1004// ListItem.SubItems.Add('Yes') <-- original line. //kt 8/26/2007
1005 ListItem.SubItems.Add(DKLangConstW('fNoteProps_Yes')) //kt added 8/26/2007
1006 else
1007 ListItem.SubItems.Add('No');
1008 end;
1009end;
1010
1011procedure TfrmNoteProperties.FormDestroy(Sender: TObject);
1012begin
1013 FPRFActions.Free;
1014end;
1015
1016procedure TfrmNoteProperties.btnDetailsClick(Sender: TObject);
1017var
1018 ConsultDetail: TStringList;
1019begin
1020 if lstRequests.ItemIEN <= 0 then exit;
1021 ConsultDetail := TStringList.Create;
1022 try
1023 LoadConsultDetail(ConsultDetail, lstRequests.ItemIEN) ;
1024// ReportBox(ConsultDetail, 'Consult Details: #' + lstRequests.ItemID + ' - ' + <-- original line. //kt 8/26/2007
1025 ReportBox(ConsultDetail, DKLangConstW('fNoteProps_Consult_Detailsx_x') + lstRequests.ItemID + DKLangConstW('fNoteProps_x') + //kt added 8/26/2007
1026 Piece(lstRequests.Items[lstRequests.ItemIndex], U, 3), TRUE);
1027 finally
1028 ConsultDetail.Free;
1029 end;
1030end;
1031
1032procedure TfrmNoteProperties.lstRequestsChange(Sender: TObject);
1033begin
1034 btnDetails.Enabled := (lstRequests.ItemIEN > 0);
1035end;
1036
1037end.
Note: See TracBrowser for help on using the repository browser.