Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12546
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Math Formula Question - Need Ideas |
| Date | 2014-01-05 00:54 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <laaagn$1bo$1@dont-email.me> (permalink) |
| References | <XnsA2ABA6A53901Farbpenyahoocom@78.46.70.116> |
On Sun, 05 Jan 2014 00:26:08 +0000, Adrienne Boswell wrote: > I have a math question to which I can't find the answer. Here is the > scenario: > > Someone goes to a store and has $100.00 worth of items. The merchant > gives the customer a 10% discount, so only $90.00 is sent to the bank. > Of the original amount, $10.00 goes to the customer for the discount, > $80.00 goes to the merchant, $10.00 goes for a processing fee. But > those amounts have to be calced on the original amount, not what the > bank got. I need a formula to find the original amount if I have the > percentage (10%) and the amount the bank got ($90.00). I know in my > head that the original amount is $100.00, but I have to do it > programatically. > > I know this is probably dead simple, but I just can't get my head around > it. > > Thanks in advance. If a * b = c then a = c / b b = c / a In your case, 100 * 0.9 = 90 Therefore to get the original, 90 / 0.9 = 100 0.9 being the decimal fraction that equates to 90%, ie the amount the customer paid after discount. Observation though, processing fees are usually a % of the amount paid. eg if a card payment processing service charges 1.25%, that would be 1.25% of the payments made, so in your case: Invoice: = 100.00 Discount: 10% = 10.00 Amount due: = 90.00 ======================== Processing: 10% = 9.00 Amount to bank: = 81.00 The payment processing is only concerned with the amount of the transaction that it actually processes, not some other intermediate calculation between the merchant and the customer. Consider the case where the customer is given a 95% discount by the store. If your processing service still charges 10% of the original amount, the your processing fee is more than actual transaction value: Invoice: = 100.00 Discount: 10% = 95.00 Amount due: = 5.00 ================================== Processing: 10% of 100.00 = 10.00 Amount to bank: = -5.00 ???? Error The correct math for this case is more likely: Invoice: = 100.00 Discount: 10% = 95.00 Amount due: = 5.00 ======================== Processing: 10% = 0.50 Amount to bank: = 4.50 As a general rule, payment processing systems only concern themselves with the amounts that they are handling, and not other amounts that may have appeared in calculations made outside of their own systems. Of course, if you're working on something like a sales commission basis, that might be a different set of rules, as you might expect to be receiving a commission based on the listed price, regardless of whether the items are sold at a discount or not. -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Math Formula Question - Need Ideas Adrienne Boswell <arbpen@yahoo.com> - 2014-01-05 00:26 +0000
Re: Math Formula Question - Need Ideas Richard Damon <Richard@Damon-Family.org> - 2014-01-04 19:33 -0500
Re: Math Formula Question - Need Ideas Allodoxaphobia <knock_yourself_out@example.net> - 2014-01-05 17:56 +0000
Re: Math Formula Question - Need Ideas Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-05 13:15 -0500
Re: Math Formula Question - Need Ideas John Smith <johnsmithjsm@live.com> - 2014-01-07 14:57 +0000
Re: Math Formula Question - Need Ideas The Natural Philosopher <tnp@invalid.invalid> - 2014-01-05 00:37 +0000
Re: Math Formula Question - Need Ideas Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-04 20:20 -0500
Re: Math Formula Question - Need Ideas Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-05 00:54 +0000
Re: Math Formula Question - Need Ideas Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-04 20:22 -0500
Re: Math Formula Question - Need Ideas Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-05 16:40 +0000
Re: Math Formula Question - Need Ideas Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-05 13:16 -0500
Re: Math Formula Question - Need Ideas Adrienne Boswell <arbpen@yahoo.com> - 2014-01-05 23:09 +0000
Re: Math Formula Question - Need Ideas Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-05 18:53 +0100
Re: Math Formula Question - Need Ideas Adrienne Boswell <arbpen@yahoo.com> - 2014-01-05 22:56 +0000
Re: Math Formula Question - Need Ideas Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-05 18:11 -0500
Re: Math Formula Question - Need Ideas Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-06 20:47 +0100
csiph-web