-->

如何改变APInvoice类型(比尔,信贷调整等)的出现?(How to change the ap

2019-10-16 13:07发布

客户端已进入扣款调整和信贷调整到应付账款的烦恼,因为他们更熟悉的术语借项通知单和贷项通知单。 因为他们有将两者混为一谈,他们往往当他们的意思是进入信用调整输入借记调整。 我们怎样才能改变借方和贷方调整的出现使它们出现为信用卡和借记通知单?

我们追踪的地方APInvoice获取文档类型的PX.Objects \ AP \描述\ Messages.cs文件的值的来源。 然而,我们不知道如何通过定制项目访问它。

using System;

using PX.Common;

namespace PX.Objects.AP
{
    [PXLocalizable(Messages.Prefix)]
    public static class Messages
    {
        // Add your messages here as follows (see line below):
        // public const string YourMessage = "Your message here.";
        #region Validation and Processing Messages

        #region Translatable Strings used in the code

        #region Graph Names

        #region DAC Names

        #region Document Type

        public const string Invoice = "Bill";
        public const string CreditAdj = "Credit Adj.";
        public const string DebitAdj = "Debit Adj.";
        public const string Check = "Check";
        public const string Prepayment = "Prepayment";
        public const string Refund = "Vendor Refund";

我们想要的是CreditAdj等于“借项通知单”和DebitAdj等于“贷项通知单”。 请让我们知道这是可能的,如果有,试图改变这些值或者任何已知的问题,这不是一个好的做法。

编辑:现在,我已经成功地实现了标签的变化得益于Samvel的回答,我已经尝试做APPayment类似的东西。 的问题已拿出其中加载屏幕时,出现了一个错误:
错误:值数组的长度不等于标签阵列的长度。 参数名:allowedLabels

我的新代码如下:

APPaymentEntry:

    public class APPaymentEntry_Extension : PXGraphExtension<APPaymentEntry>
    { 
       #region Event Handlers
       [PXDBString(3, IsKey = true, IsFixed = true)]
       [PXDefault]
       [PXUIField(DisplayName = "Type", Visibility = 
                  PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)]
       [PXFieldDescription]
       [CustomAPPaymentTypeList]

       protected virtual void APPayment_DocType_CacheAttached(PXCache sender)
       {
       }
       #endregion
  }

CustomAPPaymentType:

  public class CustomAPPaymentType : APPaymentType
  {

      public new static readonly string[] NewLabels = new string[]
      {
        "Check",
        "Credit Memo",
        "Prepayment",
        "Vendor Refund",
        "Voided Refund",
        "Voided Check"
      };

      public new class ListAttribute : PXStringListAttribute
      {
          public ListAttribute() : base(APPaymentType.Values, CustomAPPaymentType.NewLabels )
          {
          }
      }

  }

CustomAPPaymentTypeListAttribute

    public class CustomAPPaymentTypeListAttribute : CustomAPPaymentType.ListAttribute
  {
     public override void CacheAttached(PXCache sender)
    {
          this._AllowedValues = new string[]
                                      {
                                      "CHK",
                                      "ADR",
                                      "PPM",
                                      "REF",
                                      "VRF",
                                      "VCK"
                                      };
          this._AllowedLabels = new string[]
                                      {
                                      "Check",
                                      "Credit Memo",
                                      "Prepayment",
                                      "Vendor Refund",
                                      "Voided Refund",
                                      "Voided Check"
                                      };
          this._NeutralAllowedLabels = new string[]
                                      {
                                      "Check",
                                      "Credit Memo",
                                      "Prepayment",
                                      "Vendor Refund",
                                     "Voided Refund",
                                      "Voided Check"
                                      };
          base.CacheAttached(sender);
    }
  }

我如何进行把握,好像我不是有太多的“标签”或“价值”,但它是不是在哪不清楚。 我力求做到准确对当前设置为当前类型APPayment,在哪里出了问题有什么建议?

Answer 1:

您可以实现通过以下方式这一目标:

警告下面提供的借记卡和信用卡调标签不会更改为信用卡和借记凭证在整个系统中,这样做,你将需要修改属性,所有的DAC定制。

  1. 首先,你需要在基础属性,它是改变标签APInvoiceType.List ,我将继承APInvoiceType做它象下面这样:

     public class CustomAPInvoiceType : APInvoiceType { public new static readonly string[] NewLabels = new string[] { "Bill", "Debit Memo", "Credit Memo", "Prepayment" }; public new class ListAttribute : PXStringListAttribute { public ListAttribute() : base(APInvoiceType.Values, CustomAPInvoiceType.NewLabels ) { } } } 
  2. 现在,您需要更改标签APMigrationModeDependentInvoiceTypeListAttribute这样做,我会继承CustomAPInvoiceType.ListAttribute ,我在下面像前面的步骤定义:

     public class CustomAPMigrationModeDependentInvoiceTypeListAttribute : CustomAPInvoiceType.ListAttribute { public override void CacheAttached(PXCache sender) { APSetup apsetup = (sender.Graph.Caches[typeof(APSetup)].Current as APSetup) ?? PXSelectBase<APSetup, PXSelect<APSetup>.Config>.SelectWindowed(sender.Graph, 0, 1, Array.Empty<object>()); if (apsetup != null) { bool? migrationMode = apsetup.MigrationMode; bool flag = true; if (migrationMode.GetValueOrDefault() == flag & migrationMode != null) { this._AllowedValues = new string[] { "INV", "ADR", "ACR" }; this._AllowedLabels = new string[] { "Bill", "Credit Memo", "Debit Memo" }; this._NeutralAllowedLabels = new string[] { "Bill", "Credit Memo", "Debit Memo" }; base.CacheAttached(sender); return; } } base.CacheAttached(sender); } } 
  3. 最后一步是从第2步中应用此属性DocType领域,我们将用做CacheAttached事件处理程序和PXGraphExtension

     public class APInvoiceEntry_Extension : PXGraphExtension<APInvoiceEntry> { #region Event Handlers [PXDBString(3, IsKey = true, IsFixed = true)] [PXDefault] [PXUIField(DisplayName = "Type", Visibility = PXUIVisibility.SelectorVisible, Enabled = true, TabOrder = 0)] [PXFieldDescription] [CustomAPMigrationModeDependentInvoiceTypeList] protected virtual void APInvoice_DocType_CacheAttached(PXCache sender) { } #endregion } 

发布此代码后,你会看到下拉类型的显示像OB下面的截图信用卡和借记备注:



文章来源: How to change the appearance of APInvoice types (Bill, Credit Adjustment, etc)?
标签: acumatica