コード例 #1
0
ファイル: caja_general.php プロジェクト: jcanda/caja_general
 /**
  * esta función se ejecuta si el usuario ha hecho login,
  * a efectos prácticos, este es el constructor
  */
 protected function private_core()
 {
     $this->busqueda = array('contenido' => '', 'filtro_almacen' => '', 'desde' => '', 'hasta' => '', 'orden' => 'fecha');
     /// ¿El usuario tiene permiso para eliminar en esta página?
     $this->allow_delete = $this->user->allow_delete_on(__CLASS__);
     //Consultamos almacenes existentes
     $almacenes = new almacen();
     $this->almacenes = $almacenes->all();
     //Conseguimos el agente
     $this->agente = $this->user->get_agente();
     //cargamos nuestro modelo vacio de tabla caja general
     $this->recogidas_model = new cajas_general();
     //Cargo el modelo de los movimientos
     $this->cajamov_model = new cajas_general_mov();
     /************
        // BUSCAR CAJA
        * ********** */
     if (isset($_POST['filtro_almacen'])) {
         $this->busqueda['filtro_almacen'] = $_POST['filtro_almacen'];
         $this->busqueda['desde'] = $_POST['desde'];
         $this->busqueda['hasta'] = $_POST['hasta'];
         $this->resultado = $this->recogidas_model->search($this->busqueda['filtro_almacen'], $this->busqueda['desde'], $this->busqueda['hasta']);
         return;
     } elseif (isset($_POST['almacen'])) {
         /************
            // ABRIR CAJA
            * ********** */
         if ($this->recogidas_model->disponible($_POST['almacen'])) {
             $this->recogidas_model->codalmacen = $_POST['almacen'];
             $this->recogidas_model->d_inicio = floatval($_POST['d_inicio']);
             $this->recogidas_model->codagente = $this->agente->codagente;
             if ($this->recogidas_model->save()) {
                 //Genero una primera linea de entrada en la caja
                 $this->cajamov_model->concepto = 'Apertura de Caja';
                 $this->cajamov_model->apunte = floatval($_POST['d_inicio']);
                 $this->cajamov_model->caja_id = $this->recogidas_model->id;
                 $this->cajamov_model->codagente = $this->agente->codagente;
                 if ($this->cajamov_model->save()) {
                     $this->new_message("Caja iniciada con " . $this->show_numero($this->recogidas_model->d_inicio, 2) . ' €');
                 }
             } else {
                 $this->new_error_msg("¡Imposible guardar los datos de caja!");
             }
         } else {
             $this->new_error_msg("¡Caja ya abierta para este Almacen!");
         }
     } else {
         if (isset($_GET['delete'])) {
             /*             * ***********
                           // ELIMINAR CAJA
                          * ********** */
             $caja2 = $this->recogidas_model->get($_GET['delete']);
             if ($caja2) {
                 //OK, ahora eliminamos todos sus apuntes
                 $this->cajamov_model->delete_all($caja2->id);
                 //Y ahora eliminamos
                 if ($caja2->delete()) {
                     $this->new_log_msg('Caja Nº ' . $_GET['delete'] . ' y apuntes eliminados correctamente...');
                     $this->new_message("Caja y Apuntes eliminados correctamente.");
                 } else {
                     $this->new_error_msg("¡Imposible eliminar la caja!");
                 }
             } else {
                 $this->new_error_msg("Caja no encontrada.");
             }
         } else {
             if (isset($_POST['cierre'])) {
                 /*             * ***********
                               // CERRAR CAJA
                              * ********** */
                 $caja2 = $this->recogidas_model->get($_POST['cierre']);
                 if ($caja2) {
                     $saldo = $this->cajamov_model->apuntes_suma($caja2->id);
                     $contado = floatval($_POST['d_fin']);
                     $descuadre = round($contado - $saldo, 2);
                     $caja2->f_fin = Date('d-m-Y H:i:s');
                     $caja2->d_fin = floatval($_POST['d_fin']);
                     $caja2->descuadre = $descuadre;
                     $caja2->codagente_fin = $this->agente->codagente;
                     $caja2->apuntes = $this->cajamov_model->apuntes_contar($caja2->id);
                     if ($caja2->save()) {
                         $this->new_message("Caja cerrada correctamente.");
                         //Si hay descuadre lo aviso y genero linea en su caja
                         if ($descuadre != 0) {
                             //Genero una linea del descuadre en la caja
                             $this->cajamov_model->concepto = 'Descuadre en Caja';
                             $this->cajamov_model->apunte = $descuadre;
                             $this->cajamov_model->caja_id = $caja2->id;
                             $this->cajamov_model->codagente = $this->agente->codagente;
                             if ($this->cajamov_model->save()) {
                                 $this->new_advice('DESCUADRE: Se ha anotado un apunte con el descuadre de la Caja Nº ' . $caja2->id);
                             }
                         }
                     } else {
                         $this->new_error_msg("¡Imposible cerrar la caja!");
                     }
                 } else {
                     $this->new_error_msg("Caja no encontrada.");
                 }
             }
         }
     }
     $this->offset = 0;
     if (isset($_GET['offset'])) {
         $this->offset = intval($_GET['offset']);
     }
     $this->resultado = $this->recogidas_model->get_all_offset($this->offset);
 }
コード例 #2
0
 protected function private_core()
 {
     $almacen = new almacen();
     $this->pais = new pais();
     /// ¿El usuario tiene permiso para eliminar en esta página?
     $this->allow_delete = $this->user->allow_delete_on(__CLASS__);
     if (isset($_POST['scodalmacen'])) {
         $al0 = $almacen->get($_POST['scodalmacen']);
         if (!$al0) {
             $al0 = new almacen();
             $al0->codalmacen = $_POST['scodalmacen'];
         }
         $al0->nombre = $_POST['snombre'];
         $al0->codpais = $_POST['scodpais'];
         $al0->provincia = $_POST['sprovincia'];
         $al0->poblacion = $_POST['spoblacion'];
         $al0->direccion = $_POST['sdireccion'];
         $al0->codpostal = $_POST['scodpostal'];
         $al0->telefono = $_POST['stelefono'];
         $al0->fax = $_POST['sfax'];
         $al0->contacto = $_POST['scontacto'];
         if ($al0->save()) {
             $this->new_message("Almacén " . $al0->codalmacen . " guardado correctamente.");
         } else {
             $this->new_error_msg("¡Imposible guardar el almacén!");
         }
     } else {
         if (isset($_GET['delete'])) {
             $al0 = $almacen->get($_GET['delete']);
             if ($al0) {
                 if (!$this->user->admin) {
                     $this->new_error_msg("Solo un administrador puede eliminar un almacén.");
                 } else {
                     if ($al0->delete()) {
                         $this->new_message("Almacén " . $al0->codalmacen . " eliminado correctamente");
                     } else {
                         $this->new_error_msg("¡Imposible eliminar el almacén!");
                     }
                 }
             } else {
                 $this->new_error_msg("¡Almacén no encontrado!");
             }
         } else {
             /// ¿Guardamos las opciones avanzadas?
             $guardar = FALSE;
             foreach ($GLOBALS['config2'] as $i => $value) {
                 if (isset($_POST[$i])) {
                     $GLOBALS['config2'][$i] = $_POST[$i];
                     $guardar = TRUE;
                 }
             }
             if ($guardar) {
                 $file = fopen('tmp/' . FS_TMP_NAME . 'config2.ini', 'w');
                 if ($file) {
                     foreach ($GLOBALS['config2'] as $i => $value) {
                         if (is_numeric($value)) {
                             fwrite($file, $i . " = " . $value . ";\n");
                         } else {
                             fwrite($file, $i . " = '" . $value . "';\n");
                         }
                     }
                     fclose($file);
                 }
                 $this->new_message('Datos guardados correctamente.');
             }
         }
     }
     $this->almacenes = $almacen->all();
     /// si hay más de un almacén activamos el soporte multi-almacén en los listados
     $fsvar = new fs_var();
     if (count($this->almacenes) > 1) {
         $fsvar->simple_save('multi_almacen', TRUE);
     } else {
         $fsvar->simple_delete('multi_almacen');
     }
 }
コード例 #3
0
ファイル: informe_errores.php プロジェクト: ramikat/ERPSISFS
 private function test_tablas()
 {
     $recargar = FALSE;
     if ($this->informe['offset'] == 0) {
         /// comprobamos la tabla familias
         if ($this->db->table_exists('familias')) {
             $data = $this->db->select("SELECT * FROM familias WHERE madre IS NOT NULL AND madre NOT IN (SELECT codfamilia FROM familias);");
             if ($data) {
                 foreach ($data as $d) {
                     $familia = new familia($d);
                     $familia->madre = NULL;
                     $familia->save();
                 }
             }
         }
         /// comprobamos la tabla de articulos de proveedor
         if ($this->db->table_exists('articulosprov')) {
             $this->db->exec("DELETE FROM articulosprov WHERE codproveedor NOT IN (SELECT codproveedor FROM proveedores);");
         }
         $recargar = TRUE;
         $this->informe['offset'] += 1;
     } else {
         if ($this->informe['offset'] == 1) {
             /// comprobamos la tabla de articulos de proveedor
             if ($this->db->table_exists('articulosprov')) {
                 $this->db->exec("UPDATE articulosprov SET refproveedor = referencia WHERE refproveedor IS NULL;");
             }
             $recargar = TRUE;
             $this->informe['offset'] += 1;
         } else {
             if ($this->informe['offset'] == 2) {
                 /// comprobamos la tabla de stock
                 if ($this->db->table_exists('stocks')) {
                     $this->db->exec("DELETE FROM stocks s WHERE NOT EXISTS (SELECT referencia FROM articulos a WHERE a.referencia = s.referencia);");
                 }
                 $recargar = TRUE;
                 $this->informe['offset'] += 1;
             } else {
                 if ($this->informe['offset'] == 3) {
                     /// comprobamos la tabla de regulaciones de stock
                     if ($this->db->table_exists('lineasregstocks')) {
                         $this->db->exec("DELETE FROM lineasregstocks WHERE idstock NOT IN (SELECT idstock FROM stocks);");
                     }
                     $recargar = TRUE;
                     $this->informe['offset'] += 1;
                 } else {
                     if ($this->informe['offset'] == 4) {
                         /// comprobamos la tabla de subcuentas de proveedores
                         if ($this->db->table_exists('co_subcuentasprov')) {
                             $this->db->exec("DELETE FROM co_subcuentasprov WHERE codproveedor NOT IN (SELECT codproveedor FROM proveedores);");
                         }
                         /// comprobamos la tabla de direcciones de proveedores
                         if ($this->db->table_exists('dirproveedores')) {
                             $this->db->exec("DELETE FROM dirproveedores WHERE codproveedor NOT IN (SELECT codproveedor FROM proveedores);");
                         }
                         /// comprobamos la tabla de subcuentas de clientes
                         if ($this->db->table_exists('co_subcuentascli')) {
                             $this->db->exec("DELETE FROM co_subcuentascli WHERE codcliente NOT IN (SELECT codcliente FROM clientes);");
                         }
                         /// comprobamos la tabla de direcciones de clientes
                         if ($this->db->table_exists('dirclientes')) {
                             $this->db->exec("DELETE FROM dirclientes WHERE codcliente NOT IN (SELECT codcliente FROM clientes);");
                         }
                         $recargar = TRUE;
                         $this->informe['offset'] += 1;
                     } else {
                         if ($this->informe['offset'] == 5) {
                             $almacen = new almacen();
                             if (!$almacen->all()) {
                                 $this->db->exec($almacen->install());
                             }
                             $divisa = new divisa();
                             if (!$divisa->all()) {
                                 $this->db->exec($divisa->install());
                             }
                             $formap = new forma_pago();
                             if (!$formap->all()) {
                                 $this->db->exec($formap->install());
                             }
                             $pais = new pais();
                             if (!$pais->all()) {
                                 $this->db->exec($pais->install());
                             }
                             $serie = new serie();
                             if (!$serie->all()) {
                                 $this->db->exec($serie->install());
                             }
                             $recargar = TRUE;
                             $this->informe['offset'] += 1;
                         } else {
                             /// comprobamos la tabla de articulos de proveedor
                             if ($this->db->table_exists('articulosprov')) {
                                 /// buscamos duplicados
                                 $data = $this->db->select("SELECT codproveedor,refproveedor,COUNT(*) as count FROM articulosprov GROUP BY codproveedor,refproveedor HAVING COUNT(*) > 1;");
                                 if ($data) {
                                     foreach ($data as $d) {
                                         $data2 = $this->db->select("SELECT * FROM articulosprov WHERE codproveedor = '" . $d['codproveedor'] . "' AND refproveedor = '" . $d['refproveedor'] . "';");
                                         if ($data2) {
                                             $this->db->exec("DELETE FROM articulosprov WHERE id = " . $this->empresa->var2str($data2[1]['id']) . ";");
                                         }
                                     }
                                     $recargar = TRUE;
                                     $this->informe['offset'] += 1;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$recargar) {
         if ($this->informe['all']) {
             $this->informe['model'] = 'asiento';
         } else {
             $this->informe['model'] = 'fin';
         }
         $this->informe['offset'] = 0;
     }
 }
コード例 #4
0
 private function test_tablas()
 {
     $recargar = FALSE;
     if ($this->informe['offset'] == 0) {
         /// comprobamos la tabla familias
         if ($this->db->table_exists('familias')) {
             $data = $this->db->select("SELECT * FROM familias WHERE madre IS NOT NULL AND madre NOT IN (SELECT codfamilia FROM familias);");
             if ($data) {
                 foreach ($data as $d) {
                     $familia = new familia($d);
                     $familia->madre = NULL;
                     $familia->save();
                 }
             }
         }
         /// comprobamos la tabla de articulos de proveedor
         if ($this->db->table_exists('articulosprov')) {
             $this->db->exec("DELETE FROM articulosprov WHERE codproveedor NOT IN (SELECT codproveedor FROM proveedores);");
         }
         $recargar = TRUE;
         $this->informe['offset'] += 1;
     } else {
         if ($this->informe['offset'] == 1) {
             /// comprobamos la tabla de articulos de proveedor
             if ($this->db->table_exists('articulosprov')) {
                 $this->db->exec("UPDATE articulosprov SET refproveedor = referencia WHERE refproveedor IS NULL;");
             }
             $recargar = TRUE;
             $this->informe['offset'] += 1;
         } else {
             if ($this->informe['offset'] == 2) {
                 /// comprobamos la tabla de stock
                 if ($this->db->table_exists('stocks')) {
                     /**
                      * Esta consulta produce un error si no hay datos erroneos, pero da igual
                      */
                     $this->db->exec("DELETE FROM stocks s WHERE NOT EXISTS " . "(SELECT referencia FROM articulos a WHERE a.referencia = s.referencia);");
                 }
                 $recargar = TRUE;
                 $this->informe['offset'] += 1;
             } else {
                 if ($this->informe['offset'] == 3) {
                     /// comprobamos la tabla de regulaciones de stock
                     if ($this->db->table_exists('lineasregstocks')) {
                         $this->db->exec("DELETE FROM lineasregstocks WHERE idstock NOT IN (SELECT idstock FROM stocks);");
                     }
                     $recargar = TRUE;
                     $this->informe['offset'] += 1;
                 } else {
                     if ($this->informe['offset'] == 4) {
                         /// eliminamos los elementos de contabilidad que apuntan a ejercicios que no existen
                         $tablas = array('co_gruposepigrafes', 'co_epigrafes', 'co_cuentas', 'co_subcuentas');
                         foreach ($tablas as $tabla) {
                             $this->db->exec("DELETE FROM " . $tabla . " WHERE codejercicio NOT IN (SELECT codejercicio FROM ejercicios);");
                         }
                         /// comprobamos la tabla de subcuentas de proveedores
                         if ($this->db->table_exists('co_subcuentasprov')) {
                             $this->db->exec("DELETE FROM co_subcuentasprov WHERE codproveedor NOT IN (SELECT codproveedor FROM proveedores);");
                         }
                         /// comprobamos la tabla de direcciones de proveedores
                         if ($this->db->table_exists('dirproveedores')) {
                             $this->db->exec("DELETE FROM dirproveedores WHERE codproveedor NOT IN (SELECT codproveedor FROM proveedores);");
                         }
                         /// comprobamos la tabla de subcuentas de clientes
                         if ($this->db->table_exists('co_subcuentascli')) {
                             $this->db->exec("DELETE FROM co_subcuentascli WHERE codcliente NOT IN (SELECT codcliente FROM clientes);");
                         }
                         /// comprobamos la tabla de direcciones de clientes
                         if ($this->db->table_exists('dirclientes')) {
                             $this->db->exec("DELETE FROM dirclientes WHERE codcliente NOT IN (SELECT codcliente FROM clientes);");
                         }
                         $recargar = TRUE;
                         $this->informe['offset'] += 1;
                     } else {
                         if ($this->informe['offset'] == 5) {
                             /// comprobamos la tabla de epigrafes
                             if ($this->db->table_exists('co_epigrafes')) {
                                 $this->db->exec("UPDATE co_epigrafes SET idgrupo = NULL WHERE idgrupo NOT IN (SELECT idgrupo FROM co_gruposepigrafes);");
                             }
                             $recargar = TRUE;
                             $this->informe['offset'] += 1;
                         } else {
                             if ($this->informe['offset'] == 6) {
                                 $almacen = new almacen();
                                 if (!$almacen->all()) {
                                     $this->db->exec($almacen->install());
                                 }
                                 $divisa = new divisa();
                                 if (!$divisa->all()) {
                                     $this->db->exec($divisa->install());
                                 }
                                 $formap = new forma_pago();
                                 if (!$formap->all()) {
                                     $this->db->exec($formap->install());
                                 }
                                 $pais = new pais();
                                 if (!$pais->all()) {
                                     $this->db->exec($pais->install());
                                 }
                                 $serie = new serie();
                                 if (!$serie->all()) {
                                     $this->db->exec($serie->install());
                                 }
                                 $recargar = TRUE;
                                 $this->informe['offset'] += 1;
                             } else {
                                 /// comprobamos la tabla de articulos de proveedor
                                 if ($this->db->table_exists('articulosprov')) {
                                     /// buscamos duplicados
                                     $data = $this->db->select("SELECT codproveedor,refproveedor,COUNT(*) as count FROM articulosprov GROUP BY codproveedor,refproveedor HAVING COUNT(*) > 1;");
                                     if ($data) {
                                         foreach ($data as $d) {
                                             $sql = "SELECT * FROM articulosprov WHERE codproveedor = " . $this->empresa->var2str($d['codproveedor']) . " AND refproveedor = " . $this->empresa->var2str($d['refproveedor']) . ";";
                                             $data2 = $this->db->select($sql);
                                             if ($data2) {
                                                 $this->db->exec("DELETE FROM articulosprov WHERE id = " . $this->empresa->var2str($data2[1]['id']) . ";");
                                             }
                                         }
                                         $recargar = TRUE;
                                         $this->informe['offset'] += 1;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$recargar) {
         if ($this->informe['all']) {
             $this->informe['model'] = 'asiento';
         } else {
             $this->informe['model'] = 'fin';
         }
         $this->informe['offset'] = 0;
     }
 }
コード例 #5
0
 protected function private_core()
 {
     /// ¿El usuario tiene permiso para eliminar en esta página?
     $this->allow_delete = $this->user->allow_delete_on(__CLASS__);
     $almacen = new almacen();
     $this->almacenes = $almacen->all();
     $articulo = new articulo();
     $this->familia = new familia();
     $this->fabricante = new fabricante();
     $this->impuesto = new impuesto();
     $this->tarifa = new tarifa();
     $this->transferencia_stock = new transferencia_stock();
     /**
      * Si hay alguna extensión de tipo config y texto no_tab_tarifas,
      * desactivamos la pestaña tarifas.
      */
     $this->mostrar_tab_tarifas = TRUE;
     foreach ($this->extensions as $ext) {
         if ($ext->type == 'config' and $ext->text == 'no_tab_tarifas') {
             $this->mostrar_tab_tarifas = FALSE;
             break;
         }
     }
     if (isset($_POST['codtarifa'])) {
         /// crear/editar tarifa
         $tar0 = $this->tarifa->get($_POST['codtarifa']);
         if (!$tar0) {
             $tar0 = new tarifa();
             $tar0->codtarifa = $_POST['codtarifa'];
         }
         $tar0->nombre = $_POST['nombre'];
         $tar0->aplicar_a = $_POST['aplicar_a'];
         $tar0->set_x(floatval($_POST['dtopor']));
         $tar0->set_y(floatval($_POST['inclineal']));
         $tar0->mincoste = isset($_POST['mincoste']);
         $tar0->maxpvp = isset($_POST['maxpvp']);
         if ($tar0->save()) {
             $this->new_message("Tarifa guardada correctamente.");
         } else {
             $this->new_error_msg("¡Imposible guardar la tarifa!");
         }
     } else {
         if (isset($_GET['delete_tarifa'])) {
             /// eliminar tarifa
             $tar0 = $this->tarifa->get($_GET['delete_tarifa']);
             if ($tar0) {
                 if ($tar0->delete()) {
                     $this->new_message("Tarifa " . $tar0->codtarifa . " eliminada correctamente.", TRUE);
                 } else {
                     $this->new_error_msg("¡Imposible eliminar la tarifa!");
                 }
             } else {
                 $this->new_error_msg("¡La tarifa no existe!");
             }
         } else {
             if (isset($_POST['referencia']) and isset($_POST['codfamilia']) and isset($_POST['codimpuesto'])) {
                 /// nuevo artículo
                 $this->save_codimpuesto($_POST['codimpuesto']);
                 $art0 = $articulo->get($_POST['referencia']);
                 if ($art0) {
                     $this->new_error_msg('Ya existe el artículo <a href="' . $art0->url() . '">' . $art0->referencia . '</a>');
                 } else {
                     if ($_POST['referencia'] == '') {
                         $articulo->referencia = $articulo->get_new_referencia();
                     } else {
                         $articulo->referencia = $_POST['referencia'];
                     }
                     $articulo->descripcion = $_POST['descripcion'];
                     $articulo->nostock = isset($_POST['nostock']);
                     if ($_POST['codfamilia'] != '') {
                         $articulo->codfamilia = $_POST['codfamilia'];
                     }
                     if ($_POST['codfabricante'] != '') {
                         $articulo->codfabricante = $_POST['codfabricante'];
                     }
                     $articulo->set_impuesto($_POST['codimpuesto']);
                     if (isset($_POST['coniva'])) {
                         $articulo->set_pvp_iva(floatval($_POST['pvp']));
                     } else {
                         $articulo->set_pvp(floatval($_POST['pvp']));
                     }
                     if ($articulo->save()) {
                         header('location: ' . $articulo->url());
                     } else {
                         $this->new_error_msg("¡Error al crear el articulo!");
                     }
                 }
             } else {
                 if (isset($_GET['delete'])) {
                     /// eliminar artículo
                     $art = $articulo->get($_GET['delete']);
                     if ($art) {
                         if ($art->delete()) {
                             $this->new_message("Articulo " . $art->referencia . " eliminado correctamente.", TRUE);
                         } else {
                             $this->new_error_msg("¡Error al eliminarl el articulo!");
                         }
                     }
                 } else {
                     if (isset($_POST['origen'])) {
                         /// nueva transferencia de stock
                         $this->transferencia_stock->usuario = $this->user->nick;
                         $this->transferencia_stock->codalmaorigen = $_POST['origen'];
                         $this->transferencia_stock->codalmadestino = $_POST['destino'];
                         if ($this->transferencia_stock->save()) {
                             $this->new_message('Datos guardados correctamente.');
                             header('Location: ' . $this->transferencia_stock->url());
                         } else {
                             $this->new_error_msg('Error al guardar los datos.');
                         }
                     } else {
                         if (isset($_GET['delete_transf'])) {
                             $transf = $this->transferencia_stock->get($_GET['delete_transf']);
                             if ($transf) {
                                 $ok = TRUE;
                                 /// eliminamos las líneas
                                 $ltf = new linea_transferencia_stock();
                                 foreach ($ltf->all_from_transferencia($transf->idtrans) as $lin) {
                                     if ($lin->delete()) {
                                         /// movemos el stock
                                         $art = $articulo->get($lin->referencia);
                                         if ($art) {
                                             $art->sum_stock($transf->codalmadestino, 0 - $lin->cantidad);
                                             $art->sum_stock($transf->codalmaorigen, $lin->cantidad);
                                         }
                                     } else {
                                         $this->new_error_msg('Error al eliminar la línea con referencia ' . $lin->referencia);
                                         $ok = FALSE;
                                     }
                                 }
                                 if ($ok) {
                                     if ($transf->delete()) {
                                         $this->new_message('Transferencia eliminada correctamente.');
                                     } else {
                                         $this->new_error_msg('Error al eliminar la transferencia.');
                                     }
                                 }
                             } else {
                                 $this->new_error_msg('Transferencia no encontrada.');
                             }
                         }
                     }
                 }
             }
         }
     }
     /// obtenemos los datos para la búsqueda
     $this->offset = 0;
     if (isset($_REQUEST['offset'])) {
         $this->offset = intval($_REQUEST['offset']);
     }
     $this->b_codalmacen = '';
     if (isset($_REQUEST['b_codalmacen'])) {
         $this->b_codalmacen = $_REQUEST['b_codalmacen'];
     }
     $this->b_codfamilia = '';
     if (isset($_REQUEST['b_codfamilia'])) {
         $this->b_codfamilia = $_REQUEST['b_codfamilia'];
     }
     $this->b_codfabricante = '';
     if (isset($_REQUEST['b_codfabricante'])) {
         $this->b_codfabricante = $_REQUEST['b_codfabricante'];
     }
     $this->b_constock = isset($_REQUEST['b_constock']);
     $this->b_bloqueados = isset($_REQUEST['b_bloqueados']);
     $this->b_publicos = isset($_REQUEST['b_publicos']);
     $this->b_codtarifa = '';
     if (isset($_REQUEST['b_codtarifa'])) {
         $this->b_codtarifa = $_REQUEST['b_codtarifa'];
         setcookie('b_codtarifa', $this->b_codtarifa, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['b_codtarifa'])) {
             $this->b_codtarifa = $_COOKIE['b_codtarifa'];
         }
     }
     $this->b_orden = 'refmin';
     if (isset($_REQUEST['b_orden'])) {
         $this->b_orden = $_REQUEST['b_orden'];
         setcookie('ventas_articulos_orden', $this->b_orden, time() + FS_COOKIES_EXPIRE);
     } else {
         if (isset($_COOKIE['ventas_articulos_orden'])) {
             $this->b_orden = $_COOKIE['ventas_articulos_orden'];
         }
     }
     $this->b_url = $this->url() . "&query=" . $this->query . "&b_codfabricante=" . $this->b_codfabricante . "&b_codalmacen=" . $this->b_codalmacen . "&b_codfamilia=" . $this->b_codfamilia . "&b_codtarifa=" . $this->b_codtarifa;
     if ($this->b_constock) {
         $this->b_url .= '&b_constock=TRUE';
     }
     if ($this->b_bloqueados) {
         $this->b_url .= '&b_bloqueados=TRUE';
     }
     if ($this->b_publicos) {
         $this->b_url .= '&b_publicos=TRUE';
     }
     $this->search_articulos();
 }