maintenance: title: SCH_FUNC_CCDA_PRINT;; mlmname: SCH_FUNC_CCDA_PRINT;; arden: version 2.5;; version: 5.50;; institution: Allscripts;; author: Renish Bhimani;; specialist: ;; date: 2014-05-21;; validation: testing;; library: purpose: print CCD-A document report from MLM ;; explanation: This called MLM uses ReportRequest class to print CCD-A document report. It also set report{{{SINGLE-QUOTE}}}s parameter values and distribution information Change history 06.25.2014 DW CSR# 31688 - MU2 Created from ACS_CCDA_DocumentAutoPrint 07.08.2014 DW CSR# 31688 - MU2 Corrected routing issue with code attained from JT Mather which updates destination info to the Report Request object ;; keywords: ;; knowledge: type: data-driven;; data: standard_libs := MLM {{{SINGLE-QUOTE}}}std_include_libs{{{SINGLE-QUOTE}}}; include standard_libs; using "SCMLib"; using "SCM.Common.Interfaces"; using namespace "SCMLib"; using namespace "SCM.Common.Interfaces"; (ClientGuid,ChartGuid,VisitGuid,CCDAReport) := ARGUMENT; ClientDocumentGUID := read first { " Select GUID from CV3ClientDocument with (nolock) WHERE DocumentName = " || SQL(CCDAReport) || " AND ClientGUID = " || sql(ClientGUID) || " AND ChartGUID = " || SQL(ChartGuid) || " AND ClientVisitGUID = " || SQL(VisitGuid) || " ORDER BY TouchedWhen DESC" }; error_destination := destination { Alert } with [ alert_type := "Warning", short_message := "ObjectsPlus Error from MLM", priority := "low", scope := "chart", Rule_group := "ObjectsPlus Error from MLM", Rule_number := 1001, Rule_subgroup := "", Send_with_order := "", Alert_dialog_settings := "", Display_alert := true ]; if (ClientDocumentGUID <> "" OR ClientDocumentGUID is not null) then try report_request_obj := call {{{SINGLE-QUOTE}}}ObjectsPlusXA.SunriseClinicalManager.ReportRequest{{{SINGLE-QUOTE}}}.CreateReportRequest with ("ACS CCDA Document Auto Print" as {{{SINGLE-QUOTE}}}String{{{SINGLE-QUOTE}}}); if (report_request_obj.Parameters is not null and report_request_obj.Parameters.Count > 0) then report_parameter_list := (); for parameterIndex in (1 seqto report_request_obj.Parameters.Count) do report_parameter_list := report_parameter_list, report_request_obj.Parameters[parameterIndex]; enddo; endif; parameter0 := first (report_parameter_list where report_parameter_list.Name = "varClientDocumentGUID"); if parameter0.AllowModification then void := call parameter0.{{{SINGLE-QUOTE}}}SetValue{{{SINGLE-QUOTE}}} with STRING(ClientDocumentGUID) as {{{SINGLE-QUOTE}}}System.String{{{SINGLE-QUOTE}}}; endif; (user_workstation_name) := read last {StateInfo: WorkstationName}; print_job_destination := read last {"Select TOP(01) lpl.PrinterAddress From CV3Workstation ws JOIN CV3Location l on l.GUID = ws.LocationGUID JOIN HVCLogicalPrintLocation lpl on lpl.LocnGUID = l.GUID Where ws.IDCode = " || SQL(user_workstation_name) || " AND ws.Active = 1 AND l.Active = 1 AND lpl.Active = 1 AND lpl.LogicalPrinter = {{{SINGLE-QUOTE}}}default report printer{{{SINGLE-QUOTE}}} "}; print_policy := "PhysicalPrinter";//"WorkstationLocation" ; process_report_locally := true;//false; print_job_destination := print_job_destination; // "\\sc1erp1\scmip"; "\\sc1erp1\PDF_HIS_DEV"; report_request_obj.PrintPolicy := print_policy as {{{SINGLE-QUOTE}}}PrintPolicy{{{SINGLE-QUOTE}}}; report_request_obj.ProcessReportLocally := process_report_locally ; report_request_obj.PrintJobDestination := print_job_destination ; reportRequest.PrintJobPriority := Print_job_priority as {{{SINGLE-QUOTE}}}PrintJobPriority{{{SINGLE-QUOTE}}}; report_request_obj.NumberOfCopies := 1; // print the report void := call report_request_obj.Save; // Call Dispose on report_request_obj to clean it up if report_request_obj is not null then void := call report_request_obj.Dispose; report_request_obj := null; endif; endtry; catch exception ex error_occurred := true; error_message := "{{+R}}Auto Print:{{-R}}\n" || ex.Message || "\n\n"; if ex.InnerException is not null net_object then error_message := error_message || "Inner Exception: " || ex.InnerException.Message || "\n\n"; endif; // Call Dispose on report_request_obj to clean it up if report_request_obj is not null then void := call report_request_obj.Dispose; report_request_obj := null; endif; endcatch; endif; // Diagnostic Alert - Can be enabled if needed // send_alert := "DoNotSend"; // alert_dest := destination { Alert: warning, "Informational", high, chart, "Informational", 15042, send_alert, "No Override Allowed" }; ;; priority: 50 ;; evoke: ;; logic: conclude true; ;; action: if Error_occurred then write "An error has occured in the MLM {{+B}}ACS_CCDA_DocumentAutoPrint{{-B}} " || "Please notify your System Administrators that an error message has " || "occurred for this patient. They will review the following error " || "message: \n" at error_destination; write error_message at error_destination; endif; // Diagnostic Alert - Can be enabled if needed // write " Messages " || " Execute the Called PRINT MLM - " || NOW || " " || ClientDocumentGUID at alert_dest; ;; Urgency: 50;; end: