public function actionView($id) { $diag = new ActiveDataProvider(['query' => Ovstdiag::find()->where(['vn' => $id])->orderBy('diagtype'), 'pagination' => ['pageSize' => 20]]); $drug = new ActiveDataProvider(['query' => Opitemrece::find()->join('LEFT OUTER JOIN', 's_drugitems', 'opitemrece.icode =s_drugitems.icode')->where(['vn' => $id]), 'pagination' => ['pageSize' => 20]]); $lab = new ActiveDataProvider(['query' => Laborder::find()->join('LEFT OUTER JOIN', 'lab_head', 'lab_order.lab_order_number =lab_head.lab_order_number')->join('LEFT OUTER JOIN', 'lab_items', 'lab_order.lab_items_code =lab_items.lab_items_code')->where(['vn' => $id]), 'pagination' => ['pageSize' => 20]]); return $this->render('view', ['model' => $this->findModel($id), 'dataProvider' => $drug, 'dataProviderLab' => $lab, 'dataProviderDiag' => $diag]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Opitemrece::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(['qty' => $this->qty, 'iperday' => $this->iperday, 'iperdose' => $this->iperdose, 'recetime' => $this->recetime, 'unitprice' => $this->unitprice, 'vstdate' => $this->vstdate, 'vsttime' => $this->vsttime, 'rxdate' => $this->rxdate, 'rxtime' => $this->rxtime, 'discount' => $this->discount, 'order_no' => $this->order_no, 'item_no' => $this->item_no, 'last_modified' => $this->last_modified, 'sum_price' => $this->sum_price, 'cost' => $this->cost, 'stock_department_id' => $this->stock_department_id]); $query->andFilterWhere(['like', 'hos_guid', $this->hos_guid])->andFilterWhere(['like', 'vn', $this->vn])->andFilterWhere(['like', 'hn', $this->hn])->andFilterWhere(['like', 'an', $this->an])->andFilterWhere(['like', 'icode', $this->icode])->andFilterWhere(['like', 'drugusage', $this->drugusage])->andFilterWhere(['like', 'idr', $this->idr])->andFilterWhere(['like', 'doctor', $this->doctor])->andFilterWhere(['like', 'sp_use', $this->sp_use])->andFilterWhere(['like', 'hcode', $this->hcode])->andFilterWhere(['like', 'print', $this->print])->andFilterWhere(['like', 'dep_code', $this->dep_code])->andFilterWhere(['like', 'finance_number', $this->finance_number])->andFilterWhere(['like', 'use_right', $this->use_right])->andFilterWhere(['like', 'node_id', $this->node_id])->andFilterWhere(['like', 'sub_type', $this->sub_type])->andFilterWhere(['like', 'pttype', $this->pttype])->andFilterWhere(['like', 'income', $this->income])->andFilterWhere(['like', 'remain', $this->remain])->andFilterWhere(['like', 'item_type', $this->item_type])->andFilterWhere(['like', 'staff', $this->staff])->andFilterWhere(['like', 'doctor_lock', $this->doctor_lock])->andFilterWhere(['like', 'paidst', $this->paidst])->andFilterWhere(['like', 'command_doctor', $this->command_doctor]); return $dataProvider; }
public function getOpitemrece() { return $this->hasOne(Opitemrece::className(), ['vn' => 'vn']); }
/** * Finds the Opitemrece model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Opitemrece the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Opitemrece::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }