source: cprs/trunk/CPRS-Chart/rTIU.pas@ 1224

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

Upgrading to version 27

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