original_string: public function updateGrandTotals()
      {
          // get model
          $m = $this->getIterator();
  
          // create DSQL query for sum and count request
          $fields = array_keys($this->totals);
  
          // select as sub-query
          $sub_q = $m->dsql()->del('limit')->del('order');
  
          $q = $this->app->db->dsql();//->debug();
          $q->table($sub_q, 'grandTotals'); // alias is mandatory if you pass table as DSQL
          foreach ($fields as $field) {
              $q->field($q->sum($field), $field);
          }
          $q->field($q->count(), 'total_cnt');
  
          // execute DSQL
          $data = $q->getHash();
  
          // parse results
          $this->total_rows = $data['total_cnt'];
          unset($data['total_cnt']);
          $this->totals = $data;
      }
code: public function updateGrandTotals()
      {
          // get model
          $m = $this->getIterator();
  
          // create DSQL query for sum and count request
          $fields = array_keys($this->totals);
  
          // select as sub-query
          $sub_q = $m->dsql()->del('limit')->del('order');
  
          $q = $this->app->db->dsql();//->debug();
          $q->table($sub_q, 'grandTotals'); // alias is mandatory if you pass table as DSQL
          foreach ($fields as $field) {
              $q->field($q->sum($field), $field);
          }
          $q->field($q->count(), 'total_cnt');
  
          // execute DSQL
          $data = $q->getHash();
  
          // parse results
          $this->total_rows = $data['total_cnt'];
          unset($data['total_cnt']);
          $this->totals = $data;
      }
code_tokens: public function updateGrandTotals ( ) { // get model $ m = $ this -> getIterator ( ) ; // create DSQL query for sum and count request $ fields = array_keys ( $ this -> totals ) ; // select as sub-query $ sub_q = $ m -> dsql ( ) -> del ( 'limit' ) -> del ( 'order' ) ; $ q = $ this -> app -> db -> dsql ( ) ; //->debug(); $ q -> table ( $ sub_q , 'grandTotals' ) ; // alias is mandatory if you pass table as DSQL foreach ( $ fields as $ field ) { $ q -> field ( $ q -> sum ( $ field ) , $ field ) ; } $ q -> field ( $ q -> count ( ) , 'total_cnt' ) ; // execute DSQL $ data = $ q -> getHash ( ) ; // parse results $ this -> total_rows = $ data [ 'total_cnt' ] ; unset ( $ data [ 'total_cnt' ] ) ; $ this -> totals = $ data ; }
docstring: Calculate grand totals of all rows.
  
  Called one time on rendering phase - before renderRows() call.
docstring_tokens: Calculate grand totals of all rows .