通过代码而非自动化步骤添加报告菜单项 [英] Add a Report Menu item via code rather than Automation Steps

查看:64
本文介绍了通过代码而非自动化步骤添加报告菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过代码而不是使用自动化步骤将报告添加到SO Order Entry页面的Reports菜单中。我正在使用的代码如下,但是会产生错误:
错误CS0122:由于其保护级别$ b,无法访问 PX.Objects.SO.SOOrderEntry.Report(PX.Data.PXAdapter,string) $ b错误CS0119: PX.Objects.SO.SOOrderEntry.Report(PX.Data.PXAdapter,字符串)是一种方法,在给定的上下文中无效

I am trying to add a report to the Reports menu of the SO Order Entry page via code rather than using Automation steps. The code I am using is as follows but is producing the errors: error CS0122: 'PX.Objects.SO.SOOrderEntry.Report(PX.Data.PXAdapter, string)' is inaccessible due to its protection level error CS0119: 'PX.Objects.SO.SOOrderEntry.Report(PX.Data.PXAdapter, string)' is a 'method', which is not valid in the given context

public SOOrderEntry_Extension()
 {
    Base.Report.AddMenuAction(sOAcknowledgementReport);
 }

public PXAction<SOOrder> sOAcknowledgementReport;
    [PXButton]
    [PXUIField(DisplayName = "SO Acknowledgement Report")]
    protected void SOAcknowledgementReport()
       {
          if (Base.Document.Current.OrderNbr != string.Empty)
        {
           throw newPXReportRequiredException(Base.Document.Current, "SO641010", string.Empty);
        }
      }

是否有人建议如何将报告添加到通过代码而不是使用自动化步骤生成报告菜单?

Does anybody have suggestions how to add a Report to the reports menu via code rather than using Automation Steps?

推荐答案

我认为您可以覆盖Initialize()方法并将Report添加到报告中那里的菜单。请参见下面的SOOrderEntry图扩展上的代码段:

I think you can override Initialize() method and add the Report to report menu there. See the snippet code below on SOOrderEntry Graph Extension:

public class SOOrderEntry_Extension:PXGraphExtension<SOOrderEntry>
{


    public override void Initialize()
    {
        Base.report.AddMenuAction(sOAcknowledgementReport);
    }


    public PXAction<SOOrder> sOAcknowledgementReport;
    [PXButton]
    [PXUIField(DisplayName = "SO Acknowledgement Report")]
    protected void SOAcknowledgementReport()
    {
        if (Base.Document.Current.OrderNbr != string.Empty)
        {
           throw new PXException("Test");
        }
    }

}

这篇关于通过代码而非自动化步骤添加报告菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆