/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Allowance::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->joinWith('allowanceScholar'); $query->andFilterWhere([ 'allowance_id' => $this->allowance_id, 'allowance_amount' => $this->allowance_amount, 'allowance_scholar_id' => $this->allowance_scholar_id, 'allowance_school_id' => $this->allowance_school_id, 'benefit_allowance_id' => $this->benefit_allowance_id, 'allowance_paidDate' => $this->allowance_paidDate, ]); $query->andFilterWhere(['like', 'allowance_remark', $this->allowance_remark]) ->andFilterWhere(['like', 'allowance_payStatus', $this->allowance_payStatus]) ->andFilterWhere(['like', 'scholars.scholar_lastName', $this->allowance_scholar_lastName]) ->andFilterWhere(['like', 'scholars.scholar_firstName', $this->allowance_scholar_firstName]) ->andFilterWhere(['like', 'scholars.scholar_middleName', $this->allowance_scholar_middleName]); return $dataProvider; }
/** * Lists all Allowance models. * @return mixed */ public function actionIndex() { $schools = Schools::find()->all(); $users = User::find()->all(); $scholars = Scholars::find()->all(); $allowances = Allowance::find()->all(); $benefits = Benefit::find()->all(); return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'allowances' => $allowances, 'benefits' => $benefits)); }
/** * Lists all Compile models. * @return mixed */ public function actionIndex() { $schools = School::find()->all(); $users = User::find()->all(); $scholars = Scholar::find()->all(); $allowances = Allowance::find()->all(); $grades = Grade::find()->all(); return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'allowances' => $allowances, 'grades' => $grades)); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Allowance::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(['allowance_amount' => $this->allowance_amount]); $query->andFilterWhere(['like', 'allowance_area', $this->allowance_area]); return $dataProvider; }
use common\models\Scholar; use common\models\User; /* @var $this yii\web\View */ /* @var $searchModel common\models\DeductionsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Deductions'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="deductions-index"> <?php $username = Yii::$app->user->identity->username; $users = User::find()->all(); $scholars = Scholar::find()->all(); $allowances = Allowance::find()->all(); foreach ($users as $user) { foreach ($scholars as $scholar) { foreach ($allowances as $allowance) { if ($user->username == $username && $user->id == $scholar->scholar_user_id && $allowance->allowance_area == $scholar->allowance_allowance_area) { echo '<strong><h3 style="margin-top:150px">Current Allowance Received: Php <strong>' . $allowance->allowance_amount . '</h3><strong><h3>Current School Location: <strong>' . $allowance->allowance_area . '</h3><br><br></strong>'; } } } } ?> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php