2015-10-22 24 views
0

我想在Acumatica的Action下添加一個選項,在支票&付款屏幕AP302000上。見下面我想實現:在Action下創建按鈕重定向到Acumatica中的報表

using System; 
 
using System.Collections; 
 
using System.Collections.Generic; 
 
using System.Runtime.Serialization; 
 
using PX.Common; 
 
using PX.Data; 
 
using PX.Objects.CM; 
 
using PX.Objects.CA; 
 
using PX.Objects.CS; 
 
using PX.Objects.GL; 
 
using PX.Objects.CR; 
 
using PX.Objects; 
 
using PX.Objects.AP; 
 

 
namespace PX.Objects.AP 
 
{ 
 
    
 
    public class APPaymentEntry_Extension:PXGraphExtension<APPaymentEntry> 
 
    { 
 

 
    #region Event Handlers 
 
     public PXAction<APPayment> ShowURL; 
 
     [PXUIField(DisplayName = "Print Remittance")] 
 
     [PXButton] 
 
     
 
     protected virtual void showURL() 
 
     { 
 
      APPayment doc = Document.Current; 
 
      if (doc.RefNbr != null) { 
 
      throw new PXReportRequiredException(doc.RefNbr, "AP991000", null); 
 
      } 
 
     } 
 

 
    #endregion 
 

 
    } 
 

 

 
}

但是,這是告訴我,沒有定義和「APPayment」沒有擴展方法。有人能告訴我如何實現我想要做的事嗎?

注意到,該報告只有1個參數(RefNbr)

感謝, 摹

回答

4

添加在現有的操作菜單中一個新的動作,你應該重寫Initialize()方法,並使用AddMenuAction。

public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry> 
{ 
    public override void Initialize() 
    { 
     Base.action.AddMenuAction(ShowURL); 
    } 

    public PXAction<APPayment> ShowURL; 
    [PXUIField(DisplayName = "Print Remittance")] 
    [PXButton] 
    protected virtual void showURL() 
    { 
     APPayment doc = Base.Document.Current; 
     if (doc.RefNbr != null) 
     { 
      throw new PXReportRequiredException(doc, "AP991000", null); 
     } 
    } 
} 

Document.Current應該作爲Base.Document.Current在Extensions中訪問。如果DAC具有適當的參數值,則需要將DAC作爲PXReportRequiredException中的第一個參數傳遞。或者,您可以構建參數並將其傳遞給PXReportRedirectException。

Dictionary<string, string> parameters = new Dictionary<string, string>(); 
parameters["ParameterName1"] = <Parameter Value>; 
... 
throw new PXReportRequiredException(parameters, <reportID>, "Report") 
相關問題