public function actionSinAprobar($id)
 {
     $comite = Comite::findOne(['id' => $id]);
     $proyectos = Faer::find()->where(['categoria' => $comite->tipo]);
     if (strtoupper($comite->getSubtipo0()->one()->nombre) != "GENERAL") {
         $proyectos = $proyectos->andWhere(['subcategoria' => $comite->subtipo]);
     }
     $proyectos = $proyectos->all();
     $html = $this->renderAjax('_por_aprobar', ['proyectos' => $proyectos]);
     return Json::encode($html);
 }
Example #2
0
 public function searchfixed($id)
 {
     $comite = Comite::findOne(['id' => $id]);
     $proyectos_ya_asignados = ArrayHelper::getColumn(ProyectosComite::find()->asArray()->all(), 'proyecto', false);
     $query = Faer::find()->where(['categoria' => $comite->tipo]);
     if (!empty($proyectos_ya_asignados)) {
         $query = $query->andWhere(['not in', 'numero', $proyectos_ya_asignados]);
     }
     if (strtoupper($comite->getSubtipo0()->one()->nombre) != "GENERAL") {
         $query = $query->andWhere(['subcategoria' => $comite->subtipo]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     return $dataProvider;
 }
 /**
  * Creates a new DetalleProyecto model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($numero)
 {
     $model = new DetalleProyecto();
     $model->numero = $numero;
     $model->aporte_fondo = $model->total - $model->cofinanciacion;
     $model_faer = Faer::findOne(['numero' => $numero]);
     $lista_detalle_proyecto = DetalleProyecto::findAll(['numero' => $numero]);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $model = new DetalleProyecto();
         $model->numero = $numero;
         $model->aporte_fondo = $model->total - $model->cofinanciacion;
         $this->refresh();
     }
     return $this->render('create', ['model' => $model, 'model_faer' => $model_faer, 'lista_detalles' => $lista_detalle_proyecto]);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFaers()
 {
     return $this->hasMany(Faer::className(), ['comite' => 'id']);
 }
Example #5
0
 /**
  * Finds the Faer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Faer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Faer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['proyecto', 'comite'], 'integer'], [['fecha_aprobacion'], 'safe'], [['acta_aprobacion', 'usuario_aprobo'], 'string', 'max' => 255], [['comite'], 'exist', 'skipOnError' => true, 'targetClass' => Comite::className(), 'targetAttribute' => ['comite' => 'id']], [['proyecto'], 'exist', 'skipOnError' => true, 'targetClass' => Faer::className(), 'targetAttribute' => ['proyecto' => 'numero']]];
 }
Example #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFaers()
 {
     return $this->hasMany(Faer::className(), ['subcategoria' => 'id']);
 }
Example #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getNumero0()
 {
     return $this->hasOne(Faer::className(), ['numero' => 'numero']);
 }