如何在Acumatica中启用网格字段-调整

时间:2019-04-03 15:45:43

标签: acumatica acumatica-kb

这是我的代码,用于启用网格并输入数据,但是不起作用。

   protected void ARAdjust_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
    {

        ARInvoice rInvoice = Base.Document.Current;

        if (rInvoice.DocType == ARDocType.DebitMemo)
        {
            Base.Adjustments_2.AllowInsert = true;

        }
    }

这是尚未启用网格的图像。

enter image description here

1 个答案:

答案 0 :(得分:2)

在主要视图(DAC APInvoice)行选定事件中设置了“调整”视图。我将重写此事件,并在调用base方法后添加您的更改。类似于以下示例:

public class APInvoiceEntryTestExtension : PXGraphExtension<APInvoiceEntry>
{
    public virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
    {
        del?.Invoke(cache, e);
        var row = (APInvoice)e.Row;
        if (row?.DocType != ARDocType.DebitMemo)
        {
            return;
        }

        Base.Adjustments.AllowInsert = true;

        //  FROM BASE CALL:
        //    Adjustments.Cache.AllowInsert = false;
        //    Adjustments.Cache.AllowDelete = false;
        //    Adjustments.Cache.AllowUpdate = !invoiceState.IsRetainageDebAdj &&
        //    invoiceState.IsDocumentRejectedOrPendingApproval || invoiceState.IsDocumentApprovedBalanced
        //        ? !invoiceState.IsDocumentRejected
        //        : Transactions.Cache.AllowUpdate && !invoiceState.IsDocumentPrebookedNotCompleted;
        }
}