2016-01-22 151 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