1 | unit uTIU;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses SysUtils, Classes, ORNet, ORFn, rCore, uCore, uConst, ORCtrls, ComCtrls, Controls;
|
---|
6 |
|
---|
7 | type
|
---|
8 |
|
---|
9 | TEditNoteRec = record
|
---|
10 | DocType: Integer;
|
---|
11 | IsNewNote: boolean;
|
---|
12 | Title: Integer;
|
---|
13 | TitleName: string;
|
---|
14 | DateTime: TFMDateTime;
|
---|
15 | Author: Int64;
|
---|
16 | AuthorName: string;
|
---|
17 | Cosigner: Int64;
|
---|
18 | CosignerName: string;
|
---|
19 | Subject: string;
|
---|
20 | Location: Integer;
|
---|
21 | LocationName: string;
|
---|
22 | VisitDate: TFMDateTime;
|
---|
23 | PkgRef: string; // 'IEN;GMR(123,' or 'IEN;SRF('
|
---|
24 | PkgIEN: integer; // file IEN
|
---|
25 | PkgPtr: string; // 'GMR(123,' or 'SRF('
|
---|
26 | NeedCPT: Boolean;
|
---|
27 | Addend: Integer;
|
---|
28 | LastCosigner: Int64;
|
---|
29 | LastCosignerName: string;
|
---|
30 | IDParent: integer;
|
---|
31 | ClinProcSummCode: integer;
|
---|
32 | ClinProcDateTime: TFMDateTime;
|
---|
33 | Lines: TStrings;
|
---|
34 | end;
|
---|
35 |
|
---|
36 | TNoteRec = TEditNoteRec;
|
---|
37 |
|
---|
38 | TActionRec = record
|
---|
39 | Success: Boolean;
|
---|
40 | Reason: string;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | TCreatedDoc = record
|
---|
44 | IEN: Integer;
|
---|
45 | ErrorText: string;
|
---|
46 | end;
|
---|
47 |
|
---|
48 | TTIUContext = record
|
---|
49 | Changed: Boolean;
|
---|
50 | BeginDate: string;
|
---|
51 | EndDate: string;
|
---|
52 | FMBeginDate: TFMDateTime;
|
---|
53 | FMEndDate: TFMDateTime;
|
---|
54 | Status: string;
|
---|
55 | Author: int64;
|
---|
56 | MaxDocs: integer;
|
---|
57 | ShowSubject: Boolean;
|
---|
58 | SortBy: string;
|
---|
59 | ListAscending: Boolean;
|
---|
60 | GroupBy: string;
|
---|
61 | TreeAscending: Boolean;
|
---|
62 | SearchField: string;
|
---|
63 | KeyWord: string;
|
---|
64 | Filtered: Boolean;
|
---|
65 | end ;
|
---|
66 |
|
---|
67 | TNoteTitles = class
|
---|
68 | DfltTitle: Integer;
|
---|
69 | DfltTitleName: string;
|
---|
70 | ShortList: TStringList;
|
---|
71 | constructor Create;
|
---|
72 | destructor Destroy; override;
|
---|
73 | end;
|
---|
74 |
|
---|
75 | TTIUPrefs = class
|
---|
76 | DfltLoc: Integer;
|
---|
77 | DfltLocName: string;
|
---|
78 | SortAscending: Boolean;
|
---|
79 | SortBy: string; // D,R,S,A
|
---|
80 | AskNoteSubject: Boolean;
|
---|
81 | AskCosigner: Boolean;
|
---|
82 | DfltCosigner: Int64;
|
---|
83 | DfltCosignerName: string;
|
---|
84 | MaxNotes: Integer;
|
---|
85 | end;
|
---|
86 |
|
---|
87 | // notes tab specific procedures
|
---|
88 | function MakeNoteDisplayText(RawText: string): string;
|
---|
89 | function MakeConsultDisplayText(RawText:string): string;
|
---|
90 | function SetLinesTo74ForSave(AStrings: TStrings; AParent: TWinControl): TStrings;
|
---|
91 |
|
---|
92 | const
|
---|
93 | TX_SAVE_ERROR1 = 'An error was encountered while trying to save the note you are editing.' + CRLF + CRLF + ' Error: ';
|
---|
94 | TX_SAVE_ERROR2 = CRLF + CRLF + 'Please try again now using CTRL-SHIFT-S, or ''Save without signature''.' + CRLF +
|
---|
95 | 'These actions will improve the likelihood that no text will be lost.' + CRLF + CRLF +
|
---|
96 | 'If problems continue, or network connectivity is lost, please copy all of your text to' + CRLF +
|
---|
97 | 'the clipboard and paste it into Microsoft Word before continuing or before closing CPRS.';
|
---|
98 | TC_SAVE_ERROR = 'Error saving note text';
|
---|
99 |
|
---|
100 | implementation
|
---|
101 |
|
---|
102 | function MakeConsultDisplayText(RawText:string): string;
|
---|
103 | var
|
---|
104 | x: string;
|
---|
105 | begin
|
---|
106 | x := RawText;
|
---|
107 | Result := Piece(x, U, 2) + ',' + Piece(x, U, 3) + ',' +
|
---|
108 | Piece(x, U, 4) + ', '+ Piece(x, U, 5);
|
---|
109 |
|
---|
110 | end;
|
---|
111 |
|
---|
112 | function MakeNoteDisplayText(RawText: string): string;
|
---|
113 | var
|
---|
114 | x: string;
|
---|
115 | begin
|
---|
116 | x := RawText;
|
---|
117 | if Piece(x, U, 1) = '' then
|
---|
118 | Result := FormatFMDateTime('mmm dd,yy', MakeFMDateTime(Piece(x, U, 3))) + ' ' +
|
---|
119 | Piece(x, U, 2) + ', ' + Piece(x, U, 6) + ', ' + Piece(Piece(x, U, 5), ';', 2)
|
---|
120 | else if Piece(x, U, 1)[1] in ['A', 'N', 'E'] then
|
---|
121 | Result := Piece(x, U, 2)
|
---|
122 | else
|
---|
123 | Result := FormatFMDateTime('mmm dd,yy', MakeFMDateTime(Piece(x, U, 3))) + ' ' +
|
---|
124 | Piece(x, U, 2) + ', ' + Piece(x, U, 6) + ', ' + Piece(Piece(x, U, 5), ';', 2);
|
---|
125 | end;
|
---|
126 |
|
---|
127 |
|
---|
128 | { Progress Note Titles -------------------------------------------------------------------- }
|
---|
129 | constructor TNoteTitles.Create;
|
---|
130 | { creates an object to store progress note titles so only obtained from server once }
|
---|
131 | begin
|
---|
132 | inherited Create;
|
---|
133 | ShortList := TStringList.Create;
|
---|
134 | end;
|
---|
135 |
|
---|
136 | destructor TNoteTitles.Destroy;
|
---|
137 | { frees the lists that were used to store the progress note titles }
|
---|
138 | begin
|
---|
139 | ShortList.Free;
|
---|
140 | inherited Destroy;
|
---|
141 | end;
|
---|
142 |
|
---|
143 | function SetLinesTo74ForSave(AStrings: TStrings; AParent: TWinControl): TStrings;
|
---|
144 | var
|
---|
145 | ARichEdit74: TRichEdit;
|
---|
146 | begin
|
---|
147 | Result := AStrings;
|
---|
148 | ARichEdit74 := TRichEdit.Create(AParent);
|
---|
149 | try
|
---|
150 | with ARichEdit74 do
|
---|
151 | begin
|
---|
152 | Parent := AParent;
|
---|
153 | Lines.Text := AStrings.Text;
|
---|
154 | Width := 525;
|
---|
155 | Result.Assign(Lines);
|
---|
156 | end;
|
---|
157 | finally
|
---|
158 | ARichEdit74.Free;
|
---|
159 | end;
|
---|
160 | end;
|
---|
161 |
|
---|
162 | end.
|
---|