/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Anc::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pagesize' => 15]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['DATE_SERV' => $this->DATE_SERV, 'D_UPDATE' => $this->D_UPDATE]); $query->andFilterWhere(['like', 'HOSPCODE', $this->HOSPCODE])->andFilterWhere(['like', 'PID', $this->PID])->andFilterWhere(['like', 'SEQ', $this->SEQ])->andFilterWhere(['like', 'GRAVIDA', $this->GRAVIDA])->andFilterWhere(['like', 'ANCNO', $this->ANCNO])->andFilterWhere(['like', 'GA', $this->GA])->andFilterWhere(['like', 'ANCRESULT', $this->ANCRESULT])->andFilterWhere(['like', 'ANCPLACE', $this->ANCPLACE])->andFilterWhere(['like', 'PROVIDER', $this->PROVIDER]); return $dataProvider; }
/** * Finds the Anc model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $HOSPCODE * @param string $PID * @param string $DATE_SERV * @return Anc the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($HOSPCODE, $PID, $DATE_SERV) { if (($model = Anc::findOne(['HOSPCODE' => $HOSPCODE, 'PID' => $PID, 'DATE_SERV' => $DATE_SERV])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }