/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Benhnhan::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(['id' => $this->id, 'ngaySinh' => $this->ngaySinh, 'gioiTinh' => $this->gioiTinh]); $query->andFilterWhere(['like', 'tenBN', $this->tenBN])->andFilterWhere(['like', 'ngheNghiep', $this->ngheNghiep])->andFilterWhere(['like', 'danToc', $this->danToc])->andFilterWhere(['like', 'diaChi', $this->diaChi])->andFilterWhere(['like', 'anh', $this->anh]); return $dataProvider; }
var restorepage = document.body.innerHTML; var printcontent = document.getElementById(el).innerHTML; document.body.innerHTML = printcontent; window.print(); document.body.innerHTML = restorepage; } </script> <a href='javascript:history.go(-1)' class="btn btn-warning">Quay lại trang trước</a> <!--this.style.display ='none'; window.print()--> <input type="button" class="btn btn-default" id="print_button" value="In hóa đơn" onclick="printContent('donthuoc')" /> <div class="col-md-10 col-md-offset-1" id="donthuoc"> <center><h3>ĐƠN THUỐC</h3></center> <br /><br /> <?php $maNT = \app\models\Noitru::findOne(['id' => $_GET['noitru']]); $benhnhan = \app\models\Benhnhan::findOne(['id' => $maNT->maBN]); $donthuoc = \app\models\Donthuocnt::findOne(['maNT' => $maNT->id]); ?> <h4> <table> <tr> <td>Bệnh nhân :</td> <td><?php echo $benhnhan->tenBN; ?> </td> </tr> <tr></tr> <tr> <td>Đơn thuốc :</td> <td><?php
/* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Hồ sơ'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="hoso-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['id', 'maBN', ['label' => 'Tên bệnh nhân', 'format' => 'raw', 'value' => function ($data) { $url = \app\models\Benhnhan::findOne(['id' => $data->maBN]); return $url->tenBN; }], ['attribute' => 'created_at', 'value' => function ($dataProvider) { return gmdate("Y-m-d\\TH:i:s\\Z", $dataProvider->created_at); }], ['attribute' => 'updated_at', 'value' => function ($dataProvider) { return gmdate("Y-m-d\\TH:i:s\\Z", $dataProvider->updated_at); }], ['label' => 'Hồ sơ', 'format' => 'raw', 'value' => function ($data) { $url = yii::$app->request->baseUrl . '/benhan?hoso=' . $data->id; return Html::a('Hồ sơ', $url, ['title' => 'Go']); }], ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['update' => function ($url, $model) { return ''; }]]]]); ?> </div>
/** * Finds the Benhnhan model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Benhnhan the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Benhnhan::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }