/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Reqreport::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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([
     //            'recid' => $this->recid,
     //            'jobtype' => $this->jobtype,
     //            'jobaction' => $this->jobaction,
     //            'jobdate' => $this->jobdate,
     //            'aproveddate' => $this->aproveddate,
     //            'requestby' => $this->requestby,
     //            'approvedby' => $this->approvedby,
     //            'jobstatus' => $this->jobstatus,
     //            'startdate' => $this->startdate,
     //            'enddate' => $this->enddate,
     //            'operateby' => $this->operateby,
     //        ]);
     $session = new Session();
     $session->open();
     if ($session['groupid'] != 1) {
         $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->orFilterWhere(['like', 'jobformat', $this->globalSearch])->orFilterWhere(['like', 'jobcondition', $this->globalSearch])->orFilterWhere(['like', 'usdef1', $this->globalSearch])->orFilterWhere(['like', 'usdef2', $this->globalSearch])->andFilterWhere(['=', 'jobtype', 3])->andFilterWhere(['=', 'requestby', $session['userid']]);
     } else {
         $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->orFilterWhere(['like', 'jobformat', $this->globalSearch])->orFilterWhere(['like', 'jobcondition', $this->globalSearch])->orFilterWhere(['like', 'usdef1', $this->globalSearch])->orFilterWhere(['like', 'usdef2', $this->globalSearch])->andFilterWhere(['=', 'jobtype', 3]);
     }
     return $dataProvider;
 }
 /**
  * Finds the Reqreport model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Reqreport the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Reqreport::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }