*/
protected $_createNew;
+ /**
+ * When a grand total row has calculated the status we pop it off to here.
+ *
+ * This allows us to access it from the stats function and avoid recalculating.
+ */
+ protected $rollupRow = array();
+
/**
* SQL being run in this report.
*
* @return bool
*/
public function grandTotal(&$rows) {
- if (!$this->_rollup || ($this->_rollup == '') ||
+ if (!$this->_rollup || ($this->_rollup == '' || count($rows) == 1) ||
($this->_limit && count($rows) >= self::ROW_COUNT_LIMIT)
) {
return FALSE;
}
- $lastRow = array_pop($rows);
+
+ $this->rollupRow = array_pop($rows);
foreach ($this->_columnHeaders as $fld => $val) {
if (!in_array($fld, $this->_statFields)) {
if (!$this->_grandFlag) {
- $lastRow[$fld] = "Grand Total";
+ $this->rollupRow[$fld] = "Grand Total";
$this->_grandFlag = TRUE;
}
else {
- $lastRow[$fld] = "";
+ $this->rollupRow[$fld] = "";
}
}
}
- $this->assign('grandStat', $lastRow);
+ $this->assign('grandStat', $this->rollupRow);
return TRUE;
}
$statistics = array();
$count = count($rows);
-
+ // Why do we increment the count for rollup seems to artificially inflate the count.
if ($this->_rollup && ($this->_rollup != '') && $this->_grandFlag) {
$count++;
}