public function getDataProvider($reportId) { $dataProvider = new ActiveDataProvider(); $pagination = new Pagination(['pageSize' => 50]); $query = ReportItem::find()->where(['reportId' => $reportId, 'overrun' => ['$exists' => true]]); $dataProvider->query = $query; $dataProvider->pagination = $pagination; return $dataProvider; }
public function getDataProvider($reportId) { $dataProvider = new ActiveDataProvider(); $pagination = new Pagination(['pageSize' => 50]); $query = ReportItem::find()->where(['reportId' => $reportId, 'expenditure' => ['$gte' => $this->sum]]); $dataProvider->query = $query; $dataProvider->pagination = $pagination; return $dataProvider; }
/** * @param array $params * @return ActiveDataProvider */ public function search($params) { $query = ReportItem::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['employee' => SORT_ASC]]]); if (!$this->load($params) || !$this->validate()) { $query->where(['1' => false]); return $dataProvider; } /** @var Report $report */ $report = Report::findOne(['operatorId' => $this->operatorId, 'period' => $this->_period]); $query->andWhere(['reportId' => $report->primaryKey]); $query->andWhere(['or', ['number' => ['$in' => $this->_numbers]], ['employee' => ['$in' => $this->_employees]]]); return $dataProvider; }