/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Garantias(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Garantias'])) { $model->attributes = $_POST['Garantias']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->ID)); } } $this->render('create', array('model' => $model)); }
public function savegarantiaAction() { if ($this->request->isPost()) { if ($_POST['garantia_id'] > 0) { $fecha_deposito = date("Y-m-d", strtotime($this->request->getPost('fecha_deposito'))); $resul = Garantias::findFirstById($_POST['garantia_id']); $resul->fecha_deposito = $fecha_deposito; $resul->nro_deposito = $this->request->getPost('nro_deposito'); $resul->monto_deposito = $this->request->getPost('monto_deposito'); if ($resul->save()) { $msm = 'Exito: Se guardo correctamente'; } else { $msm = 'Error: No se guardo el registro'; } } else { $resul = new Garantias(); $resul->contratoproducto_id = $this->request->getPost('contratoproducto_id'); $resul->tipo = $this->request->getPost('tipo'); $resul->fecha_deposito = date("Y-m-d", strtotime($this->request->getPost('fecha_deposito'))); $resul->nro_deposito = $this->request->getPost('nro_deposito'); $resul->monto_deposito = $this->request->getPost('monto_deposito'); $resul->fecha_devolucion = ''; $resul->nro_devolucion = ''; $resul->monto_devolucion = ''; $resul->baja_logica = 1; if ($resul->save()) { $msm = 'Exito: Se guardo correctamente'; } else { $msm = 'Error: No se guardo el registro'; } } } $this->view->disable(); echo $html; }