Merge pull request #16411 from woocommerce/fix/16306

Don't subtract negative taxes in net sales report
This commit is contained in:
Claudio Sanches 2017-08-11 21:30:25 -03:00 committed by GitHub
commit 2ffc09de0d
1 changed files with 1 additions and 1 deletions

View File

@ -391,7 +391,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
// Total the refunds and sales amounts. Sales subract refunds. Note - total_sales also includes shipping costs.
$this->report_data->total_sales = wc_format_decimal( array_sum( wp_list_pluck( $this->report_data->orders, 'total_sales' ) ) - $this->report_data->total_refunds, 2 );
$this->report_data->net_sales = wc_format_decimal( $this->report_data->total_sales - $this->report_data->total_shipping - $this->report_data->total_tax - $this->report_data->total_shipping_tax, 2 );
$this->report_data->net_sales = wc_format_decimal( $this->report_data->total_sales - $this->report_data->total_shipping - max( 0, $this->report_data->total_tax ) - max( 0, $this->report_data->total_shipping_tax ), 2 );
// Calculate average based on net
$this->report_data->average_sales = wc_format_decimal( $this->report_data->net_sales / ( $this->chart_interval + 1 ), 2 );