View Single Post
 04-02-2013, 06:26 PM PM User | #1 treigh New Coder   Join Date: Jan 2008 Posts: 37 Thanks: 5 Thanked 0 Times in 0 Posts Adding Sales Tax and Other Charges to Jquery Calculation Plugin Hi there, this is a follow-up question to one I asked @ Stack Overflow, but I couldn't get any further help there. Basically I have a delivery price estimator that uses the very helpful Jquery Calculation Plugin and a live example of it can be found here: http://jsfiddle.net/mohammadAdil/afk3C/5/ With some help, I managed to have almost everything to work. So far I can display the subtotal and the grand total, which includes a 13% sales tax. I need to be able to also display the actual tax value after the subtotal as well as fuel charge and a late fee (when applicable). In other words, the subtotal should not include the fuel charge and the late fee. I should have the following: Subtotal = \$amount Fuel = \$amount Late Fee = \$amount Sales tax = 0.13(subtotal + fuel + Late) Total = subtotal + fuel + + Late + sales tax I hope it makes some sense. Here's my javascript from Jsfiddle (Link above): Code: ``` \$("#FirstHourRate, #HalfHourRate, [rel='eta']").keyup(recalc); function recalc() { \$("#subtotal").calc( // the equation to use for the calculation "FirstHourRate + (eta-1)*2*HalfHourRate", { bind: "keyup", eta: \$("[rel='eta']").sum(), FirstHourRate: \$("#FirstHourRate"), HalfHourRate: \$("#HalfHourRate") }, function(s) { // return the number as a dollar amount var gt = s.toFixed(2) * 1.13; \$("#hst").text("\$" + gt.toFixed(2)); return "\$" + s.toFixed(2); }); }``` Thanks