public function actionIndex() { $HOSPCODE = \Yii::$app->request->post('HOSPCODE'); $PID = \Yii::$app->request->post('PID'); $SEQ = \Yii::$app->request->post('SEQ'); $result = DrugOpd::find()->where(['HOSPCODE' => $HOSPCODE, 'PID' => $PID, 'SEQ' => $SEQ])->all(); return $this->renderPartial('index', ['result' => $result]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DrugOpd::find(); /*$query = DrugOpd::find() ->groupBy('DNAME') ->count();*/ $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(['DNAME' => $this->DNAME, 'DATE_SERV' => $this->DATE_SERV, 'AMOUNT' => $this->AMOUNT, 'DRUGPRICE' => $this->DRUGPRICE, 'DRUGCOST' => $this->DRUGCOST, 'D_UPDATE' => $this->D_UPDATE]); $query->andFilterWhere(['like', 'HOSPCODE', $this->HOSPCODE])->andFilterWhere(['like', 'PID', $this->PID])->andFilterWhere(['like', 'SEQ', $this->SEQ])->andFilterWhere(['like', 'CLINIC', $this->CLINIC])->andFilterWhere(['like', 'DIDSTD', $this->DIDSTD])->andFilterWhere(['like', 'DNAME', $this->DNAME])->andFilterWhere(['like', 'UNIT', $this->UNIT])->andFilterWhere(['like', 'UNIT_PACKING', $this->UNIT_PACKING])->andFilterWhere(['like', 'PROVIDER', $this->PROVIDER]); return $dataProvider; }