function commerce_reports_sales_format in Commerce Reporting 7.4
Same name and namespace in other branches
- 7.3 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 67 - 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;
}