1 | unit fReportsPrint;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
7 | StdCtrls, fAutoSz, ORCtrls, ORNet, Mask, ComCtrls, rECS,
|
---|
8 | fBase508Form, VA508AccessibilityManager;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmReportPrt = class(TfrmBase508Form)
|
---|
12 | lblReportsTitle: TMemo;
|
---|
13 | lblPrintTo: TLabel;
|
---|
14 | grpDevice: TGroupBox;
|
---|
15 | lblMargin: TLabel;
|
---|
16 | lblLength: TLabel;
|
---|
17 | txtRightMargin: TMaskEdit;
|
---|
18 | txtPageLength: TMaskEdit;
|
---|
19 | cboDevice: TORComboBox;
|
---|
20 | cmdOK: TButton;
|
---|
21 | cmdCancel: TButton;
|
---|
22 | dlgWinPrinter: TPrintDialog;
|
---|
23 | chkDefault: TCheckBox;
|
---|
24 | procedure cboDeviceChange(Sender: TObject);
|
---|
25 | procedure cmdOKClick(Sender: TObject);
|
---|
26 | procedure cmdCancelClick(Sender: TObject);
|
---|
27 | procedure cboDeviceNeedData(Sender: TObject; const StartFrom: String;
|
---|
28 | Direction, InsertAt: Integer);
|
---|
29 | procedure FindVType;
|
---|
30 |
|
---|
31 | private
|
---|
32 | { Private declarations }
|
---|
33 | FReports: string;
|
---|
34 | FReportText: TRichEdit;
|
---|
35 | procedure DisplaySelectDevice;
|
---|
36 |
|
---|
37 | public
|
---|
38 | { Public declarations }
|
---|
39 | end;
|
---|
40 |
|
---|
41 | var
|
---|
42 | frmReportPrt: TfrmReportPrt;
|
---|
43 |
|
---|
44 | procedure PrintReports(AReports: string; const AReportsTitle: string);
|
---|
45 | function StringPad(aString: string; aStringCount, aPadCount: integer): String;
|
---|
46 |
|
---|
47 | implementation
|
---|
48 |
|
---|
49 | {$R *.DFM}
|
---|
50 |
|
---|
51 | uses ORFn, rCore, uCore, fReports, rReports, uReports, Printers, fFrame,
|
---|
52 | VAUtils;
|
---|
53 |
|
---|
54 | const
|
---|
55 | TX_NODEVICE = 'A device must be selected to print, or press ''Cancel'' to not print.';
|
---|
56 | TX_NODEVICE_CAP = 'Device Not Selected';
|
---|
57 | TX_ERR_CAP = 'Print Error';
|
---|
58 | PAGE_BREAK = '**PAGE BREAK**';
|
---|
59 | QT_OTHER = 0;
|
---|
60 | QT_HSTYPE = 1;
|
---|
61 | QT_DATERANGE = 2;
|
---|
62 | QT_IMAGING = 3;
|
---|
63 | QT_NUTR = 4;
|
---|
64 | QT_PROCEDURES = 19;
|
---|
65 | QT_SURGERY = 28;
|
---|
66 | QT_HSCOMPONENT = 5;
|
---|
67 | QT_HSWPCOMPONENT = 6;
|
---|
68 |
|
---|
69 | procedure PrintReports(AReports: string; const AReportsTitle: string);
|
---|
70 | { displays a form that prompts for a device and then prints the report }
|
---|
71 | var
|
---|
72 | frmReportPrt: TfrmReportPrt;
|
---|
73 | DefPrt: string;
|
---|
74 | begin
|
---|
75 | frmReportPrt := TfrmReportPrt.Create(Application);
|
---|
76 | try
|
---|
77 | ResizeAnchoredFormToFont(TForm(frmReportPrt));
|
---|
78 | with frmReportPrt do
|
---|
79 | begin
|
---|
80 | lblReportsTitle.Text := AReportsTitle;
|
---|
81 | FReports := AReports;
|
---|
82 | DefPrt := GetDefaultPrinter(User.Duz, Encounter.Location);
|
---|
83 | if User.CurrentPrinter = '' then User.CurrentPrinter := DefPrt;
|
---|
84 | with cboDevice do
|
---|
85 | begin
|
---|
86 | if Printer.Printers.Count > 0 then
|
---|
87 | begin
|
---|
88 | Items.Add('WIN;Windows Printer^Windows Printer');
|
---|
89 | Items.Add('^--------------------VistA Printers----------------------');
|
---|
90 | end;
|
---|
91 | if User.CurrentPrinter <> '' then
|
---|
92 | begin
|
---|
93 | InitLongList(Piece(User.CurrentPrinter, ';', 2));
|
---|
94 | SelectByID(User.CurrentPrinter);
|
---|
95 | end
|
---|
96 | else
|
---|
97 | InitLongList('');
|
---|
98 | end;
|
---|
99 | if (DefPrt = 'WIN;Windows Printer') and
|
---|
100 | (User.CurrentPrinter = DefPrt) then
|
---|
101 | cmdOKClick(frmReportPrt)
|
---|
102 | else
|
---|
103 | ShowModal;
|
---|
104 | end;
|
---|
105 | finally
|
---|
106 | frmReportPrt.Release;
|
---|
107 | end;
|
---|
108 | end;
|
---|
109 |
|
---|
110 | procedure TfrmReportPrt.FindVType;
|
---|
111 | var
|
---|
112 | i,j,k,L,cnt: integer;
|
---|
113 | aBasket: TStringList;
|
---|
114 | aID, aHead, aData, aCol, x: string;
|
---|
115 | ListItem: TListItem;
|
---|
116 | aWPFlag: Boolean;
|
---|
117 | begin
|
---|
118 | aBasket := TStringList.Create;
|
---|
119 | aBasket.Clear;
|
---|
120 | //frmReports.MemText.Clear;
|
---|
121 | aHead := '';
|
---|
122 | cnt := 2;
|
---|
123 | //aWPFlag := false;
|
---|
124 | for i := 0 to uColumns.Count - 1 do
|
---|
125 | begin
|
---|
126 | if (piece(uColumns[i],'^',7) = '1') and (not(piece(uColumns[i],'^',4) = '1')) then
|
---|
127 | begin
|
---|
128 | L := StrToIntDef(piece(uColumns[i],'^',6),15);
|
---|
129 | if length(piece(uColumns[i],'^',8)) > 0 then
|
---|
130 | x := piece(uColumns[i],'^',8)
|
---|
131 | else
|
---|
132 | x := piece(uColumns[i],'^',1);
|
---|
133 | x := StringPad(x, L, L+1);
|
---|
134 | if frmReports.TabControl1.Tabs.Count > 1 then
|
---|
135 | aHead := aHead + x
|
---|
136 | else
|
---|
137 | if i = 0 then
|
---|
138 | continue
|
---|
139 | else
|
---|
140 | aHead := aHead + x;
|
---|
141 | end;
|
---|
142 | end;
|
---|
143 | if length(aHead) > 0 then
|
---|
144 | begin
|
---|
145 | FReportText.Lines.Add(aHead);
|
---|
146 | FReportText.Lines.Add('-------------------------------------------------------------------------------');
|
---|
147 | //frmReports.memText.Lines.Add(aHead);
|
---|
148 | //frmReports.MemText.Lines.Add('-------------------------------------------------------------------------------');
|
---|
149 | end;
|
---|
150 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
151 | if frmReports.lvReports.Items[i].Selected then
|
---|
152 | begin
|
---|
153 | aData := '';
|
---|
154 | aWPFlag := false;
|
---|
155 | ListItem := frmReports.lvReports.Items[i];
|
---|
156 | aID := ListItem.SubItems[0];
|
---|
157 | if frmReports.TabControl1.Tabs.Count > 1 then
|
---|
158 | begin
|
---|
159 | L := StrToIntDef(piece(uColumns[0],'^',6),10);
|
---|
160 | x := StringPad(ListItem.Caption, L, L+1);
|
---|
161 | aData := x;
|
---|
162 | end;
|
---|
163 | for j := 0 to RowObjects.ColumnList.Count - 1 do
|
---|
164 | begin
|
---|
165 | aCol := TCellObject(RowObjects.ColumnList[j]).Handle;
|
---|
166 | if piece(aID,':',1) = piece(TCellObject(RowObjects.ColumnList[j]).Handle,':',1) then
|
---|
167 | if ListItem.Caption = (piece(TCellObject(RowObjects.ColumnList[j]).Site,';',1)) then
|
---|
168 | begin
|
---|
169 | if (piece(uColumns[StrToInt(piece(aCol,':',2))],'^',7) = '1') and
|
---|
170 | (not (piece(uColumns[StrToInt(piece(aCol,':',2))],'^',4) = '1')) then
|
---|
171 | begin
|
---|
172 | FastAssign(TCellObject(RowObjects.ColumnList[j]).Data, aBasket);
|
---|
173 | for k := 0 to aBasket.Count - 1 do
|
---|
174 | begin
|
---|
175 | L := StrToIntDef(piece(uColumns[StrToInt(piece(aCol,':',2))],'^',6),15);
|
---|
176 | x := StringPad(aBasket[k], L, L+1);
|
---|
177 | aData := aData + x;
|
---|
178 | end;
|
---|
179 | end;
|
---|
180 | end;
|
---|
181 | end;
|
---|
182 | //frmReports.memText.Lines.Add(aData);
|
---|
183 | FReportText.Lines.Add(aData);
|
---|
184 | cnt := cnt + 1;
|
---|
185 | if cnt > 40 then
|
---|
186 | begin
|
---|
187 | cnt := 0;
|
---|
188 | //frmReports.memText.Lines.Add('**PAGE BREAK**');
|
---|
189 | FReportText.Lines.Add('**PAGE BREAK**');
|
---|
190 | end;
|
---|
191 | for j := 0 to RowObjects.ColumnList.Count - 1 do
|
---|
192 | begin
|
---|
193 | aCol := TCellObject(RowObjects.ColumnList[j]).Handle;
|
---|
194 | if piece(aID,':',1) = piece(TCellObject(RowObjects.ColumnList[j]).Handle,':',1) then
|
---|
195 | if ListItem.Caption = (piece(TCellObject(RowObjects.ColumnList[j]).Site,';',1)) then
|
---|
196 | begin
|
---|
197 | if (piece(uColumns[StrToInt(piece(aCol,':',2))],'^',7) = '1') and
|
---|
198 | (piece(uColumns[StrToInt(piece(aCol,':',2))],'^',4) = '1') then
|
---|
199 | begin
|
---|
200 | aWPFlag := true;
|
---|
201 | FastAssign(TCellObject(RowObjects.ColumnList[j]).Data, aBasket);
|
---|
202 | //frmReports.MemText.Lines.Add(TCellObject(RowObjects.ColumnList[j]).Name);
|
---|
203 | FReportText.Lines.Add(TCellObject(RowObjects.ColumnList[j]).Name);
|
---|
204 | cnt := cnt + 1;
|
---|
205 | for k := 0 to aBasket.Count - 1 do
|
---|
206 | begin
|
---|
207 | //frmReports.memText.Lines.Add(' ' + aBasket[k]);
|
---|
208 | FReportText.Lines.Add(' ' + aBasket[k]);
|
---|
209 | cnt := cnt + 1;
|
---|
210 | if cnt > 40 then
|
---|
211 | begin
|
---|
212 | cnt := 0;
|
---|
213 | //frmReports.memText.Lines.Add('**PAGE BREAK**');
|
---|
214 | FReportText.Lines.Add('**PAGE BREAK**');
|
---|
215 | end;
|
---|
216 | end;
|
---|
217 | end;
|
---|
218 | end;
|
---|
219 | end;
|
---|
220 | if aWPFlag = true then
|
---|
221 | begin
|
---|
222 | //frmReports.MemText.Lines.Add('===============================================================================');
|
---|
223 | FReportText.Lines.Add('===============================================================================');
|
---|
224 | end;
|
---|
225 | end;
|
---|
226 | aBasket.Free;
|
---|
227 | end;
|
---|
228 |
|
---|
229 | function StringPad(aString: string; aStringCount, aPadCount: integer): String;
|
---|
230 | var
|
---|
231 | s: integer;
|
---|
232 | begin
|
---|
233 | if aStringCount >= aPadCount then
|
---|
234 | aStringCount := aPadCount - 1;
|
---|
235 | Result := copy(aString, 1, aStringCount);
|
---|
236 | s := aPadCount - length(Result);
|
---|
237 | if s < 0 then s := 0;
|
---|
238 | Result := Result + StringOfChar(' ', s);
|
---|
239 | end;
|
---|
240 |
|
---|
241 | procedure TfrmReportPrt.DisplaySelectDevice;
|
---|
242 | begin
|
---|
243 | with cboDevice, lblPrintTo do
|
---|
244 | begin
|
---|
245 | Caption := 'Print Report on: ' + Piece(ItemID, ';', 2);
|
---|
246 | end;
|
---|
247 | end;
|
---|
248 |
|
---|
249 | procedure TfrmReportPrt.cboDeviceChange(Sender: TObject);
|
---|
250 | begin
|
---|
251 | inherited;
|
---|
252 | with cboDevice do if ItemIndex > -1 then
|
---|
253 | begin
|
---|
254 | txtRightMargin.Text := Piece(Items[ItemIndex], '^', 4);
|
---|
255 | txtPageLength.Text := Piece(Items[ItemIndex], '^', 5);
|
---|
256 | DisplaySelectDevice;
|
---|
257 | end;
|
---|
258 | end;
|
---|
259 |
|
---|
260 | procedure TfrmReportPrt.cmdOKClick(Sender: TObject);
|
---|
261 | var
|
---|
262 | ADevice, ErrMsg: string;
|
---|
263 | RemoteSiteID: string;
|
---|
264 | RemoteQuery: string;
|
---|
265 | aQualifier: string;
|
---|
266 | aReport: TStringList;
|
---|
267 | aCaption: string;
|
---|
268 | i: integer;
|
---|
269 | ListItem: TListItem;
|
---|
270 | MoreID: String; //Restores MaxOcc value
|
---|
271 | begin
|
---|
272 | inherited;
|
---|
273 | FReportText := CreateReportTextComponent(Self);
|
---|
274 | RemoteSiteID := '';
|
---|
275 | RemoteQuery := '';
|
---|
276 | MoreID := '';
|
---|
277 | aReport := TStringList.Create;
|
---|
278 | if uQualifier = '' then
|
---|
279 | aQualifier := piece(uRemoteType,'^',5) //Health Summary Type Report
|
---|
280 | else
|
---|
281 | begin
|
---|
282 | MoreID := ';' + Piece(uQualifier,';',3);
|
---|
283 | aQualifier := piece(uRemoteType,'^',5);
|
---|
284 | end;
|
---|
285 | with frmReports.TabControl1 do
|
---|
286 | if TabIndex > 0 then
|
---|
287 | begin
|
---|
288 | RemoteSiteID := TRemoteSite(Tabs.Objects[TabIndex]).SiteID;
|
---|
289 | RemoteQuery := TRemoteSite(Tabs.Objects[TabIndex]).CurrentReportQuery;
|
---|
290 | end;
|
---|
291 | if cboDevice.ItemID = '' then
|
---|
292 | begin
|
---|
293 | InfoBox(TX_NODEVICE, TX_NODEVICE_CAP, MB_OK);
|
---|
294 | Exit;
|
---|
295 | end;
|
---|
296 | if Piece(cboDevice.ItemID, ';', 1) = 'WIN' then
|
---|
297 | begin
|
---|
298 | if dlgWinPrinter.Execute then with FReportText do
|
---|
299 | begin
|
---|
300 | if uReportType = 'V' then
|
---|
301 | begin
|
---|
302 | case uQualifierType of
|
---|
303 | QT_IMAGING:
|
---|
304 | begin
|
---|
305 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
306 | if frmReports.lvReports.Items[i].Selected then
|
---|
307 | begin
|
---|
308 | ListItem := frmReports.lvReports.Items[i];
|
---|
309 | aQualifier := ListItem.SubItems[0];
|
---|
310 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
311 | QuickCopy(GetFormattedReport(FReports, aQualifier,
|
---|
312 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
313 | aCaption := piece(uRemoteType,'^',4);
|
---|
314 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
315 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
316 | end;
|
---|
317 | end;
|
---|
318 | QT_NUTR:
|
---|
319 | begin
|
---|
320 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
321 | if frmReports.lvReports.Items[i].Selected then
|
---|
322 | begin
|
---|
323 | ListItem := frmReports.lvReports.Items[i];
|
---|
324 | aQualifier := ListItem.SubItems[0];
|
---|
325 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
326 | QuickCopy(GetFormattedReport(FReports, aQualifier + MoreID,
|
---|
327 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
328 | aCaption := piece(uRemoteType,'^',4);
|
---|
329 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
330 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
331 | end;
|
---|
332 | end;
|
---|
333 | QT_HSCOMPONENT:
|
---|
334 | begin
|
---|
335 | if (length(piece(uHState,';',2)) > 0) then
|
---|
336 | begin
|
---|
337 | FReportText.Clear;
|
---|
338 | aReport.Clear;
|
---|
339 | CreatePatientHeader(aReport,piece(uRemoteType,'^',4));
|
---|
340 | QuickCopy(aReport, FReportText);
|
---|
341 | FindVType;
|
---|
342 | aCaption := piece(uRemoteType,'^',4) + ';1';
|
---|
343 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
344 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
345 | end
|
---|
346 | else
|
---|
347 | begin
|
---|
348 | QuickCopy(GetFormattedReport(FReports, aQualifier + MoreID,
|
---|
349 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
350 | aCaption := piece(uRemoteType,'^',4);
|
---|
351 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
352 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
353 | end;
|
---|
354 | end;
|
---|
355 | QT_HSWPCOMPONENT:
|
---|
356 | begin
|
---|
357 | if (length(piece(uHState,';',2)) > 0) then
|
---|
358 | begin
|
---|
359 | FReportText.Clear;
|
---|
360 | aReport.Clear;
|
---|
361 | CreatePatientHeader(aReport,piece(uRemoteType,'^',4));
|
---|
362 | QuickCopy(aReport, FReportText);
|
---|
363 | FindVType;
|
---|
364 | aCaption := piece(uRemoteType,'^',4) + ';1';
|
---|
365 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
366 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
367 | end
|
---|
368 | else
|
---|
369 | begin
|
---|
370 | QuickCopy(GetFormattedReport(FReports, aQualifier + MoreID,
|
---|
371 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
372 | aCaption := piece(uRemoteType,'^',4);
|
---|
373 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
374 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
375 | end;
|
---|
376 | end;
|
---|
377 | QT_PROCEDURES:
|
---|
378 | begin
|
---|
379 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
380 | if frmReports.lvReports.Items[i].Selected then
|
---|
381 | begin
|
---|
382 | ListItem := frmReports.lvReports.Items[i];
|
---|
383 | aQualifier := ListItem.SubItems[0];
|
---|
384 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
385 | QuickCopy(GetFormattedReport(FReports, aQualifier,
|
---|
386 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
387 | aCaption := piece(uRemoteType,'^',4);
|
---|
388 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
389 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
390 | end;
|
---|
391 | end;
|
---|
392 | QT_SURGERY:
|
---|
393 | begin
|
---|
394 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
395 | if frmReports.lvReports.Items[i].Selected then
|
---|
396 | begin
|
---|
397 | ListItem := frmReports.lvReports.Items[i];
|
---|
398 | aQualifier := ListItem.SubItems[0];
|
---|
399 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
400 | QuickCopy(GetFormattedReport(FReports, aQualifier,
|
---|
401 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
402 | aCaption := piece(uRemoteType,'^',4);
|
---|
403 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
404 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
405 | end;
|
---|
406 | end;
|
---|
407 | end;
|
---|
408 | end
|
---|
409 | else
|
---|
410 | begin
|
---|
411 | if (Pos('OR_ECS1',FReports)>0) or (Pos('OR_ECS2',FReports)>0) then
|
---|
412 | begin
|
---|
413 | ShowMsg('The Event Capture report can only be printed by Vista printer.');
|
---|
414 | Exit;
|
---|
415 | end;
|
---|
416 | aQualifier := Piece(uRemoteType,'^',5);
|
---|
417 | QuickCopy(GetFormattedReport(FReports, aQualifier,
|
---|
418 | Patient.DFN, uHSComponents, RemoteSiteID, RemoteQuery, uHState), FReportText);
|
---|
419 | aCaption := piece(uRemoteType,'^',4);
|
---|
420 | PrintWindowsReport(FReportText, PAGE_BREAK, aCaption, ErrMsg);
|
---|
421 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
422 | end;
|
---|
423 | end;
|
---|
424 | end
|
---|
425 | else // if it's not a Win printer
|
---|
426 | begin
|
---|
427 | if uReportType = 'V' then
|
---|
428 | begin
|
---|
429 | case uQualifierType of
|
---|
430 | QT_IMAGING:
|
---|
431 | begin
|
---|
432 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
433 | if frmReports.lvReports.Items[i].Selected then
|
---|
434 | begin
|
---|
435 | ListItem := frmReports.lvReports.Items[i];
|
---|
436 | aQualifier := ListItem.SubItems[0];
|
---|
437 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
438 | PrintReportsToDevice(piece(FReports,':',1), aQualifier + MoreID,
|
---|
439 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
440 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
441 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
442 | end;
|
---|
443 | end;
|
---|
444 | QT_NUTR:
|
---|
445 | begin
|
---|
446 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
447 | if frmReports.lvReports.Items[i].Selected then
|
---|
448 | begin
|
---|
449 | ListItem := frmReports.lvReports.Items[i];
|
---|
450 | aQualifier := ListItem.SubItems[0];
|
---|
451 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
452 | PrintReportsToDevice(piece(FReports,':',1), aQualifier + MoreID,
|
---|
453 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
454 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
455 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
456 | end;
|
---|
457 | end;
|
---|
458 | QT_HSCOMPONENT:
|
---|
459 | begin
|
---|
460 | if (length(piece(uHState,';',2)) > 0) then
|
---|
461 | begin
|
---|
462 | FindVType;
|
---|
463 | aReport.Clear;
|
---|
464 | QuickCopy(FReportText.Lines, aReport);
|
---|
465 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
466 | PrintVReports(ErrMsg, ADevice, piece(uRemoteType,'^',4),aReport);
|
---|
467 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
468 | end
|
---|
469 | else
|
---|
470 | begin
|
---|
471 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
472 | PrintReportsToDevice(FReports, aQualifier + MoreID,
|
---|
473 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
474 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
475 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
476 | end;
|
---|
477 | end;
|
---|
478 | QT_HSWPCOMPONENT:
|
---|
479 | begin
|
---|
480 | if (length(piece(uHState,';',2)) > 0) then
|
---|
481 | begin
|
---|
482 | FindVType;
|
---|
483 | aReport.Clear;
|
---|
484 | QuickCopy(FReportText, aReport);
|
---|
485 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
486 | PrintVReports(ErrMsg, ADevice, piece(uRemoteType,'^',4),aReport);
|
---|
487 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
488 | end
|
---|
489 | else
|
---|
490 | begin
|
---|
491 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
492 | PrintReportsToDevice(FReports, aQualifier + MoreID,
|
---|
493 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
494 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
495 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
496 | end;
|
---|
497 | end;
|
---|
498 | QT_PROCEDURES:
|
---|
499 | begin
|
---|
500 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
501 | if frmReports.lvReports.Items[i].Selected then
|
---|
502 | begin
|
---|
503 | ListItem := frmReports.lvReports.Items[i];
|
---|
504 | aQualifier := ListItem.SubItems[0];
|
---|
505 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
506 | PrintReportsToDevice(piece(FReports,':',1), aQualifier,
|
---|
507 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
508 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
509 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
510 | end;
|
---|
511 | end;
|
---|
512 | QT_SURGERY:
|
---|
513 | begin
|
---|
514 | for i := 0 to frmReports.lvReports.Items.Count - 1 do
|
---|
515 | if frmReports.lvReports.Items[i].Selected then
|
---|
516 | begin
|
---|
517 | ListItem := frmReports.lvReports.Items[i];
|
---|
518 | aQualifier := ListItem.SubItems[0];
|
---|
519 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
520 | PrintReportsToDevice(piece(FReports,':',1), aQualifier + MoreID,
|
---|
521 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
522 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
523 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
524 | end;
|
---|
525 | end;
|
---|
526 | end;
|
---|
527 | end
|
---|
528 | else
|
---|
529 | begin
|
---|
530 | ADevice := Piece(cboDevice.ItemID, ';', 2);
|
---|
531 | aQualifier := Piece(uRemoteType,'^',5);
|
---|
532 | if (Pos('OR_ECS1',FReports)>0) or (Pos('OR_ECS2',FReports)>0) then
|
---|
533 | begin
|
---|
534 | uECSReport.ReportType := 'P';
|
---|
535 | uECSReport.PrintDEV := Piece(cboDevice.ItemID,';',1);
|
---|
536 | PrintECSReportToDevice(uECSReport);
|
---|
537 | end
|
---|
538 | else
|
---|
539 | begin
|
---|
540 | PrintReportsToDevice(FReports, aQualifier + MoreID,
|
---|
541 | Patient.DFN, ADevice, ErrMsg, uHSComponents, RemoteSiteID, RemoteQuery, uHState);
|
---|
542 | ErrMsg := Piece(FReportText.Lines[0], U, 2);
|
---|
543 | if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
|
---|
544 | end;
|
---|
545 | end;
|
---|
546 | end;
|
---|
547 | if chkDefault.Checked then SaveDefaultPrinter(Piece(cboDevice.ItemID, ';', 1));
|
---|
548 | User.CurrentPrinter := cboDevice.ItemID;
|
---|
549 | aReport.Free;
|
---|
550 | FReportText.Free;
|
---|
551 | Close;
|
---|
552 | end;
|
---|
553 |
|
---|
554 | procedure TfrmReportPrt.cmdCancelClick(Sender: TObject);
|
---|
555 | begin
|
---|
556 | inherited;
|
---|
557 | Close;
|
---|
558 | end;
|
---|
559 |
|
---|
560 | procedure TfrmReportPrt.cboDeviceNeedData(Sender: TObject;
|
---|
561 | const StartFrom: String; Direction, InsertAt: Integer);
|
---|
562 | begin
|
---|
563 | inherited;
|
---|
564 | cboDevice.ForDataUse(SubsetOfDevices(StartFrom, Direction));
|
---|
565 | end;
|
---|
566 |
|
---|
567 | end.
|
---|
568 |
|
---|
569 |
|
---|
570 |
|
---|