【问题标题】:Create Button Under Actions To Redirect To Report In Acumatica在 Acumatica 中重定向到报告的操作下创建按钮
【发布时间】:2015-11-04 00:30:10
【问题描述】:

我正在尝试在支票和付款屏幕 AP302000 的 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

  }


}

然而,这告诉我“APPPayment”没有定义也没有扩展方法。有人可以指导我如何实现我想要做的事情吗?

请注意,报告只有 1 个参数 (RefNbr)

谢谢, G

【问题讨论】:

    标签: acumatica


    【解决方案1】:

    要在现有的 Actions Menu 中添加新的 Action,您应该重写 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 应该在 Extensions 中作为 Base.Document.Current 访问。如果 DAC 具有适当的参数值,则需要将 DAC 作为 PXReportRequiredException 中的第一个参数传递。或者,您可以构建参数并将其传递给 PXReportRedirectException。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-16
      • 1970-01-01
      • 2017-09-01
      相关资源
      最近更新 更多