Acumatica ERP 6.0 创建报告下拉列表
Acumatica ERP 6.0 Create Reports Dropdown
我已经创建了自定义条目,我需要向其中添加一些报告。
我正在尝试像这样获取 Reports Dropdown
但是我所有的努力都没有成功。
我有收据条目中的操作和功能
public PXAction<MyMasterView> report;
[PXUIField(DisplayName = "Reports", MapEnableRights = PXCacheRights.Select),PXButton(SpecialType = PXSpecialButtonType.Report)]
protected virtual IEnumerable Report(PXAdapter adapter, [PXString(8, InputMask = "CC.CC.CC.CC"), PXStringList(new string[]{"PO649999","PO646000"}, new string[]{"Print My Report","Print Receipt"})] string reportID)
{
List<MyMasterView> list = adapter.Get<MyMasterView>().ToList<MyMasterView>();
if (!string.IsNullOrEmpty(reportID))
{
this.Save.Press();
int num = 0;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (MyMasterViewcurrent in list)
{
dictionary["PARAMETER"] = current.PARAMETER;
num++;
}
if (num > 0)
{
throw new PXReportRequiredException(dictionary, reportID, string.Format("Report {0}", reportID));
}
}
return list;
}
但结果我得到了以下内容
有几种方法可以解决这个问题。
这里的另一个问题概述了一种方法:
Acumatica - Add additional buttons to Actions drop down to screen CT30100
另一种方法是利用列表并通过自动化步骤控制它。
如果您查看 PO 收据屏幕,您会看到这一点。
1) 创建包含其他项目列表的按钮方法:
public PXAction<POReceipt> report;
[PXUIField(DisplayName = "Reports", MapEnableRights = PXCacheRights.Select)]
[PXButton]
protected virtual IEnumerable Report(PXAdapter adapter,
[PXString(8, InputMask = "CC.CC.CC.CC")]
[PXStringList(new string[] { "PO646000", "PO632000", "PO622000" }, new string[] { "Purchase Receipt", Messages.ReportPOReceiptBillingDetails, Messages.ReportPOReceipAllocated })]
string reportID)
{
List<POReceipt> list = adapter.Get<POReceipt>().ToList();
if (string.IsNullOrEmpty(reportID) == false)
{
Save.Press();
int i = 0;
Dictionary<string, string> parameters = new Dictionary<string, string>();
foreach (POReceipt doc in list)
{
if (reportID == "PO632000")
{
parameters["FinPeriodID"] = (string)Document.GetValueExt<POReceipt.finPeriodID>(doc);
parameters["ReceiptNbr"] = doc.ReceiptNbr;
}
else
{
parameters["ReceiptType"] = doc.ReceiptType;
parameters["ReceiptNbr"] = doc.ReceiptNbr;
}
i++;
}
if (i > 0)
{
throw new PXReportRequiredException(parameters, reportID, string.Format("Report {0}", reportID));
}
}
return list;
}
注意 PXStringList,其中包含可能的值和描述。
然后您可以从自动化步骤控制 active/inactive 状态。
您在原始问题中缺少的步骤是您仍然需要从自动化步骤中添加这些按钮以将它们添加到列表中。
我已经创建了自定义条目,我需要向其中添加一些报告。
我正在尝试像这样获取 Reports Dropdown
我有收据条目中的操作和功能
public PXAction<MyMasterView> report;
[PXUIField(DisplayName = "Reports", MapEnableRights = PXCacheRights.Select),PXButton(SpecialType = PXSpecialButtonType.Report)]
protected virtual IEnumerable Report(PXAdapter adapter, [PXString(8, InputMask = "CC.CC.CC.CC"), PXStringList(new string[]{"PO649999","PO646000"}, new string[]{"Print My Report","Print Receipt"})] string reportID)
{
List<MyMasterView> list = adapter.Get<MyMasterView>().ToList<MyMasterView>();
if (!string.IsNullOrEmpty(reportID))
{
this.Save.Press();
int num = 0;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (MyMasterViewcurrent in list)
{
dictionary["PARAMETER"] = current.PARAMETER;
num++;
}
if (num > 0)
{
throw new PXReportRequiredException(dictionary, reportID, string.Format("Report {0}", reportID));
}
}
return list;
}
但结果我得到了以下内容
有几种方法可以解决这个问题。
这里的另一个问题概述了一种方法: Acumatica - Add additional buttons to Actions drop down to screen CT30100
另一种方法是利用列表并通过自动化步骤控制它。
如果您查看 PO 收据屏幕,您会看到这一点。
1) 创建包含其他项目列表的按钮方法:
public PXAction<POReceipt> report;
[PXUIField(DisplayName = "Reports", MapEnableRights = PXCacheRights.Select)]
[PXButton]
protected virtual IEnumerable Report(PXAdapter adapter,
[PXString(8, InputMask = "CC.CC.CC.CC")]
[PXStringList(new string[] { "PO646000", "PO632000", "PO622000" }, new string[] { "Purchase Receipt", Messages.ReportPOReceiptBillingDetails, Messages.ReportPOReceipAllocated })]
string reportID)
{
List<POReceipt> list = adapter.Get<POReceipt>().ToList();
if (string.IsNullOrEmpty(reportID) == false)
{
Save.Press();
int i = 0;
Dictionary<string, string> parameters = new Dictionary<string, string>();
foreach (POReceipt doc in list)
{
if (reportID == "PO632000")
{
parameters["FinPeriodID"] = (string)Document.GetValueExt<POReceipt.finPeriodID>(doc);
parameters["ReceiptNbr"] = doc.ReceiptNbr;
}
else
{
parameters["ReceiptType"] = doc.ReceiptType;
parameters["ReceiptNbr"] = doc.ReceiptNbr;
}
i++;
}
if (i > 0)
{
throw new PXReportRequiredException(parameters, reportID, string.Format("Report {0}", reportID));
}
}
return list;
}
注意 PXStringList,其中包含可能的值和描述。
然后您可以从自动化步骤控制 active/inactive 状态。
您在原始问题中缺少的步骤是您仍然需要从自动化步骤中添加这些按钮以将它们添加到列表中。