diff --git a/includes/admin/reports/class-wc-report-sales-by-date.php b/includes/admin/reports/class-wc-report-sales-by-date.php index 0050806dea3..4620c9d7647 100644 --- a/includes/admin/reports/class-wc-report-sales-by-date.php +++ b/includes/admin/reports/class-wc-report-sales-by-date.php @@ -479,22 +479,27 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report { $shipping_tax_amounts = $this->prepare_chart_data( $this->report_data->orders, 'post_date', 'total_shipping_tax', $this->chart_interval, $this->start_date, $this->chart_groupby ); $tax_amounts = $this->prepare_chart_data( $this->report_data->orders, 'post_date', 'total_tax', $this->chart_interval, $this->start_date, $this->chart_groupby ); - $net_order_amounts = array(); + $net_order_amounts = array(); + $gross_order_amounts = array(); foreach ( $order_amounts as $order_amount_key => $order_amount_value ) { + $gross_order_amounts[ $order_amount_key ] = $order_amount_value; + $gross_order_amounts[ $order_amount_key ][1] = $gross_order_amounts[ $order_amount_key ][1] - $refund_amounts[ $order_amount_key ][1]; + $net_order_amounts[ $order_amount_key ] = $order_amount_value; - $net_order_amounts[ $order_amount_key ][1] = $net_order_amounts[ $order_amount_key ][1] - $shipping_amounts[ $order_amount_key ][1] - $shipping_tax_amounts[ $order_amount_key ][1] - $tax_amounts[ $order_amount_key ][1]; + $net_order_amounts[ $order_amount_key ][1] = $net_order_amounts[ $order_amount_key ][1] - $refund_amounts[ $order_amount_key ][1] - $shipping_amounts[ $order_amount_key ][1] - $shipping_tax_amounts[ $order_amount_key ][1] - $tax_amounts[ $order_amount_key ][1]; } // Encode in json format $chart_data = json_encode( array( - 'order_counts' => array_values( $order_counts ), - 'order_item_counts' => array_values( $order_item_counts ), - 'order_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $order_amounts ) ), - 'net_order_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $net_order_amounts ) ), - 'shipping_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $shipping_amounts ) ), - 'coupon_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $coupon_amounts ) ), - 'refund_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $refund_amounts ) ) + 'order_counts' => array_values( $order_counts ), + 'order_item_counts' => array_values( $order_item_counts ), + 'order_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $order_amounts ) ), + 'gross_order_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $gross_order_amounts ) ), + 'net_order_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $net_order_amounts ) ), + 'shipping_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $shipping_amounts ) ), + 'coupon_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $coupon_amounts ) ), + 'refund_amounts' => array_map( array( $this, 'round_chart_totals' ), array_values( $refund_amounts ) ) ) ); ?>