在处理屏幕中打印包含封面和页脚的报告作为子报告

Printing a Report having Covering & Footer as Sub Reports in processing screen

我创建了一个自定义报告,它有一个附信作为在报告页眉中调用的子报告和一个在报告页脚中调用的摘要报告。这在操作菜单中调用以打印单个报告时工作正常。

我设计了一个类似于销售订单Print/Email处理的处理屏幕,当打印多个文件时,附信打印一次,所有选定文件打印主报告,最后打印摘要报告文件.

public PXAction<SOOrder> printreport;
    [PXUIField(DisplayName = "Print Production Report", MapEnableRights = PXCacheRights.Select)]
    [PXButton(SpecialType = PXSpecialButtonType.ReportsFolder)]
    protected virtual IEnumerable PrintReport(PXAdapter adapter)
    {
        List<SOOrder> list = adapter.Get<SOOrder>().ToList();
        if (list.Count > 0)
        {
            string reportID = "PS642000";
            Base.Save.Press();
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            string actualReportID = null;

            PXReportRequiredException ex = null;
            Dictionary<PX.SM.PrintSettings, PXReportRequiredException> reportsToPrint = new Dictionary<PX.SM.PrintSettings, PXReportRequiredException>();

            foreach (SOOrder order in list)
            {
                PSSOOrderExtNV extNV = Base.Document.Cache.GetExtension<PSSOOrderExtNV>(order);
                if (extNV.UsrIsScreenPrint != true)
                    continue;
                parameters = new Dictionary<string, string>();
                parameters["SOOrder.OrderType"] = order.OrderType;
                parameters["SOOrder.OrderNbr"] = order.OrderNbr;

                object cstmr = PXSelectorAttribute.Select<SOOrder.customerID>(Base.Document.Cache, order);
                actualReportID = new NotificationUtility(Base).SearchReport(SONotificationSource.Customer, cstmr, reportID, order.BranchID);
                ex = PXReportRequiredException.CombineReport(ex, actualReportID, parameters);

                reportsToPrint = PX.SM.SMPrintJobMaint.AssignPrintJobToPrinter(reportsToPrint, parameters, adapter, new NotificationUtility(Base).SearchPrinter, SONotificationSource.Customer, reportID, actualReportID, order.BranchID);
            }

            if (ex != null)
            {
                PX.SM.SMPrintJobMaint.CreatePrintJobGroups(reportsToPrint);

                throw ex;
            }
        }

如何解决这个问题?

我试过了,没用。现在我已经删除了子报告并按顺序单独执行以存档所需的结果。

    public PXAction<SOOrder> screenprintreport;
    [PXUIField(DisplayName = "Screen Print Production Report", MapEnableRights = PXCacheRights.Select)]
    [PXButton(SpecialType = PXSpecialButtonType.ReportsFolder)]
    protected virtual IEnumerable screenPrintReport(PXAdapter adapter)
    {
        List<SOOrder> list = adapter.Get<SOOrder>().ToList();
        if (list.Count > 0)
        {
            string creportID = "SO641010";
            string reportID = "PS642000";
            Base.Save.Press();
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            string actualReportID = null;

            PXReportRequiredException ex = null;
            Dictionary<PX.SM.PrintSettings, PXReportRequiredException> reportsToPrint = new Dictionary<PX.SM.PrintSettings, PXReportRequiredException>();

            foreach (SOOrder order in list)
            {
                PSSOOrderExtNV extNV = Base.Document.Cache.GetExtension<PSSOOrderExtNV>(order);
                if (extNV.UsrIsScreenPrint != true)
                    continue;
                parameters = new Dictionary<string, string>();
                parameters["SOOrder.OrderType"] = order.OrderType;
                parameters["SOOrder.OrderNbr"] = order.OrderNbr;

                object cstmr = PXSelectorAttribute.Select<SOOrder.customerID>(Base.Document.Cache, order);
                actualReportID = new NotificationUtility(Base).SearchReport(SONotificationSource.Customer, cstmr, creportID, order.BranchID);
                ex = PXReportRequiredException.CombineReport(ex, actualReportID, parameters);

                reportsToPrint = PX.SM.SMPrintJobMaint.AssignPrintJobToPrinter(reportsToPrint, parameters, adapter, new NotificationUtility(Base).SearchPrinter, SONotificationSource.Customer, creportID, actualReportID, order.BranchID);
                actualReportID = null;
                actualReportID = new NotificationUtility(Base).SearchReport(SONotificationSource.Customer, cstmr, reportID, order.BranchID);
                ex = PXReportRequiredException.CombineReport(ex, actualReportID, parameters);

                reportsToPrint = PX.SM.SMPrintJobMaint.AssignPrintJobToPrinter(reportsToPrint, parameters, adapter, new NotificationUtility(Base).SearchPrinter, SONotificationSource.Customer, reportID, actualReportID, order.BranchID);


            }

            if (ex != null)
            {
                PX.SM.SMPrintJobMaint.CreatePrintJobGroups(reportsToPrint);

                throw ex;
            }
        }
    }