Proyectos de Subversion LeadersLinked - Services

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 152
Línea 114... Línea 114...
114
        //echo $select->getSqlString($this->adapter->platform); exit;
114
        //echo $select->getSqlString($this->adapter->platform); exit;
Línea 115... Línea 115...
115
        
115
        
116
 
116
 
-
 
117
        return $this->executeFetchAllArray($select);
-
 
118
    }
-
 
119
    
-
 
120
    /**
-
 
121
     *
-
 
122
     * @param  int $company_id
-
 
123
     * @return string
-
 
124
     */
-
 
125
    public function fetchOneMaxDateActivityFromCompanyId($company_id)
-
 
126
    {
-
 
127
        
-
 
128
        
-
 
129
        $select = $this->sql->select();
-
 
130
        $select->columns(['date' => new Expression('MAX(date)') ] );
-
 
131
        $select->from(self::_TABLE);
-
 
132
        $select->where->equalTo('company_id', $company_id);
-
 
133
        
-
 
134
        
-
 
135
        $record = $this->executeFetchOneArray($select);
-
 
136
        return empty($record['date']) ? '' :   $record['date'];
-
 
137
    }
-
 
138
    
-
 
139
    /**
-
 
140
     *
-
 
141
     * @param int $company_id
-
 
142
     * @param string $start_date
-
 
143
     * @param string $end_date
-
 
144
     * @return array
-
 
145
     */
-
 
146
    public function fetchAllCountUsersWithClosedCapsulesDailyByCompanyIdAndStartDateAndEndDate($company_id, $start_date, $end_date)
-
 
147
    {
-
 
148
        $select = $this->sql->select();
-
 
149
        $select->columns(['total' => new Expression('COUNT(DISTINCT(user_id))'), 'date' ] );
-
 
150
        $select->from(self::_TABLE);
-
 
151
        $select->where->equalTo('company_id', $company_id);
-
 
152
        $select->where->between('date', $start_date, $end_date);
-
 
153
        $select->group('date');
-
 
154
        $select->order('date desc');
-
 
155
        
-
 
156
       // echo $select->getSqlString( $this->adapter->platform ); exit;
-
 
157
        
-
 
158
        return $this->executeFetchAllArray($select);
Línea 117... Línea 159...
117
        return $this->executeFetchAllArray($select);
159
    }