You are here

function commerce_reports_sales_format in Commerce Reporting 7.3

Same name and namespace in other branches
  1. 7.4 commerce_reports.blocks.inc \commerce_reports_sales_format()

Helper function that formats the data retrieved from commerce_reports_sales_data() function.

1 call to commerce_reports_sales_format()
commerce_reports_sales in ./commerce_reports.blocks.inc
Implementation of table showing sales overview.

File

./commerce_reports.blocks.inc, line 63
Provides all statistics and other features that are not powered by Views.

Code

function commerce_reports_sales_format($data, $title) {
  $sales = array();
  foreach ($data as $currency => $row) {
    $sales[] = array(
      $title,
      $row['count'],
      commerce_currency_format($row['sum'], $currency),
    );
  }
  if (empty($sales)) {
    $sales[] = array(
      $title,
      0,
      commerce_currency_format(0, commerce_default_currency()),
    );
  }
  return $sales;
}