/* @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>
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
/** * 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.'); } }