public function search($params) { $query = Transfers::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 20]]); // load the search form data and validate if (!($this->load($params) && $this->validate())) { return $dataProvider; } // adjust the query by adding the filters $query->filterWhere(['like', 'number', $this->number])->andFilterWhere(['like', 'declaration', $this->declaration])->andFilterWhere(['=', 'from_id', $this->from_id])->andFilterWhere(['=', 'to_id', $this->to_id])->andFilterWhere(['like', 'ship_date', $this->ship_date])->andFilterWhere(['=', 'status', $this->status]); return $dataProvider; }
public function actionReport() { $today = Transfers::find()->where('ship_date = CURDATE()')->all(); $tomorrow = Transfers::find()->where('ship_date = DATE_ADD(CURDATE(), INTERVAL +1 DAY)')->all(); $uncompleted = Transfers::find()->where('ship_date < CURDATE()')->andWhere(['!=', 'status', Transfers::STATUS_SHIPPED])->all(); return $this->render('report', ['uncompleted' => $uncompleted, 'today' => $today, 'tomorrow' => $tomorrow, 'title' => 'Отчет']); }