You are here

function uc_taxes_admin_settings in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_taxes/uc_taxes.admin.inc \uc_taxes_admin_settings()
  2. 7.3 uc_taxes/uc_taxes.admin.inc \uc_taxes_admin_settings()

Display a list of tax rates.

1 string reference to 'uc_taxes_admin_settings'
uc_taxes_menu in uc_taxes/uc_taxes.module
Implementation of hook_menu().

File

uc_taxes/uc_taxes.module, line 175

Code

function uc_taxes_admin_settings() {
  $header = array(
    t('Name'),
    t('Rate'),
    t('Taxed product types'),
    t('Tax only shippable?'),
    t('Taxed line items'),
    t('Weight'),
    array(
      'data' => t('Actions'),
      'colspan' => 3,
    ),
  );
  $result = db_query("SELECT * FROM {uc_taxes} ORDER BY weight");
  while ($rule = db_fetch_object($result)) {
    $rule->taxed_product_types = (array) unserialize($rule->taxed_product_types);
    $rule->taxed_line_items = (array) unserialize($rule->taxed_line_items);
    $rows[] = array(
      $rule->name,
      $rule->rate * 100 . '%',
      implode(', ', $rule->taxed_product_types),
      $rule->shippable ? t('Yes') : '',
      implode(', ', $rule->taxed_line_items),
      $rule->weight,
      l(t('edit'), 'admin/store/settings/taxes/edit/' . $rule->id),
      l(t('copy'), 'admin/store/settings/taxes/copy/' . $rule->id),
      l(t('delete'), 'admin/store/settings/taxes/delete/' . $rule->id),
    );
  }
  $output = theme('table', $header, $rows);
  $output .= l('Make a new tax rule.', 'admin/store/settings/taxes/edit');
  return $output;
}