Gossamer Forum
Home : Products : DBMan SQL : Discussion :

calculations suggestion

Quote Reply
calculations suggestion
I read through the GT:Template to get a basic understanding of calculations. Basically what I have is a invoice that parses any number of items and their price (the results are a looped search result). Then there is a subtotal, tax and total field. Here is what I plan to do:

I will add to the template for items price: <%if price%><%price%><%include hidden.html%><%endif%>

Hidden.html will be a blank html document with a hidden value called "cost" that will include <%price%>. So when the document is parsed to the user, there will be a hidden value (cost) for each item. Now, what I am thinking is that for each "cost" (except for the first) there will be a sequential number automatically added to it. i.e. Invoice A has three items in it. After the document is parsed to the user, there will be three hidden "cost" items: cost, cost2 and cost3.

So, then for subtotal, I could have <%cost + cost2 + cost3 + cost4 + cost5...%> plus a hidden value called "stotal" that does the same. This will add all of the prices of the items. If there are only two items, then "cost3" and on will be ignored becuase they don't exist.

Then for total, I could do <%stotal * tax + stotal%>

===========

Does anyone see anything wrong with this? Any suggestions? Any improvements? Any syntax errors (" or ' that need to be included)?

Thank you.
Subject Author Views Date
Post calculations suggestion useruseruser 1815 Jan 22, 2003, 9:28 AM