public function glbalance() { // return last unclosed period, year $glperiod = DataObjectFactory::Factory('GLPeriod'); $glperiod->getCurrentPeriod(); $year = $glperiod->year; // get future periods from the last period 0 $temp_future_periods = $glperiod->getFuturePeriods(-1, $year); // reconstruct periods array, as we cannot send a value (year + period), but period_id $future_periods = array_keys($temp_future_periods); array_fill_keys($future_periods, NULL); // get sum of periods $sum = GLBalance::getSum($future_periods, $this->_data['glaccount_id'], $this->_data['glcentre_id']); return $sum; }