function wcaf_report_monthly()
{
    global $start_date, $end_date, $woocommerce, $wpdb;
    $first_year = $wpdb->get_var("SELECT post_date FROM {$wpdb->posts} ORDER BY post_date ASC LIMIT 1;");
    if ($first_year) {
        $first_year = date('Y', strtotime($first_year));
    } else {
        $first_year = date('Y');
    }
    $current_year = isset($_POST['show_year']) ? $_POST['show_year'] : date('Y', current_time('timestamp'));
    $start_date = isset($_POST['start_date']) ? $_POST['start_date'] : '';
    $end_date = isset($_POST['end_date']) ? $_POST['end_date'] : '';
    if (!$start_date) {
        $start_date = $current_year . '0101';
    }
    if (!$end_date) {
        $end_date = date('Ym', current_time('timestamp')) . '31';
    }
    $start_date = strtotime($start_date);
    $end_date = strtotime($end_date);
    $amounts_deposited = 0;
    $num_deposits = 0;
    if (version_compare(WC_VERSION, '2.2.0', '<')) {
        $args = array('numberposts' => -1, 'orderby' => 'post_date', 'order' => 'ASC', 'post_type' => 'shop_order', 'suppress_filters' => 0, 'meta_query' => array(array('key' => '_funds_deposited', 'value' => '1')), 'tax_query' => array(array('taxonomy' => 'shop_order_status', 'terms' => array('completed', 'processing', 'on-hold'), 'field' => 'slug', 'operator' => 'IN')));
    } else {
        $args = array('numberposts' => -1, 'orderby' => 'post_date', 'order' => 'ASC', 'post_type' => 'shop_order', 'post_status' => array('wc-completed', 'wc-processing', 'wc-on-hold'), 'suppress_filters' => 0, 'meta_query' => array(array('key' => '_funds_deposited', 'value' => '1')));
    }
    $orders = get_posts($args);
    $deposit_counts = array();
    $deposit_amounts = array();
    // Blank date ranges to begin
    $count = 0;
    $months = ($end_date - $start_date) / (60 * 60 * 24 * 7 * 4);
    while ($count < $months) {
        $time = strtotime(date('Ym', strtotime('+ ' . $count . ' MONTH', $start_date)) . '01') . '000';
        $deposit_counts[$time] = 0;
        $deposit_amounts[$time] = 0;
        $count++;
    }
    if ($orders) {
        foreach ($orders as $order) {
            $order_obj = new WC_Order($order->ID);
            $time = strtotime(date('Ym', strtotime($order->post_date)) . '01') . '000';
            $order_items_array = $order_obj->get_items();
            foreach ($order_items_array as $item) {
                $item_id = isset($item['product_id']) ? $item['product_id'] : $item['id'];
                $product = X3M_AccountFunds::get_product($item_id);
                $is_deposit = get_post_meta($item_id, '_is_deposit', true);
                if ($is_deposit == 'yes') {
                    $num_deposits++;
                    $amounts_deposited += $product->get_price() * $item['qty'];
                    if (isset($deposit_counts[$time])) {
                        $deposit_counts[$time]++;
                    } else {
                        $deposit_counts[$time] = 1;
                    }
                    if (isset($deposit_amounts[$time])) {
                        $deposit_amounts[$time] = $deposit_amounts[$time] + $product->get_price() * $item['qty'];
                    } else {
                        $deposit_amounts[$time] = $product->get_price() * $item['qty'];
                    }
                }
            }
        }
    }
    ?>
	<form method="post" action="">
		<p><label for="show_year"><?php 
    _e('Year:', 'woocommerce');
    ?>
</label>
		<select name="show_year" id="show_year">
			<?php 
    for ($i = $first_year; $i <= date('Y'); $i++) {
        printf('<option value="%s" %s>%s</option>', $i, selected($current_year, $i, false), $i);
    }
    ?>
		</select> <input type="submit" class="button" value="<?php 
    _e('Show', 'woocommerce');
    ?>
" /></p>
	</form>
	<div id="poststuff" class="woocommerce-reports-wrap">
		<div class="woocommerce-reports-sidebar">
			<div class="postbox">
				<h3><span><?php 
    _e('Total deposits for year', 'wc_account_funds');
    ?>
</span></h3>
				<div class="inside">
					<p class="stat"><?php 
    if ($amounts_deposited > 0) {
        echo woocommerce_price($amounts_deposited);
    } else {
        _e('n/a', 'woocommerce');
    }
    ?>
</p>
				</div>
			</div>
			<div class="postbox">
				<h3><span><?php 
    _e('Number of deposits for year', 'wc_account_funds');
    ?>
</span></h3>
				<div class="inside">
					<p class="stat"><?php 
    if ($num_deposits > 0) {
        echo $num_deposits;
    } else {
        _e('n/a', 'woocommerce');
    }
    ?>
</p>
				</div>
			</div>
			<div class="postbox">
				<h3><span><?php 
    _e('Average deposit for year', 'wc_account_funds');
    ?>
</span></h3>
				<div class="inside">
					<p class="stat"><?php 
    if ($amounts_deposited > 0) {
        echo woocommerce_price($amounts_deposited / $num_deposits);
    } else {
        _e('n/a', 'woocommerce');
    }
    ?>
</p>
				</div>
			</div>
		</div>
		<div class="woocommerce-reports-main">
			<div class="postbox">
				<h3><span><?php 
    _e('Monthly deposits for year', 'wc_account_funds');
    ?>
</span></h3>
				<div class="inside chart">
					<div id="placeholder" style="width:100%; overflow:hidden; height:568px; position:relative;"></div>
				</div>
			</div>
		</div>
	</div>
	<?php 
    $deposit_counts_array = array();
    foreach ($deposit_counts as $key => $count) {
        $deposit_counts_array[] = array($key, $count);
    }
    $deposit_amounts_array = array();
    foreach ($deposit_amounts as $key => $amount) {
        $deposit_amounts_array[] = array($key, $amount);
    }
    $deposit_data = array('deposit_counts' => $deposit_counts_array, 'deposit_amounts' => $deposit_amounts_array);
    $chart_data = json_encode($deposit_data);
    ?>
	<script type="text/javascript">
		jQuery(function(){
			var deposit_data = jQuery.parseJSON( '<?php 
    echo $chart_data;
    ?>
' );

			var d = deposit_data.deposit_counts;
			var d2 = deposit_data.deposit_amounts;

			var placeholder = jQuery("#placeholder");

			var plot = jQuery.plot(placeholder, [ { label: "Number of deposits", data: d }, { label: "Deposit amount", data: d2, yaxis: 2 } ], {
				series: {
					lines: { show: true },
					points: { show: true, align: "left" }
				},
				grid: {
					show: true,
					aboveData: false,
					color: '#ccc',
					backgroundColor: '#fff',
					borderWidth: 2,
					borderColor: '#ccc',
					clickable: false,
					hoverable: true
				},
				xaxis: {
					mode: "time",
					timeformat: "%b %y",
					tickLength: 1,
					minTickSize: [1, "month"]
				},
				yaxes: [ { min: 0, tickSize: 10, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
		   		colors: ["#8a4b75", "#47a03e"]
		 	});

		 	placeholder.resize();

			<?php 
    woocommerce_tooltip_js();
    ?>
		});
	</script>
	<?php 
}
 public function skip_sending_invoice($order_statuses, $order_id)
 {
     $order = new WC_Order($order_id);
     // if this order is to deposit funds, skip sending of invoice
     $deposit_product = false;
     foreach ($order->get_items() as $item) {
         $_product = X3M_AccountFunds::get_product($item['product_id']);
         if (X3M_AccountFunds::product_is_deposit($_product)) {
             $deposit_product = true;
             break;
         }
     }
     if ($deposit_product) {
         return array();
     }
     return $order_statuses;
 }