onestcoder Posted January 5, 2007 Share Posted January 5, 2007 What i'm tring to do is to do a simple calculate: and have it round to the nearest cent. ex: $325.50 + 10% = ??? I have an input box for the percent. In it the user will typy "10" for 10% here are the vars. $total_price = 325.50 ;(or what they enter into the input box) $markup_percent = 10 ; (or what they enter into the input box) $makeup_amount = ??? $total_price_after_markup =??? Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
hearurscream Posted January 5, 2007 Share Posted January 5, 2007 $markup_amount=round(100*$total_price/$markup_percent,2) $total_price_after_markup=$markup_amount + $total_price Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house. Link to comment Share on other sites More sharing options...
onestcoder Posted January 5, 2007 Author Share Posted January 5, 2007 That works THANK you I just need to swich some var $markup_amount=round($markup_percent/100*$total_price,2) $total_price_after_markup=$markup_amount + $total_price Need a website: http://www.iconixmarketing.com Link to comment Share on other sites More sharing options...
hearurscream Posted January 5, 2007 Share Posted January 5, 2007 The order of multiplying and dividing does not matter at all, try both, you will get the same answer. Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 5, 2007 Developers Share Posted January 5, 2007 (edited) The order of multiplying and dividing does not matter at all, try both, you will get the same answer.true .... but are you sure about the fomula?shouldn't that be? :$markup_amount=round($total_price*$markup_percent/100,2) Edited January 5, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hearurscream Posted January 5, 2007 Share Posted January 5, 2007 Sorry, I mixed up my formula. I divided the total price by decimal percent. You are correct grandmaster JdeB. @ OP Sorry for the confusion. Infinity is a floorless room without walls or ceiling.Anyone who cannot cope with mathematics is not fully human. At best he is a tolerable subhuman who has learned to wear shoes, bathe, and not make messes in the house. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now