RE: need a quick help with an order total module
dreamscape <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.devel |
|---|---|
| Message-ID | <351156b8a698a61fc19154e04a5138a5@osCommerce-Forums> |
This message was sent from: Development http://forums.oscommerce.com/viewtopic.php?p=163202#163202 ---------------------------------------------------------------- yeah Ian that works... though seems a little round about way of getting the deduction: take for example (at 4.956% interest): [quote]20/256.78 ($f_deduct/$this->get_order_total()) = .077887686... 12.7260168*.07787... ($order->info['tax_groups'][$key] * $ratio1) = .9912[/quote] that gets you the correct tax difference, but it is much easier & faster to just go: 4.956/100*20 = .9912 the difference in the tax (what needs deducted) will always be the tax on the difference of the 2 subtotal (a flat difference in this case)... (it is just simple algebra). take this: let x = the subtotal prior to discounts. let y = the flat discount amount. we will use 5% interest for simplicity. we are attempting to find [b]D[/b], the tax difference. D = .05x [b]-[/b] .05(x [b]-[/b] y) D = .05x [b]-[/b] .05x [b]+[/b] .05y D = .05y see, the difference in tax is equal to the amount of tax on the difference. No eral need for any of those fancy ratio calculations. Simple algebra will get ya there much faster :wink: