Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where should ROUND() be applied in complex calc
Message
 
To
24/04/2009 21:29:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01396309
Message ID:
01396357
Views:
53
Hi Dragan

>My experience with things like that tells me to forget the maths, logic and common sense, and simulate the manual process the accountants will use to check your calculations, so you get the same result as they do. Anything else will be an error to them.

Even they vary between companies :), so I was looking towards dictating something ;)

>From the same set of long afternoons and evenings with accountants in my wilder days: calculate the tax per item only once, and _store it_. Never calculate again.

okay, I will de-normalize the tables, I think that will be good, though I hate it from the DOS days when I had always done this.

>Never calculate tax on the total of multiple items, the calculation will be more precise and your tax total will be different from the sum of tax amounts per item
>The accountants will take this as evidence that your program does something wrong.

Yes, learn't that the hard way, this provided consistency within the application but when the manual systems get converted the accountants cried murder, but that was the only way to go to keep ones sanity

>Calculate once, store, then sum. No matter how you sum it, the sum will be the same - no roundoff error there, you're clean.

Yes, I am sure I am going to do it this way, but the frigging problem is that these taxes come (and never go) but get more complicated (or revamped), so having fixed columns for taxes on a line item basis is not possible (with all the add / less that happens before and after 2 sets of taxes, I mentioned only one set in my eg. and no add /less), unless there is some way to do so, I will have to calculate what I can calculate on a line by line basis and put the total in the traditional manner in the parent / header record. This leaves open, the calculation to be done all over again in reports that report on a line by line basis.

>As to your specific calculation, you can achieve the best accuracy if you round up only the final result, but it won't matter a bit if they add it this way and that way and it doesn't match. It's accountants we're talking about, is it?

Yes, accountants and tax accountants.
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform