我在CR306000上有一个自定义按钮,可以尝试通过调用一个自定义报告来打印当前加载的案例信息。导航 URL 当前设置为:
~/Frames/ReportLauncher.aspx?ID=Inquirycase.rpx&CASEID=####
我需要自定义编程来分配当前案例 ID 以替换"####",但不知道在哪里以及如何引用该自定义按钮并修改其属性。 请帮忙。谢谢。
可以将名为"CaseID"的报表参数添加到报表中,并使用以下代码使用 AEF 扩展调用它,如下所示:
public class CRCaseMaintExtension : PXGraphExtension<CRCaseMaint>
{
public override void Initialize()
{
base.Initialize();
//if adding to an existing menu button do that here...
// Example:
//Base.Inquiry.AddMenuAction(this.CustomReportButton);
}
public PXAction<CRCase> CustomReportButton;
[PXButton]
[PXUIField(DisplayName = "Custom Report", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
public virtual IEnumerable customReportButton(PXAdapter adapter)
{
if (Base.Case.Current != null)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["CaseID"] = Base.Case.Current.CaseID.ToString();
//enter in your report id/number here
string reportNumber = "Inquirycase";
//opens the report using the defined parameters
throw new PXReportRequiredException(parameters, reportNumber, "Custom Report");
}
return adapter.Get();
}
}
我还没有测试过上述内容,但这应该可以让您大部分时间到达那里。