The report function get_order_total() is written somewhat incorrecly. It searches for the first order number of the month, then the last order number of the month and then gives you the total of all the orders in between. If you modify the date purchased of an order made in a later month, it then gets all the order totals up to that date.
Here is the new function. This should make it a bit faster too.
function get_order_total($mo, $yr) {
$totals_query = tep_db_query(" SELECT sum( ot.value ) as totals
FROM orders o, orders_total ot
WHERE o.date_purchased
LIKE \"".$yr."-".$mo."%\" AND ot.class = 'ot_total'
AND o.orders_id = ot.orders_id");
$totals_row = tep_db_fetch_array($totals_query);
return $totals_row['totals'];
}
Thanks for this report. It has been great,
Chris