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

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

问题描述

一些用户字段已添加到 ARInvoice 输入屏幕 (AR301000) 的顶级表单中.用户希望在发票发布后修改特定用户文本字段 - 实现此目的的最佳方法是什么?

Some user fields were added to the top-level form of the ARInvoice entry screen (AR301000). A user wishes to modify a particular user text field after the invoice is released - what would be the best way to achieve this?

推荐答案

对于 ARInvoice 条目屏幕,所有特定于顶级表单的 UI 呈现逻辑仅在 ARInvoiceEntry BLC 中实现:

For the ARInvoice entry screen, all UI presentation logic specific to the top-level form is only implemented 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)
        {
            bool isUnreleasedWO = doc.Released != true && doc.DocType == ARDocType.SmallCreditWO;
            bool isUnreleasedPPD = doc.Released != true && doc.PendingPPD == true;

            PXUIFieldAttribute.SetEnabled(cache, doc, false);
            PXUIFieldAttribute.SetEnabled<ARInvoice.dueDate>(cache, doc, (doc.DocType != ARDocType.CreditMemo && doc.DocType != ARDocType.SmallCreditWO && doc.DocType != ARDocType.FinCharge) && doc.OpenDoc == true && doc.PendingPPD != true);
            PXUIFieldAttribute.SetEnabled<ARInvoice.discDate>(cache, doc, (doc.DocType != ARDocType.CreditMemo && doc.DocType != ARDocType.SmallCreditWO && doc.DocType != ARDocType.FinCharge) && doc.OpenDoc == true && doc.PendingPPD != true);
            PXUIFieldAttribute.SetEnabled<ARInvoice.emailed>(cache, doc, true);
            cache.AllowDelete = isUnreleasedWO || isUnreleasedPPD;
            cache.AllowUpdate = true;
            Transactions.Cache.AllowDelete = false;
            Transactions.Cache.AllowUpdate = false;
            Transactions.Cache.AllowInsert = false;

            ..
        }
        else
        {
            ...
        }
        ...
    }
    ...
}

要在发布 ARInvoice 后在 AR301000 顶级表单上启用自定义字段,您应该按照以下示例为 ARInvoiceEntry 声明扩展并订阅 ARInvoice_RowSelected 处理程序:

To enable a custom field on the AR301000 top-level form after the ARInvoice is released, you should declare an extension for ARInvoiceEntry and subscribe to ARInvoice_RowSelected handler following the sample below:

public class ARInvoiceEntryExt : PXGraphExtension<ARInvoiceEntry>
{
    public void ARInvoice_RowSelected(PXCache sender, 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 
            && !Base.IsProcessingMode && sender.GetStatus(doc) == PXEntryStatus.Inserted;

        if (shouldDisable)
        {
            PXUIFieldAttribute.SetEnabled<ARInvoiceExt.usrCustomTextField>(sender, doc, true);
        }
    }
}

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

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