Exemple #1
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new VentaCabeceraForm(array('Fecha' => date('d/m/Y')));
     if ($request->isMethod('POST')) {
         $this->form->bind($request->getParameter('venta_cabecera'));
         if ($this->form->isValid()) {
             $valores = $this->form->getValues();
             $Factura = new Factura();
             $Factura->setClienteId($valores['Cliente']);
             $Factura->setTipoPagoId($valores['TipoPago']);
             $Factura->setFecha($valores['Fecha']);
             $Factura->setSerie($valores['Serie']);
             $Factura->setDocumento($valores['Documento']);
             $Factura->save();
             $this->redirect('venta/detalle?id=' . $Factura->getId());
         }
     }
 }