/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = WorkloadDoctor::find()->byWard(); $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(['ref' => $this->ref]); $query->andFilterWhere(['like', 'ward', $this->ward])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'doc_no', $this->doc_no]); return $dataProvider; }
use yii\bootstrap\ActiveForm; use app\models\LibBedtype; use yii\helpers\ArrayHelper; use app\models\LibPttype; use app\models\LibAdmit; use app\models\LibDisc; use app\models\WorkloadDoctor; use yii\helpers\Url; //use yii\widgets\Pjax; //use yii\bootstrap\Modal; use kartik\popover\PopoverX; $lib_admit = ArrayHelper::map(LibAdmit::find()->all(), 'code', 'name'); $lib_pttype = ArrayHelper::map(LibPttype::find()->all(), 'code', 'name'); $lib_disc = ArrayHelper::map(LibDisc::find()->all(), 'code', 'name'); $lib_bedtype = ArrayHelper::map(LibBedtype::find()->all(), 'code', 'name'); $lib_doctor = ArrayHelper::map(WorkloadDoctor::find()->byWard()->all(), 'ref', 'Fullname'); $lib_item = $model->getItem(); $lib_tube = $model->getTube(); //print_r($lib_doctor); //print_r($lib_bedtype2); /* @var $this yii\web\View */ /* @var $model app\models\WorkloadEvent2 */ /* @var $form yii\widgets\ActiveForm */ ?> <?php function DateThai($strDate) { $strYear = date("Y", strtotime($strDate)) + 543; $strMonth = date("n", strtotime($strDate));
/** * Finds the WorkloadDoctor model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return WorkloadDoctor the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = WorkloadDoctor::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }