/**
  * Filter the query by a related Expedientegasto object
  *
  * @param   Expedientegasto|PropelObjectCollection $expedientegasto  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 GastofacturacionQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByExpedientegasto($expedientegasto, $comparison = null)
 {
     if ($expedientegasto instanceof Expedientegasto) {
         return $this->addUsingAlias(GastofacturacionPeer::IDGASTOFACTURACION, $expedientegasto->getIdgastofacturacion(), $comparison);
     } elseif ($expedientegasto instanceof PropelObjectCollection) {
         return $this->useExpedientegastoQuery()->filterByPrimaryKeys($expedientegasto->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByExpedientegasto() only accepts arguments of type Expedientegasto or PropelCollection');
     }
 }
 /**
  * @param	Expedientegasto $expedientegasto The expedientegasto object to add.
  */
 protected function doAddExpedientegasto($expedientegasto)
 {
     $this->collExpedientegastos[] = $expedientegasto;
     $expedientegasto->setGastofacturacion($this);
 }
 /**
  * Exclude object from result
  *
  * @param   Expedientegasto $expedientegasto Object to remove from the list of results
  *
  * @return ExpedientegastoQuery The current query, for fluid interface
  */
 public function prune($expedientegasto = null)
 {
     if ($expedientegasto) {
         $this->addUsingAlias(ExpedientegastoPeer::IDEXPEDIENTEGASTO, $expedientegasto->getIdexpedientegasto(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * @param	Expedientegasto $expedientegasto The expedientegasto object to add.
  */
 protected function doAddExpedientegasto($expedientegasto)
 {
     $this->collExpedientegastos[] = $expedientegasto;
     $expedientegasto->setProveedoritrade($this);
 }
Beispiel #5
0
 /**
  * @param	Expedientegasto $expedientegasto The expedientegasto object to add.
  */
 protected function doAddExpedientegasto($expedientegasto)
 {
     $this->collExpedientegastos[] = $expedientegasto;
     $expedientegasto->setEmpleado($this);
 }
 /**
  * Filter the query by a related Expedientegasto object
  *
  * @param   Expedientegasto|PropelObjectCollection $expedientegasto  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 ProveedoritradeQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByExpedientegasto($expedientegasto, $comparison = null)
 {
     if ($expedientegasto instanceof Expedientegasto) {
         return $this->addUsingAlias(ProveedoritradePeer::IDPROVEEDORITRADE, $expedientegasto->getIdproveedoritrade(), $comparison);
     } elseif ($expedientegasto instanceof PropelObjectCollection) {
         return $this->useExpedientegastoQuery()->filterByPrimaryKeys($expedientegasto->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByExpedientegasto() only accepts arguments of type Expedientegasto or PropelCollection');
     }
 }
 public function nuevocargoAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post_data = $request->getPost();
         $post_files = $request->getFiles();
         $auth = new \Shared\Session\AouthSession();
         $auth = $auth->getData();
         $entity = new \Expedientegasto();
         foreach ($post_data as $key => $value) {
             if (\ExpedientegastoPeer::getTableMap()->hasColumn($key) && !empty($value) && $key != 'expedientegasto_fecha') {
                 $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME);
             }
         }
         //LA FECHA
         $expedientegasto_fecha = \DateTime::createFromFormat('d/m/Y', $post_data['expedientegasto_fecha']);
         $entity->setExpedientegastoFecha($expedientegasto_fecha);
         $entity->setIdempleado($auth['idempleado']);
         $entity->save();
         //El comprobante
         if (!empty($post_files['expedientegasto_comprobante']['name'])) {
             $target_path = "/files/expedientesgastos/";
             $target_path = $target_path . $entity->getIdexpedientegasto() . '_' . basename($post_files['expedientegasto_comprobante']['name']);
             if (move_uploaded_file($_FILES['expedientegasto_comprobante']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . $target_path)) {
                 $entity->setExpedientegastoComprobante($target_path);
                 $entity->save();
             }
         }
         $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!');
         //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR
         return $this->redirect()->toUrl('/clientes/ver/' . $entity->getExpediente()->getIdcliente() . '/expedientes/ver/' . $entity->getIdexpediente());
     }
     $idexpediente = $this->params()->fromQuery('id');
     $moneda = $this->params()->fromQuery('moneda');
     $entity = \ExpedienteQuery::create()->findPk($idexpediente);
     //LAS CATEGORIAS DE NUESTROS GASTOS
     $categoriasgasto = \CategoriagastoQuery::create()->find();
     $categoriasgasto_array = array();
     foreach ($categoriasgasto as $categoriagastos) {
         $id = $categoriagastos->getIdcategoriagasto();
         $categoriasgasto_array[$id] = $categoriagastos->getCategoriagastoNombre();
     }
     //LOS PROVEEDORES
     $proveedores = \ProveedoritradeQuery::create()->filterByIdproveedoritrade(1, \Criteria::NOT_EQUAL)->find();
     $proveedores_array = array();
     $proveedor = new \Proveedoritrade();
     foreach ($proveedores as $proveedor) {
         $id = $proveedor->getIdproveedoritrade();
         $proveedores_array[$id] = $proveedor->getProveedoritradeNombre();
     }
     //INSTANCIAMOS NUESTRO FORMULARIO
     $form = new \Admin\Clientes\Form\ExpedientegastoForm($idexpediente, $categoriasgasto_array, $proveedores_array, $moneda);
     //Enviamos a la vista
     $view_model = new ViewModel();
     $view_model->setTerminal(true)->setVariable('form', $form)->setVariable('entity', $entity)->setTemplate('/clientes/expedientes/modal/nuevocargo');
     return $view_model;
 }
 /**
  * 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 Expedientegasto $obj A Expedientegasto 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->getIdexpedientegasto();
         }
         // if key === null
         ExpedientegastoPeer::$instances[$key] = $obj;
     }
 }