Esempio n. 1
0
 /**
  * Creates a new Pago model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Pago();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PagoCreateRequest $request)
 {
     $socio = Socio::where('numero', $request['socio_id'])->first();
     $pago = new Pago();
     $pago->fecha = $request['fecha'];
     $pago->hora = $request['hora'];
     $pago->monto = $request['monto'];
     $pago->planes_id = $request['plan_id'];
     $pago->socios_id = $socio->id;
     $pago->descuento = $request['descuento'];
     //dd($pago);
     $pago->save();
     Session::flash('mensaje', 'Pago registrado correctamente');
     return redirect('pagos');
 }
Esempio n. 3
0
 /**
  * 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]);
     }
 }