Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com Adding Sales Tax and Other Charges to Jquery Calculation Plugin

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 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
 04-03-2013, 06:29 PM PM User | #2 xelawho Senior Coder     Join Date: Nov 2010 Posts: 2,590 Thanks: 54 Thanked 476 Times in 474 Posts I don't know why you need a plug in to do this - it seems like fairly simple mathematics. Anyway. If your spans look like this: Code: ```
Subtotal :
HST:
Fuel:
Late Fee:
Sales tax:
Total:
``` your script could look like this: Code: ``````
 Users who have thanked xelawho for this post: treigh (04-03-2013)
 04-03-2013, 07:00 PM PM User | #3 treigh New Coder   Join Date: Jan 2008 Posts: 37 Thanks: 5 Thanked 0 Times in 0 Posts Thanks @xelawho -- This answers a 2-day long question.

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 07:49 PM.