Exemplo n.º 1
0
 public function _calculateUserCollection(RM_Points_Account $obAccount, $minDate, $maxDate)
 {
     static $query;
     if (!$query) {
         $query = M('Db')->createQuery($this->table('payment') . ' p');
         $query->what('sum(amount) as total');
     }
     $query->where()->reset();
     $query->where('p.account_id=? and p.cdate>=? and p.cdate<?', $obAccount->id(), $minDate, $maxDate);
     foreach ($query->execute() as $row) {
         return $row['total'];
     }
     return NULL;
 }