Calculating VAT values - InfoPath Dev
in

InfoPath Dev

Calculating VAT values

Last post 12-21-2007 10:35 AM by Greg Collins. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-20-2007 04:18 AM

    Calculating VAT values

    When creating a repeating table for invoicing i have the following fields: Number ordered, Cost per unit, Tax rate, Total cost before tax, Total cost including tax, and Total cost of tax. Each field is a decimal double set to display two decimal places.

    In a single row this works fine, however if i want to have sum fields outside the table adding up the values of each column, for example the total amount of tax raised in all five rows of a table, (containing five rows), the totals will very often differ since the calculation uses the whole of any calculated number rather than the displayed two decimal places.

    This means that with order forms or invoicing with multiple rows in a table the displayed value for sum of net cost added to the displayed value in the sum of tax cost is often not the value displayed in the field which shows the sum of the Total cost including tax.

    Obviously the system is using the true calculated values rather than the displayed value for calculations, is there a way to avoid this conflict and force the system to display and submit values based on display values rather than the actual calculated figure?

  • 12-21-2007 10:35 AM In reply to

    You can use the round() function. Keep in mind that round() only works to whole numbers, so to get your 2 decimal places, you have to do some multiplying and dividing by 100:

    round(my:field1 * 100) / 100

Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.