我正在尝试在Acumatica的Actions下添加一个选项,用于Checks&付款界面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)
谢谢, ģ
答案 0 :(得分:5)
要在现有的Actions菜单中添加新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")