'; $o .= '
Sorry, you are not allowed to access this page!
'; $o .= ''; wp_die( $o, 403 ); } global $wpdb; $table_name_commission = $wpdb->prefix . 'zacctmgr_acm_commissions_mapping'; $order = wc_get_order( $_GET['edit'] ); $account_manager = get_post_meta( $order->get_id(), '_account_manager', true ); $current_commission = (float) str_replace( ',', '', get_post_meta( $order->get_id(), '_commission', true ) ); $customer = $order->get_user(); $order_timestamp = $order->get_date_created()->date( 'Y-m-d H:i:s' ); $user_query = new WP_User_Query( array( 'search' => $account_manager, 'search_columns' => array( 'display_name' ), 'number' => 1 ) ); $results = $user_query->get_results(); $manager = $results[0]; $allowed_statuses = zacctmgr_get_allowed_wc_statuses(); $manager_commission_rate_query = $wpdb->get_results( "SELECT * FROM $table_name_commission WHERE manager_id=$manager->ID AND customer_id IS NULL AND timestamp <= '$order_timestamp' ORDER BY timestamp DESC LIMIT 1;" ); if ( count( $manager_commission_rate_query ) != 0 ) { if ( $manager_commission_rate_query[0]->no_commission == 1 ) { return 0; } if ( $manager_commission_rate_query[0]->order_level == 1 ) { $commission_rate = $manager_commission_rate_query[0]; } if ( $manager_commission_rate_query[0]->customer_account_level == 1 ) { $customer_commission_rate_query = $wpdb->get_results( "SELECT * FROM $table_name_commission WHERE manager_id=$manager->ID AND customer_id=$customer->ID AND customer_account_level=1 AND timestamp <= '$order_timestamp' ORDER BY timestamp DESC LIMIT 1;" ); if ( count( $customer_commission_rate_query ) != 0 ) { if ( $customer_commission_rate_query[0]->order_level == 0 ) { $commission_rate = $customer_commission_rate_query[0]; } else { $manager_customer_account_level_commission_rate_query = $wpdb->get_results( "SELECT * FROM $table_name_commission WHERE manager_id=$manager->ID AND customer_id IS NULL AND customer_account_level=1 AND timestamp <= '$order_timestamp' ORDER BY timestamp DESC LIMIT 1;" ); if ( count( $manager_customer_account_level_commission_rate_query ) != 0 ) { $commission_rate = $manager_customer_account_level_commission_rate_query[0]; } } } else { $manager_customer_account_level_commission_rate_query = $wpdb->get_results( "SELECT * FROM $table_name_commission WHERE manager_id=$manager->ID AND customer_id IS NULL AND customer_account_level=1 AND timestamp <= '$order_timestamp' ORDER BY timestamp DESC LIMIT 1;" ); if ( count( $manager_customer_account_level_commission_rate_query ) != 0 ) { $commission_rate = $manager_customer_account_level_commission_rate_query[0]; } } } } else { $new_commission = $existing_commission = 0; } if ( $commission_rate->no_commission == 1 ) { $new_commission = $existing_commission = 0; } else { $orders = get_posts( array( 'numberposts' => $commission_rate->new_order_commission_limit, 'meta_key' => '_customer_user', 'meta_value' => $customer->ID, 'post_type' => wc_get_order_types(), 'post_status' => $allowed_statuses, 'orderby' => 'post_date', 'order' => 'ASC' ) ); if ( $commission_rate->new_order_commission_limit != 0 ) { $isNew = false; if ( count( $orders ) > 0 ) { foreach ( $orders as $item ) { if ( $order->get_id() == $item->ID ) { $isNew = true; break; } } } } else { $isNew = false; } if ( $isNew ) { $order_new_commission_type = get_post_meta( $order->get_id(), '_new_commission_type', true ); if ( $order_new_commission_type != "" ) { if ( $order_new_commission_type == 1 ) { $new_commission = $current_commission; $existing_commission = 0.00; } else { $existing_commission = $current_commission; $new_commission = 0.00; } } else { $new_commission = $current_commission; $existing_commission = 0.00; } } else { $order_new_commission_type = get_post_meta( $order->get_id(), '_new_commission_type', true ); if ( $order_new_commission_type != "" ) { if ( $order_new_commission_type == 1 ) { $new_commission = $current_commission; $existing_commission = 0.00; } else { $existing_commission = $current_commission; $new_commission = 0.00; } } else { $existing_commission = $current_commission; $new_commission = 0.00; } } } $current_new_commission = $new_commission; $current_existing_commission = $existing_commission; $account_managers = zacctmgr_get_em_users(); ?>@ :
get_user_id() ) { $user_id = absint( $order->get_user_id() ); $user = get_user_by( 'id', $user_id ); /* translators: 1: user display name 2: user ID 3: user email */ $user_string = sprintf( esc_html__( '%1$s (#%2$s – %3$s)', 'woocommerce' ), $user->display_name, absint( $user->ID ), $user->user_email ); } else { $user_string = sprintf( esc_html__( '%1$s (#%2$s – %3$s)', 'woocommerce' ), 'Guest', '', $order->get_billing_email() ); } ?>
' . wp_kses( $order->get_formatted_billing_address(), array( 'br' => array() ) ) . '
'; } else { echo '' . __( 'Address:', 'woocommerce' ) . ' ' . __( 'No billing address set.', 'woocommerce' ) . '
'; } ?>' . wp_kses( $order->get_formatted_shipping_address(), array( 'br' => array() ) ) . '
'; } else { echo '' . __( 'Address:', 'woocommerce' ) . ' ' . __( 'No shipping address set.', 'woocommerce' ) . '
'; } ?>| get_total_discount(), array( 'currency' => $order->get_currency() ) ); // WPCS: XSS ok. ?> | ||
|
get_total_shipping_refunded();
if ( $refunded > 0 ) {
echo ' |
||
| label ); ?>: |
get_total_tax_refunded_by_rate_id( $tax->rate_id );
if ( $refunded > 0 ) {
echo ' |
|
| : | get_formatted_order_total(); // WPCS: XSS ok. ?> | |
| : | -get_total_refunded(), array( 'currency' => $order->get_currency() ) ); // WPCS: XSS ok. ?> |