country()->id,NULL,$value)); } /** * Return array of taxes * * @param $cid * @param $zone * @param $value * @return array Tax Information */ public static function detail($cid,$zone,$value=0) { $tax = ORM::factory('Tax') ->where('country_id','=',$cid) ->and_where('zone','=',$zone) ->find_all(); $taxes = array(); foreach ($tax as $to) { $total = array(); $total['id'] = $to->id; $total['description'] = $to->description; $total['amount'] = $to->rate*$value; $total['rate'] = $to->rate; array_push($taxes,$total); } return $taxes; } // Calculate the tax amount public static function total($cid,$zone,$value) { $total = 0; foreach (self::detail($cid,$zone,$value) as $tax) $total += $tax['amount']; return $total; } } ?>