Hi,
What is the total that you have mentioned ? Is it the Total value of the document ?
If the requirement is that you want to see the total in the invoice print - It is better to handle through Invoice form enhancement wherein for the price corresponding to the main item pick up the price based on the item category and sum it and display.
Please let me know if the understanding of the reqt is not correct.
Regards