protected function process() { $this->show_fs_toolbar = FALSE; $this->cliente = new cliente(); $this->ejercicio = new ejercicio(); $this->proveedor = new proveedor(); $this->regularizacion = new regularizacion_iva(); $this->opciones = array('ventas' => TRUE, 'compras' => TRUE, 'fecha' => 'hoy'); if (isset($_REQUEST['fecha'])) { $this->opciones['fecha'] = $_REQUEST['fecha']; $this->total = 0; if (isset($_REQUEST['ventas'])) { $albaran_cli = new albaran_cliente(); foreach ($albaran_cli->all_ptefactura(0, 'ASC') as $alb) { $this->generar_factura_cliente(array($alb)); } $this->new_message($this->total . ' ' . FS_ALBARANES . ' de cliente facturados.'); } else { $this->opciones['ventas'] = FALSE; } $this->total = 0; if (isset($_REQUEST['compras'])) { $albaran_pro = new albaran_proveedor(); foreach ($albaran_pro->all_ptefactura(0, 'ASC') as $alb) { $this->generar_factura_proveedor(array($alb)); } $this->new_message($this->total . ' ' . FS_ALBARANES . ' de proveedor facturados.'); } else { $this->opciones['compras'] = FALSE; } } }
protected function process() { $albaran = new albaran_proveedor(); /// desactivamos la barra de botones $this->show_fs_toolbar = FALSE; $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_GET['codagente'])) { $this->template = 'extension/compras_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['codproveedor'])) { $this->template = 'extension/compras_albaranes_proveedor'; $proveedor = new proveedor(); $this->proveedor = $proveedor->get($_GET['codproveedor']); $this->resultados = $albaran->all_from_proveedor($_GET['codproveedor'], $this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/compras_albaranes_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_albaran_proveedor(); $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 (isset($_GET['ptefactura'])) { $this->resultados = $albaran->all_ptefactura($this->offset); } else { $this->resultados = $albaran->all($this->offset); } } } } } } }
protected function private_core() { $this->cliente = new cliente(); $this->ejercicio = new ejercicio(); $this->forma_pago = new forma_pago(); $this->proveedor = new proveedor(); $this->regularizacion = new regularizacion_iva(); $serie = new serie(); $this->series = $serie->all(); $this->opciones = array('ventas' => TRUE, 'compras' => TRUE, 'fecha' => 'hoy'); $this->codserie = FALSE; if (isset($_REQUEST['codserie'])) { $this->codserie = $_REQUEST['codserie']; } if (isset($_REQUEST['fecha'])) { $this->opciones['fecha'] = $_REQUEST['fecha']; $this->total = 0; if (isset($_REQUEST['ventas'])) { $albaran_cli = new albaran_cliente(); foreach ($albaran_cli->all_ptefactura(0, 'fecha ASC', $this->codserie) as $alb) { $this->generar_factura_cliente(array($alb)); } $this->new_message($this->total . ' ' . FS_ALBARANES . ' de cliente facturados.'); } else { $this->opciones['ventas'] = FALSE; } $this->total = 0; if (isset($_REQUEST['compras'])) { $albaran_pro = new albaran_proveedor(); foreach ($albaran_pro->all_ptefactura(0, 'fecha ASC', $this->codserie) as $alb) { $this->generar_factura_proveedor(array($alb)); } $this->new_message($this->total . ' ' . FS_ALBARANES . ' de proveedor facturados.'); } else { $this->opciones['compras'] = FALSE; } } }
protected function private_core() { $albaran = new albaran_proveedor(); $this->agente = new agente(); $this->serie = new serie(); $this->mostrar = 'todo'; if (isset($_GET['mostrar'])) { $this->mostrar = $_GET['mostrar']; setcookie('compras_alb_mostrar', $this->mostrar, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['compras_alb_mostrar'])) { $this->mostrar = $_COOKIE['compras_alb_mostrar']; } } $this->offset = 0; if (isset($_REQUEST['offset'])) { $this->offset = intval($_REQUEST['offset']); } $this->order = 'fecha DESC'; if (isset($_GET['order'])) { if ($_GET['order'] == 'fecha_desc') { $this->order = 'fecha DESC'; } else { if ($_GET['order'] == 'fecha_asc') { $this->order = 'fecha ASC'; } else { if ($_GET['order'] == 'codigo_desc') { $this->order = 'codigo DESC'; } else { if ($_GET['order'] == 'codigo_asc') { $this->order = 'codigo ASC'; } } } } setcookie('compras_alb_order', $this->order, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['compras_alb_order'])) { $this->order = $_COOKIE['compras_alb_order']; } } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_REQUEST['buscar_proveedor'])) { $this->buscar_proveedor(); } else { if (isset($_GET['ref'])) { $this->template = 'extension/compras_albaranes_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_albaran_proveedor(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); $this->codagente = ''; $this->codserie = ''; $this->desde = ''; $this->hasta = ''; $this->num_resultados = ''; $this->proveedor = FALSE; $this->total_resultados = ''; $this->total_resultados_txt = ''; if (isset($_POST['delete'])) { $this->delete_albaran(); } else { if (!isset($_GET['mostrar']) and (isset($_REQUEST['codagente']) or isset($_REQUEST['codproveedor']))) { /** * si obtenermos un codagente o un codproveedor pasamos direcatemente * a la pestaña de búsqueda, a menos que tengamos un mostrar, que * entonces nos indica donde tenemos que estar. */ $this->mostrar = 'buscar'; } if (isset($_REQUEST['codproveedor'])) { if ($_REQUEST['codproveedor'] != '') { $pro0 = new proveedor(); $this->proveedor = $pro0->get($_REQUEST['codproveedor']); } } if (isset($_REQUEST['codagente'])) { $this->codagente = $_REQUEST['codagente']; } if (isset($_REQUEST['codserie'])) { $this->codserie = $_REQUEST['codserie']; $this->desde = $_REQUEST['desde']; $this->hasta = $_REQUEST['hasta']; } } /// añadimos segundo nivel de ordenación $order2 = ''; if ($this->order == 'fecha DESC') { $order2 = ', codigo DESC'; } else { if ($this->order == 'fecha ASC') { $order2 = ', codigo ASC'; } } if ($this->mostrar == 'pendientes') { $this->resultados = $albaran->all_ptefactura($this->offset, $this->order . $order2); if ($this->offset == 0) { $this->total_resultados = 0; $this->total_resultados_txt = 'Suma total de esta página:'; foreach ($this->resultados as $alb) { $this->total_resultados += $alb->total; } } } else { if ($this->mostrar == 'buscar') { $this->buscar($order2); } else { $this->resultados = $albaran->all($this->offset, $this->order . $order2); } } } } } }
protected function private_core() { $this->ppage = $this->page->get('compras_albaranes'); $this->empresa = new empresa(); $this->articulo_prov = new articulo_proveedor(); $this->fabricante = new fabricante(); $this->familia = new familia(); $this->impuesto = new impuesto(); $this->proveedor = new proveedor(); $this->proveedor_s = FALSE; $this->results = array(); $factura = new factura_proveedor(); $this->verif_factura = $factura->all_sin_anular(); $remito = new albaran_proveedor(); $this->verif_remito = $remito->all_ptefactura(); $this->subcuentas = new subcuenta(); $this->artsubcuentas = new articulo(); $this->view_subcuen = $this->subcuentas->subcoenta_compras($this->empresa->codejercicio); $this->view_subcuen_dev = $this->subcuentas->subcoenta_compras($this->empresa->codejercicio); if (isset($_REQUEST['tipo'])) { if (isset($_REQUEST['autorizar_factura'])) { $this->autorizar_factura = $_REQUEST['autorizar_factura']; } $this->tipo = $_REQUEST['tipo']; } else { foreach ($this->tipos_a_guardar() as $t) { $this->tipo = $t['tipo']; break; } } if (isset($_REQUEST['buscar_proveedor'])) { $this->buscar_proveedor(); } else { if (isset($_REQUEST['datosproveedor'])) { $this->datos_proveedor(); } else { if (isset($_REQUEST['new_articulo'])) { $this->new_articulo(); } else { if ($this->query != '') { $this->new_search(); } else { if (isset($_POST['referencia4precios'])) { $this->get_precios_articulo(); } else { if (isset($_POST['proveedor'])) { if (isset($_POST['numfactproveedor'])) { $this->numproveedor = $_POST['numfactproveedor']; } $this->proveedor_s = $this->proveedor->get($_POST['proveedor']); $this->cai = $this->proveedor_s->cai; $this->caivence = $this->proveedor_s->caivence; if (isset($_POST['nuevo_proveedor'])) { if ($_POST['nuevo_proveedor'] != '') { $this->proveedor_s = FALSE; if ($_POST['nuevo_dni'] != '') { $this->proveedor_s = $this->proveedor->get_by_cifnif($_POST['nuevo_dni']); if ($this->proveedor_s) { $this->new_advice('Ya existe un proveedor con ese ' . FS_CIFNIF . '. Se ha seleccionado.'); } } if (!$this->proveedor_s) { $this->proveedor_s = new proveedor(); $this->proveedor_s->codproveedor = $this->proveedor_s->get_new_codigo(); $this->proveedor_s->nombre = $this->proveedor_s->razonsocial = $_POST['nuevo_proveedor']; $this->proveedor_s->cifnif = $_POST['nuevo_dni']; $this->proveedor_s->acreedor = isset($_POST['acreedor']); $this->proveedor_s->save(); } } } if (isset($_POST['codagente'])) { $agente = new agente(); $this->agente = $agente->get($_POST['codagente']); } else { $this->agente = $this->user->get_agente(); } $this->almacen = new almacen(); $this->serie = new serie(); $this->forma_pago = new forma_pago(); $this->divisa = new divisa(); if (isset($_POST['tipo'])) { if ($_POST['tipo'] == 'pedido') { if (class_exists('pedido_proveedor')) { $this->nuevo_pedido_proveedor(); } else { $this->new_error_msg('Clase pedido_proveedor no encontrada.'); } } else { if ($_POST['pagina'] == 'albaran') { $this->nuevo_albaran_proveedor(); // header('Location: '.$this->url_list1()); } else { if ($_POST['tipo'] == 'B') { $this->nueva_factura_proveedor(); // header('Location: '.$this->url_list()); } else { if ($_POST['tipo'] == 'F') { $this->nueva_factura_proveedor(); // header('Location: '.$this->url_list()); } else { if ($_POST['tipo'] == 'T') { $this->nueva_factura_proveedor(); // header('Location: '.$this->url_list()); } else { if ($_POST['tipo'] == 'Q') { $this->nueva_factura_proveedor(); // header('Location: '.$this->url_list()); } else { if ($_POST['tipo'] == 'C') { $this->nueva_factura_proveedor(); // header('Location: '.$this->url_list()); } else { if ($_POST['tipo'] == 'D') { $this->nueva_factura_proveedor(); // header('Location: '.$this->url_list()); } } } } } } } } } } } } } } } }
protected function private_core() { $this->agente = new agente(); $this->factura = new factura_proveedor(); $this->serie = new serie(); $albaran = new albaran_proveedor(); $this->autorizar_factura = 1; if (isset($_GET['nueva'])) { if ($_GET['nueva'] == 1) { $this->new_message("Factura guardada correctamente."); } if ($_GET['nueva'] == 2) { $this->new_error_msg("La Factura no se guardó. La Fecha corresponde a un ejercicio Cerrado o Inexistente."); } } $this->mostrar = 'todo'; if (isset($_GET['mostrar'])) { $this->mostrar = $_GET['mostrar']; setcookie('compras_fac_mostrar', $this->mostrar, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['compras_fac_mostrar'])) { $this->mostrar = $_COOKIE['compras_fac_mostrar']; } } $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } $this->order = 'fecha DESC'; if (isset($_GET['order'])) { if ($_GET['order'] == 'fecha_desc') { $this->order = 'fecha DESC'; } else { if ($_GET['order'] == 'fecha_asc') { $this->order = 'fecha ASC'; } else { if ($_GET['order'] == 'codigo_desc') { $this->order = 'numproveedor DESC'; } else { if ($_GET['order'] == 'codigo_asc') { $this->order = 'numproveedor ASC'; } } } } setcookie('compras_fac_order', $this->order, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['compras_fac_order'])) { $this->order = $_COOKIE['compras_fac_order']; } } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_REQUEST['buscar_proveedor'])) { $this->buscar_proveedor(); } else { if (isset($_GET['ref'])) { $this->template = 'extension/compras_facturas_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_factura_proveedor(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); $this->proveedor = FALSE; $this->codagente = ''; $this->codserie = ''; $this->desde = ''; $this->hasta = ''; $this->num_resultados = ''; $this->total_resultados = ''; $this->total_resultados_txt = ''; if (isset($_POST['delete'])) { $this->delete_albaran(); } if (isset($_GET['delete'])) { $this->delete_factura(); } else { if (!isset($_GET['mostrar']) and (isset($_REQUEST['codagente']) or isset($_REQUEST['codproveedor']))) { /** * si obtenermos un codagente o un codproveedor pasamos direcatemente * a la pestaña de búsqueda, a menos que tengamos un mostrar, que * entonces nos indica donde tenemos que estar. */ $this->mostrar = 'buscar'; } if (isset($_REQUEST['codproveedor'])) { if ($_REQUEST['codproveedor'] != '') { $pro0 = new proveedor(); $this->proveedor = $pro0->get($_REQUEST['codproveedor']); } } if (isset($_REQUEST['codagente'])) { $this->codagente = $_REQUEST['codagente']; } if (isset($_REQUEST['codserie'])) { $this->codserie = $_REQUEST['codserie']; $this->desde = $_REQUEST['desde']; $this->hasta = $_REQUEST['hasta']; } } /// añadimos segundo nivel de ordenación $order2 = ''; if ($this->order == 'fecha DESC') { $order2 = ', numproveedor DESC'; } else { if ($this->order == 'fecha ASC') { $order2 = ', numproveedor ASC'; } } if ($this->mostrar == 'sinpagar') { $this->resultados = $this->factura->all_sin_pagar($this->offset, FS_ITEM_LIMIT, $this->order . $order2); if ($this->offset == 0) { $this->total_resultados = 0; $this->total_resultados_txt = 'Suma total de esta página:'; foreach ($this->resultados as $alb) { $this->total_resultados += $alb->total; } } } else { if ($this->mostrar == 'buscar') { $this->buscar($order2); } else { $this->resultados = $this->factura->all($this->offset, FS_ITEM_LIMIT, $this->order . $order2); } } } } } if ($this->mostrar == 'remitos') { $this->resultados = $albaran->all_ptefactura($this->offset, $this->order . $order2); if ($this->offset == 0) { $this->total_resultados = 0; $this->total_resultados_txt = 'Suma total de esta página:'; foreach ($this->resultados as $alb) { $this->total_resultados += $alb->total; } } } }