Incorrect calculation of miscellaneous charges

Hi all,

I have now joined and hope that anybody can help me with some development task.

When a new sales order is invoiced, the miscellaneous charges are calculated incorrect. I’d like to know where this calculation takes place, especially the entry of a new data record into the “MarkupTrans” table.

I think this must be either in form “SalesEditLines” or in class “SalesFormLetter”. I searched through every method in that form and class, but I cannot find the calculation respectively the entry to “MarkupTrans” table.

I hope anybody can tell me.




Define “incorrectly”? Have you checked the Accounts receivable >> Setup >> Misc. Charges options?

Check class SalesFormLetter_Invoice, methods updateNow() and postJournal()


“Incorrectly” means that packing costs are calculated for each item in an invoice.

for example I have an invoice with following items:

123456 - mountainbike - 300 $

00099 - Freight - 40 $

summary: 340 $

miscellaneous charges(packing costs 1.0%): 3.4 $ (3 $ for mountainbike + 0.4 $ for freight)

But it’s incorrect to calculate packing costs for freight, that doesn’t make sense. So, packing costs have only be calculated for “real” products.

I have to change the calculation of miscellaneous charges in some method so that it will be correct. But I don’t know where I can change this.

can you understand now?

Thanks so far.




yeah, much clearer to me now :slight_smile:

You have the kind of problem I let consultant solve, because it’s not a coding problem and I don’t actually use the interface that much. But it sounds like you have auto misc charges applied to everything. Check out this:


Are you using AX 2009 or AX 2012?

In 2009:

Check AR>Setup>Misc.Charges > Misc.Charge code … here in this you check the postings how its applying.

I want to know, this charge which you talking about $3.4, it should be entered manually or automatically? if you want to set it as automatic, then you need to configure Auto Misc.charges at AR. (AR>Setup>Misc.Charge> Auto.Misc.Charges) … here you need to specify MC code & select the MC category like (fixed,percentage,pcs). and where you want to apply these charges (Main or Lines).

Check these above settings properly. i hope your issue gets resolved.


Thanks for your advice.

I hope that I can find any solution for this problem.


Hi Johannes,

Did you solved misc charges issue? I have similar misc charges calculation issue.


Hey Lahu,

What kind of issue your facing in Misc.Charges? If you have issue, then post it as new one.

May i know whats your exact requirement and where your getting problem?


The requirement is to exclude all misc charges from total cash discount calculation for sales orders. The cash discount should be applied only on invoice total excluding any misc charges. Currently the total discount is applied on invoice total + misc charges. As a result the discount is not corrent.

Hi Sarathy,

I can use salestotals class and then display correct discount amount on sales order totals form. But it is not saving the discount 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.