In some industries, because the price per unit is very small, the company has to work with 6 decimal for prices, for more accuracy in their cost price or Gross profits. However, they only need to provide an invoice with two decimals places to their customers.
Some companies create a user defined field (UDF) in the marketing document which will display the price rounded to two decimal places. This UDF will then be called in the template of the marketing document, instead of the current price's field. Other companies want to avoid having too many UDFs and formatted searches. Therefore, they prefer to round the value of the Unit Price field in the template.
This article demonstrates how to round the value of the Unit Price field in a template.
In the template, modification needs to be done on every field which holds the price with more than 2 digits. In our example the Unit Price has 6 decimals but in print out of the Sales Quotation only 2 decimals are required for this field.
In the template, a formula field has to be created for each field which requires a rounding.
In this case there is just one field to be changed, the Unit Price field. In the following screenshots the Unit Price field has a green background.
To create a formula for the Unit Price field, its UniqueID is required. This information can be obtained from the Field Index, as shown below:
To create the formula:
- Create a formula field, fielding the same area as the field to be rounded.
- In the Properties - Field window_, Content_ tab, click on Formula Editor button to open the Formula Editor window.
- Clicking on the arrow in the Operation field displays a list of formulas which are available to use in the print layout.
- Select the formula Round ( , ) (available under the Arithmetical Operations section) and press the Insert button to place it in the editing section of the Formula Editor.
The Round ( , ) requires the following input; Round (UniqueID of field to be rounded, Number of decimals required in rounding). In our example, the UniqueID of the Unit Price field is F_024 and this field should be rounded to 2 decimal places. Consequently the formula becomes, Round (F_024,2). This field has been given a blue background for demonstration purposes only.
For more information on the formula refer to the document How to Customize Templates with PLD in 2007 A and 2007 B. As shown in the preview of the print out below, the formula field (the blue field in the preview below) is now rounded to 2 decimal places.
When choosing to do such a change the accountant has to be aware that the display might not match the information in the database. For example, if the rounding is done on the document total, because the currency and the payment means require the amount to be absolute, then the payment received might differ from the invoice total.
In the first line the value is null in the Unit Price rounded field. However there is a value in the system field Unit Price for the item, hence there is a value in the Total field. This happens because the unit price is very small at GBP 0.00153 which rounds to GBP 0.00
The rounding is done at line level in this document and the rounding line totals are added to obtain the total before tax.
For more information on editing templates please refer to Print Layout Designer articles and Print Layout Designer landing page