在操作下创建按钮以重定向到Acumatica中的报告 [英] Create Button Under Actions To Redirect To Report In Acumatica

查看:34
本文介绍了在操作下创建按钮以重定向到Acumatica中的报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Acumatica中的操作下的检查与控制中添加一个选项。付款屏幕AP302000。参见下面我要达到的目标:

I am trying to add an option under Actions in Acumatica on the Checks & Payment screen AP302000. See below what I am trying to achieve:

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'的扩展方法。有人可以指导我逐步实现我的目标吗?

This is however telling me that there is no definition and no extension method for 'APPayment'. Can someone please walk me through how to achieve what I am trying to do?

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

Note that the report has only 1 parameter (RefNbr)

谢谢,
G

Thanks, G

推荐答案

要在现有操作菜单中添加新的操作,

To Add a new Action in existing Actions Menu, you should override the Initialize() method and use 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。如果DAC具有适当的参数值,则需要将DAC作为PXReportRequiredException中的第一个参数传递。或者,您可以构建参数并将其传递给PXReportRedirectException。

Document.Current should be accessed as Base.Document.Current in Extensions. You need to pass the DAC as first parameter in PXReportRequiredException if DAC has the appropriate parameter value. Alternatively, you can build parameters and pass it to PXReportRedirectException.

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

这篇关于在操作下创建按钮以重定向到Acumatica中的报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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