/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Refunds::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([ 'refund_id' => $this->refund_id, 'refund_amount' => $this->refund_amount, 'refund_smShare' => $this->refund_smShare, 'refund_scholarShare' => $this->refund_scholarShare, 'refund_scholar_id' => $this->refund_scholar_id, 'refund_tuitionfee_id' => $this->refund_tuitionfee_id, 'refund_date' => $this->refund_date, ]); $query->andFilterWhere(['like', 'refund_description', $this->refund_description]); return $dataProvider; }
/** * Lists all Allowance models. * @return mixed */ public function actionIndex() { $username=Yii::$app->user->identity->username; $users = User::find()->all(); $scholars = Scholars::find()->all(); $deductions = Deductions::find()->all(); $refunds = Refunds::find()->all(); $model = new Allowance(); foreach($users as $user){ foreach($scholars as $scholar){ foreach($deductions as $deduction){ foreach($refunds as $refund){ if($user->username==$username&&$user->id==$scholar->scholar_id){ $model->allowance_scholar_id=$scholar->scholar_id; $searchModel = new AllowanceSearch($model); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } } } } } }
/* @var $this yii\web\View */ /* @var $searchModel frontend\models\GradeSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->params['breadcrumbs'][] = $this->title; ?> <div class="grades-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo '<table width=100% border=2><tr><td><h3><center>Refund Amount</center></h3></td><td><h3><center>SM Share</center></h3></td><td><h3><center>Scholar Share</center></h3></td><td><h3><center>Description</center></h3></td><td><h3><center>Refund Date</center></h3></td></tr>'; $users = User::find()->all(); $refunds = Refunds::find()->all(); $scholars = Scholars::find()->all(); $username = Yii::$app->user->identity->username; foreach ($users as $ctr) { if ($ctr->username == $username) { foreach ($scholars as $scholarctr) { foreach ($refunds as $refund) { if ($scholarctr->scholar_user_id == $ctr->id && $refund->refund_scholar_id == $scholarctr->scholar_user_id) { echo '<tr><td><h4><center>' . $refund->refund_amount . '<br></center></h4></td><td><h4><center>' . $refund->refund_smShare . '</center></h4></td><td><h4><center>' . $refund->refund_scholarShare . '</center></h4></td><td><h4><center>' . $refund->refund_description . '</center></h4></td><td><h4><center>' . $refund->refund_date . '</center></h4></td></tr>'; } } } } } echo '</table>'; ?>
/** * Finds the Refunds model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Refunds the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Refunds::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }