Example #1
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;
     }
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProyectoPedido::find();
     // Join para la relacion
     $query->joinWith(['idMaterial']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     //Ordenamiento
     $dataProvider->sort->attributes['nombreMaterial'] = ['asc' => ['materiales_servicios.nombre' => SORT_ASC], 'desc' => ['materiales_servicios.nombre' => 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, 'proyecto_pedido.estatus' => $this->estatus]);
     $query->andFilterWhere(['like', 'materiales_servicios.nombre', $this->nombreMaterial]);
     return $dataProvider;
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProyectoPedidos()
 {
     return $this->hasMany(ProyectoPedido::className(), ['asignado' => 'id']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProyectoPedidos()
 {
     return $this->hasMany(ProyectoPedido::className(), ['id_material' => 'id']);
 }
 /**
  * Finds the ProyectoPedido model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return ProyectoPedido the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = ProyectoPedido::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }