# Cash Discount to be calculated on amount excluding Miscellaneous charges

**URL:** <https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291>\
**Category:** Developer Forum\
**Created:** [December 15, 2012, 10:09am UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291 "2012-12-15T10:09:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![preetipandey](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@preetipandey](https://www.dynamicsuser.net/u/preetipandey)\
**Post date:** [December 15, 2012, 10:09am UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/1 "2012-12-15T10:09:44Z")

</div>

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

Thanks,

---

<div class="post-metadata">

**Author:** ![dax-0912](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dax-0912](https://www.dynamicsuser.net/u/dax-0912)\
**Post date:** [January 18, 2013, 12:53am UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/2 "2013-01-18T00:53:19Z")

</div>

Hello,

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?

Thanks.

---

<div class="post-metadata">

**Author:** ![preetipandey](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@preetipandey](https://www.dynamicsuser.net/u/preetipandey)\
**Post date:** [January 23, 2013, 10:55am UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/3 "2013-01-23T10:55:30Z")

</div>

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!!

---

<div class="post-metadata">

**Author:** ![ax\_cons](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@ax\_cons](https://www.dynamicsuser.net/u/ax_cons)\
**Post date:** [January 23, 2013, 12:36pm UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/4 "2013-01-23T12:36:19Z")

</div>

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?

Pranav…

---

<div class="post-metadata">

**Author:** ![dax-0912](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dax-0912](https://www.dynamicsuser.net/u/dax-0912)\
**Post date:** [January 30, 2013, 1:42pm UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/5 "2013-01-30T13:42:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![preetipandey](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@preetipandey](https://www.dynamicsuser.net/u/preetipandey)\
**Post date:** [February 5, 2013, 9:56am UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/6 "2013-02-05T09:56:28Z")

</div>

Hi,

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.

Preeti

---

<div class="post-metadata">

**Author:** ![preetipandey](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@preetipandey](https://www.dynamicsuser.net/u/preetipandey)\
**Post date:** [February 5, 2013, 10:00am UTC](https://www.dynamicsuser.net/t/cash-discount-to-be-calculated-on-amount-excluding-miscellaneous-charges/42291/7 "2013-02-05T10:00:59Z")

</div>

Hi Pranav,

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

Thanks,

Preeti
