At 04:22 2015-11-18, Ted Roche <[email protected]> wrote:
Shibboleth backatcha.

First, the problem was "Customer 1" and "Customer 2" not "dozens" nor thousands.

Second, the question was whether total price included tax on the gross
amount or tax on the cost amount, which *might* vary by state or
locality, not dozens of variations.

I also think the "do the simplest" rule would say: when you first run
into the situation, write and IF statement. When there are three
cases, update to a CASE. When there are too many to handle easily,
promote it to a Strategy Pattern. Solve the problem in front of you.
YAGNI: You Ain't Gonna Need It.

     Not quite.  Let me coin "YMWNNI" (You Might Well Not Need It).

I have had these sorts of situations come up in my client billing app. Sometimes, the situation gets more complicated sometime later. Write it so it can be easily changed.

Depending on the exact application and the customers involved, it's
also possible that individual items may be taxed at different rates
(materials v. services v. labor) or that the entire order might be
tax-exempt for other reasons. And what is taxed and in which amounts
may vary by municipality, county, state and country.

All of these are common problems. There are standard "Acceptable
Accounting Practices" of calculating these, and ideally the code ought
to be easily accessible and readable and kept in source code control
(another reason to keep them out of memo fields!) so MB can explain
exactly what is done when he is subpoenaed by the taxing authorities,
or when the customer discovers at the end of the year that they have
not calculated their withholdings correctly.

     Nicely written.

One thing that has been missing from the posts in this thread is rounding. round() is your friend.

Sincerely,

Gene Wirchenko


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to