/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Cuenta::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['monto' => $this->monto, 'idcategoriaprogramatica' => $this->idcategoriaprogramatica, 'idpuc' => $this->idpuc]);
     $query->andFilterWhere(['like', 'tipo', $this->tipo])->andFilterWhere(['like', 'puc', $this->puc])->andFilterWhere(['like', 'categoria', $this->categoria])->andFilterWhere(['like', 'descripcion', $this->descripcion])->andFilterWhere(['like', 'auxiliar', $this->auxiliar])->andFilterWhere(['like', 'pucn', $this->pucn]);
     return $dataProvider;
 }
?>
        <?php 
$searchModel = new CuentaPresupuestariaSearch();
$dataProvider = $searchModel->search('');
//            $dataProvider = new act CActiveDataProvider('C001tProyecto', array(
//                'criteria' => array(
//                    'condition' => 'in_cargado = 1 AND in_activo = 0',
//                ),
//            ));
echo yii\grid\GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['label' => 'PARTIDA PRESUPUESTARIA', 'format' => 'raw', 'value' => function ($data) {
    return Html::label(trim($data->categoria) . trim($data->puc));
}], ['label' => 'DESCRIPCION DE PARTIDA', 'format' => 'raw', 'value' => function ($data) {
    if (trim($data->descripcionaux) != "") {
        return Html::label(trim($data->descripcionaux));
    } else {
        $cuenta = Cuenta::find()->where("puc like '%" . trim($data->puc) . "%'")->andWhere("categoria like '%" . trim($data->categoria) . "%'")->one();
        if ($cuenta) {
            return Html::label(trim($cuenta->descripcion));
        } else {
            $puc = app\models\Puc::find()->where("puc like '%" . trim($data->puc) . "%'")->one();
            if ($puc) {
                return Html::label(trim($puc->descripcion));
            } else {
                return Html::label("N/A");
            }
        }
    }
}], ['label' => 'COMPROMETIDO ACTUAL', 'format' => 'raw', 'value' => function ($data) {
    return '<div class="input-group">' . Html::input("text", "beneficiario", $data->comprometido, ['class' => 'form-control', 'readonly' => 'readonly']) . '<span class="input-group-addon">Bs</span>.</div>';
}], ['label' => 'AJUSTE', 'format' => 'raw', 'value' => function ($data) {
    return '<div class="input-group">' . Html::input("numeric", "ajuste", "0", ['class' => 'form-control']) . '<span class="input-group-addon">Bs</span>.</div>';