发布ARInvoice后如何在AR301000上启用自定义字段? [英] How to enable a custom field on AR301000 after the ARInvoice is released?

查看:108
本文介绍了发布ARInvoice后如何在AR301000上启用自定义字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些用户字段已添加到ARInvoice输入屏幕(AR301000)。用户字段存在于事务网格中。它们仅是文本字段。没有自定义逻辑关联,并且绑定到DB表。

Some user fields were added to the ARInvoice entry screen (AR301000). The user fields exist in the Transactions grid. They are text fields only. There is no custom logic associated, and are bound to the DB table.

用户希望在发票下达后修改特定的用户文本字段-这将是实现此目标的最佳方法?

A user wishes to modify a particular user text field after the invoice is released - what would be the best way to achievee this?

推荐答案

很幸运,ARInvoces输入屏幕上的交易网格从未被自动化步骤禁用。事务网格的所有UI表示逻辑仅在ARInvoiceEntry BLC中定义:

Thankfully, the Transactions grid on the ARInvoces entry screen is never disabled by automation steps. All UI presentation logic for the Transactions grid is only defined within the ARInvoiceEntry BLC:

public class ARInvoiceEntry : ARDataEntryGraph<ARInvoiceEntry, ARInvoice>, PXImportAttribute.IPXPrepareItems
{
    ...
    protected virtual void ARInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
        ARInvoice doc = e.Row as ARInvoice;
        if (doc == null) return;

        ...
        bool shouldDisable = doc.Released == true
                            || doc.Voided == true
                            || doc.DocType == ARDocType.SmallCreditWO
                            || doc.PendingPPD == true
                            || doc.DocType == ARDocType.FinCharge && !IsProcessingMode && cache.GetStatus(doc) == PXEntryStatus.Inserted;
        if (shouldDisable)
        {
            ...
            Transactions.Cache.AllowDelete = false;
            Transactions.Cache.AllowUpdate = false;
            Transactions.Cache.AllowInsert = false;
            ...
        }
        else
        {
            ...
            Transactions.Cache.AllowDelete = true;
            Transactions.Cache.AllowUpdate = true;
            Transactions.Cache.AllowInsert =
                doc.CustomerID != null &&
                doc.CustomerLocationID != null &&
                doc.DocType != ARDocType.FinCharge &&
                (doc.ProjectID != null || !PM.ProjectAttribute.IsPMVisible(this, BatchModule.AR));
            ...
        }
        ...
    }

    protected virtual void ARTran_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        ARTran row = e.Row as ARTran;
        if (row != null)
        {
            PXUIFieldAttribute.SetEnabled<ARTran.defScheduleID>(sender, row, row.TranType == ARInvoiceType.CreditMemo || row.TranType == ARInvoiceType.DebitMemo);
            PXUIFieldAttribute.SetEnabled<ARTran.deferredCode>(sender, row, row.DefScheduleID == null);
        }
    }
    ...
}

要在发布ARInvoice之后在AR301000上启用自定义字段,您应该完成以下相关的简单步骤:

To enable a custom field on AR301000 after the ARInvoice is released, you should complete the following relatevely simple steps:


  1. 设置<针对ARInvoice_RowSelected事件处理程序中的ARTran缓存,将strong> low>更新更新为 true

  1. Set AllowUpdate to true for the ARTran cache within the ARInvoice_RowSelected event handler

调用静态的 PXUIFieldAttribute.SetEnabled 方法以禁用除用户要修改的特定自定义文本字段之外的所有ARTran字段

Invoke the static PXUIFieldAttribute.SetEnabled method to disable all ARTran fields, except the particular custom text field, the user wants to modify

下面列出了完整的代码段:

The complete code snippet is listed below:

public class ARInvoiceEntryExt : PXGraphExtension<ARInvoiceEntry>
{
    private bool IsDisabled(ARInvoice doc)
    {
        return doc.Released == true
            || doc.Voided == true
            || doc.DocType == ARDocType.SmallCreditWO
            || doc.PendingPPD == true
            || doc.DocType == ARDocType.FinCharge 
            && !Base.IsProcessingMode 
            && Base.Document.Cache.GetStatus(doc) == PXEntryStatus.Inserted;
    }

    public void ARInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {
        ARInvoice doc = e.Row as ARInvoice;
        if (doc == null) return;

        if (IsDisabled(doc))
        {
            Base.Transactions.Cache.AllowUpdate = true;
        }
    }

    public void ARTran_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        var doc = Base.Document.Current;
        ARTran row = e.Row as ARTran;

        if (row != null && doc != null && IsDisabled(doc))
        {
            PXUIFieldAttribute.SetEnabled(sender, row, false);
            PXUIFieldAttribute.SetEnabled<ARTranExt.usrCustomTextField>(sender, row, true);
        }
    }
}

这篇关于发布ARInvoice后如何在AR301000上启用自定义字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆