Cash Discount Customization

Hi Everyone,

Today want to share with you a ways to customize cash discount calculation in AP and AR. The main payer there is a TermsAttribute, that does all required discount calculations. It is linked to fields it need through parameters in constructor:

[Terms(typeof(ARInvoice.docDate), typeof(ARInvoice.dueDate), typeof(ARInvoice.discDate), typeof(ARInvoice.curyOrigDocAmt), typeof(ARInvoice.curyOrigDiscAmt))]
  • ARInvoice.docDate – input – date of the document
  • ARInvoice.dueDate – output – due data of the document
  • ARInvoice.discDate – output – data where discount is applicable
  • ARInvoice.curyOrigDocAmt – input – total document amt from where discount will be calculated
  • ARInvoice.curyOrigDiscAmt – output – end discount value

As there values are configurable it very easy to replace its calculations using customization framework and use different values as a base for calculations.

So here I want to give you an example on how to calculate cash discounts for non-inclusive taxes in AR and SO invoices and in purchase orders and AP bills.
Main problem here is that we need to exclude discounts, there is no real field in Acumatica for that. Basically we need field for “Details Total – Discounts”.
So we need to calculate it on the fly first. This is perfect example for PXFormula usage as formula can easily calculate virtual fields on change of any arguments.

Main change there is argument change for TermsAttribute from ARInvoice.curyOrigDocAmount to ARInvoiceCashDiscount.curyClientTotal. Last one is a dynamically calculated difference between Details and Discounts (ARInvoice.CuryLineTotal – ARInvoice.CuryDiscTot) using PXFormula.

Now you can test that Cash Discount is calculated differently.

Complete version of customization you can download here.

Hope it helps and have an easy customization!

Leave a Reply

Your email address will not be published. Required fields are marked *