- EH Lim

# How to insert the discounted amount into an invoice template of the MoneyWorks accounting software?

In our __previous post__, we discussed how to record a trade discount given to a customer in the MoneyWorks Sales Invoice transaction. We recorded the discount percentage in the Discount field and the Extension (which is the detail line total) will calculate based on the Unit Price less the discount given multiplied by the quantity sold.

Besides printing the percentage discount on the invoice form, you can print the discounted amount by inserting a discount field to the form.

From the template designer, add a Calculation Box. You need to use a Sum() function together with an ExpandList() function to calculate the discounted amount. Enter the below formula into the Calculate Box:

**Sum(ExpandList ("list", "detail.unitprice * detail.stockqty - detail.net "))**

The "List" in the above formula is referring to the list box name, which contains all the item detail lines. You can get the gross amount of the detail line by multiplying the product unit price with the quantity sold. You will get the discounted amount of the detail line by subtracting the gross amount of the detail line with the net amount of the detail line (discounted value of the product sold). Then, total them up with a Sum() function.

If you prefer to view the discounted amount as a negative value instead of a positive value, then amend the formula to:

**Sum(ExpandList ("list", "detail.net - (detail.unitprice * detail.stockqty)"))**

The net amount of the detail line (the discounted amount) subtract the gross amount of the detail line will give you a negative value.

You can use a Text tool from the Form Designer to add a field label such as "Less Discount" or "Discount" before the discounted amount field.

Refer to the MoneyWorks version 7 User Guide page G-379 for "Form Design" and page G-405 for "Calculation and Things" if you like to know more on form design.

#Template #Macaccountingsoftware #moneyworksaccountingsoftware #Singapore #Malaysia #HongKong