Sales invoice cash discount calculation

Hi All,

While posting sales invoice the cash discount calculation includes the miscellaneous charges. The cash discount should be calculated on just invoice total and exclude any misc charges while calculating the discount. I’d like to know where this calculation takes place e.g. CustTransCashDisc table methods. Thanks.


Misc. Charges will not be considered while calculating the discount. after calculation of discount misc.charges will be added to amount and then it will show it in the Invoice amount. You can view this in SO > Inquiries > Totals. It will give you clear picture.

Please check once again.



Please check the class SalesTotals–>cashDiscAmount method for cash discount amount calculation.

please let me know if you any query regarding this.


Vijay Solanki.

Hi Vijay,

I updated this method to exclude misc charges and then correct discount is displayed in the Sales order totals form.

The issue is this calculation also needs to be in other classes as well. Because at the time of posting sales invoice it replaces the discount.

Any ideas,



In addition to the above you 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.