"Murphy was an optimist!"
What is programming? November 24, 2006 12:30 pmPosted by Doug McCaughan in : ColdFusion, Daily Life, Programming, Technology
In essense, a client presents a challenge and I solve the problem.
Today’s challenge: a custom ordering system (shopping cart) written in ColdFusion is producing the wrong totals.
The system design: tax is built into the price of the items stored in the database except for certain non-taxable items. A flag indicates if an item has tax built into the price or not. At the bottom of the invoice, the amount of tax charged is shown.
The problem: The system allows for the administrator to apply a discount. Tax cannot be discounted but the total tax shown on the invoice is calculated off the discounted price.
How do you solve this kind of problem? I use my tools available to me. I could just jump into the code and start changing it but I can do a better job and document my efforts by using MS Excel and MS Word to help solve the problem.
- I pull up the sample invoice that the client used to show the incorrect figures.
- I reproduce the invoice in Excel.
- I open the database (in this case with MS Access) and find the products listed on the invoice so that I can be certain which items are taxed and which are not.
- I manipulate the spreadsheet to assure that I am using the correct math formulas to get the correct result.
- Find the code within the system that calculates the tax and change it to use the new formula for presentation.
Update: I think perhaps the end of this post was lost…trackback