Posted on 1 Comment

What is programming?

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.

  1. I pull up the sample invoice that the client used to show the incorrect figures.
  2. I reproduce the invoice in Excel.
  3. 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.
  4. I manipulate the spreadsheet to assure that I am using the correct math formulas to get the correct result.
  5. 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…