Cash Discount to be calculated on amount excluding Miscellaneous charges

Hi all,

I want certain modification to be done. Pls help.

I want Cash Disc field on Sales Totals form to show Cash Discount that is excluding the miscellaneous charges. Cash Discount should only be applicable and calculated for the SubTotal Amount. It should not be adding any miscellaneous charges. How do get it done. Any help is deeply appreciated



I have same problem regarding cash discount calculation in AX 2012. I want to exclude all miscellaneous charges while calculating Cash Discount.

Were you able to solve this issue?


Yes it was done.

To exclude miscellaneous charges, you have to edit the method ‘cashDiscAmount’ of the class ‘SalesTotals’.

Below is the code:

" totalCashDisc = CustParameters::cashDiscAmount(this.cashDiscCode(), this.currencyCode(), this.totalAmount() - this.totalMarkup(), this.totalAmount() - this.totalMarkup() - this.totalTaxAmount(), this.cashDiscPercent()); "

Hope it helps!!

Hi Preeti,

If suppose client requires thet for other customer they want to calculate cash discount on miscellaneous charges also, then in that case what will happen?


Thank you. This logic excludes misc charges and displays correct discount amount on sales order totals form.

It seems like the correct discount is not saved and afterwords while posting sales invoice it calculates discount again which is not correct. Can you suggest which other places the calculation should be done? Thanks.


After you are done with the steps told previously we need to change some code in post method of class CustVendVoucher.(While debugging you will see that from exactly where it is being fetched. )
Replace CustVendTransCashDisc::amountExclTax(amountCur, custVendInvoiceJour.SumTax) with
your code where you have to pass the amountCur value excluding markup total.


Hi Pranav,

I am not really aware of it right now but would let you know once I will found a solution to this.