Issues with rounding, decimal places on simple invoice form.

AbacusInfoTech
AbacusInfoTech used Ask the Experts™
on
Hi,

I have an issue with rounding on a simple invoice form. I want to calculate a sales tax on a line-by-line basis, to two decimal places, and then add up each of these values and pass them to my parent form. My approach so far has been to calculate the tax on individual invoice lines, and I can display them to two decimal places, however the 'SUM' calculation which you have to put in the child form footer (to pass to the parent form) will not actually sum my rounded values, it recalculates on the base data and then rounds itself.

For example (tax rate = 17.5%)

1 X Item 1 @ £15 + Tax gives a tax of £2.63 when rounded.
1 X Item 2 @ £15 + Tax gives a tax of £2.63 when rounded.
1 X Item 3 @ £15 + Tax gives a tax of £2.63 when rounded.

The tax on the invoice should therefore be £7.89 (3 X £2.63)

However, the SUM at the bottom of my child form gives a tax due of £7.88, which is passed to my main form.

Should I use a field for my line tax, and then sum the contents of my field, or should I stick with a calculated control...?
How can I simply pass the correct sum of the line tax on my child form to the parent form?

My 'price each' field is set to currency / 2dp. My calculated controls are too. The display as a currency to 2dp but when you click into a box that reads £2.63 it shows the underlying figure of 2.625.


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You need to round your data when calculating Tax:
round(MySum*0.175, 2)
You can check it with Excel. If you simply decrease dp, dum will not be changed
Hamed NasrRetired IT Professional

Commented:
Looks strange behavior!
Can you attach a simple database just showing this issue with few records of dummy data?

Author

Commented:
Hi, thanks for your comments. I'll be looking at this later this week.

Author

Commented:
.... and three months later I get around to it :-)

Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial