/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Estadogasto::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(['ID_ESTADO_GASTO' => $this->ID_ESTADO_GASTO]); $query->andFilterWhere(['like', 'ESTADO_GASTO', $this->ESTADO_GASTO]); return $dataProvider; }
<h3><?php echo $msg; ?> </h3> <div class="form-group"> <?php $form = ActiveForm::begin(["method" => "post", 'enableClientValidation' => true]); ?> <?php echo $form->field($model, "ID_GASTO")->input("hidden")->label(false); ?> <?php echo $form->field($model, "estadogasto")->dropDownList(ArrayHelper::Map(Estadogasto::find()->all(), "ID_ESTADO_GASTO", "ESTADO_GASTO")); ?> </div> <?php echo Html::submitButton("Cambiar Estado", ["class" => "btn btn-primary"]); ?> <?php $form->end(); ?>
/** * Finds the Estadogasto model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Estadogasto the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { PermisosController::permisoAdministrador(); if (($model = Estadogasto::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<th> Aceptar/Rechazar Gasto</th> </tr> <?php foreach ($model as $row) { ?> <tr> <td><?php echo $row->ID_GASTO; ?> </td> <td><?php echo $row->ID_VIAJE; ?> </td> <td><?php echo Estadogasto::findOne($row->ID_ESTADO_GASTO)->ESTADO_GASTO; ?> </td> <td><?php echo $row->NOMBRE_GASTO; ?> </td> <td><?php echo $row->MONTO_GASTO; ?> </td> <td><?php echo $row->FECHA_GASTO; ?> </td> <td><a href="<?php