render_widget(); } /** * Render widget. */ public function render_widget() { ?>

render_widget_content(); ?>
product_type ] ) ) { $series_data[ $cost->product_type ] = array( 'name' => isset( $product_types[ $cost->product_type ] ) ? esc_js( $product_types[ $cost->product_type ] ) : 'N/A', ); $colors[ $cost->product_type ] = isset( $product_colors[ $cost->product_type ] ) ? $product_colors[ $cost->product_type ] : ''; $series_products_price[ $cost->product_type ] = 0; } $next_rl = $cost->next_renewal; if ( $next_rl <= $upcoming1 ) { $next_rl = Cost_Tracker_Admin::get_next_renewal( $upcoming1, $cost->renewal_type, false ); } $next_price = 0; while ( $next_rl <= $upcoming2 ) { if ( $next_rl > $upcoming1 && $next_rl <= $upcoming2 ) { $next_price = $cost->price; } $series_products_price[ $cost->product_type ] += $next_price; $next_rl = Cost_Tracker_Admin::get_next_renewal( $next_rl, $cost->renewal_type, false ); $next_price = 0; } } } $dec = Cost_Tracker_Utility::cost_tracker_format_price( 0, true, array( 'get_decimals' => true ) ); foreach ( $series_products_price as $product_type => $price ) { $series_data[ $product_type ]['data'][] = round( $price, $dec ); } $categories = array( gmdate( 'M' ) ); $cur_format = Cost_Tracker_Utility::cost_tracker_format_price( 0, true, array( 'get_currency_format' => true ) ); return array( 'series' => array_values( $series_data ), 'categories' => array_values( $categories ), 'colors' => array_values( $colors ), 'currency_format' => $cur_format['format'], 'decimals' => $cur_format['decimals'], ); } /** * Method render_widget_content() */ public function render_widget_content() { $costs_data = Cost_Tracker_DB::get_instance()->get_summary_data( array( 'sum_data' => 'all' ) ); $chart_data = static::get_costs_widgets_data( $costs_data ); ?>