/** * Displays a single Booktour model. * @param integer $id * @return mixed */ public function actionView($id) { $model = $this->findModel($id); $visaRelation = Visa::find()->where(['fullname' => $model->fullname])->andWhere(['email' => $model->email])->andWhere(['regdate' => $model->depdate]); $provider = new \yii\data\ActiveDataProvider(['query' => $visaRelation, 'pagination' => ['pageSize' => 20]]); return $this->render('view', ['model' => $model, 'provider' => $provider]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Visa::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['regdate' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'numapply' => $this->numapply, 'usebefore' => $this->usebefore, 'receiveinfo' => $this->receiveinfo, 'regdate' => $this->regdate, 'status' => $this->status]); $query->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'nation', $this->nation])->andFilterWhere(['like', 'visatype', $this->visatype])->andFilterWhere(['like', 'processtime', $this->processtime])->andFilterWhere(['like', 'message', $this->message])->andFilterWhere(['like', 'knwthrough', $this->knwthrough])->andFilterWhere(['like', 'paymethod', $this->paymethod]); return $dataProvider; }
public function actionExport($id) { $model = Visa::find()->where(['id' => $id])->one(); $visaRelation = Visadetail::find()->where(['id_visa' => $model->id]); $provider = new \yii\data\ActiveDataProvider(['query' => $visaRelation]); /*$searchModel = new VisaSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams);*/ ExcelView::widget(['dataProvider' => $provider, 'fullExportType' => 'xlsx', 'filename' => 'Visa', 'fullExportConfig' => ['xlsx' => ['filename' => 'Visa']], 'grid_mode' => 'export', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', 'id_visa', 'fullname', 'nation', 'idpassport', 'birthday', 'expire', 'flightdetail', 'arrivaldate', 'exitdate', 'portarrival', 'purposevisit']]); }