示例#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());
         }
     }
 }
示例#2
0
 /**
  * Declares an association between this object and a Factura object.
  *
  * @param             Factura $v
  * @return FacturaDetalle The current object (for fluent API support)
  * @throws PropelException
  */
 public function setFactura(Factura $v = null)
 {
     if ($v === null) {
         $this->setFacturaId(NULL);
     } else {
         $this->setFacturaId($v->getId());
     }
     $this->aFactura = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Factura object, it will not be re-added.
     if ($v !== null) {
         $v->addFacturaDetalle($this);
     }
     return $this;
 }
示例#3
0
 /**
  * Filter the query by a related Factura object
  *
  * @param   Factura|PropelObjectCollection $factura The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   FacturaDetalleQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByFactura($factura, $comparison = null)
 {
     if ($factura instanceof Factura) {
         return $this->addUsingAlias(FacturaDetallePeer::FACTURA_ID, $factura->getId(), $comparison);
     } elseif ($factura instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(FacturaDetallePeer::FACTURA_ID, $factura->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByFactura() only accepts arguments of type Factura or PropelCollection');
     }
 }
示例#4
0
 /**
  * Exclude object from result
  *
  * @param   Factura $factura Object to remove from the list of results
  *
  * @return FacturaQuery The current query, for fluid interface
  */
 public function prune($factura = null)
 {
     if ($factura) {
         $this->addUsingAlias(FacturaPeer::ID, $factura->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
示例#5
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Factura $obj A Factura object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         FacturaPeer::$instances[$key] = $obj;
     }
 }