長弘科技 Acumatica 部落格

如何一次列印多個報表於同一個報表檔案中

若想要一次印出報表檔案中含多個報表,則可使用以下方式:

public static void MethodName(IEnumerable<DAC> list)

    {

        PXReportRequiredException ex = null;

        foreach (var order in list)

        {

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

  parameters[Name1] = Value1;

            parameters[Name2] = Value2;

            if (ex == null)

                ex = new PXReportRequiredException(parameters, ” ReportID”, ” ReportID”);

            else

                ex.AddSibling(“ReportID”, parameters, false);

        }

        if (ex != null) throw ex;

    }

透過宣告PXReportRequiredException,然後使用 foreach 去逐筆執行欲印出來的資料,並帶入報表所需的參數,第一筆則 new PXReportRequiredException;後面則使用AddSibling去加上其他筆資料於同一個報表中,最後透過throw PXReportRequiredException開啟多筆資料的報表。

分享文章

Share on facebook
Facebook
Share on linkedin
LinkedIn
Share on google
Google+
Share on twitter
Twitter

相關文章

Copyright © 2021 長弘科技有限公司. All rights reserved