/**
  * @param	Gastofacturacion $gastofacturacion The gastofacturacion object to add.
  */
 protected function doAddGastofacturacion($gastofacturacion)
 {
     $this->collGastofacturacions[] = $gastofacturacion;
     $gastofacturacion->setCategoriagasto($this);
 }
 /**
  * Exclude object from result
  *
  * @param   Gastofacturacion $gastofacturacion Object to remove from the list of results
  *
  * @return GastofacturacionQuery The current query, for fluid interface
  */
 public function prune($gastofacturacion = null)
 {
     if ($gastofacturacion) {
         $this->addUsingAlias(GastofacturacionPeer::IDGASTOFACTURACION, $gastofacturacion->getIdgastofacturacion(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Filter the query by a related Gastofacturacion object
  *
  * @param   Gastofacturacion|PropelObjectCollection $gastofacturacion The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 ExpedientegastoQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByGastofacturacion($gastofacturacion, $comparison = null)
 {
     if ($gastofacturacion instanceof Gastofacturacion) {
         return $this->addUsingAlias(ExpedientegastoPeer::IDGASTOFACTURACION, $gastofacturacion->getIdgastofacturacion(), $comparison);
     } elseif ($gastofacturacion instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ExpedientegastoPeer::IDGASTOFACTURACION, $gastofacturacion->toKeyValue('PrimaryKey', 'Idgastofacturacion'), $comparison);
     } else {
         throw new PropelException('filterByGastofacturacion() only accepts arguments of type Gastofacturacion or PropelCollection');
     }
 }
 /**
  * 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 Gastofacturacion $obj A Gastofacturacion 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->getIdgastofacturacion();
         }
         // if key === null
         GastofacturacionPeer::$instances[$key] = $obj;
     }
 }
Beispiel #5
0
 public function serversideAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         //EL MAPEO DE NUESTRA TABALA
         $table_map = array(0 => 'gastofacturacion_nombre', 1 => 'categoriagasto_nombre', 2 => 'gastofacturacion_descripcion', 3 => 'gastofacturacion_iva');
         $post_data = $request->getPost();
         //NUESTRA QUERY
         $query = new \GastofacturacionQuery();
         //JOIN
         $query->joinCategoriagasto()->withColumn('categoriagasto_nombre');
         //ORDER
         if (isset($post_data['order'])) {
             $order = $table_map[$post_data['order'][0]['column']];
             $dir = $post_data['order'][0]['dir'];
             $query->orderBy($order, $dir);
         } else {
             $query->orderByIdgastofacturacion(\Criteria::DESC);
         }
         if (!empty($post_data['search']['value'])) {
             $search = $post_data['search']['value'];
             $c = new \Criteria();
             $c1 = $c->getNewCriterion('gastofacturacion.gastofacturacion_nombre', '%' . $search . '%', \Criteria::LIKE);
             $c2 = $c->getNewCriterion('gastofacturacion.gastofacturacion_descripcion', '%' . $search . '%', \Criteria::LIKE);
             $c2 = $c->getNewCriterion('categoriagasto.categoriagasto_nombre', '%' . $search . '%', \Criteria::LIKE);
             $c3 = $c->getNewCriterion('gastofacturacion.gastofacturacion_iva', '%' . $search . '%', \Criteria::LIKE);
             $c1->addOr($c2)->addOr($c3);
             $query->addAnd($c1);
         }
         //EL TOTAL DE LA BUSQUEDA
         $recordsFiltered = $query->count();
         //SUSTITUIMOS VARIABLES SI NOS LAS ENVIAN POR LA URL
         if (isset($post_data['url_params']['limit']) && isset($post_data['url_params']['page'])) {
             $post_data['length'] = (int) $post_data['url_params']['limit'];
             $post_data['start'] = 0;
             if ((int) $post_data['url_params']['page'] > 1) {
                 $post_data['start'] = $post_data['url_params']['limit'] * ((int) $post_data['url_params']['page'] - 1);
             }
         }
         //LIMIT
         $query->setOffset((int) $post_data['start']);
         $query->setLimit((int) $post_data['length']);
         //DAMOS EL FORMATO CORRECTO
         $data = array();
         $value = new \Gastofacturacion();
         foreach ($query->find() as $value) {
             $tmp['DT_RowId'] = $value->getIdgastofacturacion();
             $tmp['gastofacturacion_nombre'] = $value->getGastofacturacionNombre();
             $tmp['categoriagasto_nombre'] = $value->getCategoriagasto()->getCategoriagastoNombre();
             $tmp['gastofacturacion_descripcion'] = $value->getGastofacturacionDescripcion();
             $tmp['gastofacturacion_iva'] = ucfirst($value->getGastofacturacionIva()) . ' %';
             $tmp['gastofacturacion_options'] = '<a data-toggle="tooltip" data-placement="left" title="Editar" href="/catalogo/gastos/editar/' . $value->getIdgastofacturacion() . '"><i class="fa fa-pencil"></i></a><a class="delete" data-toggle="tooltip" data-placement="left" title="Eliminar" href="javascript:void(0)"><i class="fa fa-trash-o"></i></a>';
             $data[] = $tmp;
         }
         //El arreglo que regresamos
         $json_data = array("draw" => (int) $post_data['draw'], "recordsFiltered" => $recordsFiltered, "data" => $data, "page" => $post_data['url_params']['page']);
         return $this->getResponse()->setContent(json_encode($json_data));
     }
 }
 /**
  * Filter the query by a related Gastofacturacion object
  *
  * @param   Gastofacturacion|PropelObjectCollection $gastofacturacion  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 CategoriagastoQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByGastofacturacion($gastofacturacion, $comparison = null)
 {
     if ($gastofacturacion instanceof Gastofacturacion) {
         return $this->addUsingAlias(CategoriagastoPeer::IDCATEGORIAGASTO, $gastofacturacion->getIdcategoriagasto(), $comparison);
     } elseif ($gastofacturacion instanceof PropelObjectCollection) {
         return $this->useGastofacturacionQuery()->filterByPrimaryKeys($gastofacturacion->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByGastofacturacion() only accepts arguments of type Gastofacturacion or PropelCollection');
     }
 }
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aEmpleado instanceof Persistent) {
             $this->aEmpleado->clearAllReferences($deep);
         }
         if ($this->aExpediente instanceof Persistent) {
             $this->aExpediente->clearAllReferences($deep);
         }
         if ($this->aGastofacturacion instanceof Persistent) {
             $this->aGastofacturacion->clearAllReferences($deep);
         }
         if ($this->aProveedoritrade instanceof Persistent) {
             $this->aProveedoritrade->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aEmpleado = null;
     $this->aExpediente = null;
     $this->aGastofacturacion = null;
     $this->aProveedoritrade = null;
 }