# Taxes and Discounts: order of operations question

**Derek Atkins
**
warlord@MIT.EDU

*14 Jun 2002 22:17:44 -0400*

I've got a dilemma...
I'm trying to work out the order of operations for applying discounts
and taxes. Right now I've got a flag that says whether to apply the
discount pre-tax or post-tax, but perhaps I'm just being tired (and
therefore dense), because I can see more than two ways of applying
them.
Background: I've got a bunch of numbers:
aggregate = qty * price
pretax = (aggregate or (aggregate-tvalue)/(1+tpercent)) where
tvalue == total of "tax values" and
tpercent == total of "tax percentages"
Here's the problem: Can the discount ever be applied to the taxes? In
other words, is the question of pre-tax v. post-tax application of the
discount a quesiton of whether the taxes are applied to the original
or discounted value, or is it a question of whether the discount is
actually computed before or after taxes?
In one way, you always compute the discount off the pretax number, and
compute the taxes off of either the pretax value or "pretax-discount"
value. In the other way, you either compute the tax on
"pretax-discount", or you compute the discount on "pretax+taxes".
I'm not sure which is the right way. And yes, these numbers _can_ be
different (because both taxes and discounts can be either percentages,
values, or both, so you don't lose the commutative properties of pure
percentages).
I suppose in the worst case I could supply yet another option to
choose which computation method to use, but I'd rather not if I can
avoid it.
Comments or suggestions?
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord@MIT.EDU PGP key available