source: cprs/branches/foia-cprs/CPRS-Chart/rTIU.pas@ 1643

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

Uploading from OR_30_258

File size: 38.4 KB
Line 
1unit rTIU;
2
3interface
4
5uses SysUtils, Classes, ORNet, ORFn, rCore, uCore, uConst, TRPCB, uTIU;
6
7type
8 TPatchInstalled = record
9 PatchInstalled: boolean;
10 PatchChecked: boolean;
11 end;
12
13{ Progress Note Titles }
14function DfltNoteTitle: Integer;
15function DfltNoteTitleName: string;
16procedure ResetNoteTitles;
17function IsConsultTitle(TitleIEN: Integer): Boolean;
18function IsPRFTitle(TitleIEN: Integer): Boolean;
19function IsClinProcTitle(TitleIEN: Integer): Boolean;
20procedure ListNoteTitlesShort(Dest: TStrings);
21procedure LoadBoilerPlate(Dest: TStrings; Title: Integer);
22function PrintNameForTitle(TitleIEN: Integer): string;
23function SubSetOfNoteTitles(const StartFrom: string; Direction: Integer; IDNotesOnly: boolean): TStrings;
24
25{ TIU Preferences }
26procedure ResetTIUPreferences;
27function AskCosignerForNotes: Boolean;
28function AskCosignerForDocument(ADocument: Integer; AnAuthor: Int64): Boolean;
29function AskCosignerForTitle(ATitle: integer; AnAuthor: Int64; ADate: TFMDateTime): Boolean;
30function AskSubjectForNotes: Boolean;
31function CanCosign(ATitle, ADocType: integer; AUser: Int64; ADate: TFMDateTime): Boolean;
32function CanChangeCosigner(IEN: integer): boolean;
33procedure DefaultCosigner(var IEN: Int64; var Name: string);
34function ReturnMaxNotes: Integer;
35function SortNotesAscending: Boolean;
36function GetCurrentTIUContext: TTIUContext;
37procedure SaveCurrentTIUContext(AContext: TTIUContext) ;
38function TIUSiteParams: string;
39function DfltTIULocation: Integer;
40function DfltTIULocationName: string;
41
42{ Data Retrieval }
43procedure ActOnDocument(var AuthSts: TActionRec; IEN: Integer; const ActionName: string);
44function AuthorSignedDocument(IEN: Integer): boolean;
45function CosignDocument(IEN: Integer): Boolean;
46//function CPTRequiredForNote(IEN: Integer): Boolean;
47procedure ListNotes(Dest: TStrings; Context: Integer; Early, Late: TFMDateTime;
48 Person: int64; OccLim: Integer; SortAscending: Boolean);
49procedure ListNotesForTree(Dest: TStrings; Context: Integer; Early, Late: TFMDateTime;
50 Person: int64; OccLim: Integer; SortAscending: Boolean);
51procedure ListConsultRequests(Dest: TStrings);
52procedure ListDCSumm(Dest: TStrings);
53procedure LoadDetailText(Dest: TStrings; IEN: Integer); //**KCM**
54procedure LoadDocumentText(Dest: TStrings; IEN: Integer);
55procedure GetNoteForEdit(var EditRec: TEditNoteRec; IEN: Integer);
56function VisitStrForNote(IEN: Integer): string;
57function GetCurrentSigners(IEN: integer): TStrings;
58function TitleForNote(IEN: Int64): Integer;
59function GetConsultIENforNote(NoteIEN: integer): Integer;
60function GetPackageRefForNote(NoteIEN: integer): string;
61procedure LockDocument(IEN: Int64; var AnErrMsg: string);
62procedure UnlockDocument(IEN: Int64);
63function LastSaveClean(IEN: Int64): Boolean;
64function NoteHasText(NoteIEN: integer): boolean;
65function GetTIUListItem(IEN: Int64): string;
66
67{ Data Storage }
68//procedure ClearCPTRequired(IEN: Integer);
69procedure DeleteDocument(var DeleteSts: TActionRec; IEN: Integer; const Reason: string);
70function JustifyDocumentDelete(IEN: Integer): Boolean;
71procedure SignDocument(var SignSts: TActionRec; IEN: Integer; const ESCode: string);
72procedure PutNewNote(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec);
73procedure PutAddendum(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec; AddendumTo: Integer);
74procedure PutEditedNote(var UpdatedDoc: TCreatedDoc; const NoteRec: TNoteRec; NoteIEN: Integer);
75procedure PutTextOnly(var ErrMsg: string; NoteText: TStrings; NoteIEN: Int64);
76procedure SetText(var ErrMsg: string; NoteText: TStrings; NoteIEN: Int64; Suppress: Integer);
77procedure InitParams(NoteIEN: Int64; Suppress: Integer);
78procedure UpdateAdditionalSigners(IEN: integer; Signers: TStrings);
79procedure ChangeCosigner(IEN: integer; Cosigner: int64);
80
81{ Printing }
82function AllowChartPrintForNote(ANote: Integer): Boolean;
83procedure PrintNoteToDevice(ANote: Integer; const ADevice: string; ChartCopy: Boolean;
84 var ErrMsg: string);
85function GetFormattedNote(ANote: Integer; ChartCopy: Boolean): TStrings;
86
87// Interdisciplinary Notes
88function IDNotesInstalled: boolean;
89function CanTitleBeIDChild(Title: integer; var WhyNot: string): boolean;
90function CanReceiveAttachment(DocID: string; var WhyNot: string): boolean;
91function CanBeAttached(DocID: string; var WhyNot: string): boolean;
92function DetachEntryFromParent(DocID: string; var WhyNot: string): boolean;
93function AttachEntryToParent(DocID, ParentDocID: string; var WhyNot: string): boolean;
94function OneNotePerVisit(NoteEIN: Integer; DFN: String;VisitStr: String): boolean;
95
96
97//User Classes
98function SubSetOfUserClasses(const StartFrom: string; Direction: Integer): TStrings;
99function UserDivClassInfo(User: Int64): TStrings;
100function UserInactive(EIN: String): boolean;
101
102//Miscellaneous
103function TIUPatch175Installed: boolean;
104
105const
106 CLS_PROGRESS_NOTES = 3;
107
108implementation
109
110uses rMisc;
111
112var
113 uTIUSiteParams: string;
114 uTIUSiteParamsLoaded: boolean = FALSE;
115 uNoteTitles: TNoteTitles;
116 uTIUPrefs: TTIUPrefs;
117 uPatch175Installed: TPatchInstalled;
118
119
120{ Progress Note Titles -------------------------------------------------------------------- }
121
122procedure LoadNoteTitles;
123{ private - called one time to set up the uNoteTitles object }
124const
125 CLASS_PROGRESS_NOTES = 3;
126var
127 x: string;
128begin
129 if uNoteTitles <> nil then Exit;
130 CallV('TIU PERSONAL TITLE LIST', [User.DUZ, CLS_PROGRESS_NOTES]);
131 RPCBrokerV.Results.Insert(0, '~SHORT LIST'); // insert so can call ExtractItems
132 uNoteTitles := TNoteTitles.Create;
133 ExtractItems(uNoteTitles.ShortList, RPCBrokerV.Results, 'SHORT LIST');
134 x := ExtractDefault(RPCBrokerV.Results, 'SHORT LIST');
135 uNoteTitles.DfltTitle := StrToIntDef(Piece(x, U, 1), 0);
136 uNoteTitles.DfltTitleName := Piece(x, U, 2);
137end;
138
139procedure ResetNoteTitles;
140begin
141 if uNoteTitles <> nil then
142 begin
143 uNoteTitles.Free;
144 uNoteTitles := nil;
145 LoadNoteTitles;
146 end;
147end;
148
149function DfltNoteTitle: Integer;
150{ returns the IEN of the user defined default progress note title (if any) }
151begin
152 if uNoteTitles = nil then LoadNoteTitles;
153 Result := uNoteTitles.DfltTitle;
154end;
155
156function DfltNoteTitleName: string;
157{ returns the name of the user defined default progress note title (if any) }
158begin
159 if uNoteTitles = nil then LoadNoteTitles;
160 Result := uNoteTitles.DfltTitleName;
161end;
162
163function IsConsultTitle(TitleIEN: Integer): Boolean;
164begin
165 Result := False;
166 if TitleIEN <= 0 then Exit;
167 Result := sCallV('TIU IS THIS A CONSULT?', [TitleIEN]) = '1';
168end;
169
170function IsPRFTitle(TitleIEN: Integer): Boolean;
171begin
172 Result := False;
173 if TitleIEN <= 0 then Exit;
174 Result := sCallV('TIU ISPRF', [TitleIEN]) = '1';
175end;
176
177function IsClinProcTitle(TitleIEN: Integer): Boolean;
178begin
179 Result := False;
180 if TitleIEN <= 0 then Exit;
181 Result := sCallV('TIU IS THIS A CLINPROC?', [TitleIEN]) = '1';
182end;
183
184procedure ListNoteTitlesShort(Dest: TStrings);
185{ returns the user defined list (short list) of progress note titles }
186begin
187 if uNoteTitles = nil then LoadNoteTitles;
188 Dest.AddStrings(uNoteTitles.ShortList);
189 if uNoteTitles.ShortList.Count > 0 then
190 begin
191 Dest.Add('0^________________________________________________________________________');
192 Dest.Add('0^ ');
193 end;
194end;
195
196procedure LoadBoilerPlate(Dest: TStrings; Title: Integer);
197{ returns the boilerplate text (if any) for a given progress note title }
198begin
199 CallV('TIU LOAD BOILERPLATE TEXT', [Title, Patient.DFN, Encounter.VisitStr]);
200 Dest.Assign(RPCBrokerV.Results);
201end;
202
203function PrintNameForTitle(TitleIEN: Integer): string;
204begin
205 Result := sCallV('TIU GET PRINT NAME', [TitleIEN]);
206end;
207
208function SubSetOfNoteTitles(const StartFrom: string; Direction: Integer; IDNotesOnly: boolean): TStrings;
209{ returns a pointer to a list of progress note titles (for use in a long list box) -
210 The return value is a pointer to RPCBrokerV.Results, so the data must be used BEFORE
211 the next broker call! }
212begin
213 if IDNotesOnly then
214 CallV('TIU LONG LIST OF TITLES', [CLS_PROGRESS_NOTES, StartFrom, Direction, IDNotesOnly])
215 else
216 CallV('TIU LONG LIST OF TITLES', [CLS_PROGRESS_NOTES, StartFrom, Direction]);
217 //MixedCaseList(RPCBrokerV.Results);
218 Result := RPCBrokerV.Results;
219end;
220
221{ TIU Preferences ------------------------------------------------------------------------- }
222
223procedure LoadTIUPrefs;
224{ private - creates TIUPrefs object for reference throughout the session }
225var
226 x: string;
227begin
228 uTIUPrefs := TTIUPrefs.Create;
229 with uTIUPrefs do
230 begin
231 x := sCallV('TIU GET PERSONAL PREFERENCES', [User.DUZ]);
232 DfltLoc := StrToIntDef(Piece(x, U, 2), 0);
233 DfltLocName := ExternalName(DfltLoc, FN_HOSPITAL_LOCATION);
234 SortAscending := Piece(x, U, 4) = 'A';
235 SortBy := Piece(x, U, 3);
236 AskNoteSubject := Piece(x, U, 8) = '1';
237 DfltCosigner := StrToInt64Def(Piece(x, U, 9), 0);
238 DfltCosignerName := ExternalName(DfltCosigner, FN_NEW_PERSON);
239 MaxNotes := StrToIntDef(Piece(x, U, 10), 0);
240 x := sCallV('TIU REQUIRES COSIGNATURE', [TYP_PROGRESS_NOTE, 0, User.DUZ]);
241 AskCosigner := Piece(x, U, 1) = '1';
242 end;
243end;
244
245procedure ResetTIUPreferences;
246begin
247 if uTIUPrefs <> nil then
248 begin
249 uTIUPrefs.Free;
250 uTIUPrefs := nil;
251 LoadTIUPrefs;
252 end;
253end;
254
255function AskCosignerForDocument(ADocument: Integer; AnAuthor: Int64): Boolean;
256begin
257 Result := Piece(sCallV('TIU REQUIRES COSIGNATURE', [0, ADocument, AnAuthor]), U, 1) = '1';
258end;
259
260function AskCosignerForTitle(ATitle: integer; AnAuthor: Int64; ADate: TFMDateTime): Boolean;
261{ returns TRUE if a cosignature is required for a document title and author }
262begin
263 if TIUPatch175Installed then
264 Result := Piece(sCallV('TIU REQUIRES COSIGNATURE', [ATitle, 0, AnAuthor, ADate]), U, 1) = '1'
265 else
266 Result := Piece(sCallV('TIU REQUIRES COSIGNATURE', [ATitle, 0, AnAuthor]), U, 1) = '1';
267end;
268
269function AskCosignerForNotes: Boolean;
270{ returns true if cosigner should be asked when creating a new progress note }
271begin
272 if uTIUPrefs = nil then LoadTIUPrefs;
273 Result := uTIUPrefs.AskCosigner;
274end;
275
276function AskSubjectForNotes: Boolean;
277{ returns true if subject should be asked when creating a new progress note }
278begin
279 if uTIUPrefs = nil then LoadTIUPrefs;
280 Result := uTIUPrefs.AskNoteSubject;
281end;
282
283function CanCosign(ATitle, ADocType: integer; AUser: Int64; ADate: TFMDateTime): Boolean;
284begin
285 if ATitle > 0 then ADocType := 0;
286 if TIUPatch175Installed and (ADocType = 0) then
287 Result := Piece(sCallV('TIU REQUIRES COSIGNATURE', [ATitle, ADocType, AUser, ADate]), U, 1) <> '1'
288 else
289 Result := Piece(sCallV('TIU REQUIRES COSIGNATURE', [ATitle, ADocType, AUser]), U, 1) <> '1';
290end;
291
292procedure DefaultCosigner(var IEN: Int64; var Name: string);
293{ returns the IEN (from the New Person file) and Name of this user's default cosigner }
294begin
295 if uTIUPrefs = nil then LoadTIUPrefs;
296 IEN := uTIUPrefs.DfltCosigner;
297 Name := uTIUPrefs.DfltCosignerName;
298end;
299
300function ReturnMaxNotes: Integer;
301begin
302 if uTIUPrefs = nil then LoadTIUPrefs;
303 Result := uTIUPrefs.MaxNotes;
304 if Result = 0 then Result := 100;
305end;
306
307function SortNotesAscending: Boolean;
308{ returns true if progress notes should be sorted from oldest to newest (chronological) }
309begin
310 if uTIUPrefs = nil then LoadTIUPrefs;
311 Result := uTIUPrefs.SortAscending;
312end;
313
314function DfltTIULocation: Integer;
315{ returns the IEN of the user defined default progress note title (if any) }
316begin
317 if uTIUPrefs = nil then LoadTIUPrefs;
318 Result := uTIUPrefs.DfltLoc;
319end;
320
321function DfltTIULocationName: string;
322{ returns the name of the user defined default progress note title (if any) }
323begin
324 if uTIUPrefs = nil then LoadTIUPrefs;
325 Result := uTIUPrefs.DfltLocName;
326end;
327
328{ Data Retrieval --------------------------------------------------------------------------- }
329
330procedure ActOnDocument(var AuthSts: TActionRec; IEN: Integer; const ActionName: string);
331var
332 x: string;
333begin
334 if not (IEN > 0) then
335 begin
336 AuthSts.Success := True;
337 AuthSts.Reason := '';
338 Exit;
339 end;
340 x := sCallV('TIU AUTHORIZATION', [IEN, ActionName]);
341 AuthSts.Success := Piece(x, U, 1) = '1';
342 AuthSts.Reason := Piece(x, U, 2);
343end;
344
345function AuthorSignedDocument(IEN: Integer): boolean;
346begin
347 Result := SCallV('TIU HAS AUTHOR SIGNED?', [IEN, User.DUZ]) = '1';
348end;
349
350function CosignDocument(IEN: Integer): Boolean;
351var
352 x: string;
353begin
354 x := sCallV('TIU WHICH SIGNATURE ACTION', [IEN]);
355 Result := x = 'COSIGNATURE';
356end;
357
358(*function CPTRequiredForNote(IEN: Integer): Boolean;
359begin
360 If IEN > 0 then
361 Result := sCallV('ORWPCE CPTREQD', [IEN]) = '1'
362 else
363 Result := False;
364end;*)
365
366procedure ListConsultRequests(Dest: TStrings);
367{ lists outstanding consult requests for a patient: IEN^Request D/T^Service^Procedure }
368begin
369 CallV('GMRC LIST CONSULT REQUESTS', [Patient.DFN]);
370 //MixedCaseList(RPCBrokerV.Results);
371 { remove first returned string, it is just a count }
372 if RPCBrokerV.Results.Count > 0 then RPCBrokerV.Results.Delete(0);
373 SetListFMDateTime('mmm dd,yy hh:nn', TStringList(RPCBrokerV.Results), U, 2);
374 Dest.Assign(RPCBrokerV.Results);
375end;
376
377procedure ListNotes(Dest: TStrings; Context: Integer; Early, Late: TFMDateTime;
378 Person: int64; OccLim: Integer; SortAscending: Boolean);
379{ retrieves existing progress notes for a patient according to the parameters passed in
380 Pieces: IEN^Title^FMDateOfNote^Patient^Author^Location^Status^Visit
381 Return: IEN^ExDateOfNote^Title, Location, Author^ImageCount^Visit }
382var
383 i: Integer;
384 x: string;
385 SortSeq: Char;
386begin
387 if SortAscending then SortSeq := 'A' else SortSeq := 'D';
388 //if OccLim = 0 then OccLim := MaxNotesReturned;
389 CallV('TIU DOCUMENTS BY CONTEXT',
390 [3, Context, Patient.DFN, Early, Late, Person, OccLim, SortSeq]);
391 with RPCBrokerV do
392 begin
393 for i := 0 to Results.Count - 1 do
394 begin
395 x := Results[i];
396 x := Piece(x, U, 1) + U + FormatFMDateTime('mmm dd,yy', MakeFMDateTime(Piece(x, U, 3))) +
397 U + Piece(x, U, 2) + ', ' + Piece(x, U, 6) + ', ' + Piece(Piece(x, U, 5), ';', 2) +
398 U + Piece(x, U, 11) + U + Piece(x, U, 8) + U + Piece(x, U, 3);
399 Results[i] := x;
400 end; {for}
401 Dest.Assign(Results);
402 end; {with}
403end;
404
405procedure ListNotesForTree(Dest: TStrings; Context: Integer; Early, Late: TFMDateTime;
406 Person: int64; OccLim: Integer; SortAscending: Boolean);
407{ retrieves existing progress notes for a patient according to the parameters passed in
408 Pieces: IEN^Title^FMDateOfNote^Patient^Author^Location^Status^Visit
409 Return: IEN^ExDateOfNote^Title, Location, Author^ImageCount^Visit }
410var
411 SortSeq: Char;
412const
413 SHOW_ADDENDA = True;
414begin
415 if SortAscending then SortSeq := 'A' else SortSeq := 'D';
416 if Context > 0 then
417 begin
418 CallV('TIU DOCUMENTS BY CONTEXT', [3, Context, Patient.DFN, Early, Late, Person, OccLim, SortSeq, SHOW_ADDENDA]);
419 Dest.Assign(RPCBrokerV.Results);
420 end;
421end;
422
423
424procedure ListDCSumm(Dest: TStrings);
425{ returns the list of discharge summaries for a patient - see ListNotes for pieces }
426var
427 i: Integer;
428 x: string;
429begin
430 CallV('TIU SUMMARIES', [Patient.DFN]);
431 with RPCBrokerV do
432 begin
433 SortByPiece(TStringList(Results), U, 3); // sort on date/time of summary
434 for i := 0 to Results.Count - 1 do
435 begin
436 x := Results[i];
437 x := Piece(x, U, 1) + U + FormatFMDateTime('mmm dd,yy', MakeFMDateTime(Piece(x, U, 3)))
438 + U + Piece(x, U, 2) + ', ' + Piece(x, U, 6) + ', ' + Piece(Piece(x, U, 5), ';', 2);
439 Results[i] := x;
440 end; {for}
441 Dest.Assign(Results);
442 end; {with}
443end;
444
445procedure LoadDocumentText(Dest: TStrings; IEN: Integer);
446{ returns the text of a document (progress note, discharge summary, etc.) }
447begin
448 CallV('TIU GET RECORD TEXT', [IEN]);
449 Dest.Assign(RPCBrokerV.Results);
450end;
451
452procedure LoadDetailText(Dest: TStrings; IEN: Integer); //**KCM**
453begin
454 CallV('TIU DETAILED DISPLAY', [IEN]);
455 Dest.Assign(RPCBrokerV.Results);
456end;
457
458procedure GetNoteForEdit(var EditRec: TEditNoteRec; IEN: Integer);
459{ retrieves internal/external values for progress note fields & loads them into EditRec
460 Fields: Title:.01, RefDate:1301, Author:1204, Cosigner:1208, Subject:1701, Location:1205 }
461var
462 i, j: Integer;
463 //x: string;
464
465 function FindDT(const FieldID: string): TFMDateTime;
466 var
467 i: Integer;
468 begin
469 Result := 0;
470 with RPCBrokerV do for i := 0 to Results.Count - 1 do
471 if Piece(Results[i], U, 1) = FieldID then
472 begin
473 Result := MakeFMDateTime(Piece(Results[i], U, 2));
474 Break;
475 end;
476 end;
477
478 function FindExt(const FieldID: string): string;
479 var
480 i: Integer;
481 begin
482 Result := '';
483 with RPCBrokerV do for i := 0 to Results.Count - 1 do
484 if Piece(Results[i], U, 1) = FieldID then
485 begin
486 Result := Piece(Results[i], U, 3);
487 Break;
488 end;
489 end;
490
491 function FindInt(const FieldID: string): Integer;
492 var
493 i: Integer;
494 begin
495 Result := 0;
496 with RPCBrokerV do for i := 0 to Results.Count - 1 do
497 if Piece(Results[i], U, 1) = FieldID then
498 begin
499 Result := StrToIntDef(Piece(Results[i], U, 2), 0);
500 Break;
501 end;
502 end;
503
504 function FindInt64(const FieldID: string): Int64;
505 var
506 i: Integer;
507 begin
508 Result := 0;
509 with RPCBrokerV do for i := 0 to Results.Count - 1 do
510 if Piece(Results[i], U, 1) = FieldID then
511 begin
512 Result := StrToInt64Def(Piece(Results[i], U, 2), 0);
513 Break;
514 end;
515 end;
516
517 function FindVal(const FieldID: string): string;
518 var
519 i: Integer;
520 begin
521 Result := '';
522 with RPCBrokerV do for i := 0 to Results.Count - 1 do
523 if Piece(Results[i], U, 1) = FieldID then
524 begin
525 Result := Piece(Results[i], U, 2);
526 Break;
527 end;
528 end;
529
530begin
531 CallV('TIU LOAD RECORD FOR EDIT', [IEN, '.01;.06;.07;1301;1204;1208;1701;1205;1405;2101;70201;70202']);
532 FillChar(EditRec, SizeOf(EditRec), 0);
533 with EditRec do
534 begin
535 Title := FindInt('.01');
536 TitleName := FindExt('.01');
537 DateTime := FindDT('1301');
538 Author := FindInt64('1204');
539 AuthorName := FindExt('1204');
540 Cosigner := FindInt64('1208');
541 CosignerName := FindExt('1208');
542 Subject := FindExt('1701');
543 Location := FindInt('1205');
544 LocationName := FindExt('1205');
545 IDParent := FindInt('2101');
546 ClinProcSummCode := FindInt('70201');
547 ClinProcDateTime := FindDT('70202');
548 VisitDate := FindDT('.07');
549 PkgRef := FindVal('1405');
550 PkgIEN := StrToIntDef(Piece(PkgRef, ';', 1), 0);
551 PkgPtr := Piece(PkgRef, ';', 2);
552 if Title = TYP_ADDENDUM then Addend := FindInt('.06');
553 with RPCBrokerV do
554 begin
555 for i := 0 to Results.Count - 1 do if Results[i] = '$TXT' then break;
556 for j := i downto 0 do Results.Delete(j);
557 // -------------------- v19.1 (RV) LOST NOTES?----------------------------
558 //Lines := Results; 'Lines' is being overwritten by subsequent Broker calls
559 if not Assigned(Lines) then Lines := TStringList.Create;
560 Lines.Assign(Results);
561 // -----------------------------------------------------------------------
562 end;
563 end;
564end;
565
566function VisitStrForNote(IEN: Integer): string;
567begin
568 Result := sCallV('ORWPCE NOTEVSTR', [IEN]);
569end;
570
571function TitleForNote(IEN: Int64): Integer;
572begin
573 Result := StrToIntDef(sCallV('TIU GET DOCUMENT TITLE', [IEN]), 3);
574// with RPCBrokerV do
575// begin
576// ClearParameters := True;
577// RemoteProcedure := 'XWB GET VARIABLE VALUE';
578// Param[0].PType := reference;
579// Param[0].Value := '$G(^TIU(8925,' + IntToStr(IEN) + ',0))';
580// CallBroker;
581// Result := StrToIntDef(Piece(Results[0], U, 1), 3);
582// end;
583end;
584
585function GetPackageRefForNote(NoteIEN: integer): string;
586begin
587 Result := sCallV('TIU GET REQUEST', [NoteIEN]);
588end;
589
590function GetConsultIENforNote(NoteIEN: integer): Integer;
591var
592 x: string;
593begin
594 x := sCallV('TIU GET REQUEST', [NoteIEN]);
595 if Piece(x, ';', 2) <> PKG_CONSULTS then
596 Result := -1
597 else
598 Result := StrTOIntDef(Piece(x, ';', 1), -1);
599end;
600
601procedure LockDocument(IEN: Int64; var AnErrMsg: string);
602var
603 x: string;
604begin
605 x := sCallV('TIU LOCK RECORD', [IEN]);
606 if CharAt(x, 1) = '0' then AnErrMsg := '' else AnErrMsg := Piece(x, U, 2);
607end;
608
609procedure UnlockDocument(IEN: Int64);
610begin
611 CallV('TIU UNLOCK RECORD', [IEN]);
612end;
613
614function LastSaveClean(IEN: Int64): Boolean;
615begin
616 Result := sCallV('TIU WAS THIS SAVED?', [IEN]) = '1';
617end;
618
619function GetTIUListItem(IEN: Int64): string;
620begin
621 Result := sCallV('ORWTIU GET LISTBOX ITEM', [IEN]);
622end;
623
624{ Data Updates ----------------------------------------------------------------------------- }
625
626(*procedure ClearCPTRequired(IEN: Integer);
627{ sets CREDIT STOP CODE ON COMPLETION to NO when no more need to get encounter information }
628begin
629 with RPCBrokerV do
630 begin
631 ClearParameters := True;
632 RemoteProcedure := 'TIU UPDATE RECORD';
633 Param[0].PType := literal;
634 Param[0].Value := IntToStr(IEN);
635 Param[1].PType := list;
636 with Param[1] do Mult['.11'] := '0'; // **** block removed in v19.1 {RV} ****
637 CallBroker;
638 end;
639end;*)
640
641procedure DeleteDocument(var DeleteSts: TActionRec; IEN: Integer; const Reason: string);
642{ delete a TIU document given the internal entry number, return reason if unable to delete }
643var
644 x: string;
645begin
646 x := sCallV('TIU DELETE RECORD', [IEN, Reason]);
647 DeleteSts.Success := Piece(x, U, 1) = '0';
648 DeleteSts.Reason := Piece(x, U, 2);
649end;
650
651function JustifyDocumentDelete(IEN: Integer): Boolean;
652begin
653 Result := sCallV('TIU JUSTIFY DELETE?', [IEN]) = '1';
654end;
655
656procedure SignDocument(var SignSts: TActionRec; IEN: Integer; const ESCode: string);
657{ update signed status of a TIU document, return reason if signature is not accepted }
658var
659 x: string;
660begin
661(* with RPCBrokerV do // temp - to insure sign doesn't go interactive
662 begin
663 ClearParameters := True;
664 RemoteProcedure := 'TIU UPDATE RECORD';
665 Param[0].PType := literal;
666 Param[0].Value := IntToStr(IEN);
667 Param[1].PType := list;
668 with Param[1] do Mult['.11'] := '0'; // **** block removed in v19.1 {RV} ****
669 CallBroker;
670 end; // temp - end*)
671 x := sCallV('TIU SIGN RECORD', [IEN, ESCode]);
672 SignSts.Success := Piece(x, U, 1) = '0';
673 SignSts.Reason := Piece(x, U, 2);
674end;
675
676procedure PutNewNote(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec);
677{ create a new progress note with the data in NoteRec and return its internal entry number
678 load broker directly since there isn't a good way to set up mutilple subscript arrays }
679(*var
680 i: Integer;*)
681var
682 ErrMsg: string;
683begin
684 with RPCBrokerV do
685 begin
686 ClearParameters := True;
687 RemoteProcedure := 'TIU CREATE RECORD';
688 Param[0].PType := literal;
689 Param[0].Value := Patient.DFN; //*DFN*
690 Param[1].PType := literal;
691 Param[1].Value := IntToStr(NoteRec.Title);
692 Param[2].PType := literal;
693 Param[2].Value := ''; //FloatToStr(Encounter.DateTime);
694 Param[3].PType := literal;
695 Param[3].Value := ''; //IntToStr(Encounter.Location);
696 Param[4].PType := literal;
697 Param[4].Value := '';
698 Param[5].PType := list;
699 with Param[5] do
700 begin
701 //Mult['.11'] := BOOLCHAR[NoteRec.NeedCPT]; // **** removed in v19.1 {RV} ****
702 Mult['1202'] := IntToStr(NoteRec.Author);
703 Mult['1301'] := FloatToStr(NoteRec.DateTime);
704 Mult['1205'] := IntToStr(Encounter.Location);
705 if NoteRec.Cosigner > 0 then Mult['1208'] := IntToStr(NoteRec.Cosigner);
706 if NoteRec.PkgRef <> '' then Mult['1405'] := NoteRec.PkgRef;
707 Mult['1701'] := FilteredString(Copy(NoteRec.Subject, 1, 80));
708 if NoteRec.IDParent > 0 then Mult['2101'] := IntToStr(NoteRec.IDParent);
709(* if NoteRec.Lines <> nil then
710 for i := 0 to NoteRec.Lines.Count - 1 do
711 Mult['"TEXT",' + IntToStr(i+1) + ',0'] := FilteredString(NoteRec.Lines[i]);*)
712 end;
713 Param[6].PType := literal;
714 Param[6].Value := Encounter.VisitStr;
715 Param[7].PType := literal;
716 Param[7].Value := '1'; // suppress commit logic
717 CallBroker;
718 CreatedDoc.IEN := StrToIntDef(Piece(Results[0], U, 1), 0);
719 CreatedDoc.ErrorText := Piece(Results[0], U, 2);
720 end;
721 if ( NoteRec.Lines <> nil ) and ( CreatedDoc.IEN <> 0 ) then
722 begin
723 SetText(ErrMsg, NoteRec.Lines, CreatedDoc.IEN, 1);
724 if ErrMsg <> '' then
725 begin
726 CreatedDoc.IEN := 0;
727 CreatedDoc.ErrorText := ErrMsg;
728 end;
729 end;
730end;
731
732procedure PutAddendum(var CreatedDoc: TCreatedDoc; const NoteRec: TNoteRec; AddendumTo: Integer);
733{ create a new addendum for note identified in AddendumTo, returns IEN of new document
734 load broker directly since there isn't a good way to set up mutilple subscript arrays }
735(*var
736 i: Integer;*)
737var
738 ErrMsg: string;
739begin
740 with RPCBrokerV do
741 begin
742 ClearParameters := True;
743 RemoteProcedure := 'TIU CREATE ADDENDUM RECORD';
744 Param[0].PType := literal;
745 Param[0].Value := IntToStr(AddendumTo);
746 Param[1].PType := list;
747 with Param[1] do
748 begin
749 Mult['1202'] := IntToStr(NoteRec.Author);
750 Mult['1301'] := FloatToStr(NoteRec.DateTime);
751 if NoteRec.Cosigner > 0 then Mult['1208'] := IntToStr(NoteRec.Cosigner);
752(* if NoteRec.Lines <> nil then
753 for i := 0 to NoteRec.Lines.Count - 1 do
754 Mult['"TEXT",' + IntToStr(i+1) + ',0'] := FilteredString(NoteRec.Lines[i]);*)
755 end;
756 Param[2].PType := literal;
757 Param[2].Value := '1'; // suppress commit logic
758 CallBroker;
759 CreatedDoc.IEN := StrToIntDef(Piece(Results[0], U, 1), 0);
760 CreatedDoc.ErrorText := Piece(Results[0], U, 2);
761 end;
762 if ( NoteRec.Lines <> nil ) and ( CreatedDoc.IEN <> 0 ) then
763 begin
764 SetText(ErrMsg, NoteRec.Lines, CreatedDoc.IEN, 1);
765 if ErrMsg <> '' then
766 begin
767 CreatedDoc.IEN := 0;
768 CreatedDoc.ErrorText := ErrMsg;
769 end;
770 end;
771end;
772
773procedure PutEditedNote(var UpdatedDoc: TCreatedDoc; const NoteRec: TNoteRec; NoteIEN: Integer);
774{ update the fields and content of the note identified in NoteIEN, returns 1 if successful
775 load broker directly since there isn't a good way to set up mutilple subscript arrays }
776(*var
777 i: Integer;*)
778var
779 ErrMsg: string;
780begin
781 // First, file field data
782 with RPCBrokerV do
783 begin
784 ClearParameters := True;
785 RemoteProcedure := 'TIU UPDATE RECORD';
786 Param[0].PType := literal;
787 Param[0].Value := IntToStr(NoteIEN);
788 Param[1].PType := list;
789 with Param[1] do
790 begin
791 if NoteRec.Addend = 0 then
792 begin
793 Mult['.01'] := IntToStr(NoteRec.Title);
794 //Mult['.11'] := BOOLCHAR[NoteRec.NeedCPT]; // **** removed in v19.1 {RV} ****
795 end;
796 Mult['1202'] := IntToStr(NoteRec.Author);
797 if NoteRec.Cosigner > 0 then Mult['1208'] := IntToStr(NoteRec.Cosigner);
798 if NoteRec.PkgRef <> '' then Mult['1405'] := NoteRec.PkgRef;
799 Mult['1301'] := FloatToStr(NoteRec.DateTime);
800 Mult['1701'] := FilteredString(Copy(NoteRec.Subject, 1, 80));
801 if NoteRec.ClinProcSummCode > 0 then Mult['70201'] := IntToStr(NoteRec.ClinProcSummCode);
802 if NoteRec.ClinProcDateTime > 0 then Mult['70202'] := FloatToStr(NoteRec.ClinProcDateTime);
803(* for i := 0 to NoteRec.Lines.Count - 1 do
804 Mult['"TEXT",' + IntToStr(i+1) + ',0'] := FilteredString(NoteRec.Lines[i]);*)
805 end;
806 CallBroker;
807 UpdatedDoc.IEN := StrToIntDef(Piece(Results[0], U, 1), 0);
808 UpdatedDoc.ErrorText := Piece(Results[0], U, 2);
809 end;
810
811 if UpdatedDoc.IEN <= 0 then //v22.12 - RV
812 //if UpdatedDoc.ErrorText <> '' then //v22.5 - RV
813 begin
814 UpdatedDoc.ErrorText := UpdatedDoc.ErrorText + #13#10 + #13#10 + 'Document #: ' + IntToStr(NoteIEN);
815 exit;
816 end;
817
818 // next, if no error, file document body
819 SetText(ErrMsg, NoteRec.Lines, NoteIEN, 0);
820 if ErrMsg <> '' then
821 begin
822 UpdatedDoc.IEN := 0;
823 UpdatedDoc.ErrorText := ErrMsg;
824 end;
825end;
826
827procedure PutTextOnly(var ErrMsg: string; NoteText: TStrings; NoteIEN: Int64);
828var
829 i: Integer;
830begin
831 with RPCBrokerV do
832 begin
833 ClearParameters := True;
834 RemoteProcedure := 'TIU UPDATE RECORD';
835 Param[0].PType := literal;
836 Param[0].Value := IntToStr(NoteIEN);
837 Param[1].PType := list;
838 for i := 0 to Pred(NoteText.Count) do
839 Param[1].Mult['"TEXT",' + IntToStr(Succ(i)) + ',0'] := FilteredString(NoteText[i]);
840 Param[2].PType := literal;
841 Param[2].Value :='1'; // suppress commit code
842 CallBroker;
843 if Piece(Results[0], U, 1) = '0' then ErrMsg := Piece(Results[0], U, 2) else ErrMsg := '';
844 end;
845end;
846
847procedure SetText(var ErrMsg: string; NoteText: TStrings; NoteIEN: Int64; Suppress: Integer);
848const
849 DOCUMENT_PAGE_SIZE = 300;
850 TX_SERVER_ERROR = 'An error occurred on the server.' ;
851var
852 i, j, page, pages: Integer;
853begin
854 // Compute pages, initialize Params
855 pages := ( NoteText.Count div DOCUMENT_PAGE_SIZE );
856 if (NoteText.Count mod DOCUMENT_PAGE_SIZE) > 0 then pages := pages + 1;
857 page := 1;
858 InitParams( NoteIEN, Suppress );
859 // Loop through NoteRec.Lines
860 for i := 0 to NoteText.Count - 1 do
861 begin
862 j := i + 1;
863 //Add each successive line to Param[1].Mult...
864 RPCBrokerV.Param[1].Mult['"TEXT",' + IntToStr(j) + ',0'] := FilteredString(NoteText[i]);
865 // When current page is filled, call broker, increment page, itialize params,
866 // and continue...
867 if ( j mod DOCUMENT_PAGE_SIZE ) = 0 then
868 begin
869 RPCBrokerV.Param[1].Mult['"HDR"'] := IntToStr(page) + U + IntToStr(pages);
870 CallBroker;
871 if RPCBrokerV.Results.Count > 0 then
872 ErrMsg := Piece(RPCBrokerV.Results[0], U, 4)
873 else
874 ErrMsg := TX_SERVER_ERROR;
875 if ErrMsg <> '' then Exit;
876 page := page + 1;
877 InitParams( NoteIEN, Suppress );
878 end; // if
879 end; // for
880 // finally, file any remaining partial page
881 if ( NoteText.Count mod DOCUMENT_PAGE_SIZE ) <> 0 then
882 begin
883 RPCBrokerV.Param[1].Mult['"HDR"'] := IntToStr(page) + U + IntToStr(pages);
884 CallBroker;
885 if RPCBrokerV.Results.Count > 0 then
886 ErrMsg := Piece(RPCBrokerV.Results[0], U, 4)
887 else
888 ErrMsg := TX_SERVER_ERROR;
889 end;
890end;
891
892procedure InitParams( NoteIEN: Int64; Suppress: Integer );
893begin
894 with RPCBrokerV do
895 begin
896 ClearParameters := True;
897 RemoteProcedure := 'TIU SET DOCUMENT TEXT';
898 Param[0].PType := literal;
899 Param[0].Value := IntToStr(NoteIEN);
900 Param[1].PType := list;
901 Param[2].PType := literal;
902 Param[2].Value := IntToStr(Suppress);
903 end;
904end;
905
906{ Printing --------------------------------------------------------------------------------- }
907
908function AllowChartPrintForNote(ANote: Integer): Boolean;
909{ returns true if a progress note may be printed outside of MAS }
910begin
911 Result := (Piece(sCallV('TIU GET DOCUMENT PARAMETERS', [ANote]), U, 9) = '1');
912 // or (sCallV('TIU USER IS MEMBER OF CLASS', [User.DUZ, 'MEDICAL INFORMATION SECTION']) = '1');
913 // (V16? - RV) New TIU RPC required, per discussion on NOIS MAR-0900-21265
914end;
915
916procedure PrintNoteToDevice(ANote: Integer; const ADevice: string; ChartCopy: Boolean;
917 var ErrMsg: string);
918{ prints a progress note on the selected device }
919begin
920 ErrMsg := sCallV('TIU PRINT RECORD', [ANote, ADevice, ChartCopy]);
921 if Piece(ErrMsg, U, 1) = '0' then ErrMsg := '' else ErrMsg := Piece(ErrMsg, U, 2);
922end;
923
924function GetFormattedNote(ANote: Integer; ChartCopy: Boolean): TStrings;
925begin
926 CallV('ORWTIU WINPRINT NOTE',[ANote, ChartCopy]);
927 Result := RPCBrokerV.Results;
928end;
929
930function GetCurrentSigners(IEN: integer): TStrings;
931begin
932 CallV('TIU GET ADDITIONAL SIGNERS', [IEN]);
933 MixedCaseList(RPCBrokerV.Results);
934 Result := RPCBrokerV.Results ;
935end;
936
937procedure UpdateAdditionalSigners(IEN: integer; Signers: TStrings);
938begin
939 CallV('TIU UPDATE ADDITIONAL SIGNERS', [IEN, Signers]);
940end;
941
942function CanChangeCosigner(IEN: integer): boolean;
943begin
944 Result := Piece(sCallV('TIU CAN CHANGE COSIGNER?', [IEN]), U, 1) = '1';
945end;
946
947procedure ChangeCosigner(IEN: integer; Cosigner: int64);
948begin
949 with RPCBrokerV do
950 begin
951 ClearParameters := True;
952 RemoteProcedure := 'TIU UPDATE RECORD';
953 Param[0].PType := literal;
954 Param[0].Value := IntToStr(IEN);
955 Param[1].PType := list;
956 with Param[1] do
957 if Cosigner > 0 then
958 Mult['1208'] := IntToStr(Cosigner)
959 else
960 Mult['1208'] := '@';
961 CallBroker;
962 end;
963end;
964
965// Determine if given note title is allowed more than once per visit. 12/2002-GRE
966function OneNotePerVisit(NoteEIN: Integer; DFN: String; VisitStr: String):boolean;
967var x: string;
968begin
969 x := sCallV('TIU ONE VISIT NOTE?', [IntToStr(NoteEIN),DFN,VisitStr]);
970 if StrToInt(x) > 0 then
971 Result := True //Only one per visit
972 else
973 Result := False;
974end;
975
976function GetCurrentTIUContext: TTIUContext;
977var
978 x: string;
979 AContext: TTIUContext;
980begin
981 x := sCallV('ORWTIU GET TIU CONTEXT', [User.DUZ]) ;
982 with AContext do
983 begin
984 Changed := True;
985 BeginDate := Piece(x, ';', 1);
986 FMBeginDate := StrToFMDateTime(BeginDate);
987 EndDate := Piece(x, ';', 2);
988 FMEndDate := StrToFMDateTime(EndDate);
989 Status := Piece(x, ';', 3);
990 if (StrToIntDef(Status, 0) < 1) or (StrToIntDef(Status, 0) > 5) then Status := '1';
991 Author := StrToInt64Def(Piece(x, ';', 4), 0);
992 MaxDocs := StrToIntDef(Piece(x, ';', 5), 0);
993 ShowSubject := StrToIntDef(Piece(x, ';', 6), 0) > 0; //TIU PREFERENCE??
994 SortBy := Piece(x, ';', 7); //TIU PREFERENCE??
995 ListAscending := StrToIntDef(Piece(x, ';', 8), 0) > 0;
996 TreeAscending := StrToIntDef(Piece(x, ';', 9), 0) > 0; //TIU PREFERENCE??
997 GroupBy := Piece(x, ';', 10);
998 SearchField := Piece(x, ';', 11);
999 KeyWord := Piece(x, ';', 12);
1000 Filtered := (Keyword <> '');
1001 end;
1002 Result := AContext;
1003end;
1004
1005procedure SaveCurrentTIUContext(AContext: TTIUContext) ;
1006var
1007 x: string;
1008begin
1009 with AContext do
1010 begin
1011 SetPiece(x, ';', 1, BeginDate);
1012 SetPiece(x, ';', 2, EndDate);
1013 SetPiece(x, ';', 3, Status);
1014 if Author > 0 then
1015 SetPiece(x, ';', 4, IntToStr(Author))
1016 else
1017 SetPiece(x, ';', 4, '');
1018 SetPiece(x, ';', 5, IntToStr(MaxDocs));
1019 SetPiece(x, ';', 6, BOOLCHAR[ShowSubject]); //TIU PREFERENCE??
1020 SetPiece(x, ';', 7, SortBy); //TIU PREFERENCE??
1021 SetPiece(x, ';', 8, BOOLCHAR[ListAscending]);
1022 SetPiece(x, ';', 9, BOOLCHAR[TreeAscending]); //TIU PREFERENCE??
1023 SetPiece(x, ';', 10, GroupBy);
1024 SetPiece(x, ';', 11, SearchField);
1025 SetPiece(x, ';', 12, KeyWord);
1026 end;
1027 CallV('ORWTIU SAVE TIU CONTEXT', [x]);
1028end;
1029
1030function TIUSiteParams: string;
1031begin
1032 if(not uTIUSiteParamsLoaded) then
1033 begin
1034 uTIUSiteParams := sCallV('TIU GET SITE PARAMETERS', []) ;
1035 uTIUSiteParamsLoaded := TRUE;
1036 end;
1037 Result := uTIUSiteParams;
1038end;
1039
1040// ===================Interdisciplinary Notes RPCs =====================
1041
1042function IDNotesInstalled: boolean;
1043begin
1044 Result := True; // old patch check no longer called
1045end;
1046
1047function CanTitleBeIDChild(Title: integer; var WhyNot: string): boolean;
1048var
1049 x: string;
1050begin
1051 Result := False;
1052 x := sCallV('ORWTIU CANLINK', [Title]);
1053 if Piece(x, U, 1) = '1' then
1054 Result := True
1055 else if Piece(x, U, 1) = '0' then
1056 begin
1057 Result := False;
1058 WhyNot := Piece(x, U, 2);
1059 end;
1060end;
1061
1062function CanBeAttached(DocID: string; var WhyNot: string): boolean;
1063var
1064 x: string;
1065const
1066 TX_NO_ATTACH = 'This note appears to be an interdisciplinary parent. Please drag the child note you wish to ' + CRLF +
1067 'attach instead of attempting to drag the parent, or check with IRM or your' + CRLF +
1068 'clinical coordinator.';
1069begin
1070 Result := False;
1071 if StrToIntDef(DocID, 0) = 0 then exit;
1072 x := sCallV('TIU ID CAN ATTACH', [DocID]);
1073 if Piece(x, U, 1) = '1' then
1074 Result := True
1075 else if Piece(x, U, 1) = '0' then
1076 begin
1077 Result := False;
1078 WhyNot := Piece(x, U, 2);
1079 end
1080 else if Piece(x, U, 1) = '-1' then
1081 begin
1082 Result := False;
1083 WhyNot := TX_NO_ATTACH;
1084 end;
1085end;
1086
1087function CanReceiveAttachment(DocID: string; var WhyNot: string): boolean;
1088var
1089 x: string;
1090begin
1091 x := sCallV('TIU ID CAN RECEIVE', [DocID]);
1092 if Piece(x, U, 1) = '1' then
1093 Result := True
1094 else
1095 begin
1096 Result := False;
1097 WhyNot := Piece(x, U, 2);
1098 end;
1099end;
1100
1101function AttachEntryToParent(DocID, ParentDocID: string; var WhyNot: string): boolean;
1102var
1103 x: string;
1104begin
1105 x := sCallV('TIU ID ATTACH ENTRY', [DocID, ParentDocID]);
1106 if StrToIntDef(Piece(x, U, 1), 0) > 0 then
1107 Result := True
1108 else
1109 begin
1110 Result := False;
1111 WhyNot := Piece(x, U, 2);
1112 end;
1113end;
1114
1115function DetachEntryFromParent(DocID: string; var WhyNot: string): boolean;
1116var
1117 x: string;
1118begin
1119 x := sCallV('TIU ID DETACH ENTRY', [DocID]);
1120 if StrToIntDef(Piece(x, U, 1), 0) > 0 then
1121 Result := True
1122 else
1123 begin
1124 Result := False;
1125 WhyNot := Piece(x, U, 2);
1126 end;
1127end;
1128
1129function SubSetOfUserClasses(const StartFrom: string; Direction: Integer): TStrings;
1130begin
1131 CallV('TIU USER CLASS LONG LIST', [StartFrom, Direction]);
1132 Result := RPCBrokerV.Results;
1133end;
1134
1135function UserDivClassInfo(User: Int64): TStrings;
1136begin
1137 CallV('TIU DIV AND CLASS INFO', [User]);
1138 Result := RPCBrokerV.Results;
1139end;
1140
1141function UserInactive(EIN: String): boolean;
1142var x: string;
1143begin
1144 x:= sCallv('TIU USER INACTIVE?', [EIN]) ;
1145 if (StrToInt(x) > 0) then
1146 Result := True
1147 else
1148 Result := False;
1149end;
1150
1151function TIUPatch175Installed: boolean;
1152begin
1153 with uPatch175Installed do
1154 if not PatchChecked then
1155 begin
1156 PatchInstalled := ServerHasPatch('TIU*1.0*175');
1157 PatchChecked := True;
1158 end;
1159 Result := uPatch175Installed.PatchInstalled;
1160end;
1161
1162function NoteHasText(NoteIEN: integer): boolean;
1163begin
1164 Result := (StrToIntDef(sCallV('ORWTIU CHKTXT', [NoteIEN]), 0) > 0);
1165end;
1166
1167
1168initialization
1169 // nothing for now
1170
1171finalization
1172 if uNoteTitles <> nil then uNoteTitles.Free;
1173 if uTIUPrefs <> nil then uTIUPrefs.Free;
1174
1175end.
Note: See TracBrowser for help on using the repository browser.