예제 #1
0
 public function actionIndex2()
 {
     $searchModel = new DeductionSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     if (Yii::$app->request->post('hasEditable')) {
         $deductionId = Yii::$app->request->post('editableKey');
         $deduction = Deduction::findOne($deductionId);
         $out = Json::encode(['output' => '', 'message' => '']);
         $post = [];
         $posted = current($_POST['Deduction']);
         $post['Deduction'] = $posted;
         if ($deduction->load($post)) {
             $deduction->save();
         }
         echo $out;
         return;
     }
     return $this->render('index2', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
예제 #2
0
 /**
  * Lists all Deductions models.
  * @return mixed
  */
 public function actionIndex()
 {
     $username = Yii::$app->user->identity->username;
     $users = User::find()->all();
     $scholars = Scholar::find()->all();
     $model = new Deduction();
     $model2 = new Incentive();
     foreach ($users as $user) {
         foreach ($scholars as $scholar) {
             if ($user->username == $username && $user->id == $scholar->scholar_user_id) {
                 $model->scholar_scholar_id = $scholar->scholar_id;
                 $model2->scholar_scholar_id = $scholar->scholar_id;
                 $searchModel1 = new DeductionSearch($model);
                 $dataProvider1 = $searchModel1->search(Yii::$app->request->queryParams);
                 $searchModel2 = new IncentiveSearch($model2);
                 $dataProvider2 = $searchModel2->search(Yii::$app->request->queryParams);
                 return $this->render('index', ['searchModel1' => $searchModel1, 'dataProvider1' => $dataProvider1, 'searchModel2' => $searchModel2, 'dataProvider2' => $dataProvider2]);
             }
         }
     }
 }
예제 #3
0
?>
<div class="scholar-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

<?php 
$exportedValues = [['class' => 'kartik\\grid\\ExpandRowColumn', 'value' => function ($model, $key, $index, $column) {
    return GridView::ROW_COLLAPSED;
}, 'detail' => function ($model, $key, $index, $column) {
    $searchModel = new DeductionSearch();
    $searchModel->scholar_scholar_id = $model->scholar_id;
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
    return Yii::$app->controller->renderPartial('_dropdown', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
}], 'scholar_id', ['attribute' => 'scholar_first_name'], ['attribute' => 'scholar_middle_name'], ['attribute' => 'scholar_last_name']];
$export = ExportMenu::widget(['dataProvider' => $dataProvider, 'columns' => $exportedValues, 'noExportColumns' => [18], 'columnSelectorOptions' => ['label' => 'Columns', 'class' => 'btn btn-danger'], 'target' => '_blank', 'fontAwesome' => true, 'dropdownOptions' => ['label' => 'Export', 'class' => 'btn btn-success']]);
echo Html::a('Group By Scholar', ['index'], ['class' => 'btn btn-success']);
echo Html::a('Show Only Deduction Records', ['index2'], ['class' => 'btn btn-success']);
?>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'rowOptions' => function ($model) {
    if (strcasecmp($model->allowance_allowance_area, 'NCR') != 0) {
        return ['class' => 'provincial-row'];
    } else {
        if (strcasecmp($model->allowance_allowance_area, 'NCR') == 0) {
            return ['class' => 'ncr-row'];