Changeset 541 for cprs/branches/tmg-cprs/CPRS-Chart/rReports.pas
- Timestamp:
- Aug 12, 2009, 7:14:16 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/tmg-cprs/CPRS-Chart/rReports.pas
r453 r541 4 4 interface 5 5 6 uses Windows, SysUtils, Classes, ORNet, ORFn, ComCtrls, Chart, graphics; 6 uses 7 Windows, SysUtils, Classes, ORNet, ORFn, 8 Forms, //kt 8/09 9 ComCtrls, Chart, graphics; 7 10 8 11 { Consults } … … 47 50 aComponents: TStringlist; ARemoteSiteID, ARemoteQuery, AHSTag: string): TStrings; 48 51 procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, ATitle: string; 49 var ErrMsg: string);52 var ErrMsg: string; Application : TApplication); //kt 8/09 added Application 50 53 function DefaultToWindowsPrinter: Boolean; 51 54 procedure PrintGraph(GraphImage: TChart; PageTitle: string); … … 63 66 64 67 uses uCore, rCore, Printers, clipbrd, uReports, fReports, 68 rHTMLTools, //kt 8/09 65 69 DKLang //kt 66 70 ; … … 541 545 end; 542 546 543 procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, Atitle: string; var ErrMsg: string); 547 procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, Atitle: string; 548 var ErrMsg: string; 549 Application : TApplication //kt added 8/09 550 ); 544 551 var 545 552 i, j, x, y, LineHeight: integer; 546 553 aGoHead: string; 547 554 aHeader: TStringList; 555 Header,Footer,TempLines: TStringList; //kt added 8/09 556 IsHTML : Boolean; //kt added 8/09 557 548 558 const 549 559 //TX_ERR_CAP = 'Print Error'; <-- original line. //kt 8/20/2007 … … 566 576 end; 567 577 CreatePatientHeader(aHeader ,ATitle); 568 with ARichEdit do 569 begin 570 (* if Lines[Lines.Count - 1] = APageBreak then // remove trailing form feed 578 IsHTML := rHTMLTools.IsHTML(ARichEdit.Lines); //kt 8/09 579 if not IsHTML then begin //kt 8/09 580 with ARichEdit do begin 581 (* if Lines[Lines.Count - 1] = APageBreak then // remove trailing form feed 571 582 Lines.Delete(Lines.Count - 1); 572 583 while (Lines[0] = '') or (Lines[0] = APageBreak) do 573 584 Lines.Delete(0); // remove leading blank lines and form feeds*) 574 585 575 {v20.4 - SFC-0602-62899 - RV} 576 while (Lines.Count > 0) and ((Lines[Lines.Count - 1] = '') or (Lines[Lines.Count - 1] = APageBreak)) do 577 Lines.Delete(Lines.Count - 1); // remove trailing blank lines and form feeds 578 while (Lines.Count > 0) and ((Lines[0] = '') or (Lines[0] = APageBreak)) do 579 Lines.Delete(0); // remove leading blank lines and form feeds 580 581 if Lines.Count > 1 then 582 begin 583 (* i := Lines.IndexOf(APageBreak); 584 if ((i >= 0 ) and (i < Lines.Count - 1)) then // removed in v15.9 (RV) 585 begin*) 586 Printer.Canvas.Font.Size := TX_FONT_SIZE; 587 Printer.Canvas.Font.Name := TX_FONT_NAME; 588 Printer.Title := ATitle; 589 x := Trunc(Printer.Canvas.TextWidth(StringOfChar('=', TX_FONT_SIZE)) * 0.75); 590 LineHeight := Printer.Canvas.TextHeight(TX_FONT_NAME); 591 y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV) 592 Printer.BeginDoc; 593 for i := 0 to Lines.Count - 1 do 594 begin 595 if Lines[i] = APageBreak then 596 begin 597 Printer.NewPage; 598 y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV) 599 if aGoHead = '1' then 600 begin 601 for j := 0 to aHeader.Count - 1 do 602 begin 603 Printer.Canvas.TextOut(x, y, aHeader[j]); 604 y := y + LineHeight; 605 end; 606 end; 607 end 608 else 609 begin 610 Printer.Canvas.TextOut(x, y, Lines[i]); 611 y := y + LineHeight; 612 end; 613 end; 614 Printer.EndDoc; 615 (* end 616 else // removed in v15.9 (RV) TRichEdit.Print no longer used. 586 {v20.4 - SFC-0602-62899 - RV} 587 while (Lines.Count > 0) and ((Lines[Lines.Count - 1] = '') or (Lines[Lines.Count - 1] = APageBreak)) do 588 Lines.Delete(Lines.Count - 1); // remove trailing blank lines and form feeds 589 while (Lines.Count > 0) and ((Lines[0] = '') or (Lines[0] = APageBreak)) do 590 Lines.Delete(0); // remove leading blank lines and form feeds 591 592 if Lines.Count > 1 then begin 593 (* i := Lines.IndexOf(APageBreak); 594 if ((i >= 0 ) and (i < Lines.Count - 1)) then // removed in v15.9 (RV) 595 begin*) 596 Printer.Canvas.Font.Size := TX_FONT_SIZE; 597 Printer.Canvas.Font.Name := TX_FONT_NAME; 598 Printer.Title := ATitle; 599 x := Trunc(Printer.Canvas.TextWidth(StringOfChar('=', TX_FONT_SIZE)) * 0.75); 600 LineHeight := Printer.Canvas.TextHeight(TX_FONT_NAME); 601 y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV) 602 Printer.BeginDoc; 603 for i := 0 to Lines.Count - 1 do begin 604 if Lines[i] = APageBreak then begin 605 Printer.NewPage; 606 y := LineHeight * 5; // 5 lines = .83" top margin v15.9 (RV) 607 if aGoHead = '1' then begin 608 for j := 0 to aHeader.Count - 1 do begin 609 Printer.Canvas.TextOut(x, y, aHeader[j]); 610 y := y + LineHeight; 611 end; 612 end; 613 end else begin 614 Printer.Canvas.TextOut(x, y, Lines[i]); 615 y := y + LineHeight; 616 end; 617 end; 618 Printer.EndDoc; 619 (* end 620 else // removed in v15.9 (RV) TRichEdit.Print no longer used. 617 621 try 618 622 Font.Size := TX_FONT_SIZE; … … 622 626 ErrMsg := TX_ERR_CAP; 623 627 end;*) 624 end 625 else if ARichEdit.Lines.Count = 1 then 628 end else if ARichEdit.Lines.Count = 1 then 626 629 if Piece(ARichEdit.Lines[0], U, 1) <> '0' then 627 630 ErrMsg := Piece(ARichEdit.Lines[0], U, 2); 628 631 end; 632 end else begin //kt added this entire block. 8/09 633 TempLines := TStringList.Create; 634 Header := TStringList.Create; 635 Footer := TStringList.Create; 636 TempLines.Assign(ARichEdit.Lines); 637 StripBeforeAfterHTML(TempLines,Header,Footer); 638 //LoadDocumentText(TempLines, FNote); //Get document without headers/footers 639 PrintHTMLReport(TempLines,ErrMsg, 640 Patient.Name, 641 FormatFMDateTime('mm/dd/yyyy', Patient.DOB), 642 Encounter.LocationName, Application); 643 TempLines.Free; 644 Header.Free; 645 Footer.Free; 646 end; //kt end of added block 8/09 629 647 aHeader.Free; 630 648 end;
Note:
See TracChangeset
for help on using the changeset viewer.