SO发票被释放并关闭后更新值

时间:2017-10-13 17:13:52

标签: acumatica acumatica-kb

我已在SO发票屏幕(SO303000)上创建了一个自定义复选框字段,即使在发票和付款已全额付款后也需要更新。

但是现在我无法做到,因为一旦发票已全部付清,就会被禁用。

我尝试使用自动化步骤,但它无法正常工作。我在“字段”选项卡上添加了自定义字段,以便在SO发票的“关闭”步骤中启用。

请建议。

1 个答案:

答案 0 :(得分:1)

要在发票和/或关闭发票后在SO发票顶级表单和交易网格中启用自定义字段,您应该为SOInvoiceEntry创建一个扩展,并按照以下示例订阅ARInvoice_RowSelected和ARTran_RowSelected事件:

public class SOInvoiceEntryExt : PXGraphExtension<SOInvoiceEntry>
{
    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 sender, PXRowSelectedEventArgs e)
    {
        ARInvoice doc = e.Row as ARInvoice;
        if (doc == null) return;

        if (IsDisabled(doc))
        {
            PXUIFieldAttribute.SetEnabled<ARInvoiceExt.usrCustomTextField>(
                sender, doc, true);
            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);
        }
    }
}

此外,您需要在已关闭自动化步骤中将自定义字段添加到顶级表单中: enter image description here

应用上述更改后,这就是SO Invoices屏幕的工作方式:

enter image description here

enter image description here