在操作下创建按钮以重定向到 Acumatica 中的报告
Create Button Under Actions To Redirect To Report In Acumatica
我正在尝试在 Acumatica 的“支票和付款”屏幕 AP302000 上的“操作”下添加一个选项。请参阅下面我要实现的目标:
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)
谢谢,
G
要在现有操作菜单中添加新操作,您应该覆盖 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")
我正在尝试在 Acumatica 的“支票和付款”屏幕 AP302000 上的“操作”下添加一个选项。请参阅下面我要实现的目标:
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)
谢谢, G
要在现有操作菜单中添加新操作,您应该覆盖 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")