Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Acumatica ERP系统(2021 R1版)的账单和调整屏幕的报告按钮中创建附加菜单选项_C#_Customization_Acumatica_Erp - Fatal编程技术网

C# 如何在Acumatica ERP系统(2021 R1版)的账单和调整屏幕的报告按钮中创建附加菜单选项

C# 如何在Acumatica ERP系统(2021 R1版)的账单和调整屏幕的报告按钮中创建附加菜单选项,c#,customization,acumatica,erp,C#,Customization,Acumatica,Erp,是否有人知道如何在Acumatica ERP系统的账单和调整屏幕中添加报表按钮的菜单项,请参见下面的屏幕截图 我还为新的操作按钮创建了一些自定义代码,请参见下面的代码 namespace PX.Objects.AP { public class APInvoiceEntry_Extension : PXGraphExtension<APInvoiceEntry> { public override void Initialize()

是否有人知道如何在Acumatica ERP系统的账单和调整屏幕中添加报表按钮的菜单项,请参见下面的屏幕截图

我还为新的操作按钮创建了一些自定义代码,请参见下面的代码

namespace PX.Objects.AP
{
    public class APInvoiceEntry_Extension : PXGraphExtension<APInvoiceEntry>
    {
        public override void Initialize()
        {
            Base.report.AddMenuAction(VendorInvoiceUnreleased);
            Base.report.AddMenuAction(VendorInvoiceReleased);
        }

        #region buton Vendor Invoice Not Released
        public PXAction<APInvoice> VendorInvoiceUnreleased;
        [PXButton]
        [PXUIField(DisplayName = "Vendor Invoice")]
        public IEnumerable vendorInvoiceUnreleased(PXAdapter adapter)
        {
            var result = adapter.Get<APInvoice>();
            foreach (APInvoice doc in result)
            {

                object FinPeriodID;
                if (Base.Caches[typeof(APInvoice)].GetStatus(doc) == PXEntryStatus.Notchanged)
                {
                    Base.Caches[typeof(APInvoice)].SetStatus(doc, PXEntryStatus.Updated);
                }
                Base.Save.Press();

                var docPeriod = (FinPeriodID = Base.Caches[typeof(APInvoice)].GetValueExt<APRegister.finPeriodID>(doc)) is PXFieldState ? (string)((PXFieldState)FinPeriodID).Value : (string)FinPeriodID;
                Dictionary<string, string> parameters = new Dictionary<string, string>();
                parameters["BranchID"] = null;
                parameters["PeriodFrom"] = docPeriod;
                parameters["PeriodTo"] = docPeriod;
                parameters["CreatedBy"] = null;
                parameters["LastModifiedBy"] = null;
                parameters["DocType"] = doc.DocType;
                parameters["RefNbr"] = doc.RefNbr;
                throw new PXReportRequiredException(parameters, "AP910503", "Report");
            }
            return result;
        }
        #endregion

        #region Vendor Invoice Released
        public PXAction<APInvoice> VendorInvoiceReleased;
        [PXButton]
        [PXUIField(DisplayName = "Vendor Invoice Released")]
        public IEnumerable vendorInvoiceReleased(PXAdapter adapter)
        {
            var result = adapter.Get<APInvoice>();
            foreach (APInvoice doc in result)
            {
                object FinPeriodID;
                if (Base.Caches[typeof(APInvoice)].GetStatus(doc) == PXEntryStatus.Notchanged)
                {
                    Base.Caches[typeof(APInvoice)].SetStatus(doc, PXEntryStatus.Updated);
                }
                Base.Save.Press();

                var docPeriod = (FinPeriodID = Base.Caches[typeof(APInvoice)].GetValueExt<APRegister.finPeriodID>(doc)) is PXFieldState ? (string)((PXFieldState)FinPeriodID).Value : (string)FinPeriodID;
                Dictionary<string, string> parameters = new Dictionary<string, string>();
                parameters["BranchID"] = null;
                parameters["PeriodFrom"] = docPeriod;
                parameters["PeriodTo"] = docPeriod;
                parameters["CreatedBy"] = null;
                parameters["LastModifiedBy"] = null;
                parameters["DocType"] = doc.DocType;
                parameters["RefNbr"] = doc.RefNbr;
                throw new PXReportRequiredException(parameters, "AP910501", "Report");
            }
            return result;
        }
        #endregion
名称空间PX.Objects.AP
{
公共类APInvoiceEntry_扩展名:pxGrapherExtension

如果在Acumatica 2017 R2版本中,此代码可以使用,但在2021 R1版本中不可用。 有人知道解决这个问题的正确方法吗


谢谢。

我建议使用acumatica定制项目功能。这可以从定制项目访问。对于这种方法,您有两种可能的情况。如果只需要一个按钮来显示报告,而不需要其他逻辑。在这种情况下,您可以在scr的“操作”部分中指定该按钮如下面的屏幕截图所示,在定制项目中

另一个选项是在代码中定义按钮,然后转到自定义项目的“操作”部分,您可以选择“添加现有”而不是“添加新”。这将添加现有按钮,并且您可以指定要将其置于“报告”菜单下


嗨,Jean,谢谢你的建议。我已经使用了你的第二个选项,效果很好,非常感谢你,我非常感谢。:)