rebase on oct-10-2023
This commit is contained in:
@@ -512,7 +512,7 @@ class WC_Admin_Report {
|
||||
}
|
||||
|
||||
if ( $data_key ) {
|
||||
$prepared_data[ $time ][1] += $d->$data_key;
|
||||
$prepared_data[ $time ][1] += is_numeric( $d->$data_key ) ? $d->$data_key : 0;
|
||||
} else {
|
||||
$prepared_data[ $time ][1] ++;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
||||
);
|
||||
|
||||
foreach ( $this->report_data->partial_refunds as $key => $order ) {
|
||||
$this->report_data->partial_refunds[ $key ]->net_refund = $order->total_refund - ( $order->total_shipping + $order->total_tax + $order->total_shipping_tax );
|
||||
$this->report_data->partial_refunds[ $key ]->net_refund = (float) $order->total_refund - ( (float) $order->total_shipping + (float) $order->total_tax + (float) $order->total_shipping_tax );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -158,22 +158,28 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
|
||||
|
||||
// Merge.
|
||||
$tax_rows = array();
|
||||
// Initialize an associative array to store unique post_ids.
|
||||
$unique_post_ids = array();
|
||||
|
||||
foreach ( $tax_rows_orders + $tax_rows_partial_refunds as $tax_row ) {
|
||||
$key = $tax_row->rate_id;
|
||||
$key = $tax_row->tax_rate;
|
||||
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
|
||||
'tax_amount' => 0,
|
||||
'shipping_tax_amount' => 0,
|
||||
'total_orders' => 0,
|
||||
);
|
||||
$tax_rows[ $key ]->total_orders += 1;
|
||||
$tax_rows[ $key ]->tax_rate = $tax_row->tax_rate;
|
||||
$tax_rows[ $key ]->tax_amount += wc_round_tax_total( $tax_row->tax_amount );
|
||||
$tax_rows[ $key ]->shipping_tax_amount += wc_round_tax_total( $tax_row->shipping_tax_amount );
|
||||
if ( ! isset( $unique_post_ids[ $key ] ) || ! in_array( $tax_row->post_id, $unique_post_ids[ $key ], true ) ) {
|
||||
$unique_post_ids[ $key ] = isset( $unique_post_ids[ $key ] ) ? $unique_post_ids[ $key ] : array();
|
||||
$unique_post_ids[ $key ][] = $tax_row->post_id;
|
||||
$tax_rows[ $key ]->total_orders += 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( $tax_rows_full_refunds as $tax_row ) {
|
||||
$key = $tax_row->rate_id;
|
||||
$key = $tax_row->tax_rate;
|
||||
$tax_rows[ $key ] = isset( $tax_rows[ $key ] ) ? $tax_rows[ $key ] : (object) array(
|
||||
'tax_amount' => 0,
|
||||
'shipping_tax_amount' => 0,
|
||||
|
||||
Reference in New Issue
Block a user