techker Posted August 3, 2014 Share Posted August 3, 2014 hey guys can i get some help in putting this in php ? i need to calculate taxes but in quebec...so 2 taxes exapl SUBTOTAL 3.99TAX1: 18%TAX2: 15% Calculating when Compound tax is enabled: Amount with Compound tax = (SUBTOTAL + TAX1) + TAX2 in digits: (SUBTOTAL + TAX1) = 3.99 + 18% = 3.99 + 3.99 / 100 * 18 = 3.99 * 1.18 = 4.7082(SUBTOTAL + TAX1) + TAX2 = 4.7082 + 15% = 4.7082 + 4.7082 / 100 * 15 = 4.7082 + 0.70623 = 4.7082 * 1.15 = 5.41443Amount with Compound tax = 5.41443 Quote Link to comment https://forums.phpfreaks.com/topic/290248-compound-tax-in-php/ Share on other sites More sharing options...
Ch0cu3r Posted August 3, 2014 Share Posted August 3, 2014 (edited) You already have the math worked out for applying the taxes (highlighted below) (SUBTOTAL + TAX1) = 3.99 + 18% = 3.99 + 3.99 / 100 * 18 = 3.99 * 1.18 = 4.7082(SUBTOTAL + TAX1) + TAX2 = 4.7082 + 15% = 4.7082 + 4.7082 / 100 * 15 = 4.7082 + 0.70623 = 4.7082 * 1.15 = 5.41443 The number in purple is the subtotal you're applying tax to. The green number is the subtotal with 1st tax. The number in blue will be sales price (subtotal, 1st and 2nd taxes added together). So what is the problem. Are you unsure how covert it to PHP? All that is needed is for you to change the purple and green numbers to PHP variables. Edited August 3, 2014 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/290248-compound-tax-in-php/#findComment-1486744 Share on other sites More sharing options...
requinix Posted August 4, 2014 Share Posted August 4, 2014 As you've shown, compound tax is simply applying a tax to an already-taxed number. It can be simplified to just 3.99 * 1.18 * 1.15 = 5.41443 $price * $tax1 * $tax2 Quote Link to comment https://forums.phpfreaks.com/topic/290248-compound-tax-in-php/#findComment-1486804 Share on other sites More sharing options...
techker Posted August 4, 2014 Author Share Posted August 4, 2014 i got it going with this $TAX1=5.00;$TAX2 =9.974;///this is suppose to be 9.975 but i get a penny more..so i doped it a penny and im ok.. $price1 = ($price * $TAX1/100) ;$price2 = ($price * $TAX2/100) ;$price3 = $price + $price1 + $price2; $total1= round($price1, 2);$total2= round($price2, 2);$total= round($price3, 2); Quote Link to comment https://forums.phpfreaks.com/topic/290248-compound-tax-in-php/#findComment-1486810 Share on other sites More sharing options...
techker Posted August 4, 2014 Author Share Posted August 4, 2014 is there a tutorial on how to make a form that when i scan it updates the field with the product info from database?im making a POS system for my body's store.. Quote Link to comment https://forums.phpfreaks.com/topic/290248-compound-tax-in-php/#findComment-1486812 Share on other sites More sharing options...
Barand Posted August 6, 2014 Share Posted August 6, 2014 http://lmgtfy.com/?q=php+barcode+scanner+integration Quote Link to comment https://forums.phpfreaks.com/topic/290248-compound-tax-in-php/#findComment-1487038 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.