/** * Output the report */ public function output_report() { $this->chart_colours = array('totals' => '#3498db', 'enabled' => '#5cc488', 'disabled' => '#e74c3c'); $current_range = YITH_Reports()->get_current_date_range(); $this->calculate_current_range($current_range); $args = array('report' => $this, 'current_range' => $current_range, 'ranges' => YITH_Reports()->get_ranges()); $this->get_chart_data(); yith_wcpv_get_template('vendors-registered', $args, 'woocommerce/admin/reports'); }
if (!in_array($current_range, array('custom', 'year', 'last_month', 'month', '7day'))) { $current_range = '7day'; } return $current_range; } public function wc_admin_reports_path($path, $name, $class) { if ('customer-list' == $name) { $path = YITH_WPV_PATH . 'includes/reports/class.yith-report-customer-list.php'; } return $path; } } } /** * Main instance of plugin * * @return YITH_Vendors_Report * @since 1.0 */ if (!function_exists('YITH_Reports')) { /** * @return YITH_Reports */ function YITH_Reports() { return YITH_Reports::instance(); } } YITH_Reports();
/** * Admin View: Report by Vendors selling capability (with date filters) */ /* @var YITH_Report_Vendors_Registered $report */ if (!defined('ABSPATH')) { exit; // Exit if accessed directly } ?> <div id="poststuff" class="woocommerce-reports-wide"> <div class="postbox"> <h3 class="stats_range"> <?php YITH_Reports()->get_export_button(); ?> <ul> <?php foreach ($ranges as $range => $name) { echo '<li class="' . ($current_range == $range ? 'active' : '') . '"><a href="' . esc_url(remove_query_arg(array('start_date', 'end_date'), add_query_arg('range', $range))) . '">' . $name . '</a></li>'; } ?> <li class="custom <?php echo $current_range == 'custom' ? 'active' : ''; ?> "> <?php _e('Custom:', 'yith_wc_product_vendors'); ?> <form method="GET">
/** * Output the report */ public function output_report() { $this->chart_colours = array('commissions_amount' => '#0300c6', 'commissions_paid' => '#2ea2cc', 'commissions_unpaid' => '#ffba00', 'commissions_processing' => '#73a724', 'commissions_pending' => '#e74c3c', 'commissions_refunded' => '#999', 'commissions_cancelled' => '#a00', 'commissions_count' => '#ecf0f1'); $current_range = YITH_Reports()->get_current_date_range(); $this->calculate_current_range($current_range); $args = array('report' => $this, 'current_range' => $current_range, 'ranges' => YITH_Reports()->get_ranges()); yith_wcpv_get_template('sale-commissions', $args, 'woocommerce/admin/reports'); }
public function prepare_report_data() { $report_data = array(); $series = array(); $current_range = YITH_Reports()->get_current_date_range(); $this->calculate_current_range($current_range); $vendors = YITH_Vendors()->get_vendors(); /* @var $vendor YITH_Vendor */ foreach ($vendors as $vendor) { $order_ids = $vendor->get_orders(); $amount = $items_number = 0; foreach ($order_ids as $order_id) { $order = wc_get_order($order_id); /** * WC return start date and end date in midnight form. * To compare it with wc order date I need to convert * order date in midnight form too. */ $order_date = $order instanceof WC_Order ? strtotime('midnight', strtotime($order->order_date)) : false; if ($order_date && $order_date >= $this->start_date && $order_date <= $this->end_date) { $vendor_product_ids = $vendor->get_products(); $order_items = $order->get_items(); foreach ($order_items as $order_item) { if (in_array($order_item['product_id'], $vendor_product_ids)) { if (!empty($order_item['line_total'])) { /* === Chart Data === */ $series = new stdClass(); $series->order_date = $order->order_date; $series->qty = absint($order_item['qty']); $series->line_total = wc_format_decimal($order_item['line_total'], wc_get_price_decimals()); $report_data['series'][$vendor->id][] = $series; } $items_number += $order_item['qty']; $amount += floatval($order_item['line_total']); } } } } if (!empty($amount)) { $report_data[$vendor->id] = array('vendor' => $vendor, 'sales' => $amount, 'items_number' => $items_number); } } $this->set_report_data($report_data); }
/** * Output the report */ public function output_report() { $this->chart_colours = array('orders_gross' => '#b1d4ea', 'orders_net' => '#3498db', 'orders_count' => '#95a5a6', 'products_count' => '#dbe1e3'); $current_range = YITH_Reports()->get_current_date_range(); $this->calculate_current_range($current_range); $args = array('report' => $this, 'current_range' => $current_range, 'ranges' => YITH_Reports()->get_ranges()); yith_wcpv_get_template('sales-by-date', $args, 'woocommerce/admin/reports'); }