public static function getTotalsByRange($from, $to, $limit = 0) { $sr = new SalesReport(); $sr->setFromDate($from); $sr->setToDate($to); $sr->setLimit($limit); $total = 0; $productTotal = 0; $taxTotal = 0; $includedTaxTotal = 0; $shippingTotal = 0; foreach ($sr->getResults() as $order) { $total = $total + $order->getTotal(); $productTotal = $productTotal + $order->getSubTotal(); $taxTotal = $taxTotal + $order->getTaxTotal(); $includedTaxTotal = $includedTaxTotal + $order->getIncludedTaxTotal(); $shippingTotal = $shippingTotal + $order->getShippingTotal(); } $totals = array("total" => $total, "productTotal" => $productTotal, "taxTotal" => $taxTotal, "includedTaxTotal" => $includedTaxTotal, "shippingTotal" => $shippingTotal, "orders" => $sr); return $totals; }