function commerce_reports_tax in Commerce Reporting 7.3
Same name and namespace in other branches
- 7.4 modules/tax/commerce_reports_tax.module \commerce_reports_tax()
Returns all reported taxes.
2 calls to commerce_reports_tax()
- CommerceReportsTaxGenerationTests::testSingleTaxType in modules/
tax/ tests/ commerce_reports_tax.test - The following test is unfinished thanks to an apparant bug in SimpleTest.
- commerce_reports_tax_table in modules/
tax/ commerce_reports_tax.admin.inc - Returns the table containing the tax report.
7 string references to 'commerce_reports_tax'
- CommerceReportsTaxGenerationTests::setUp in modules/
tax/ tests/ commerce_reports_tax.test - Sets up a Drupal site for running functional and integration tests.
- commerce_reports_tax_block_view in modules/
tax/ commerce_reports_tax.module - Implements hook_block_view().
- commerce_reports_tax_commerce_reports_dashboard in modules/
tax/ commerce_reports_tax.module - Implements hook_commerce_reports_dashboard().
- commerce_reports_tax_generate in modules/
tax/ commerce_reports_tax.module - Generate historic tax information.
- commerce_reports_tax_order_save in modules/
tax/ commerce_reports_tax.module - Stores the tax information of an order.
File
- modules/
tax/ commerce_reports_tax.module, line 237
Code
function commerce_reports_tax($start, $end) {
$results = db_query("SELECT crt.tax_rate AS name, ctr.display_title AS title, crt.currency_code, SUM(crt.taxable) AS taxable, SUM(crt.taxed) AS taxed FROM {commerce_reports_tax} crt LEFT JOIN {commerce_tax_rate} ctr ON crt.tax_rate = ctr.name LEFT JOIN {commerce_order} co ON crt.order_id = co.order_id WHERE co.created BETWEEN :start AND :end GROUP BY crt.tax_rate, crt.currency_code", array(
':start' => $start,
':end' => $end,
));
$rows = array();
while ($result = $results
->fetchAssoc()) {
$rows[$result['name']] = array(
$result['title'],
commerce_currency_format($result['taxable'], $result['currency_code']),
commerce_currency_format($result['taxed'], $result['currency_code']),
);
}
return $rows;
}