Hi. I have Prepayment on AR302000 screen. On Application of the Prepayment to a Normal AR Invoice, i need change debit account id. How I can do this?
Change transactions AccountID
Best answer by bihalivan15
I override this method. And it solved for me:
[PXOverride]
public virtual GLTran InsertAdjustmentsAdjustingTransaction(JournalEntry je, GLTran tran, GLTranInsertionContext context, Func<JournalEntry, GLTran, GLTranInsertionContext, GLTran> baseMethod)
{
if (context.ARRegisterRecord != null && context.ARAdjustRecord != null)
{
if (tran.DebitAmt != 0 && context.ARRegisterRecord?.DocType == ARDocType.Prepayment && context.ARAdjustRecord?.AdjdDocType == ARInvoiceType.Invoice)
{
ARDepositInvoiceSetup setup = PXSelect<ARDepositInvoiceSetup>.Select(Base).FirstOrDefault();
if (setup?.EnableGLIntegration == true)
{
Customer customer = Customer.PK.Find(Base, context.ARAdjustRecord.CustomerID);
tran.AccountID = customer?.PrepaymentAcctID;
tran.SubID = customer?.PrepaymentSubID;
}
}
}
return baseMethod(je, tran, context);
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.