Fixed wrong gross sales calculation on sales by date report.
The order amounts should exclude refunds. Fixes #9125.
This commit is contained in:
parent
81f787e13b
commit
dc0d5362cd
|
@ -480,10 +480,14 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
|||
$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();
|
||||
$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
|
||||
|
@ -491,6 +495,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
|||
'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 ) ),
|
||||
|
@ -556,7 +561,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
|||
},
|
||||
{
|
||||
label: "<?php echo esc_js( __( 'Gross Sales amount', 'woocommerce' ) ) ?>",
|
||||
data: order_data.order_amounts,
|
||||
data: order_data.gross_order_amounts,
|
||||
yaxis: 2,
|
||||
color: '<?php echo $this->chart_colours['sales_amount']; ?>',
|
||||
points: { show: true, radius: 5, lineWidth: 2, fillColor: '#fff', fill: true },
|
||||
|
|
Loading…
Reference in New Issue