在Acumatica ERP

时间:2017-01-27 04:05:10

标签: c# customization acumatica erp

我已经在Acumatica ERP的屏幕支票和付款(AP302000)中使用type ='check'创建了一个文档并将其发布。请参阅下面的截图。

enter image description here

然后我将使用账单抵消这笔付款。请参阅下面的截图。

enter image description here

当我使用同一供应商创建帐单时,我想在支票和付款的屏幕上将供应商参考详细信息交易传递到“应用程序”选项卡“比尔和调整”菜单菜单中的新附加字段。

我应该创建新的附加字段吗?然后我应该在Release动作中创建APPaymentEntryExtension以将此APAdjust的Vendor Ref传递给Bill屏幕的Application Tab Menu中的新附加字段? 或者可能有另一种方式没有创建新的额外字段?

谢谢,

1 个答案:

答案 0 :(得分:0)

看起来足以为APAdjust DAC声明自定义未绑定字段并在RowSelecting中填充(对于 0 Amount Paid 的记录)和RowInserting(对于 Amount Paid大于0的记录) )APInvoiceEntry BLC扩展中的处理程序:

public class APAdjustExt : PXCacheExtension<APAdjust>
{
    public abstract class invoiceNbr : IBqlField
    { }

    [PXString]
    [PXUIField(DisplayName = "Vendor Ref.")]
    public string InvoiceNbr { get; set; }
}

public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry>
{
    protected void APAdjust_RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
    {
        APAdjust row = e.Row as APAdjust;
        if (row == null) return;

        using (var connScope = new PXConnectionScope())
        {
            row.GetExtension<APAdjustExt>().InvoiceNbr = GetInvoiceNbr(row);
        }
    }

    protected void APAdjust_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
    {
        APAdjust row = e.Row as APAdjust;
        if (row != null)
        {
            row.GetExtension<APAdjustExt>().InvoiceNbr = GetInvoiceNbr(row);
        }
    }

    private string GetInvoiceNbr(APAdjust adjustment)
    {
        string invoiceNbr = null;

        var doc = (APInvoice)PXSelect<APInvoice,
            Where<APInvoice.docType, Equal<Required<APInvoice.docType>>,
                And<APInvoice.refNbr, Equal<Required<APInvoice.refNbr>>>>>
            .Select(Base, adjustment.AdjgDocType, adjustment.AdjgRefNbr);
        if (doc != null)
        {
            invoiceNbr = doc.InvoiceNbr;
        }

        return invoiceNbr;
    }
}