Customize Release AP Document in Acumatica System

2019-09-18 08:15发布

问题:

I have a question about the BLC in Acumatica. As we know release process in screen Invoices And Memos (AR301000) using ARInvoiceEntry BLC that is invokes ARDocumentRelease static method ReleaseDoc. And ReleaseDoc invokes virtual ReleaseDocProc method, which creates GLTran Records.

My question : did this condition also imlemented in APInvoiceEntry BLC that invoikes APDocumentRelease static method ReleaseDoc. And ReleaseDoc invokes virtual ReleaseDocProc method also ?

because I have a additional field in screen Invoice And Memos and want to sent the value in this additional field to Journal Transaction when button release is clicking. Eventhough release from screen Invoice And Memos and also from AR Release Process screen. And I have finished with this customization.

Now I need to do the same thing for screen AP Release Process screen.

any suggestion how to provide it ?

回答1:

Try something like this(I copypasted code from question How to Customize screen Release AP Documents (AP501000) in Acumatica and modified it):

using System;
using System.Collections.Generic;
using PX.Data;
using PX.Objects.AP;
using PX.Objects.GL;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.IN;

namespace SGLCustomizeProject
{

    public class ARRelaseProcessExtension : PXGraphExtension<APReleaseProcess>
    {
        public delegate List<APRegister> ReleaseDocProcDel(JournalEntry je, ref APRegister doc, PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res, bool isPrebooking, out List<INRegister> inDocs);
        [PXOverride]
        public virtual List<APRegister> ReleaseDocProc(JournalEntry je, ref APRegister doc, PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res, bool isPrebooking, out List<INRegister> inDocs, ReleaseDocProcDel del)
        {
            je.RowInserting.AddHandler<GLTran>((sender, e) =>
            {
                GLTran glTran = e.Row as GLTran;

                APInvoice api = PXSelect<APInvoice, Where<APInvoice.refNbr, Equal<Required<GLTran.refNbr>>, And<APInvoice.docType, Equal<Required<GLTran.tranType>>>>>.Select(sender.Graph, glTran.RefNbr, glTran.TranType);
                if (api != null && api.InvoiceNbr != null)
                {
                    GLTranExtension glTex = PXCache<GLTran>.GetExtension<GLTranExtension>(glTran);
                    glTex.UsrInvoiceNbr = api.InvoiceNbr;
                }
            });
            return del(je, ref doc, res, isPrebooking, out inDocs);
        }
    }
}


标签: c# acumatica