2016-01-22 227 views
0

我在CR306000上有一个自定义按钮,尝试通过调用一个自定义报告来打印当前加载的案例信息。导航网址电流设置为:打印CR306000上的打印按钮以打印案例数据

~/Frames/ReportLauncher.aspx?ID=Inquirycase.rpx&CASEID=#### 

我需要有自定义编程来分配电流ID的情况下,以取代“####”,但不知道在哪里以及如何引用自定义按钮和修改其属性。请帮忙。谢谢。

回答

0

你可以叫“CaseID”报表参数添加到您的报告中并使用AEF扩展这样使用下面的代码调用它:

public class CRCaseMaintExtension : PXGraphExtension<CRCaseMaint> 
{ 
    public override void Initialize() 
    { 
     base.Initialize(); 
     //if adding to an existing menu button do that here... 
     // Example: 
     //Base.Inquiry.AddMenuAction(this.CustomReportButton); 
    } 

    public PXAction<CRCase> CustomReportButton; 
    [PXButton] 
    [PXUIField(DisplayName = "Custom Report", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)] 
    public virtual IEnumerable customReportButton(PXAdapter adapter) 
    { 
     if (Base.Case.Current != null) 
     { 
      Dictionary<string, string> parameters = new Dictionary<string, string>(); 
      parameters["CaseID"] = Base.Case.Current.CaseID.ToString(); 

      //enter in your report id/number here 
      string reportNumber = "Inquirycase"; 

      //opens the report using the defined parameters 
      throw new PXReportRequiredException(parameters, reportNumber, "Custom Report"); 
     } 

     return adapter.Get(); 
    } 
} 

我没有测试以上,但这应该最让你那里的路。

+0

感谢您的回复。我了解您提供的代码,但不知道如何从定制项目界面Acumatica提供的按钮点击事件。 – Woody

+0

我添加了图形扩展代码以包含如何从一个按钮调用代码的示例。请注意,如果已经有报告菜单按钮,最好将报告按钮添加到此菜单按钮。我不知道这个图形/页面是否包含一个,但是如果需要的话,上面的这个例子包含了AddMenuAction示例。如果你这样做,你可能需要在你的按钮上设置你的PXUIField为visible = false – Brendan

+0

非常感谢,Brendan。 – Woody