You are here

function commerce_tax_rate_round_amount in Commerce Core 7

Rounds an amount for a given tax rate.

Parameters

$tax_rate: The tax rate array for the tax to calculate.

$amount: The amount of the tax to round.

Return value

The amount rounded based on the type of tax it is for.

3 calls to commerce_tax_rate_round_amount()
commerce_tax_commerce_line_item_rebase_unit_price in modules/tax/commerce_tax.module
Implements hook_commerce_line_item_rebase_unit_price().
commerce_tax_field_attach_load in modules/tax/commerce_tax.module
Implements hook_field_attach_load().
commerce_tax_rate_calculate in modules/tax/commerce_tax.module
Calculates a price array for the tax on the unit price of a line item.

File

modules/tax/commerce_tax.module, line 345
Defines tax rates and Rules integration for configuring tax rules for applicability and display.

Code

function commerce_tax_rate_round_amount($tax_rate, $amount) {

  // Round the amount according to the tax type's specification.
  $tax_type = commerce_tax_type_load($tax_rate['type']);
  return commerce_round($tax_type['round_mode'], $amount);
}