public function actionFinished($uid) { $totalCount = Dasboarddetail::find()->where(['requestby' => $uid])->count(); $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 5]); $title = "ใบสั่งงานดำเนินการล่าสุด"; $type = "finishedorproblem"; $searchModel = Dasboarddetail::find()->where(['requestby' => $uid])->offset($pages->offset)->limit($pages->limit)->all(); return $this->render('index', ['model' => $searchModel, 'n' => 1, 'pages' => $pages, 'ptitle' => $title, 'ptype' => $type]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Dasboarddetail::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(['jobstatus'=>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, // ]); // $query->andFilterWhere(['like', 'jobtitle', $this->jobtitle]) // ->andFilterWhere(['like', 'comment', $this->comment]) // ->andFilterWhere(['like', 'jobformat', $this->jobformat]) // ->andFilterWhere(['like', 'jobcondition', $this->jobcondition]) // ->andFilterWhere(['like', 'attachfile', $this->attachfile]) // ->andFilterWhere(['like', 'filetype', $this->filetype]) // ->andFilterWhere(['like', 'usdef1', $this->usdef1]) // ->andFilterWhere(['like', 'usdef2', $this->usdef2]) // ->andFilterWhere(['like', 'usdef3', $this->usdef3]) // ->andFilterWhere(['like', 'usdef4', $this->usdef4]) // ->andFilterWhere(['like', 'usdef5', $this->usdef5]) // ->andFilterWhere(['like', 'usdef6', $this->usdef6]) // ->andFilterWhere(['like', 'usdef7', $this->usdef7]) // ->andFilterWhere(['like', 'usdef8', $this->usdef8]) // ->andFilterWhere(['like', 'usdef9', $this->usdef9]); $session = new Session(); $session->open(); $query->andFilterWhere(['=', 'jobstatus', $params])->andFilterWhere(['=', 'requestby', $session['userid']]); return $dataProvider; }