/** * 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]); }
/** * 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.'); } }