/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Vienphi::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, 'maBA' => $this->maBA, 'tien' => $this->tien, 'ngayDongVP' => $this->ngayDongVP]); $query->andFilterWhere(['like', 'mota', $this->mota]); return $dataProvider; }
/** * Deletes an existing Benhan model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $hoso = $this->findModel($id)->maHS; $vienphi = Vienphi::findOne(['maBA' => $id]); if (!empty($vienphi)) { Vienphi::findOne(['maBA' => $id])->delete(); } $donthuoc = Donthuoc::findOne(['maBA' => $id]); if (!empty($donthuoc)) { Donthuoc::findOne(['maBA' => $id])->delete(); } $this->findModel($id)->delete(); return $this->redirect(["index?hoso={$hoso}"]); }
<?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', 'maHS', ['label' => 'Đề xuất khám', 'format' => 'raw', 'value' => function ($data) { $array = array(); $arrayBA = explode(' ', $data->deXuatKham); $khoa = \app\models\Khoa::find()->all(); foreach ($khoa as $k) { if (in_array($k->id, $arrayBA)) { $array[] = $k->tenKhoa; } } return implode(',</br />', $array); }], 'ketLuanBA:ntext', 'lichHen', ['label' => 'Viện phí', 'format' => 'raw', 'value' => function ($data) { $url = "vienphi/create?benhan={$data->id}"; return Html::a('Viện phí', $url, ['title' => 'Go']); }], ['label' => 'In hóa đơn', 'format' => 'raw', 'value' => function ($data) { $model1 = \app\models\Vienphi::findOne(['maBA' => $data->id]); if (!empty($model1)) { $url = "vienphi/inhoadon?benhan={$data->id}"; return Html::a('In hóa đơn', $url, ['title' => 'Go']); } else { return ''; } }], ['label' => 'Kê đơn thuốc', 'format' => 'raw', 'value' => function ($data) { $url = "donthuoc/create?benhan={$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\Donthuoc::findOne(['maBA' => $data->id]); if (!empty($model1)) { $url = "donthuoc/indonthuoc?benhan={$data->id}"; return Html::a('In đơn thuốc', $url, ['title' => 'Go']); } else {
/** * Finds the Vienphi model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Vienphi the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Vienphi::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
document.body.innerHTML = restorepage; } </script> <a href='javascript:history.go(-1)' class="btn btn-warning">Quay lại trang trước</a> <input type="button" class="btn btn-default" id="print_button" value="In hóa đơn" onclick="printContent('hoadon')" /> <div class="col-md-10 col-md-offset-1" id="hoadon"> <center>Cộng hòa xã hội chủ nghĩa Việt Nam</center> <center>Độc lập - Tự do - Hạnh phúc</center> <br /><br /> <center><h4>Hóa đơn viện phí</h4></center> <br /><br /> <?php $benhan = \app\models\Benhan::findOne(['id' => $_GET['benhan']]); $hoso = \app\models\Hoso::findOne(['id' => $benhan->maHS]); $benhnhan = \app\models\Benhnhan::findOne(['id' => $hoso->maBN]); $vienphi = \app\models\Vienphi::findOne(['maBA' => $benhan->id]); ?> <p>Bệnh nhân : <?php echo $benhnhan->tenBN; ?> </p> <p>Tiền viện phí : <?php echo number_format($vienphi->tien, 2, '.', ','); ?> VNĐ</p> <br /><br /> <div class="col-md-3"> <center><p></p></center> <center><p></p></center> <center><p>Chữ kí người nộp tiền</p></center> <center><p>(Kí và ghi rõ họ tên)</p></center>