Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Acumatica 打印同一报告的多个迭代_Acumatica - Fatal编程技术网

Acumatica 打印同一报告的多个迭代

Acumatica 打印同一报告的多个迭代,acumatica,Acumatica,我试图模拟打印报表页面AR503500的行为,根据所选客户,他们相应的客户报表报告AR641500打印在一个顺序报告/PDF中 回顾graph ARStatementPrint.cs中的逻辑,我可以看到在PrintStatements委托中处理了这个问题,其中对DetailsResult列表的迭代正在打印报告 关键似乎是在迭代中执行的CombineReport方法: foreach (DetailsResult t in list) { i

我试图模拟打印报表页面AR503500的行为,根据所选客户,他们相应的客户报表报告AR641500打印在一个顺序报告/PDF中

回顾graph ARStatementPrint.cs中的逻辑,我可以看到在PrintStatements委托中处理了这个问题,其中对DetailsResult列表的迭代正在打印报告

关键似乎是在迭代中执行的CombineReport方法:

        foreach (DetailsResult t in list)
        {
            if (markOnly)
            {
                if (filter.ShowAll != true)
                    foreach (ARStatement doc in docview.SelectMulti(filter.StatementCycleId, filter.StatementDate, t.CustomerID, t.CuryID))
                    {
                        if (arsetup?.ConsolidatedStatement != true && doc.BranchID != filter.BranchID)
                            continue;

                        doc.DontPrint = true;
                        docview.Cache.Update(doc);
                    }
            }
            else
            {

                Dictionary<string, string> d = new Dictionary<string, string>();

                d[ARStatementReportParams.Parameters.BranchID] = filter.BranchCD;                   
                d[ARStatementReportParams.Fields.StatementCycleID] = filter.StatementCycleId;
                d[ARStatementReportParams.Fields.StatementDate]    = filter.StatementDate.Value.ToString("d", CultureInfo.InvariantCulture);
                d[ARStatementReportParams.Fields.CustomerID] = t.CustomerID.ToString();

                if (filter.ShowAll == true)
                {
                    d[ARStatementReportParams.Parameters.IgnorePrintFlags] = ARStatementReportParams.BoolValues.True;
                }
                else
                {
                    d[ARStatementReportParams.Fields.PrintStatements] = ARStatementReportParams.BoolValues.True;
                }
                if (filter.CuryStatements ?? false)
                    d[ARStatementReportParams.Fields.CuryID] = t.CuryID;

                foreach (ARStatement doc in docview.SelectMulti(filter.StatementCycleId, filter.StatementDate, t.CustomerID, t.CuryID))
                {
                    if (arsetup?.ConsolidatedStatement != true && doc.BranchID != filter.BranchID)
                        continue;

                    if (doc.Printed != true)
                    {
                        doc.Printed = true;
                        docview.Cache.Update(doc);
                    }
                }

                ex = PXReportRequiredException.CombineReport(ex,  GetCustomerReportID(graph, reportID, t), d);
            }
        }

        graph.Actions.PressSave();
        if(ex != null) throw ex;
在我自己的图表中,我创建了第一个操作,其中没有迭代发生,只发出一个报告打印请求

protected virtual IEnumerable AnotherReport(PXAdapter adapter)
    {

            Dictionary<string, string> parameters = new Dictionary<string, string>();

            parameters["CustomerID"] = "001208";

            parameters["BranchID"] = "BRANCH1";
            parameters["DateFrom"] = "01-01-2017";
            parameters["DateTo"] = "12-12-2017";


            throw new PXReportRequiredException(parameters, "TR101000", "ReportTest");                
    }
在这种情况下,结果是正确的。然后,我用以下方式实现了CombineReport方法

        protected virtual IEnumerable Report(PXAdapter adapter)
    {
        PXReportRequiredException ex = null;
        foreach (Customer doc in adapter.Get<Customer>())
        {
            var parameters = new Dictionary<string, string>();

            parameters["CustomerID"] = doc.AcctCD;

            parameters["BranchID"] = "BRANCH1";
            parameters["DateFrom"] = "01-01-2017";
            parameters["DateTo"] = "12-12-2017";

            ex = PXReportRequiredException.CombineReport(ex,  "TR101000", parameters);
        }

        this.Save.Press();
        if (ex != null) throw ex;

        return adapter.Get();
    }
但结果只打印一个客户的信息

ARPrintInvoices图也用作参考,但ArdDocumentList委托和GetBQLStatement方法中的可用信息似乎既不打印任何报告,也不使用CombineReport方法

关于如何解决这个问题,有什么建议吗?
谢谢

如果未指定,则CombineReport方法上的MergeLast参数默认为true。尝试在最后一次迭代中传递“false”

ex = PXReportRequiredException.CombineReport(ex, "TR101000", parameters, !isLastIteration);
请参阅下面的代码片段:

namespace PX.Objects.AR
{
  public class ARInvoiceEntry_Extension:PXGraphExtension<ARInvoiceEntry>
  {
    #region Event Handlers
    public PXAction<PX.Objects.AR.ARInvoice> Test;

    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Test")]
    protected void test()
    {
       PXReportRequiredException ex = null;
        var row = Base.Document.Current;

        if(row.RefNbr != null)
        {
          Dictionary<string, string> dictionary = new Dictionary<string, string>();
          dictionary["DocType"] = row.DocType;
          dictionary["RefNbr"] = row.RefNbr;

          ex = PXReportRequiredException.CombineReport(ex,  "AR610500", dictionary);
        }
        if (row.RefNbr != null)
        {

          Dictionary<string, string> dictionary = new Dictionary<string, string>();
          dictionary["DocType"] = row.DocType;
          dictionary["RefNbr"] = row.RefNbr;

          ex = PXReportRequiredException.CombineReport(ex, "AR610500", dictionary,false);
        }

        if (ex != null)
        {
          ex.Mode = PXBaseRedirectException.WindowMode.New;
          ex.SeparateWindows = false;
          throw ex;
        }
    }
    #endregion
  }
}

如果未指定,则CombineReport方法上的MergeLast参数默认为true。尝试在最后一次迭代中传递“false”。示例:ex=PXReportRequiredException.CombineReportex,TR101000,参数!孤岛效应;