Example #1
0
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new IngresoPedidoProveedorForm();
     if ($request->isMethod('POST')) {
         $this->form->bind($request->getParameter('ingreso_pedprov'));
         if ($this->form->isValid()) {
             $valores = $this->form->getValues();
             $BitacoraCambios = new BitacoraCambios();
             $BitacoraCambios->setModelo('Pedido Proveedores');
             $proveedor = ProveedorQuery::create()->filterById($valores['Proveedor'])->findOne();
             $BitacoraCambios->setDescripcion('Ingreso de Pedido a Proveedor: ' . $proveedor->getNombre());
             $BitacoraCambios->setIp($request->getRemoteAddress());
             $pedido = new PedidoProveedor();
             $pedido->setProveedor($proveedor);
             $pedido->setFecha(date('d/m/y'));
             $Usuario = UsuarioQuery::create()->findOneById(sfContext::getInstance()->getUser()->getAttribute('usuario', null, 'seguridad'));
             $pedido->setUsuario($Usuario);
             $pedido->setDescripcion($valores['Descripcion']);
             $pedido->setEstado($valores['Estado']);
             $pedido->setSerie($valores['Serie']);
             $pedido->setDocumento($valores['Documento']);
             $pedido->save();
             $this->redirect('pedido_proveedor/index');
         }
     }
     $this->pedidos = PedidoProveedorQuery::create()->orderById('DESC')->find();
 }
Example #2
0
 public function getproveedoresAction()
 {
     $proveedores = \ProveedorQuery::create()->find();
     $proveedor_array = array();
     foreach ($proveedores as $proveedor) {
         $tmp['value'] = $proveedor->getIdproveedor();
         $tmp['label'] = $proveedor->getProveedorNombre();
         array_push($proveedor_array, $tmp);
     }
     return $this->getResponse()->setContent(\Zend\Json\Json::encode($proveedor_array));
 }
 /**
  * Get the associated Proveedor object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Proveedor The associated Proveedor object.
  * @throws     PropelException
  */
 public function getProveedor(PropelPDO $con = null)
 {
     if ($this->aProveedor === null && $this->idprovee !== null) {
         $this->aProveedor = ProveedorQuery::create()->findPk($this->idprovee, $con);
         /* The following can be used additionally to
         			guarantee the related object contains a reference
         			to this object.  This level of coupling may, however, be
         			undesirable since it could result in an only partially populated collection
         			in the referenced object.
         			$this->aProveedor->addRegistrocompras($this);
         		 */
     }
     return $this->aProveedor;
 }
Example #4
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(ProveedorPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = ProveedorQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         // symfony_behaviors behavior
         foreach (sfMixer::getCallables('BaseProveedor:delete:pre') as $callable) {
             if (call_user_func($callable, $this, $con)) {
                 $con->commit();
                 return;
             }
         }
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             // symfony_behaviors behavior
             foreach (sfMixer::getCallables('BaseProveedor:delete:post') as $callable) {
                 call_user_func($callable, $this, $con);
             }
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
Example #5
0
 public function getproveedoresAction()
 {
     $collection = \ProveedorQuery::create()->filterByIdproveedor(1, \Criteria::NOT_EQUAL)->find()->toArray(null, false, \BasePeer::TYPE_FIELDNAME);
     $autcomplete = array();
     foreach ($collection as $entity) {
         $tmp['value'] = $entity["idproveedor"];
         $tmp['label'] = $entity["proveedor_nombre"];
         $conceptos_autcomplete[] = $tmp;
     }
     return $this->getResponse()->setContent(\Zend\Json\Json::encode($conceptos_autcomplete));
 }
Example #6
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(ProveedorPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = ProveedorQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }