_select) { return $this->_select; } $select = parent::getListSelect(); $select->join( $this->_getPair('Vendor', 'v'), '`v`.`id` = `t`.`vendorId`', ['vendorName' => 'v.dbaName'] ); return $select; } protected function _filter(Zend_Db_Select $select) { if (($date = $this->getFilter('date'))) { $select->where('`t`.`start` <= ? AND `t`.`end` >= ?', $date); } $this->_filterOverdue($select); return parent::_filter($select); } protected function _filterOverdue(Zend_Db_Select $select) { if (!($overdue = $this->getFilter('overdue'))) { return $this; } if ($overdue == Entity::STATUS_PAID) { $select->where('`t`.`status` = ?', Entity::STATUS_PAID); return $this; } if ($overdue == Model::OVERDUE) { $overdue = 0; } $select->where('`t`.`dueDate` <= DATE_SUB(CURDATE(),INTERVAL ? DAY)', $overdue, Qs_Db::INT_TYPE); $select->where('`t`.`status` = ?', Entity::STATUS_PENDING); return $this; } protected function _addDependenciesFromDb(array &$data) { $this->mapCollections($data); return parent::_addDependenciesFromDb($data); } }