You are here

function commerce_reports_tax_table in Commerce Reporting 7.4

Same name and namespace in other branches
  1. 7.3 modules/tax/commerce_reports_tax.admin.inc \commerce_reports_tax_table()

Returns the table containing the tax report.

1 call to commerce_reports_tax_table()
commerce_reports_tax_block_view in modules/tax/commerce_reports_tax.module
Implements hook_block_view().

File

modules/tax/commerce_reports_tax.admin.inc, line 68
Administrative forms.

Code

function commerce_reports_tax_table($start = 0, $end = REQUEST_TIME) {
  if (!variable_get('commerce_reports_tax_batch_finished', FALSE)) {
    drupal_set_message();
  }
  $rows = commerce_reports_tax($start, $end);
  if (!variable_get('commerce_reports_tax_batch_finished', FALSE)) {
    $rows = array();
    $rows[] = array(
      'data' => array(
        array(
          'data' => t("It seems you have not yet extracted tax information from orders that occurred before enabling the tax reporting module. You will have to <a href='@generate-url'>generate</a> past data before anything will show up.", array(
            '@generate-url' => url('admin/commerce/config/tax-reports/generate'),
          )),
          'colspan' => 3,
        ),
      ),
    );
  }
  elseif (!$rows) {
    $rows[] = array(
      'data' => array(
        array(
          'data' => t("There's currently no tax data available. You might want to <a href='@generate-url'>generate</a> past data.", array(
            '@generate-url' => url('admin/commerce/config/tax-reports/generate'),
          )),
          'colspan' => 3,
        ),
      ),
    );
  }
  return array(
    '#theme' => 'table',
    '#header' => array(
      t('Tax rate'),
      t('Taxable'),
      t('Taxed'),
    ),
    '#rows' => $rows,
  );
}