Well, having encountered this problem, helping to make POS for a Canadian company, came up with this solution, I hope this helps someone. (Canada removed a penny in 2012). Also includes taxes, including prices, just pass “1” as the second argh.
//calculate price and tax function calctax($amt,$tax_included = NULL){ $taxa = 'tax rate 1 here'; $taxb = 'tax rate 2 here'; $taxc = ($taxa + $taxb) + 1; if(is_null($tax_included)){ $p = $amt; }else{ $p = number_format(round($amt / $taxc,2),2); } $ta = round($p * $taxa,2); $tb = round($p * $taxb,2); $sp = number_format(round($p+($ta + $tb),2),2); $tp = number_format(round(($sp*2)/10,2)*5,2); $ret = array($ta,$tb,$tp); return $ret; }
source share