Procedure

Tfrm513Print.cmdOKClick

Module

fConsult513Prt

Last Modified

7/15/2014 3:26:34 PM

Visibility

Public/Published

Owner

Tfrm513Print

Declaration

procedure cmdOKClick(Sender: TObject);

Calls Hierarchy


Tfrm513Print.cmdOKClick
 ├CreateReportTextComponent
 │ └ReportTextFontChange
 ├GetFormattedSF513
 ├PrintWindowsReport
 │ └CreatePatientHeader
 │   ├TEncounter.GetLocationName
 │   │ └TEncounter.UpdateText
 │   │   └GetEncounterText
 │   └FMNow
 ├PrintSF513ToDevice
 ├SaveDefaultPrinter
 └TUser.SetCurrentPrinter

Called-By Hierarchy


                 Tfrm513Print.cmdOKClick
                            PrintSF513┘ 
           TfrmConsults.RequestPrint┤   
TfrmConsults.mnuActPrintSF513Click┤ │   
       TfrmFrame.mnuFilePrintClick┘ │   
   TfrmConsults.RequestMultiplePrint┘   
          TfrmPrintList.cmdOKClick┘     

Calls

Name Declaration Comments
CreateReportTextComponent function CreateReportTextComponent(ParentForm: TForm): TRichEdit; -
GetFormattedSF513 function GetFormattedSF513(AConsult: Integer; ChartCopy: string): TStrings; -
PrintSF513ToDevice procedure PrintSF513ToDevice(AConsult: Integer; const ADevice: string; ChartCopy: string; var ErrMsg: string); -
PrintWindowsReport procedure PrintWindowsReport(ARichEdit: TRichEdit; APageBreak, ATitle: string; var ErrMsg: string; IncludeHeader: Boolean = false); -
SaveDefaultPrinter procedure SaveDefaultPrinter(DefPrinter: string) ; -
TUser.SetCurrentPrinter procedure SetCurrentPrinter(Value: string); -

Called-By

Name Declaration Comments
PrintSF513 procedure PrintSF513(AConsult: Longint; AConsultTitle: string); -


Source

139   procedure Tfrm513Print.cmdOKClick(Sender: TObject);
140   var
141     ADevice, ErrMsg: string;
142     ChartCopy: string;
143     RemoteSiteID: string;    //for Remote site printing
144     RemoteQuery: string;    //for Remote site printing
145   begin
146     inherited;
147     FReportText := CreateReportTextComponent(Self);
148     RemoteSiteID := '';
149     RemoteQuery := '';
150     if cboDevice.ItemID = '' then
151     begin
152       InfoBox(TX_NODEVICE, TX_NODEVICE_CAP, MB_OK);
153       Exit;
154     end;
155     if radChartCopy.Checked then ChartCopy := 'C' else ChartCopy := 'W';
156     if Piece(cboDevice.ItemID, ';', 1) = 'WIN' then
157       begin
158         if dlgWinPrinter.Execute then with FReportText do
159           begin
160             QuickCopy(GetFormattedSF513(FConsult, ChartCopy), FReportText);
161             PrintWindowsReport(FReportText, PAGE_BREAK, Self.Caption, ErrMsg);
162             if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
163           end;
164       end
165     else
166       begin
167         ADevice := Piece(cboDevice.ItemID, ';', 2);
168         PrintSF513ToDevice(FConsult, ADevice, ChartCopy, ErrMsg);
169         ErrMsg := Piece(FReportText.Lines[0], U, 2);
170         if Length(ErrMsg) > 0 then InfoBox(ErrMsg, TX_ERR_CAP, MB_OK);
171       end;
172     if chkDefault.Checked then SaveDefaultPrinter(Piece(cboDevice.ItemID, ';', 1));
173     User.CurrentPrinter := cboDevice.ItemID;
174     FReportText.Free;
175     Close;
176   end;