/** * Finds the Donthuocnt model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Donthuocnt the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Donthuocnt::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
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 echo $donthuoc->donthuoc;
<div class="noitru-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; }], 'soPhong', 'soGiuong', ['label' => 'Kê đơn thuốc', 'format' => 'raw', 'value' => function ($data) { $url = Yii::$app->request->baseUrl . "/donthuocnt/create?noitru={$data->id}"; return Html::a('Kê đơn thuốc', $url, ['title' => 'Go']); }], ['label' => 'In đơn thuốc', 'format' => 'raw', 'value' => function ($data) { $model1 = \app\models\Donthuocnt::findOne(['maNT' => $data->id]); if (!empty($model1)) { $url = Yii::$app->request->baseUrl . "/donthuocnt/indonthuoc?noitru={$data->id}"; return Html::a('In đơn thuốc', $url, ['title' => 'Go']); } else { return ''; } }], ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div>