Can someone please help me with this?
For the life of me I can’t seem to find a way to compare
$this->quarter.
public $quarter, $records, $safety;
public function quarterlyReport()
{
$criteria=new CDbCriteria;
$criteria->select = array(
"extract(year from record_date)||'Q'|| to_char(record_date, 'Q') as quarter ",
"code",
"name",
"count(t1.id) AS records",
"sum(ppe_safe + rushing_safe) AS safety",
);
$criteria->join = "LEFT JOIN eps_observation t1 ON t1.task_id = t.id AND
extract(year from record_date)||'Q'|| to_char(record_date, 'Q') =:qtr";
$criteria->params[':qtr'] = $this->quarter;
$criteria->group = 'quarter, code, name';
$criteria->compare('code',$this->code,true);
$criteria->compare('name',$this->name,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'sort'=>array(
'defaultOrder'=>'records DESC, code ASC'),
'pagination'=>array(
'pagesize'=>64,
),
));
}
Any suggestions?