/** * Creates a new Academia model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Academia(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Academia::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' => $this->id, 'fecha_desde' => $this->fecha_desde, 'numero_carros' => $this->numero_carros, 'numero_motos' => $this->numero_motos, 'costo_por_ciclo' => $this->costo_por_ciclo, 'fecha_inicial_facturacion' => $this->fecha_inicial_facturacion]); $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'email', $this->email]); return $dataProvider; }
/** * Creates a new Pago model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($academia = 0) { $model = new Pago(); $model->academia = $academia; $searchModel = new PagoSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $model_detalle_academia = Academia::findOne(['id' => $academia]); $meses_a_pagar = Pago::calcularMesesDeuda($academia); $periodo_a_pagar = Pago::calcularPeriodoAPagar($academia); $valor_a_pagar = Pago::calcularValorAPagar($academia); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->refresh(); } else { return $this->render('create', ['model' => $model, 'model_detalle_academia' => $model_detalle_academia, 'meses_a_pagar' => $meses_a_pagar, 'periodo_a_pagar' => $periodo_a_pagar, 'valor_a_pagar' => $valor_a_pagar, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]); } }