RE: [U2] Reverse calculating taxes

2007-05-18 Thread Kryka, Richard
Here is a routine a very smart programmer showed me a long time ago, and
I have used it many times since for all kinds of situations like this:

TOT.TAX is the total you need to divide up

TAX.PCT.ARR is the multi-valued array of various tax percents
TAX.AMT.ARR is the returned multi-valued array of tax amounts for each
tax percent

Code to process and make sure the total of the individual taxes matches
the TOT.TAX.  You need to adjust where needed for decimals, etc:

TAX.AMT.ARR = ''
TOT.TAX.PCT = SUM(TAX.PCT.ARR)
MAX = DCOUNT(TAX.PCT.ARR1,@VM)
FOR K = 1 TO MAX
TAX.AMT.ARR1,K = TOT.TAX * (TAX.PCT.ARR1,K / TOT.TAX.PCT)
TOT.TAX -= TAX.AMT.ARR1,K
TOT.TAX.PCT -= TAX.PCT.ARR1,K
NEXT K

The reason this works is the two lines of subtractions.  In the last
iteration, you are multiplying the remaining tax amount by 1.

-Original Message-

Any idea's!  Does anyone think the current calculation is ok.

Dick Kryka
Director of Applications
Paragon Financial Services
a Division of Money Management International
303-632-2226
[EMAIL PROTECTED]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Reverse calculating taxes

2007-05-18 Thread Brenda Price
The tax has already been collected and passed on to the appropriate
places by our client.  We are getting just the total amount of the tax
collected on a down payment.  Right now we aren't doing anything with
this amount and the breakdown.  However, in the future we will be
producing reports for the client on what the breakdown of the taxes
were.

Brenda

-Original Message-
From: Anthony Youngman [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 18, 2007 10:27 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Reverse calculating taxes

No idea as to your exact problem, BUT

In the UK and in Europe, you normally do not have any choice in how you
calculate tax. The rounding rules etc etc are prescribed by the
legislation so the way your programmer did it MAY be illegal, or it MAY
be the way the legislation told him to do it!

For example, if I calculate VAT over here (Sales Tax to you Americans),
applying our 17.5% tax rate to goods worth #1, I get a sticker price of
#1.17. Anybody notice anything odd? That is the correct calculation as
specified by law.

(By sticker price, I mean the price quoted on the goods. In Europe,
the price you see on the goods or shelf is the price you pay - if they
charge you any more and get caught the fines are HEFTY! Saying to
customers oh there's 6% sales tax on top of the displayed price would
probably get management thrown in jail!)

Cheers,
Wol

-Original Message-
From: Brenda Price [mailto:[EMAIL PROTECTED] 
Sent: 18 May 2007 15:48
To: u2-users@listserver.u2ug.org
Subject: [U2] Reverse calculating taxes

We have a program that got into an endless loop yesterday because of the
way the programmer wrote the code.  Since that program is kicked off by
automated processes behind the scenes nothing we tried would let us get
a hold of it and get it out of the loop, we had to kill it. Not fun and
we are still dealing with the aftermath today.



I've been looking at the code and the existing calculation does not look
like it is correct.



The program takes the tax amt multiples it by the tax rate for each tax
federal, state, county, city. It then adds or subtracts a penny on the
amount from the highest tax rate until adding that amount to all the
other tax amounts equals the tax amt passed in.



What happened yesterday was that the calculation could never match
because it was 29.63 and the calculation was 2.00025, which was round to
2.0003, so once it got to 29.6303, it just keep adding and subtracting a
penny to try and make it match. In this instance the tax was a straight
6.75% state tax.



I checked records updated in the past to see what the calculation did to
those records when there were multiple taxes to break out.  I found a
record with 0 fed tax, 5.5% state tax, 1% county, and 1% city tax.  The
amount of the tax was $11.72 with the breakdown of $0 Fed, $11.48 state,
$.12 county, $.12 city.



Yes, 12 cents is 1 percent of the tax amount but is it 1 percent of the
amount the tax was calculated on which is not available to us.  To me
that is questionable.



To me, I should be able to get the original amount used to calculate the
tax, the calculate the taxes for each rate, add them up, make sure the
total amount matches what the tax amount is.  I just can't think of a
way of doing this at the moment, drawing blanks for sure.



Any idea's!  Does anyone think the current calculation is ok.



Brenda
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Reverse calculating taxes

2007-05-18 Thread Russ Watson
I think it depends if there are items which are NOT taxable at one layer
but are taxable at the others.

IF all items are taxable at each layer then Richards routine will work
for you.

But you need the answer to the first question to make that leap.


Russ


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brenda Price
Sent: Friday, May 18, 2007 12:34 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Reverse calculating taxes

This looks to be exactly what we need.  Many thanks!

Brenda

-Original Message-
From: Kryka, Richard [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 18, 2007 10:51 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Reverse calculating taxes

Here is a routine a very smart programmer showed me a long time ago, and
I have used it many times since for all kinds of situations like this:

TOT.TAX is the total you need to divide up

TAX.PCT.ARR is the multi-valued array of various tax percents
TAX.AMT.ARR is the returned multi-valued array of tax amounts for each
tax percent

Code to process and make sure the total of the individual taxes matches
the TOT.TAX.  You need to adjust where needed for decimals, etc:

TAX.AMT.ARR = ''
TOT.TAX.PCT = SUM(TAX.PCT.ARR)
MAX = DCOUNT(TAX.PCT.ARR1,@VM)
FOR K = 1 TO MAX
TAX.AMT.ARR1,K = TOT.TAX * (TAX.PCT.ARR1,K / TOT.TAX.PCT)
TOT.TAX -= TAX.AMT.ARR1,K
TOT.TAX.PCT -= TAX.PCT.ARR1,K
NEXT K

The reason this works is the two lines of subtractions.  In the last
iteration, you are multiplying the remaining tax amount by 1.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/