示例#1
0
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Deductions::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([
            'deduction_id' => $this->deduction_id,
            'deduction_date' => $this->deduction_date,
            'deduction_amount' => $this->deduction_amount,
            'deduction_scholar_id' => $this->deduction_scholar_id,
        ]);

        $query->andFilterWhere(['like', 'deduction_remark', $this->deduction_remark]);

        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,
					]);
				}
				}
				}

			}
		}
    }
 /**
  * Finds the Deductions model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Deductions the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Deductions::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#4
0
/* @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>Date</center></h3></td><td><h3><center>Deduction Amount</center></h3></td><td><h3><center>Remark</center></h3></td></tr>';
$users = User::find()->all();
$deductions = Deductions::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($deductions as $deduction){
				if($scholarctr->scholar_user_id==$ctr->id && $deduction->deduction_scholar_id==$scholarctr->scholar_user_id){
					
						
						echo'<tr><td><h4><center>'.$deduction->deduction_date.'<br></center></h4></td><td><h4><center>'.$deduction->deduction_amount.'</center></h4></td><td><h4><center>'.$deduction->deduction_remark.'</center></h4></td></tr>';