C# Acumatica-客户屏幕上的链接报告
我创建了一个报告,其中唯一的参数是SOOrder表中的CustomerID。CustomerID参数的工作方式与原始客户历史记录报告相同,只是它使用SOOrder.CustomerID而不是ARPayment.CustomerID作为链接字段。我创建此自定义项是为了将链接添加到报告:C# Acumatica-客户屏幕上的链接报告,c#,acumatica,C#,Acumatica,我创建了一个报告,其中唯一的参数是SOOrder表中的CustomerID。CustomerID参数的工作方式与原始客户历史记录报告相同,只是它使用SOOrder.CustomerID而不是ARPayment.CustomerID作为链接字段。我创建此自定义项是为了将链接添加到报告: public override void Initialize() { Base.report.AddMenuAction(NewCustHistory); } public PXAction<Cu
public override void Initialize()
{
Base.report.AddMenuAction(NewCustHistory);
}
public PXAction<Customer> NewCustHistory;
[PXUIField(DisplayName = "New Customer History", MapEnableRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.Report)]
public virtual IEnumerable newCustHistory(PXAdapter adapter)
{
Customer customer = Base.BAccountAccessor.Current;
if (customer != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["CustomerID"] = customer.AcctCD;
throw new PXReportRequiredException(parameters, "IN642501", "New Customer History");
}
return adapter.Get();
}
以下是报告的XML:
更新1:我已经更新了代码,以复制下面提供的答案。错误仍然存在。我的Acumatica版本是6.10.0755。使用客户页面上的客户历史记录报告示例,您可以看到它使用AcctCD作为客户id的报告参数
public PXAction<Customer> customerHistory;
[PXUIField(DisplayName = AR.Messages.CustomerHistory, MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.Report)]
public virtual IEnumerable CustomerHistory(PXAdapter adapter)
{
Customer customer = this.BAccountAccessor.Current;
if (customer != null && customer.BAccountID > 0L)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["CustomerID"] = customer.AcctCD;
throw new PXReportRequiredException(parameters, "AR652000", AR.Messages.CustomerHistory);
}
return adapter.Get();
}
公共PXAction客户历史记录;
[PXUIField(DisplayName=AR.Messages.CustomerHistory,MapEnableRights=PXCacheRights.Select,MapViewRights=PXCacheRights.Select)]
[PXButton(ImageKey=PX.Web.UI.Sprite.Main.Report)]
公共虚拟IEnumerable CustomerHistory(PXAdapter)
{
客户=this.BAccountAccessor.Current;
if(customer!=null&&customer.BAccountID>0L)
{
字典参数=新字典();
参数[“CustomerID”]=customer.AcctCD;
抛出新的PXReportRequiredException(参数“AR652000”、AR.Messages.CustomerHistory);
}
返回适配器Get();
}
确保自定义报告示例中的以下内容正确无误:
- 客户id的报告参数名称必须匹配,因为它存在于报告中。确保“CustomerID”是正确的值,而不是类似“Customer\u ID”的值
- 确认642501中的报告可以从站点地图/url访问,没有错误。如果不可访问,则重定向到报告将不起作用
- 尝试使用Base.BAccountAccessor.Current作为客户记录的源,如示例所示
Object reference not set to an instance of an object.
at PX.Common.Async.Process[Result](String uniqueKey, Method`1 method, Int64 waitTimeout)
at PX.Reports.Web.WebReport.Render(HttpResponse response, String format, Int32 pageNumber, Boolean refresh, Boolean isAttacment, String locale)
at PX.Reports.Web.PageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response)
at PX.Reports.Web.HttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
public PXAction<Customer> customerHistory;
[PXUIField(DisplayName = AR.Messages.CustomerHistory, MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.Report)]
public virtual IEnumerable CustomerHistory(PXAdapter adapter)
{
Customer customer = this.BAccountAccessor.Current;
if (customer != null && customer.BAccountID > 0L)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["CustomerID"] = customer.AcctCD;
throw new PXReportRequiredException(parameters, "AR652000", AR.Messages.CustomerHistory);
}
return adapter.Get();
}