/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AccionCentralizadaPedido::find();
     // Join para la relacion
     $query->joinWith(['idMaterial']);
     $query->joinWith(['asignado0.accion_centralizada_ac_especifica_uej']);
     $query->joinWith(['asignado0.accion_centralizada_ac_especifica_uej']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     //Ordenamiento
     $dataProvider->sort->attributes['nombreMaterial'] = ['asc' => ['materiales_servicios.nombre' => SORT_ASC], 'desc' => ['materiales_servicios.nombre' => SORT_DESC]];
     $dataProvider->sort->attributes['idUnidadEjecutora'] = ['asc' => ['accion_centralizada_ac_especifica_uej.id_ue' => SORT_ASC], 'desc' => ['accion_centralizada_ac_especifica_uej.id_ue' => SORT_DESC]];
     $dataProvider->sort->attributes['idAcc'] = ['asc' => ['accion_centralizada_ac_especifica_uej.id_ac_esp' => SORT_ASC], 'desc' => ['accion_centralizada_ac_especifica_uej.id_ac_esp' => SORT_DESC]];
     $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' => $this->id, 'id_material' => $this->id_material, 'enero' => $this->enero, 'febrero' => $this->febrero, 'marzo' => $this->marzo, 'abril' => $this->abril, 'mayo' => $this->mayo, 'junio' => $this->junio, 'julio' => $this->julio, 'agosto' => $this->agosto, 'septiembre' => $this->septiembre, 'octubre' => $this->octubre, 'noviembre' => $this->noviembre, 'diciembre' => $this->diciembre, 'precio' => $this->precio, 'fecha_creacion' => $this->fecha_creacion, 'asignado' => $this->asignado, 'accion_centralizada_pedido.estatus' => $this->estatus]);
     $query->andFilterWhere(['like', 'materiales_servicios.nombre', $this->nombreMaterial]);
     $query->andFilterWhere(['accion_centralizada_ac_especifica_uej.id_ue' => $this->idUnidadEjecutora]);
     $query->andFilterWhere(['accion_centralizada_ac_especifica_uej.id_ac_esp' => $this->idAcc]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAccionCentralizadaPedidos()
 {
     return $this->hasMany(AccionCentralizadaPedido::className(), ['id_material' => 'id']);
 }
 /**
  * Finds the AccionCentralizadaPedido model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AccionCentralizadaPedido the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AccionCentralizadaPedido::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #4
0
 /**
  * @inheritdoc
  */
 public function getRoute()
 {
     switch ($this->key) {
         case self::KEY_NUEVO_PEDIDO:
             $pedido = ProyectoPedido::findOne($this->key_id);
             return ['/proyecto-pedido/view', 'id' => $pedido->id];
             break;
         case self::KEY_NUEVO_PEDIDO_ACC:
             $pedido = AccionCentralizadaPedido::findOne($this->key_id);
             return ['/accion-centralizada-pedido/view', 'id' => $this->key_id];
             break;
         case self::KEY_PEDIDO_ACC_APROBADO:
             return ['/'];
             break;
     }
 }