protected function process() { $albaran = new albaran_cliente(); /// desactivamos la barra de botones $this->show_fs_toolbar = FALSE; $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } /// Usamos una cookie para recordar si el usuario quiere ver los pendientes $this->pendientes = isset($_COOKIE['ventas_alb_ptes']); if (isset($_GET['ptefactura'])) { $this->pendientes = $_GET['ptefactura'] == 'TRUE'; if ($this->pendientes) { setcookie('ventas_alb_ptes', 'TRUE', time() + FS_COOKIES_EXPIRE); } else { setcookie('ventas_alb_ptes', FALSE, time() - FS_COOKIES_EXPIRE); } } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_GET['codagente'])) { $this->template = 'extension/ventas_albaranes_agente'; $agente = new agente(); $this->agente = $agente->get($_GET['codagente']); $this->resultados = $albaran->all_from_agente($_GET['codagente'], $this->offset); } else { if (isset($_GET['codcliente'])) { $this->template = 'extension/ventas_albaranes_cliente'; $cliente = new cliente(); $this->cliente = $cliente->get($_GET['codcliente']); $this->resultados = $albaran->all_from_cliente($_GET['codcliente'], $this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_albaranes_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_albaran_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); if (isset($_POST['delete'])) { $this->delete_albaran(); } if ($this->query) { $this->resultados = $albaran->search($this->query, $this->offset); } else { if ($this->pendientes) { $this->resultados = $albaran->all_ptefactura($this->offset); } else { $this->resultados = $albaran->all($this->offset); } } } } } } }