protected function private_core() { $this->cliente = FALSE; /// obtenemos los datos de configuración de impresión $fsvar = new fs_var(); $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0'); $this->impresion = $fsvar->array_get($this->impresion, FALSE); $this->impuesto = new impuesto(); $this->servicio = FALSE; /// cargamos la configuración de servicios $this->setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'servicios_condiciones' => "Condiciones del deposito:\nLos presupuestos realizados tienen una" . " validez de 15 días.\nUna vez avisado al cliente para que recoja el producto este dispondrá" . " de un plazo máximo de 2 meses para recogerlo, de no ser así y no haber aviso por parte del" . " cliente se empezará a cobrar 1 euro al día por gastos de almacenaje.\nLos accesorios y" . " productos externos al equipo no especificados en este documento no podrán ser reclamados en" . " caso de disconformidad con el técnico.", 'st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_fechainicio' => "Fecha de Inicio", 'st_fechafin' => "Fecha de finalización", 'st_garantía' => "Garantía"), FALSE); if (isset($_REQUEST['id'])) { $serv = new servicio_cliente(); $this->servicio = $serv->get($_REQUEST['id']); if ($this->servicio) { $cliente = new cliente(); $this->cliente = $cliente->get($this->servicio->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('servicio'); } else { $this->generar_pdf_servicio(); } } $this->share_extensions(); }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->share_extensions(); $this->estado = new estado_sat(); /// leemos la API key de google maps de la base de datos o del formulario $fsvar = new fs_var(); if (isset($_POST['maps_api_key'])) { $this->maps_api_key = $_POST['maps_api_key']; $fsvar->simple_save('maps_api_key', $this->maps_api_key); } else { $this->maps_api_key = $fsvar->simple_get('maps_api_key'); } /// cargamos la configuración $this->sat_setup = $fsvar->array_get(array('sat_col_modelo' => 0, 'sat_col_posicion' => 0, 'sat_col_accesorios' => 0, 'sat_col_prioridad' => 0, 'sat_col_fecha' => 1, 'sat_col_fechaini' => 0, 'sat_col_fechafin' => 0), FALSE); if (isset($_POST['sat_setup'])) { $this->sat_setup['sat_col_modelo'] = isset($_POST['col_modelo']) ? 1 : 0; $this->sat_setup['sat_col_posicion'] = isset($_POST['col_posicion']) ? 1 : 0; $this->sat_setup['sat_col_accesorios'] = isset($_POST['col_accesorios']) ? 1 : 0; $this->sat_setup['sat_col_prioridad'] = isset($_POST['col_prioridad']) ? 1 : 0; $this->sat_setup['sat_col_fecha'] = isset($_POST['col_fecha']) ? 1 : 0; $this->sat_setup['sat_col_fechaini'] = isset($_POST['col_fechaini']) ? 1 : 0; $this->sat_setup['sat_col_fechafin'] = isset($_POST['col_fechafin']) ? 1 : 0; if ($fsvar->array_save($this->sat_setup)) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } } else { if (isset($_GET['delete_estado'])) { $estado = $this->estado->get($_GET['delete_estado']); if ($estado) { if ($estado->delete()) { $this->new_message('Estado eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el estado.'); } } else { $this->new_error_msg('Estado no encontrado.'); } } else { if (isset($_POST['id_estado'])) { $estado = $this->estado->get($_POST['id_estado']); if (!$estado) { $estado = new estado_sat(); $estado->id = intval($_POST['id_estado']); } $estado->descripcion = $_POST['descripcion']; $estado->color = $_POST['color']; $estado->activo = isset($_POST['activo']); if ($estado->save()) { $this->new_message('Estado guardado correctamente.'); } else { $this->new_error_msg('Error al guardar el estado.'); } } } } }
protected function private_core() { $this->share_extension(); /// cargamos la configuración de servicios $fsvar = new fs_var(); $this->setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'servicios_condiciones' => "Condiciones del deposito:\nLos presupuestos realizados tienen una" . " validez de 15 días.\nUna vez avisado al cliente para que recoja el producto este dispondrá" . " de un plazo máximo de 2 meses para recogerlo, de no ser así y no haber aviso por parte del" . " cliente se empezará a cobrar 1 euro al día por gastos de almacenaje.\nLos accesorios y" . " productos externos al equipo no especificados en este documento no podrán ser reclamados en" . " caso de disconformidad con el técnico.", 'st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_fechainicio' => "Fecha de Inicio", 'st_fechafin' => "Fecha de finalización", 'st_garantía' => "Garantía"), FALSE); /// cargamos el servicios $this->servicio = FALSE; if (isset($_GET['id'])) { $serv0 = new servicio_cliente(); $this->servicio = $serv0->get($_GET['id']); } $term0 = new terminal_caja(); $this->terminales = $term0->all(); $this->terminal = FALSE; if (isset($_GET['terminal'])) { $this->terminal = $term0->get($_GET['terminal']); } if ($this->servicio and $this->terminal) { $cli0 = new cliente(); $this->cliente = $cli0->get($this->servicio->codcliente); $numt = $this->terminal->num_tickets; while ($numt > 0) { $this->imprimir(); $this->terminal->save(); $numt--; } } }
protected function process() { $fsvar = new fs_var(); $cron_vars = $fsvar->array_get(array('cron_exists' => FALSE, 'cron_lock' => FALSE, 'cron_error' => FALSE)); if (isset($_GET['fix'])) { $cron_vars['cron_error'] = FALSE; $cron_vars['cron_lock'] = FALSE; $fsvar->array_save($cron_vars); } if (!$cron_vars['cron_exists']) { $this->new_advice('Nunca se ha ejecutado el <a href="http://www.facturascripts.com/comm3/index.php?page=community_item&tag=cron" target="_blank">cron</a>,' . ' te perderás algunas características interesantes de FacturaScripts.'); } else { if ($cron_vars['cron_error']) { $this->new_error_msg('Parece que ha habido un error con el cron. Haz clic <a href="' . $this->url() . '&fix=TRUE">aquí</a> para corregirlo.'); } else { if ($cron_vars['cron_lock']) { $this->new_advice('Se está ejecutando el cron.'); } } } if (isset($_GET['clean_cache'])) { /// borramos los archivos php del directorio tmp foreach (scandir(getcwd() . '/tmp') as $f) { if (substr($f, -4) == '.php') { unlink('tmp/' . $f); } } if ($this->cache->clean()) { $this->new_message("Cache limpiada correctamente."); } } }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->ppage = $this->page->get('ventas_servicios'); $this->agente = new agente(); $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->divisa = new divisa(); $this->ejercicio = new ejercicio(); $this->estado = new estado_servicio(); $this->fabricante = new fabricante(); $this->familia = new familia(); $this->forma_pago = new forma_pago(); $this->impuesto = new impuesto(); $this->pais = new pais(); $this->serie = new serie(); /// cargamos la configuración de servicios $fsvar = new fs_var(); $this->setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'cal_inicio' => "09:00", 'cal_fin' => "20:00", 'cal_intervalo' => "30", 'servicios_linea' => 0, 'servicios_linea1' => 0, 'servicios_material_linea' => 0, 'servicios_material_estado_linea' => 0, 'servicios_accesorios_linea' => 0, 'servicios_descripcion_linea' => 0, 'servicios_solucion_linea' => 0, 'servicios_fechainicio_linea' => 0, 'servicios_fechafin_linea' => 0, 'servicios_garantia_linea' => 0, 'st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_fechainicio' => "Fecha de Inicio", 'st_fechafin' => "Fecha de finalización", 'st_garantia' => "Garantía"), FALSE); /** * Comprobamos si el usuario tiene acceso a nueva_venta, * necesario para poder añadir líneas. */ $this->nuevo_servicio_url = FALSE; if ($this->user->have_access_to('nueva_venta', FALSE)) { $nuevopedp = $this->page->get('nueva_venta'); if ($nuevopedp) { $this->nuevo_servicio_url = $nuevopedp->url(); } } $this->servicio = FALSE; $servicio = new servicio_cliente(); if (isset($_POST['idservicio'])) { $this->servicio = $servicio->get($_POST['idservicio']); $this->modificar(); } else { if (isset($_GET['id'])) { $this->servicio = $servicio->get($_GET['id']); } } if ($this->servicio) { $this->page->title = $this->servicio->codigo; /// cargamos el agente if ($this->servicio->codagente) { $age0 = new agente(); $this->agente = $age0->get($this->servicio->codagente); if (!$this->agente) { $this->agente = new agente(); } } else { $this->agente = $this->user->get_agente(); } /// cargamos el cliente $this->cliente_s = $this->cliente->get($this->servicio->codcliente); $this->modificar_detalles(); } else { $this->new_error_msg("¡" . ucfirst(FS_SERVICIO) . " de cliente no encontrado!"); } }
protected function private_core() { $this->share_extensions(); $this->servicio = new servicio_cliente(); $this->agente = new agente(); $this->serie = new serie(); $this->estados = new estado_servicio(); // cargamos las opciones del calendario $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_mostrar_fechainicio' => 0, 'cal_inicio' => "09:00", 'cal_fin' => "20:00", 'cal_intervalo' => "30"), FALSE); if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } if (isset($_REQUEST['codagente']) or isset($_REQUEST['codcliente']) or isset($_REQUEST['estado'])) { if (isset($_REQUEST['codcliente'])) { if ($_REQUEST['codcliente'] != '') { $cli0 = new cliente(); $this->cliente = $cli0->get($_REQUEST['codcliente']); $this->codcliente = $_REQUEST['codcliente']; } if (isset($_REQUEST['codagente'])) { $this->codagente = $_REQUEST['codagente']; } if (isset($_REQUEST['estado'])) { $this->estado = $_REQUEST['estado']; } } } }
protected function private_core() { $this->share_extensions(); /// obtenemos los datos de configuración de impresión $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0', 'print_formapago' => '1'); $fsvar = new fs_var(); $this->impresion = $fsvar->array_get($this->impresion, FALSE); $this->factura = FALSE; if (isset($_GET['id'])) { $factura = new factura_cliente(); $this->factura = $factura->get($_GET['id']); } if (isset($_GET['abreviatura'])) { $traduccion = new traduccion_fac_det(); $this->traduccion = $traduccion->get($_GET['abreviatura']); } else { $traduccion = new traduccion_fac_det(); $this->traduccion = $traduccion->get('es_ES'); } if ($this->factura) { $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); if (isset($_POST['email'])) { $this->enviar_email('factura', $_REQUEST['tipo']); } else { $filename = 'factura_' . $this->factura->codigo . '.pdf'; $this->generar_pdf(FALSE, $filename); } } else { $this->new_error_msg("¡Factura de cliente no encontrada!"); } }
protected function private_core() { $this->grupo = new grupo_clientes(); /// cargamos la configuración $fsvar = new fs_var(); $this->nuevocli_setup = $fsvar->array_get(array('nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 1, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 1, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 1, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 1, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0, 'nuevocli_codgrupo' => ''), FALSE); if (isset($_POST['setup'])) { $this->nuevocli_setup['nuevocli_cifnif_req'] = isset($_POST['nuevocli_cifnif_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_direccion'] = isset($_POST['nuevocli_direccion']) ? 1 : 0; $this->nuevocli_setup['nuevocli_direccion_req'] = isset($_POST['nuevocli_direccion_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_codpostal'] = isset($_POST['nuevocli_codpostal']) ? 1 : 0; $this->nuevocli_setup['nuevocli_codpostal_req'] = isset($_POST['nuevocli_codpostal_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_pais'] = isset($_POST['nuevocli_pais']) ? 1 : 0; $this->nuevocli_setup['nuevocli_pais_req'] = isset($_POST['nuevocli_pais_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_provincia'] = isset($_POST['nuevocli_provincia']) ? 1 : 0; $this->nuevocli_setup['nuevocli_provincia_req'] = isset($_POST['nuevocli_provincia_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_ciudad'] = isset($_POST['nuevocli_ciudad']) ? 1 : 0; $this->nuevocli_setup['nuevocli_ciudad_req'] = isset($_POST['nuevocli_ciudad_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_telefono1'] = isset($_POST['nuevocli_telefono1']) ? 1 : 0; $this->nuevocli_setup['nuevocli_telefono1_req'] = isset($_POST['nuevocli_telefono1_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_telefono2'] = isset($_POST['nuevocli_telefono2']) ? 1 : 0; $this->nuevocli_setup['nuevocli_telefono2_req'] = isset($_POST['nuevocli_telefono2_req']) ? 1 : 0; $this->nuevocli_setup['nuevocli_codgrupo'] = $_POST['nuevocli_codgrupo']; if ($fsvar->array_save($this->nuevocli_setup)) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } } }
protected function private_core() { $this->share_extensions(); /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->admin; /** * Cargamos las variables del cron */ $fsvar = new fs_var(); $cron_vars = $fsvar->array_get(array('cron_exists' => FALSE, 'cron_lock' => FALSE, 'cron_error' => FALSE)); if (isset($_GET['fix'])) { $cron_vars['cron_error'] = FALSE; $cron_vars['cron_lock'] = FALSE; $fsvar->array_save($cron_vars); } else { if (isset($_GET['clean_cache'])) { /// borramos los archivos php del directorio tmp foreach (scandir(getcwd() . '/tmp/' . FS_TMP_NAME) as $f) { if (substr($f, -4) == '.php') { unlink('tmp/' . FS_TMP_NAME . $f); } } if ($this->cache->clean()) { $this->new_message("Cache limpiada correctamente."); } } else { if (!$cron_vars['cron_exists']) { $this->new_advice('Nunca se ha ejecutado el' . ' <a href="http://www.facturascripts.com/comm3/index.php?page=community_item&tag=cron" target="_blank">cron</a>,' . ' te perderás algunas características interesantes de FacturaScripts.'); } else { if ($cron_vars['cron_error']) { $this->new_error_msg('Parece que ha habido un error con el cron. Haz clic <a href="' . $this->url() . '&fix=TRUE">aquí</a> para corregirlo.'); } else { if ($cron_vars['cron_lock']) { $this->new_advice('Se está ejecutando el cron.'); } } } } } $this->b_alerta = ''; $this->b_desde = ''; $this->b_detalle = ''; $this->b_hasta = ''; $this->b_ip = ''; $this->b_tipo = ''; $this->b_usuario = ''; if (isset($_POST['b_desde'])) { $this->b_alerta = isset($_POST['b_alerta']); $this->b_desde = $_POST['b_desde']; $this->b_detalle = $_POST['b_detalle']; $this->b_hasta = $_POST['b_hasta']; $this->b_ip = $_POST['b_ip']; $this->b_tipo = $_POST['b_tipo']; $this->b_usuario = $_POST['b_usuario']; } $this->buscar_en_log(); $this->modulos_eneboo(); }
protected function private_core() { /// cargamos la configuración $fsvar = new fs_var(); $this->sat_setup = $fsvar->array_get(array('sat_col_modelo' => 0, 'sat_col_posicion' => 0, 'sat_col_accesorios' => 0, 'sat_col_prioridad' => 0, 'sat_col_fecha' => 1, 'sat_col_fechaini' => 0, 'sat_col_fechafin' => 0, 'sat_condiciones' => "Condiciondes del deposito:\nLos presupuestos realizados tienen una" . " validez de 15 dias.\nUna vez avisado al cliente para que recoja el producto este dispondrá" . " de un plazo máximo de 2 meses para recogerlo, de no ser así y no haber aviso por parte del" . " cliente se empezará a cobrar 1 euro al día por gastos de almacenaje.\nLos accesorios y" . " productos externos al equipo no especificados en este documento no podrán ser reclamados en" . " caso de disconformidad con el técnico."), FALSE); $this->registro = FALSE; if (isset($_REQUEST['id'])) { $reg = new registro_sat(); $this->registro = $reg->get($_REQUEST['id']); } if ($this->registro) { $this->agente = $this->user->get_agente(); } }
protected function private_core() { $this->albaran = FALSE; $this->cliente = FALSE; $this->factura = FALSE; $this->impuesto = new impuesto(); /// obtenemos los datos de configuración de impresión $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0', 'print_formapago' => '1'); $fsvar = new fs_var(); $this->impresion = $fsvar->array_get($this->impresion, FALSE); $this->logo = FALSE; if (file_exists('tmp/' . FS_TMP_NAME . 'logo.png')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.png'; } else { if (file_exists('tmp/' . FS_TMP_NAME . 'logo.jpg')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.jpg'; } } if (isset($_REQUEST['albaran']) and isset($_REQUEST['id'])) { $alb = new albaran_cliente(); $this->albaran = $alb->get($_REQUEST['id']); if ($this->albaran) { $cliente = new cliente(); $this->cliente = $cliente->get($this->albaran->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('albaran'); } else { $this->generar_pdf_albaran(); } } else { if (isset($_REQUEST['factura']) and isset($_REQUEST['id'])) { $fac = new factura_cliente(); $this->factura = $fac->get($_REQUEST['id']); if ($this->factura) { $cliente = new cliente(); $this->cliente = $cliente->get($this->factura->codcliente); } if (isset($_POST['email'])) { $this->enviar_email('factura', $_REQUEST['tipo']); } else { $this->generar_pdf_factura($_REQUEST['tipo']); } } } $this->share_extensions(); }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->admin; /** * Cargamos las variables del cron */ $fsvar = new fs_var(); $cron_vars = $fsvar->array_get(array('cron_exists' => FALSE, 'cron_lock' => FALSE, 'cron_error' => FALSE)); if (isset($_GET['fix'])) { $cron_vars['cron_error'] = FALSE; $cron_vars['cron_lock'] = FALSE; $fsvar->array_save($cron_vars); } else { if (isset($_GET['clean_cache'])) { /// borramos los archivos php del directorio tmp foreach (scandir(getcwd() . '/tmp') as $f) { if (substr($f, -4) == '.php') { unlink('tmp/' . $f); } } if ($this->cache->clean()) { $this->new_message("Cache limpiada correctamente."); } } else { if (!$cron_vars['cron_exists']) { $this->new_advice('Nunca se ha ejecutado el <a href="http://www.facturascripts.com/comm3/index.php?page=community_item&tag=cron" target="_blank">cron</a>,' . ' te perderás algunas características interesantes de FacturaScripts.'); } else { if ($cron_vars['cron_error']) { $this->new_error_msg('Parece que ha habido un error con el cron. Haz clic <a href="' . $this->url() . '&fix=TRUE">aquí</a> para corregirlo.'); } else { if ($cron_vars['cron_lock']) { $this->new_advice('Se está ejecutando el cron.'); } } } } } if (isset($_REQUEST['json'])) { /// desactivamos el motor de plantillas $this->template = FALSE; $fslog = new fs_log(); echo json_encode($fslog->all(0, 10000)); } else { $this->share_extensions(); } }
protected function private_core() { $this->check_menu(); $this->share_extension(); $this->colores = array("gris", "rojo", "verde", "azul", "naranja", "amarillo", "marron", "blanco"); /// cargamos la configuración $fsvar = new fs_var(); $this->factura_detallada_setup = $fsvar->array_get(array('f_detallada_color' => 'azul'), FALSE); if (isset($_POST['factura_detallada_setup'])) { $this->factura_detallada_setup['f_detallada_color'] = $_POST['color']; if ($fsvar->array_save($this->factura_detallada_setup)) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } } }
protected function private_core() { $this->check_menu(); $fsvar = new fs_var(); $this->inme_config = array('inme_analytics' => '', 'inme_modrewrite' => '0'); $this->inme_config = $fsvar->array_get($this->inme_config, FALSE); if (isset($_POST['analytics'])) { $this->inme_config['inme_analytics'] = $_POST['analytics']; $this->inme_config['inme_modrewrite'] = $_POST['modrewrite']; $this->empresa->web = $_POST['web']; $this->empresa->save(); if ($fsvar->array_save($this->inme_config)) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } } else { if (isset($_GET['htaccess'])) { $this->save_htaccess(); } } }
protected function process() { $this->show_fs_toolbar = FALSE; $fsvar = new fs_var(); $cron_vars = $fsvar->array_get(array('cron_exists' => FALSE, 'cron_lock' => FALSE, 'cron_error' => FALSE)); if (isset($_GET['fix'])) { $cron_vars['cron_error'] = FALSE; $cron_vars['cron_lock'] = FALSE; $fsvar->array_save($cron_vars); } if (!$cron_vars['cron_exists']) { $this->new_advice('Nunca se ha ejecutado el cron, te perderás algunas características interesantes de FacturaScripts.'); } else { if ($cron_vars['cron_error']) { $this->new_error_msg('Parece que ha habido un error con el cron. Haz clic <a href="' . $this->url() . '&fix=TRUE">aquí</a> para corregirlo.'); } else { if ($cron_vars['cron_lock']) { $this->new_advice('Se está ejecutando el cron.'); } } } if (isset($_GET['clean_cache'])) { /// borramos los archivos php del directorio tmp foreach (scandir(getcwd() . '/tmp') as $f) { if (substr($f, -4) == '.php') { unlink('tmp/' . $f); } } if ($this->cache->clean()) { $this->new_message("Cache limpiada correctamente."); } } if (FS_LCD != '') { $fpt = new fs_printer(FS_LCD); $fpt->add(chr(12) . $fpt->center_text('The cake is', 20)); $fpt->add($fpt->center_text('a lie!', 20)); $fpt->imprimir(); } }
/** * Devuelve el texto para un email con las modificaciones oportunas. * @param type $tipo * @param type $documento * @param type $firma * @return type */ function plantilla_email($tipo, $documento, $firma) { /// obtenemos las plantillas $fsvar = new fs_var(); $plantillas = array('mail_factura' => "Buenos días, le adjunto su #DOCUMENTO#.\n#FIRMA#", 'mail_albaran' => "Buenos días, le adjunto su #DOCUMENTO#.\n#FIRMA#", 'mail_pedido' => "Buenos días, le adjunto su #DOCUMENTO#.\n#FIRMA#", 'mail_presupuesto' => "Buenos días, le adjunto su #DOCUMENTO#.\n#FIRMA#"); $plantillas = $fsvar->array_get($plantillas, FALSE); if ($tipo == 'albaran') { $documento = FS_ALBARAN . ' ' . $documento; } else { if ($tipo == 'pedido') { $documento = FS_PEDIDO . ' ' . $documento; } else { if ($tipo == 'presupuesto') { $documento = FS_PRESUPUESTO . ' ' . $documento; } else { $documento = $tipo . ' ' . $documento; } } } $txt = str_replace('#DOCUMENTO#', $documento, $plantillas['mail_' . $tipo]); $txt = str_replace('#FIRMA#', $firma, $txt); return $txt; }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->cliente = new cliente(); $this->grupo = new grupo_clientes(); $this->pais = new pais(); $this->serie = new serie(); $this->tarifa = new tarifa(); /// cargamos la configuración $fsvar = new fs_var(); $this->nuevocli_setup = $fsvar->array_get(array('nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 1, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 1, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 1, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 1, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0), FALSE); if (isset($_GET['delete_grupo'])) { $grupo = $this->grupo->get($_GET['delete_grupo']); if ($grupo) { if ($grupo->delete()) { $this->new_message('Grupo eliminado correctamente.'); } else { $this->new_error_msg('Imposible eliminar el grupo.'); } } else { $this->new_error_msg('Grupo no encontrado.'); } } else { if (isset($_POST['codgrupo'])) { $grupo = $this->grupo->get($_POST['codgrupo']); if (!$grupo) { $grupo = new grupo_clientes(); $grupo->codgrupo = $_POST['codgrupo']; } $grupo->nombre = $_POST['nombre']; $grupo->codtarifa = NULL; if ($_POST['codtarifa'] != '---') { $grupo->codtarifa = $_POST['codtarifa']; } if ($grupo->save()) { $this->new_message('Grupo guardado correctamente.'); } else { $this->new_error_msg('Imposible guardar el grupo.'); } } else { if (isset($_GET['delete'])) { $cliente = $this->cliente->get($_GET['delete']); if ($cliente) { if (FS_DEMO) { $this->new_error_msg('En el modo demo no se pueden eliminar clientes. Otros usuarios podrían necesitarlos.'); } else { if ($cliente->delete()) { $this->new_message('Cliente eliminado correctamente.'); } else { $this->new_error_msg('Ha sido imposible eliminar el cliente.'); } } } else { $this->new_error_msg('Cliente no encontrado.'); } } else { if (isset($_POST['cifnif'])) { $this->save_codpais($_POST['pais']); $cliente = FALSE; if ($_POST['cifnif'] != '') { $cliente = $this->cliente->get_by_cifnif($_POST['cifnif']); if ($cliente) { $this->new_advice('Ya existe un cliente con el ' . FS_CIFNIF . ' ' . $_POST['cifnif']); $this->query = $_POST['cifnif']; } } if (!$cliente) { $cliente = new cliente(); $cliente->codcliente = $cliente->get_new_codigo(); $cliente->nombre = $_POST['nombre']; $cliente->razonsocial = $_POST['nombre']; $cliente->cifnif = $_POST['cifnif']; $cliente->codserie = $this->empresa->codserie; $cliente->codgrupo = $_POST['scodgrupo']; if (isset($_POST['telefono1'])) { $cliente->telefono1 = $_POST['telefono1']; } if (isset($_POST['telefono2'])) { $cliente->telefono2 = $_POST['telefono2']; } if ($cliente->save()) { $dircliente = new direccion_cliente(); $dircliente->codcliente = $cliente->codcliente; $dircliente->codpais = $this->empresa->codpais; $dircliente->provincia = $this->empresa->provincia; $dircliente->ciudad = $this->empresa->ciudad; $dircliente->descripcion = 'Principal'; if (isset($_POST['pais'])) { $dircliente->codpais = $_POST['pais']; } if (isset($_POST['provincia'])) { $dircliente->provincia = $_POST['provincia']; } if (isset($_POST['ciudad'])) { $dircliente->ciudad = $_POST['ciudad']; } if (isset($_POST['codpostal'])) { $dircliente->codpostal = $_POST['codpostal']; } if (isset($_POST['direccion'])) { $dircliente->direccion = $_POST['direccion']; } if ($dircliente->save()) { header('location: ' . $cliente->url()); } else { $this->new_error_msg("¡Imposible guardar la dirección del cliente!"); } } else { $this->new_error_msg("¡Imposible guardar los datos del cliente!"); } } } } } } $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } if ($this->query != '') { $this->resultados = $this->cliente->search($this->query, $this->offset); } else { $this->resultados = $this->cliente->all($this->offset); } $this->grupos = $this->grupo->all(); }
protected function private_core() { $this->almacen = new almacen(); $this->cuenta_banco = new cuenta_banco(); $this->divisa = new divisa(); $this->ejercicio = new ejercicio(); $this->forma_pago = new forma_pago(); $this->serie = new serie(); $this->pais = new pais(); $fsvar = new fs_var(); /// obtenemos los datos de configuración del email $this->mail = array('mail_host' => 'smtp.gmail.com', 'mail_port' => '465', 'mail_enc' => 'ssl', 'mail_user' => '', 'mail_low_security' => FALSE); $this->mail = $fsvar->array_get($this->mail, FALSE); /// obtenemos los datos de configuración de impresión $this->impresion = array('print_ref' => '1', 'print_dto' => '1', 'print_alb' => '0', 'print_formapago' => '1'); $this->impresion = $fsvar->array_get($this->impresion, FALSE); if (isset($_POST['cifnif'])) { /// guardamos los datos de la empresa $this->empresa->nombre = $_POST['nombre']; $this->empresa->nombrecorto = $_POST['nombrecorto']; $this->empresa->cifnif = $_POST['cifnif']; $this->empresa->administrador = $_POST['administrador']; $this->empresa->codpais = $_POST['codpais']; $this->empresa->provincia = $_POST['provincia']; $this->empresa->ciudad = $_POST['ciudad']; $this->empresa->direccion = $_POST['direccion']; $this->empresa->codpostal = $_POST['codpostal']; $this->empresa->telefono = $_POST['telefono']; $this->empresa->fax = $_POST['fax']; $this->empresa->web = $_POST['web']; $this->empresa->email = $_POST['email']; $this->empresa->email_firma = $_POST['email_firma']; $this->empresa->email_password = $_POST['email_password']; $this->empresa->lema = $_POST['lema']; $this->empresa->horario = $_POST['horario']; $this->empresa->contintegrada = isset($_POST['contintegrada']); $this->empresa->codejercicio = $_POST['codejercicio']; $this->empresa->codserie = $_POST['codserie']; $this->empresa->coddivisa = $_POST['coddivisa']; $this->empresa->codpago = $_POST['codpago']; $this->empresa->codalmacen = $_POST['codalmacen']; $this->empresa->pie_factura = $_POST['pie_factura']; $this->empresa->recequivalencia = isset($_POST['recequivalencia']); if ($this->empresa->save()) { /// guardamos las opciones por defecto de almacén y forma de pago $this->save_codalmacen($_POST['codalmacen']); $this->save_codpago($_POST['codpago']); $this->new_message('Datos guardados correctamente.'); if (!$this->empresa->contintegrada) { $this->new_message('¿Quieres activar la <b>contabilidad integrada</b>?' . ' Haz clic en la sección <a href="#facturacion">facturación</a>.'); } $step = $fsvar->simple_get('install_step'); if ($step == 2) { $step = 3; $fsvar->simple_save('install_step', $step); } if ($step == 3 and $this->empresa->contintegrada) { $this->new_message('Recuerda que tienes que <a href="index.php?page=contabilidad_ejercicio&cod=' . $this->empresa->codejercicio . '">importar los datos del ejercicio</a>.'); } } else { $this->new_error_msg('Error al guardar los datos.'); } /// guardamos los datos del email if (isset($_POST['mail_host'])) { $this->mail['mail_host'] = 'smtp.gmail.com'; if ($_POST['mail_host'] != '') { $this->mail['mail_host'] = $_POST['mail_host']; } $this->mail['mail_port'] = '465'; if ($_POST['mail_port'] != '') { $this->mail['mail_port'] = $_POST['mail_port']; } $this->mail['mail_enc'] = strtolower($_POST['mail_enc']); $this->mail['mail_user'] = $_POST['mail_user']; $this->mail['mail_low_security'] = isset($_POST['mail_low_security']); $fsvar->array_save($this->mail); $this->mail_test(); } /// guardamos los datos de impresión $this->impresion['print_ref'] = isset($_POST['print_ref']) ? 1 : 0; $this->impresion['print_dto'] = isset($_POST['print_dto']) ? 1 : 0; $this->impresion['print_alb'] = isset($_POST['print_alb']) ? 1 : 0; $this->impresion['print_formapago'] = isset($_POST['print_formapago']) ? 1 : 0; $fsvar->array_save($this->impresion); } else { if (isset($_POST['nombre'])) { /// guardamos solamente lo básico, ya que facturacion_base no está activado $this->empresa->nombre = $_POST['nombre']; $this->empresa->nombrecorto = $_POST['nombrecorto']; $this->empresa->web = $_POST['web']; $this->empresa->email = $_POST['email']; $this->empresa->email_firma = $_POST['email_firma']; $this->empresa->email_password = $_POST['email_password']; if ($this->empresa->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } /// guardamos los datos del email if (isset($_POST['mail_host'])) { $this->mail['mail_host'] = 'smtp.gmail.com'; if ($_POST['mail_host'] != '') { $this->mail['mail_host'] = $_POST['mail_host']; } $this->mail['mail_port'] = '465'; if ($_POST['mail_port'] != '') { $this->mail['mail_port'] = $_POST['mail_port']; } $this->mail['mail_enc'] = strtolower($_POST['mail_enc']); $this->mail['mail_user'] = $_POST['mail_user']; $this->mail['mail_low_security'] = isset($_POST['mail_low_security']); $fsvar->array_save($this->mail); $this->mail_test(); } } else { if (isset($_POST['logo'])) { if (is_uploaded_file($_FILES['fimagen']['tmp_name'])) { $this->delete_logo(); if (substr(strtolower($_FILES['fimagen']['name']), -3) == 'png') { copy($_FILES['fimagen']['tmp_name'], "tmp/" . FS_TMP_NAME . "logo.png"); } else { copy($_FILES['fimagen']['tmp_name'], "tmp/" . FS_TMP_NAME . "logo.jpg"); } $this->new_message('Logotipo guardado correctamente.'); } } else { if (isset($_GET['delete_logo'])) { $this->delete_logo(); } else { if (isset($_GET['delete_cuenta'])) { $cuenta = $this->cuenta_banco->get($_GET['delete_cuenta']); if ($cuenta) { if ($cuenta->delete()) { $this->new_message('Cuenta bancaria eliminada correctamente.'); } else { $this->new_error_msg('Imposible eliminar la cuenta bancaria.'); } } else { $this->new_error_msg('Cuenta bancaria no encontrada.'); } } else { if (isset($_POST['iban'])) { if (isset($_POST['codcuenta'])) { $cuentab = $this->cuenta_banco->get($_POST['codcuenta']); } else { $cuentab = new cuenta_banco(); } $cuentab->descripcion = $_POST['descripcion']; $cuentab->iban = $_POST['iban']; $cuentab->swift = $_POST['swift']; if (isset($_POST['codsubcuenta'])) { $cuentab->codsubcuenta = $_POST['codsubcuenta']; } if ($cuentab->save()) { $this->new_message('Cuenta bancaria guardada correctamente.'); } else { $this->new_error_msg('Imposible guardar la cuenta bancaria.'); } } } } } } } $this->facturacion_base = in_array('facturacion_base', $GLOBALS['plugins']); $this->logo = FALSE; if (file_exists('tmp/' . FS_TMP_NAME . 'logo.png')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.png'; } else { if (file_exists('tmp/' . FS_TMP_NAME . 'logo.jpg')) { $this->logo = 'tmp/' . FS_TMP_NAME . 'logo.jpg'; } } }
protected function process() { $this->mostrar = 'pedidos'; if (isset($_REQUEST['mostrar'])) { $this->mostrar = $_REQUEST['mostrar']; } $this->offset = 0; if (isset($_REQUEST['offset'])) { $this->offset = intval($_REQUEST['offset']); } $this->almacen = new almacen(); $this->conectado = FALSE; $this->impuesto = new impuesto(); $this->pedidos = array(); $this->productos = array(); $this->serie = new serie(); $fsv = new fs_var(); $this->setup = $fsv->array_get(array('wooc_url' => FALSE, 'wooc_ck' => FALSE, 'wooc_cs' => FALSE, 'wooc_serie' => FALSE, 'wooc_alm' => FALSE, 'wooc_imp' => FALSE)); $this->wcapi = FALSE; if (isset($_POST['wooc_ck'])) { $this->setup['wooc_url'] = $_POST['wooc_url']; $this->setup['wooc_ck'] = $_POST['wooc_ck']; $this->setup['wooc_cs'] = $_POST['wooc_cs']; $this->setup['wooc_alm'] = $_POST['wooc_alm']; $this->setup['wooc_serie'] = $_POST['wooc_serie']; $this->setup['wooc_imp'] = $_POST['wooc_imp']; if ($fsv->array_save($this->setup)) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Imposible guardar los datos.'); } } if (!function_exists('curl_init')) { $this->new_error_msg('No se encuentra la extensión php-curl, tienes que instalarla.'); } else { if ($this->setup['wooc_url']) { $this->wcapi = new WC_API_Client($this->setup['wooc_ck'], $this->setup['wooc_cs'], $this->setup['wooc_url']); $this->total_pedidos = $this->get_total_pedidos(); $this->total_productos = $this->get_total_productos(); if (isset($_GET['sync'])) { $this->productos = $this->get_productos(); $this->pedidos = $this->get_pedidos(); $this->sync(); } else { if (isset($_GET['alb'])) { $data = $this->db->select("SELECT * FROM albaranescli WHERE numero2 = " . $this->empresa->var2str('WC#' . $_GET['alb']) . ";"); if ($data) { $albaran = new albaran_cliente($data[0]); header('Location: ' . $albaran->url()); } else { $this->new_error_msg('Albarán no encontrado. Pulsa el botón importar.'); } $this->pedidos = $this->get_pedidos(); } else { if ($this->mostrar == 'articulos') { $this->productos = $this->get_productos(); } else { $this->pedidos = $this->get_pedidos(); } } } } } }
protected function private_core() { $this->agente = FALSE; $this->almacen = new almacen(); $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->descripcion = NULL; $this->direccion = FALSE; $this->divisa = new divisa(); $this->estado = new estado_servicio(); $this->fabricante = new fabricante(); $this->familia = new familia(); $this->forma_pago = new forma_pago(); $this->grupo = new grupo_clientes(); $this->impuesto = new impuesto(); $this->pais = new pais(); $this->prioridad = 3; $this->results = array(); $this->serie = new serie(); $this->servicio = new servicio_cliente(); $this->solucion = NULL; /// cargamos la configuración de servicios $fsvar = new fs_var(); $this->setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'cal_inicio' => "09:00", 'cal_fin' => "20:00", 'cal_intervalo' => "30", 'st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_fechainicio' => "Fecha de Inicio", 'st_fechafin' => "Fecha de finalización", 'st_garantia' => "Garantía", 'nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 0, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 0, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 0, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 0, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0, 'nuevocli_codgrupo' => ''), FALSE); if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_REQUEST['datoscliente'])) { $this->datos_cliente(); } 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['cliente'])) { $this->cliente_s = $this->cliente->get($_POST['cliente']); /** * Nuevo cliente */ if (isset($_POST['nuevo_cliente'])) { if ($_POST['nuevo_cliente'] != '') { $this->cliente_s = FALSE; if ($_POST['nuevo_cifnif'] != '') { $this->cliente_s = $this->cliente->get_by_cifnif($_POST['nuevo_cifnif']); if ($this->cliente_s) { $this->new_advice('Ya existe un cliente con ese ' . FS_CIFNIF . '. Se ha seleccionado.'); } } if (!$this->cliente_s) { $this->cliente_s = new cliente(); $this->cliente_s->codcliente = $this->cliente_s->get_new_codigo(); $this->cliente_s->nombre = $this->cliente_s->razonsocial = $_POST['nuevo_cliente']; $this->cliente_s->tipoidfiscal = $_POST['nuevo_tipoidfiscal']; $this->cliente_s->cifnif = $_POST['nuevo_cifnif']; $this->cliente_s->personafisica = isset($_POST['personafisica']); if (isset($_POST['nuevo_grupo'])) { if ($_POST['nuevo_grupo'] != '') { $this->cliente_s->codgrupo = $_POST['nuevo_grupo']; } } if (isset($_POST['nuevo_telefono1'])) { $this->cliente_s->telefono1 = $_POST['nuevo_telefono1']; } if (isset($_POST['nuevo_telefono2'])) { $this->cliente_s->telefono2 = $_POST['nuevo_telefono2']; } if ($this->cliente_s->save()) { if ($this->empresa->contintegrada) { /// forzamos crear la subcuenta $this->cliente_s->get_subcuenta($this->empresa->codejercicio); } $dircliente = new direccion_cliente(); $dircliente->codcliente = $this->cliente_s->codcliente; $dircliente->codpais = $this->empresa->codpais; $dircliente->provincia = $this->empresa->provincia; $dircliente->ciudad = $this->empresa->ciudad; if (isset($_POST['nuevo_pais'])) { $dircliente->codpais = $_POST['nuevo_pais']; } if (isset($_POST['nuevo_provincia'])) { $dircliente->provincia = $_POST['nuevo_provincia']; } if (isset($_POST['nuevo_ciudad'])) { $dircliente->ciudad = $_POST['nuevo_ciudad']; } if (isset($_POST['nuevo_codpostal'])) { $dircliente->codpostal = $_POST['nuevo_codpostal']; } if (isset($_POST['nuevo_direccion'])) { $dircliente->direccion = $_POST['nuevo_direccion']; } if ($dircliente->save()) { $this->new_message('Cliente agregado correctamente.'); } } else { $this->new_error_msg("¡Imposible guardar la dirección del cliente!"); } } } } if ($this->cliente_s) { foreach ($this->cliente_s->get_direcciones() as $dir) { if ($dir->domfacturacion) { $this->direccion = $dir; break; } } } if (isset($_POST['codagente'])) { $agente = new agente(); $this->agente = $agente->get($_POST['codagente']); } else { $this->agente = $this->user->get_agente(); } if (isset($_POST['numlineas'])) { $this->nuevo_servicio_cliente(); if (!$this->direccion) { $this->direccion = new direccion_cliente(); $this->direccion->codcliente = $this->cliente_s->codcliente; $this->direccion->codpais = $_POST['codpais']; $this->direccion->provincia = $_POST['provincia']; $this->direccion->ciudad = $_POST['ciudad']; $this->direccion->codpostal = $_POST['codpostal']; $this->direccion->direccion = $_POST['direccion']; $this->direccion->descripcion = 'Principal'; $this->direccion->save(); } } } } } } } } }
protected function private_core() { //cargamos configuración de servicios $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_marca' => 0, 'servicos_codmarca' => 0, 'servicios_mostrar_modelo' => 0, 'servicios_codmodelo' => 0, 'servicios_mostrar_tipo' => 0, 'servicios_tipo' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0), FALSE); /*Cargamos traduccion*/ $fsvar = new fs_var(); $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_marca' => "Marca del aparato", 'st_modelo' => "Modelo del aparato", 'st_tipo' => "Tipo de aparato"), FALSE); $servicio = new servicio_cliente(); $this->agente = new agente(); $this->serie = new serie(); $this->estados = new estados_servicios(); $this->mostrar = 'todo'; if (isset($_GET['mostrar'])) { $this->mostrar = $_GET['mostrar']; setcookie('ventas_serv_mostrar', $this->mostrar, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['ventas_serv_mostrar'])) { $this->mostrar = $_COOKIE['ventas_serv_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'; } else { if ($_GET['order'] == 'prioridad_desc') { $this->order = 'prioridad DESC'; } else { if ($_GET['order'] == 'prioridad_asc') { $this->order = 'prioridad ASC'; } } } } } } setcookie('ventas_serv_order', $this->order, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['ventas_serv_order'])) { $this->order = $_COOKIE['ventas_serv_order']; } } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if ($this->mostrar == 'rechazados') { $this->resultados = $servicio->all_rechazados($this->offset); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_servicios_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_servicio_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); $this->cliente = FALSE; $this->codagente = ''; $this->estado = ''; $this->codserie = ''; $this->desde = ''; $this->hasta = ''; $this->num_resultados = ''; $this->total_resultados = ''; $this->total_resultados_txt = ''; if (isset($_POST['delete'])) { $this->delete_servicio(); } else { if (isset($_REQUEST['codagente']) or isset($_REQUEST['codcliente']) or isset($_REQUEST['estado'])) { $this->mostrar = 'buscar'; } if (isset($_REQUEST['codcliente'])) { if ($_REQUEST['codcliente'] != '') { $cli0 = new cliente(); $this->cliente = $cli0->get($_REQUEST['codcliente']); } } if (isset($_REQUEST['codagente'])) { $this->codagente = $_REQUEST['codagente']; } if (isset($_REQUEST['estado'])) { $this->estado = $_REQUEST['estado']; } if (isset($_REQUEST['codserie'])) { $this->codserie = $_REQUEST['codserie']; $this->desde = $_REQUEST['desde']; $this->hasta = $_REQUEST['hasta']; } } if ($this->mostrar == 'pendientes') { $this->resultados = $servicio->all_ptealbaran($this->offset, $this->order); if ($this->offset == 0) { $this->total_resultados = 0; $this->total_resultados_txt = 'Suma total de esta página:'; foreach ($this->resultados as $serv) { $this->total_resultados += $serv->total; } } } else { if ($this->mostrar == 'buscar') { $this->buscar(); } else { $this->resultados = $servicio->all($this->offset, $this->order); } } } } } } }
/// accedemos al directorio de FacturaScripts chdir(__DIR__); /// cargamos las constantes de configuración require_once 'config.php'; require_once 'base/config2.php'; $tiempo = explode(' ', microtime()); $uptime = $tiempo[1] + $tiempo[0]; require_once 'base/fs_db2.php'; $db = new fs_db2(); require_once 'base/fs_default_items.php'; require_once 'base/fs_model.php'; require_model('empresa.php'); require_model('fs_var.php'); if ($db->connect()) { $fsvar = new fs_var(); $cron_vars = $fsvar->array_get(array('cron_exists' => FALSE, 'cron_lock' => FALSE, 'cron_error' => FALSE)); if ($cron_vars['cron_lock']) { echo "ERROR: Ya hay un cron en ejecución. Si crees que es un error," . " ve a Admin > Información del sistema para solucionar el problema."; /// marcamos el error en el cron $cron_vars['cron_error'] = 'TRUE'; } else { /** * He detectado que a veces, con el plugin kiwimaru, * el proceso cron tarda más de una hora, y por tanto se encadenan varios * procesos a la vez. Para evitar esto, uso la entrada cron_lock. * Además uso la entrada cron_exists para marcar que alguna vez se ha ejecutado el cron, * y cron_error por si hubiese algún fallo. */ $cron_vars['cron_lock'] = 'TRUE'; $cron_vars['cron_exists'] = 'TRUE'; /// guardamos las variables
protected function private_core() { /// cargamos configuración de servicios $fsvar = new fs_var(); $this->fabricante = new fabricante(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_marca' => 0, 'servicios_marca' => 0, 'servicios_mostrar_modelo' => 0, 'servicios_modelo' => 0, 'servicios_mostrar_tipo' => 0, 'servicios_tipo' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0), FALSE); /// cargamos traducciones $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_marca' => "Marca del aparato", 'st_modelo' => "Modelo del aparato", 'st_tipo' => "Tipo de aparato"), FALSE); // cargamos la configuración $fsvar = new fs_var(); $this->nuevocli_setup = $fsvar->array_get(array('nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 0, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 0, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 0, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 0, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0, 'nuevocli_grupo' => 0, 'nuevocli_grupo_req' => 0, 'nuevocli_grupo_pred' => 0), FALSE); $this->servicio = new servicio_cliente(); $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->direccion = FALSE; $this->familia = new familia(); $this->impuesto = new impuesto(); $this->results = array(); $this->descripcion = NULL; $this->solucion = NULL; $this->prioridad = 3; $this->material = NULL; $this->material_estado = NULL; $this->accesorios = NULL; $this->codmarca = NULL; $this->codmodelo = NULL; $this->codtipo = NULL; $this->grupo = new grupo_clientes(); $this->estado = new estados_servicios(); $this->pais = new pais(); $this->fechaprevista = date('d-m-Y', strtotime($this->today() . '+ ' . $this->servicios_setup['servicios_diasfin'] . 'days')); $this->nueva_marca_url = FALSE; $this->nuevo_modelo_url = FALSE; $this->nuevo_tipo_url = FALSE; $this->marca = new marca(); $this->modelo = new modelo(); $this->tipo = new tipo(); $this->nueva_marca_url = $this->marca->url(); $this->nuevo_modelo_url = $this->modelo->url(); $this->nuevo_tipo_url = $this->tipo->url(); $this->marca_s = $this->marca->get($this->servicio->codmarca); $this->modelo_s = $this->modelo->get($this->servicio->codmodelo); $this->tipo_s = $this->tipo->get($this->servicio->codtipo); if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_REQUEST['datoscliente'])) { $this->datos_cliente(); } 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['cliente'])) { $this->cliente_s = $this->cliente->get($_POST['cliente']); /** * Nuevo cliente */ if (isset($_POST['nuevo_cliente'])) { if ($_POST['nuevo_cliente'] != '') { $this->cliente_s = FALSE; if ($_POST['nuevo_cifnif'] != '') { $this->cliente_s = $this->cliente->get_by_cifnif($_POST['nuevo_cifnif']); if ($this->cliente_s) { $this->new_advice('Ya existe un cliente con ese ' . FS_CIFNIF . '. Se ha seleccionado.'); } } if (!$this->cliente_s) { $this->cliente_s = new cliente(); $this->cliente_s->codcliente = $this->cliente_s->get_new_codigo(); $this->cliente_s->nombre = $this->cliente_s->razonsocial = $_POST['nuevo_cliente']; $this->cliente_s->cifnif = $_POST['nuevo_cifnif']; $this->cliente_s->codserie = $this->empresa->codserie; if (isset($_POST['nuevo_grupo'])) { if ($_POST['nuevo_grupo'] != '') { $this->cliente_s->codgrupo = $_POST['nuevo_grupo']; } } if (isset($_POST['nuevo_telefono1'])) { $this->cliente_s->telefono1 = $_POST['nuevo_telefono1']; } if (isset($_POST['nuevo_telefono2'])) { $this->cliente_s->telefono2 = $_POST['nuevo_telefono2']; } if ($this->cliente_s->save()) { $dircliente = new direccion_cliente(); $dircliente->codcliente = $this->cliente_s->codcliente; $dircliente->codpais = $this->empresa->codpais; $dircliente->provincia = $this->empresa->provincia; $dircliente->ciudad = $this->empresa->ciudad; $dircliente->descripcion = 'Principal'; if (isset($_POST['nuevo_pais'])) { $dircliente->codpais = $_POST['nuevo_pais']; } if (isset($_POST['nuevo_provincia'])) { $dircliente->provincia = $_POST['nuevo_provincia']; } if (isset($_POST['nuevo_ciudad'])) { $dircliente->ciudad = $_POST['nuevo_ciudad']; } if (isset($_POST['nuevo_codpostal'])) { $dircliente->codpostal = $_POST['nuevo_codpostal']; } if (isset($_POST['nuevo_direccion'])) { $dircliente->direccion = $_POST['nuevo_direccion']; } if ($dircliente->save()) { $this->new_message('Cliente agregado correctamente.'); } } else { $this->new_error_msg("¡Imposible guardar la dirección del cliente!"); } } } } if ($this->cliente_s) { foreach ($this->cliente_s->get_direcciones() as $dir) { if ($dir->domfacturacion) { $this->direccion = $dir; break; } } } 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['numlineas'])) { $this->nuevo_servicio_cliente(); if (!$this->direccion) { $this->direccion = new direccion_cliente(); $this->direccion->codcliente = $this->cliente_s->codcliente; $this->direccion->codpais = $_POST['codpais']; $this->direccion->provincia = $_POST['provincia']; $this->direccion->ciudad = $_POST['ciudad']; $this->direccion->codpostal = $_POST['codpostal']; $this->direccion->direccion = $_POST['direccion']; $this->direccion->descripcion = 'Principal'; $this->direccion->save(); } } } } } } } } }
private function enviar_email($doc, $tipo = 'simple') { if ($this->empresa->can_send_mail()) { if ($_POST['email'] != $this->cliente->email) { $this->cliente->email = $_POST['email']; $this->cliente->save(); } /// obtenemos la configuración extra del email $mailop = array('mail_host' => 'smtp.gmail.com', 'mail_port' => '465', 'mail_user' => '', 'mail_enc' => 'ssl'); $fsvar = new fs_var(); $mailop = $fsvar->array_get($mailop, FALSE); if ($doc == 'factura') { $filename = 'factura_' . $this->factura->codigo . '.pdf'; $this->generar_pdf_factura($tipo, $filename); } else { $filename = 'albaran_' . $this->albaran->codigo . '.pdf'; $this->generar_pdf_albaran($filename); } if (file_exists('tmp/' . FS_TMP_NAME . 'enviar/' . $filename)) { $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPAuth = TRUE; $mail->SMTPSecure = $mailop['mail_enc']; $mail->Host = $mailop['mail_host']; $mail->Port = intval($mailop['mail_port']); $mail->Username = $this->empresa->email; if ($mailop['mail_user'] != '') { $mail->Username = $mailop['mail_user']; } $mail->Password = $this->empresa->email_password; $mail->From = $this->empresa->email; $mail->FromName = $this->user->nick; $mail->CharSet = 'UTF-8'; if ($doc == 'factura') { $mail->Subject = $this->empresa->nombre . ': Su factura ' . $this->factura->codigo; $mail->AltBody = 'Buenos días, le adjunto su factura ' . $this->factura->codigo . ".\n" . $this->empresa->email_firma; } else { $mail->Subject = $this->empresa->nombre . ': Su ' . FS_ALBARAN . ' ' . $this->albaran->codigo; $mail->AltBody = 'Buenos días, le adjunto su ' . FS_ALBARAN . ' ' . $this->albaran->codigo . ".\n" . $this->empresa->email_firma; } $mail->WordWrap = 50; $mail->MsgHTML(nl2br($_POST['mensaje'])); $mail->AddAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $filename); $mail->AddAddress($_POST['email'], $this->cliente->razonsocial); $mail->IsHTML(TRUE); if ($mail->Send()) { $this->new_message('Mensaje enviado correctamente.'); } else { $this->new_error_msg("Error al enviar el email: " . $mail->ErrorInfo); } unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $filename); } else { $this->new_error_msg('Imposible generar el PDF.'); } } }
protected function private_core() { $this->share_extensions(); $this->cliente = new cliente(); $this->grupo = new grupo_clientes(); // cargamos la configuración $fsvar = new fs_var(); $this->nuevocli_setup = $fsvar->array_get(array('nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 0, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 0, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 0, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 0, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0, 'nuevocli_codgrupo' => '', 'cal_inicio' => "09:00"), FALSE); $this->mostrar = 'todo'; if (isset($_GET['mostrar'])) { $this->mostrar = $_GET['mostrar']; } $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } $contrato = new contrato_servicio(); if (isset($_POST['cliente'])) { $cliente_s = $this->cliente->get($_POST['cliente']); /** * Nuevo cliente */ if (isset($_POST['nuevo_cliente'])) { if ($_POST['nuevo_cliente'] != '') { $cliente_s = FALSE; if ($_POST['nuevo_cifnif'] != '') { $cliente_s = $this->cliente->get_by_cifnif($_POST['nuevo_cifnif']); if ($cliente_s) { $this->new_advice('Ya existe un cliente con ese ' . FS_CIFNIF . '. Se ha seleccionado.'); } } if (!$cliente_s) { $cliente_s = new cliente(); $cliente_s->codcliente = $cliente_s->get_new_codigo(); $cliente_s->nombre = $cliente_s->razonsocial = $_POST['nuevo_cliente']; $cliente_s->cifnif = $_POST['nuevo_cifnif']; $cliente_s->codserie = $this->empresa->codserie; if (isset($_POST['nuevo_grupo'])) { if ($_POST['nuevo_grupo'] != '') { $cliente_s->codgrupo = $_POST['nuevo_grupo']; } } if (isset($_POST['nuevo_telefono1'])) { $cliente_s->telefono1 = $_POST['nuevo_telefono1']; } if (isset($_POST['nuevo_telefono2'])) { $cliente_s->telefono2 = $_POST['nuevo_telefono2']; } if ($cliente_s->save()) { $dircliente = new direccion_cliente(); $dircliente->codcliente = $cliente_s->codcliente; $dircliente->codpais = $this->empresa->codpais; $dircliente->provincia = $this->empresa->provincia; $dircliente->ciudad = $this->empresa->ciudad; $dircliente->descripcion = 'Principal'; if (isset($_POST['nuevo_pais'])) { $dircliente->codpais = $_POST['nuevo_pais']; } if (isset($_POST['nuevo_provincia'])) { $dircliente->provincia = $_POST['nuevo_provincia']; } if (isset($_POST['nuevo_ciudad'])) { $dircliente->ciudad = $_POST['nuevo_ciudad']; } if (isset($_POST['nuevo_codpostal'])) { $dircliente->codpostal = $_POST['nuevo_codpostal']; } if (isset($_POST['nuevo_direccion'])) { $dircliente->direccion = $_POST['nuevo_direccion']; } if ($dircliente->save()) { $this->new_message('Cliente agregado correctamente.'); } } else { $this->new_error_msg("¡Imposible guardar la dirección del cliente!"); } } } } $con = new contrato_servicio(); $con->codcliente = $cliente_s->codcliente; $con->codagente = $this->user->codagente; $con->codpago = $cliente_s->codpago; if ($con->save()) { $this->new_message('Contrato guardado correctamente.'); header('Location: ' . $con->url()); } else { $this->new_error_msg('Error al guardar el contrato.'); } } else { if (isset($_GET['test'])) { $cli0 = new cliente(); foreach ($cli0->all(mt_rand(0, 1000)) as $cliente) { $con = new contrato_servicio(); $con->codcliente = $cliente->codcliente; $con->codagente = $this->user->codagente; $con->codpago = $this->empresa->codpago; $con->fecha_alta = date(mt_rand(1, 29) . '-3-Y'); $con->fecha_renovacion = date(mt_rand(1, 29) . '-11-Y'); $con->importe_anual = mt_rand(600, 60000); $con->observaciones = $this->random_string(); $con->periodo = '+' . mt_rand(7, 120) . 'days'; $con->fsiguiente_servicio = date('d-m-Y', strtotime($con->fecha_alta . ' ' . $con->periodo)); $con->save(); } } else { if (isset($_GET['delete'])) { $con = $contrato->get($_GET['delete']); if ($con) { if ($con->delete()) { $this->new_message('Contrato eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el contrato.'); } } else { $this->new_error_msg('Contrato no encontrado.'); } } } } if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_GET['minicron'])) { $this->minicron(); } else { if ($this->mostrar == 'renovacion') { $this->resultados = $contrato->all($this->offset, 'fecha_renovacion ASC'); } else { if ($this->mostrar == 'servicio') { $this->resultados = $contrato->all($this->offset, 'fsiguiente_servicio ASC'); } else { $this->resultados = $contrato->all($this->offset); } } } } $this->total = $contrato->count(); }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->ppage = $this->page->get('ventas_servicios'); $this->agente = FALSE; $this->estado = new estados_servicios(); $servicio = new servicio_cliente(); $this->servicio = FALSE; $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->divisa = new divisa(); $this->ejercicio = new ejercicio(); $this->familia = new familia(); $this->forma_pago = new forma_pago(); $this->impuesto = new impuesto(); $this->nuevo_servicio_url = FALSE; $this->nueva_marca_url = FALSE; $this->nuevo_modelo_url = FALSE; $this->nuevo_tipo_url = FALSE; $this->pais = new pais(); $this->serie = new serie(); $this->fabricante = new fabricante(); $this->marca = new marca(); $this->modelo = new modelo(); $this->tipo = new tipo(); //cargamos configuración de servicios $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_marca' => 0, 'servicios_marca' => 0, 'servicios_mostrar_modelo' => 0, 'servicios_modelo' => 0, 'servicios_mostrar_tipo' => 0, 'servicios_tipo' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0), FALSE); /*Cargamos traduccion*/ $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_marca' => "Marca del aparato", 'st_modelo' => "Modelo del aparato", 'st_tipo' => "Tipo de aparato"), FALSE); /** * Comprobamos si el usuario tiene acceso a nueva_venta, * necesario para poder añadir líneas. */ if (isset($_GET['delete_detalle'])) { $det0 = new detalle_servicio(); $detalle = $det0->get($_GET['delete_detalle']); if ($detalle) { if ($detalle->delete()) { $this->new_message('Detalle eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el detalle.'); } } else { $this->new_error_msg('Detalle no encontrado.'); } } if ($this->user->have_access_to('nueva_venta', FALSE)) { $nuevopedp = $this->page->get('nueva_venta'); if ($nuevopedp) { $this->nuevo_servicio_url = $nuevopedp->url(); } $this->nueva_marca_url = $this->marca->url(); $this->nuevo_modelo_url = $this->modelo->url(); $this->nuevo_tipo_url = $this->tipo->url(); } if (isset($_POST['idservicio'])) { $this->servicio = $servicio->get($_POST['idservicio']); $this->modificar(); } else { if (isset($_GET['id'])) { $this->servicio = $servicio->get($_GET['id']); } } if ($this->servicio) { $this->page->title = $this->servicio->codigo; if (isset($_POST['detalle'])) { $this->agrega_detalle(); } /// cargamos el agente if (!is_null($this->servicio->codagente)) { $agente = new agente(); $this->agente = $agente->get($this->servicio->codagente); } /// cargamos el cliente $this->cliente_s = $this->cliente->get($this->servicio->codcliente); $this->marca_s = $this->marca->get($this->servicio->codmarca); $this->modelo_s = $this->modelo->get($this->servicio->codmodelo); $this->tipo_s = $this->tipo->get($this->servicio->codtipo); } else { $this->new_error_msg("¡" . ucfirst(FS_SERVICIO) . " de cliente no encontrado!"); } }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->check_menu(); $this->share_extensions(); $this->estado = new estado_servicio(); /// cargamos la configuración $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'servicios_condiciones' => "Condiciones del deposito:\nLos presupuestos realizados tienen una" . " validez de 15 días.\nUna vez avisado al cliente para que recoja el producto este dispondrá" . " de un plazo máximo de 2 meses para recogerlo, de no ser así y no haber aviso por parte del" . " cliente se empezará a cobrar 1 euro al día por gastos de almacenaje.\nLos accesorios y" . " productos externos al equipo no especificados en este documento no podrán ser reclamados en" . " caso de disconformidad con el técnico.", 'st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_solucion' => "Solución", 'st_fechainicio' => "Fecha de inicio", 'st_fechafin' => "Fecha de finalización", 'st_garantia' => "Garantía", 'cal_inicio' => "09:00", 'cal_fin' => "20:00", 'cal_intervalo' => "30"), FALSE); if (isset($_POST['servicios_setup'])) { $this->servicios_setup['servicios_diasfin'] = intval($_POST['diasfin']); $this->servicios_setup['servicios_material'] = isset($_POST['servicios_material']) ? 1 : 0; $this->servicios_setup['servicios_material_estado'] = isset($_POST['servicios_material_estado']) ? 1 : 0; $this->servicios_setup['servicios_accesorios'] = isset($_POST['servicios_accesorios']) ? 1 : 0; $this->servicios_setup['servicios_descripcion'] = isset($_POST['servicios_descripcion']) ? 1 : 0; $this->servicios_setup['servicios_solucion'] = isset($_POST['servicios_solucion']) ? 1 : 0; $this->servicios_setup['servicios_fechafin'] = isset($_POST['servicios_fechafin']) ? 1 : 0; $this->servicios_setup['servicios_fechainicio'] = isset($_POST['servicios_fechainicio']) ? 1 : 0; $this->servicios_setup['servicios_garantia'] = isset($_POST['servicios_garantia']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_material'] = isset($_POST['servicios_mostrar_material']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_material_estado'] = isset($_POST['servicios_mostrar_material_estado']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_accesorios'] = isset($_POST['servicios_mostrar_accesorios']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_descripcion'] = isset($_POST['servicios_mostrar_descripcion']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_solucion'] = isset($_POST['servicios_mostrar_solucion']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_fechafin'] = isset($_POST['servicios_mostrar_fechafin']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_fechainicio'] = isset($_POST['servicios_mostrar_fechainicio']) ? 1 : 0; $this->servicios_setup['servicios_mostrar_garantia'] = isset($_POST['servicios_mostrar_garantia']) ? 1 : 0; $this->servicios_setup['servicios_condiciones'] = $fsvar->no_html($_POST['condiciones']); $this->servicios_setup['st_servicio'] = $_POST['st_servicio']; $this->servicios_setup['st_servicios'] = $_POST['st_servicios']; $this->servicios_setup['st_material'] = $_POST['st_material']; $this->servicios_setup['st_material_estado'] = $_POST['st_material_estado']; $this->servicios_setup['st_accesorios'] = $_POST['st_accesorios']; $this->servicios_setup['st_descripcion'] = $_POST['st_descripcion']; $this->servicios_setup['st_solucion'] = $_POST['st_solucion']; $this->servicios_setup['st_fechainicio'] = $_POST['st_fechainicio']; $this->servicios_setup['st_fechafin'] = $_POST['st_fechafin']; $this->servicios_setup['st_garantia'] = $_POST['st_garantia']; $this->servicios_setup['cal_inicio'] = $_POST['cal_inicio']; $this->servicios_setup['cal_fin'] = $_POST['cal_fin']; $this->servicios_setup['cal_intervalo'] = $_POST['cal_intervalo']; if ($fsvar->array_save($this->servicios_setup)) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } } else { if (isset($_GET['delete_estado'])) { $estado = $this->estado->get($_GET['delete_estado']); if ($estado) { if ($estado->delete()) { $this->new_message('Estado eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el estado.'); } } else { $this->new_error_msg('Estado no encontrado.'); } } else { if (isset($_POST['id_estado'])) { $estado = $this->estado->get($_POST['id_estado']); if (!$estado) { $estado = new estado_servicio(); $estado->id = intval($_POST['id_estado']); } $estado->descripcion = $_POST['descripcion']; $estado->color = $_POST['color']; $estado->activo = isset($_POST['activo']); $estado->albaran = isset($_POST['albaran']); if ($estado->save()) { $this->new_message('Estado guardado correctamente.'); } else { $this->new_error_msg('Error al guardar el estado.'); } } } } }
protected function private_core() { //cargamos configuración de servicios $fsvar = new fs_var(); $this->servicios_setup = $fsvar->array_get(array('servicios_diasfin' => 10, 'servicios_material' => 0, 'servicios_mostrar_material' => 0, 'servicios_material_estado' => 0, 'servicios_mostrar_material_estado' => 0, 'servicios_accesorios' => 0, 'servicios_mostrar_accesorios' => 0, 'servicios_descripcion' => 0, 'servicios_mostrar_descripcion' => 0, 'servicios_solucion' => 0, 'servicios_mostrar_solucion' => 0, 'servicios_fechafin' => 0, 'servicios_mostrar_fechafin' => 0, 'servicios_fechainicio' => 0, 'servicios_mostrar_fechainicio' => 0, 'servicios_mostrar_garantia' => 0, 'servicios_garantia' => 0, 'cal_inicio' => "09:00", 'usar_direccion' => 0), FALSE); /*Cargamos traduccion*/ $fsvar = new fs_var(); $this->st = $fsvar->array_get(array('st_servicio' => "Servicio", 'st_servicios' => "Servicios", 'st_material' => "Material", 'st_material_estado' => "Estado del material entregado", 'st_accesorios' => "Accesorios que entrega", 'st_descripcion' => "Descripción de la averia", 'st_fechainicio' => "Fecha de inicio", 'st_fechafin' => "Fecha de fin", 'st_solucion' => "Solución", 'st_garantia' => "Garantía"), FALSE); $this->avisosat = '0'; if (class_exists('registro_sat')) { $this->avisosat = '1'; } if (isset($_GET['importar'])) { $this->importar_sat(); } $this->servicio = new servicio_cliente(); $this->agente = new agente(); $this->serie = new serie(); $this->estados = new estado_servicio(); $this->estado = ''; $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'; } else { if ($_GET['order'] == 'prioridad_desc') { $this->order = 'prioridad DESC'; } else { if ($_GET['order'] == 'prioridad_asc') { $this->order = 'prioridad ASC'; } else { if ($_GET['order'] == 'total_desc') { $this->order = 'total DESC'; } } } } } } } setcookie('ventas_serv_order', $this->order, time() + FS_COOKIES_EXPIRE); } else { if (isset($_COOKIE['ventas_serv_order'])) { $this->order = $_COOKIE['ventas_serv_order']; } } if (isset($_POST['buscar_lineas'])) { $this->buscar_lineas(); } else { if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_GET['ref'])) { $this->template = 'extension/ventas_servicios_articulo'; $articulo = new articulo(); $this->articulo = $articulo->get($_GET['ref']); $linea = new linea_servicio_cliente(); $this->resultados = $linea->all_from_articulo($_GET['ref'], $this->offset); } else { $this->share_extension(); $this->cliente = FALSE; $this->codagente = ''; $this->codserie = ''; $this->desde = ''; $this->hasta = ''; $this->num_resultados = ''; $this->total_resultados = ''; $this->total_resultados_txt = ''; $this->editable = FALSE; $this->fechainicio = ''; $this->fechafin = ''; if (isset($_POST['delete'])) { $this->delete_servicio(); } else { if (isset($_REQUEST['codcliente'])) { if ($_REQUEST['codcliente'] != '') { $cli0 = new cliente(); $this->cliente = $cli0->get($_REQUEST['codcliente']); } } if (isset($_REQUEST['codagente'])) { $this->codagente = $_REQUEST['codagente']; } if (isset($_REQUEST['estado'])) { $this->estado = $_REQUEST['estado']; } if (isset($_REQUEST['editable'])) { $this->editable = TRUE; } if (isset($_REQUEST['codserie'])) { $this->codserie = $_REQUEST['codserie']; } if (isset($_REQUEST['fechainicio'])) { $this->fechainicio = $_REQUEST['fechainicio']; } if (isset($_REQUEST['fechafin'])) { $this->fechafin = $_REQUEST['fechafin']; } if (isset($_REQUEST['garantia'])) { $this->garantia = TRUE; } if (isset($_REQUEST['desde'])) { $this->desde = $_REQUEST['desde']; } if (isset($_REQUEST['hasta'])) { $this->hasta = $_REQUEST['hasta']; } } $this->buscar(); } } } }
protected function private_core() { $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->direccion = FALSE; $this->fabricante = new fabricante(); $this->familia = new familia(); $this->impuesto = new impuesto(); $this->results = array(); $this->grupo = new grupo_clientes(); $this->pais = new pais(); /// cargamos la configuración $fsvar = new fs_var(); $this->nuevocli_setup = $fsvar->array_get(array('nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 0, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 0, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 0, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 0, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0, 'nuevocli_codgrupo' => ''), FALSE); if (isset($_REQUEST['tipo'])) { $this->tipo = $_REQUEST['tipo']; } else { foreach ($this->tipos_a_guardar() as $t) { $this->tipo = $t['tipo']; break; } } if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_REQUEST['datoscliente'])) { $this->datos_cliente(); } 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['cliente'])) { $this->cliente_s = $this->cliente->get($_POST['cliente']); /** * Nuevo cliente */ if (isset($_POST['nuevo_cliente'])) { if ($_POST['nuevo_cliente'] != '') { $this->cliente_s = FALSE; if ($_POST['nuevo_cifnif'] != '') { $this->cliente_s = $this->cliente->get_by_cifnif($_POST['nuevo_cifnif']); if ($this->cliente_s) { $this->new_advice('Ya existe un cliente con ese ' . FS_CIFNIF . '. Se ha seleccionado.'); } } if (!$this->cliente_s) { $this->cliente_s = new cliente(); $this->cliente_s->codcliente = $this->cliente_s->get_new_codigo(); $this->cliente_s->nombre = $this->cliente_s->razonsocial = $_POST['nuevo_cliente']; $this->cliente_s->cifnif = $_POST['nuevo_cifnif']; if (isset($_POST['codgrupo'])) { if ($_POST['codgrupo'] != '') { $this->cliente_s->codgrupo = $_POST['codgrupo']; } } if (isset($_POST['nuevo_telefono1'])) { $this->cliente_s->telefono1 = $_POST['nuevo_telefono1']; } if (isset($_POST['nuevo_telefono2'])) { $this->cliente_s->telefono2 = $_POST['nuevo_telefono2']; } if ($this->cliente_s->save()) { $dircliente = new direccion_cliente(); $dircliente->codcliente = $this->cliente_s->codcliente; $dircliente->codpais = $this->empresa->codpais; $dircliente->provincia = $this->empresa->provincia; $dircliente->ciudad = $this->empresa->ciudad; $dircliente->descripcion = 'Principal'; if (isset($_POST['nuevo_pais'])) { $dircliente->codpais = $_POST['nuevo_pais']; } if (isset($_POST['nuevo_provincia'])) { $dircliente->provincia = $_POST['nuevo_provincia']; } if (isset($_POST['nuevo_ciudad'])) { $dircliente->ciudad = $_POST['nuevo_ciudad']; } if (isset($_POST['nuevo_codpostal'])) { $dircliente->codpostal = $_POST['nuevo_codpostal']; } if (isset($_POST['nuevo_direccion'])) { $dircliente->direccion = $_POST['nuevo_direccion']; } if ($dircliente->save()) { $this->new_message('Cliente agregado correctamente.'); } } else { $this->new_error_msg("¡Imposible guardar la dirección del cliente!"); } } } } if ($this->cliente_s) { foreach ($this->cliente_s->get_direcciones() as $dir) { if ($dir->domfacturacion) { $this->direccion = $dir; break; } } } 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'] == 'albaran') { $this->nuevo_albaran_cliente(); } else { if ($_POST['tipo'] == 'factura') { $this->nueva_factura_cliente(); } else { if ($_POST['tipo'] == 'presupuesto' and class_exists('presupuesto_cliente')) { $this->nuevo_presupuesto_cliente(); } else { if ($_POST['tipo'] == 'pedido' and class_exists('pedido_cliente')) { $this->nuevo_pedido_cliente(); } } } } if (!$this->direccion) { $this->direccion = new direccion_cliente(); $this->direccion->codcliente = $this->cliente_s->codcliente; $this->direccion->codpais = $_POST['codpais']; $this->direccion->provincia = $_POST['provincia']; $this->direccion->ciudad = $_POST['ciudad']; $this->direccion->codpostal = $_POST['codpostal']; $this->direccion->direccion = $_POST['direccion']; $this->direccion->descripcion = 'Principal'; $this->direccion->save(); } } } } } } } } }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->cliente = new cliente(); $this->grupo = new grupo_clientes(); $this->pais = new pais(); $this->serie = new serie(); $this->tarifa = new tarifa(); $this->tarifas = $this->tarifa->all(); $this->ncf_tipo = new ncf_tipo(); $this->ncf_entidad_tipo = new ncf_entidad_tipo(); /// cargamos la configuración $fsvar = new fs_var(); $this->nuevocli_setup = $fsvar->array_get(array('nuevocli_cifnif_req' => 0, 'nuevocli_direccion' => 1, 'nuevocli_direccion_req' => 0, 'nuevocli_codpostal' => 1, 'nuevocli_codpostal_req' => 0, 'nuevocli_pais' => 0, 'nuevocli_pais_req' => 0, 'nuevocli_provincia' => 1, 'nuevocli_provincia_req' => 0, 'nuevocli_ciudad' => 1, 'nuevocli_ciudad_req' => 0, 'nuevocli_telefono1' => 0, 'nuevocli_telefono1_req' => 0, 'nuevocli_telefono2' => 0, 'nuevocli_telefono2_req' => 0, 'nuevocli_codgrupo' => ''), FALSE); if (isset($_GET['delete_grupo'])) { $grupo = $this->grupo->get($_GET['delete_grupo']); if ($grupo) { if ($grupo->delete()) { $this->new_message('Grupo eliminado correctamente.'); } else { $this->new_error_msg('Imposible eliminar el grupo.'); } } else { $this->new_error_msg('Grupo no encontrado.'); } } else { if (isset($_POST['codgrupo'])) { $grupo = $this->grupo->get($_POST['codgrupo']); if (!$grupo) { $grupo = new grupo_clientes(); $grupo->codgrupo = $_POST['codgrupo']; } $grupo->nombre = $_POST['nombre']; $grupo->codtarifa = NULL; if ($_POST['codtarifa'] != '---') { $grupo->codtarifa = $_POST['codtarifa']; } if ($grupo->save()) { $this->new_message('Grupo guardado correctamente.'); } else { $this->new_error_msg('Imposible guardar el grupo.'); } } else { if (isset($_GET['delete'])) { $cliente = $this->cliente->get($_GET['delete']); if ($cliente) { if (FS_DEMO) { $this->new_error_msg('En el modo demo no se pueden eliminar clientes. Otros usuarios podrían necesitarlos.'); } else { if ($cliente->delete()) { $this->new_message('Cliente eliminado correctamente.'); } else { $this->new_error_msg('Ha sido imposible eliminar el cliente.'); } } } else { $this->new_error_msg('Cliente no encontrado.'); } } else { if (isset($_POST['cifnif'])) { $cliente = new cliente(); $cliente->codcliente = $cliente->get_new_codigo(); $cliente->nombre = $_POST['nombre']; $cliente->razonsocial = $_POST['nombre']; $cliente->tipoidfiscal = $_POST['tipoidfiscal']; $cliente->cifnif = $_POST['cifnif']; $cliente->personafisica = isset($_POST['personafisica']); if (isset($_POST['scodgrupo'])) { if ($_POST['scodgrupo'] != '') { $cliente->codgrupo = $_POST['scodgrupo']; } } if (isset($_POST['telefono1'])) { $cliente->telefono1 = $_POST['telefono1']; } if (isset($_POST['telefono2'])) { $cliente->telefono2 = $_POST['telefono2']; } if ($cliente->save()) { if (\filter_input(INPUT_POST, 'tipo_comprobante') != '') { $ncf_entidad_tipo = new ncf_entidad_tipo(); $ncf_entidad_tipo->idempresa = $this->empresa->id; $ncf_entidad_tipo->entidad = $cliente->codcliente; $ncf_entidad_tipo->tipo_entidad = 'CLI'; $ncf_entidad_tipo->tipo_comprobante = \filter_input(INPUT_POST, 'tipo_comprobante'); $ncf_entidad_tipo->estado = TRUE; $ncf_entidad_tipo->usuario_creacion = $this->user->nick; $ncf_entidad_tipo->fecha_creacion = Date('d-m-Y H:i:s'); $ncf_entidad_tipo->save(); } $dircliente = new direccion_cliente(); $dircliente->codcliente = $cliente->codcliente; $dircliente->codpais = $this->empresa->codpais; $dircliente->provincia = $this->empresa->provincia; $dircliente->ciudad = $this->empresa->ciudad; $dircliente->descripcion = 'Principal'; if (isset($_POST['pais'])) { $dircliente->codpais = $_POST['pais']; } if (isset($_POST['provincia'])) { $dircliente->provincia = $_POST['provincia']; } if (isset($_POST['ciudad'])) { $dircliente->ciudad = $_POST['ciudad']; } if (isset($_POST['codpostal'])) { $dircliente->codpostal = $_POST['codpostal']; } if (isset($_POST['direccion'])) { $dircliente->direccion = $_POST['direccion']; } if ($dircliente->save()) { if ($this->empresa->contintegrada) { /// forzamos la creación de la subcuenta $cliente->get_subcuenta($this->empresa->codejercicio); } /// redireccionamos a la página del cliente header('location: ' . $cliente->url()); } else { $this->new_error_msg("¡Imposible guardar la dirección del cliente!"); } } else { $this->new_error_msg("¡Imposible guardar los datos del cliente!"); } } } } } $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } $this->ciudad = ''; if (isset($_REQUEST['ciudad'])) { $this->ciudad = $this->empresa->no_html($_REQUEST['ciudad']); } $this->provincia = ''; if (isset($_REQUEST['provincia'])) { $this->provincia = $this->empresa->no_html($_REQUEST['provincia']); } $this->codpais = ''; if (isset($_REQUEST['codpais'])) { $this->codpais = $_REQUEST['codpais']; } $this->codgrupo = ''; if (isset($_REQUEST['bcodgrupo'])) { $this->codgrupo = $_REQUEST['bcodgrupo']; } $this->orden = 'nombre ASC'; if (isset($_REQUEST['orden'])) { $this->orden = $_REQUEST['orden']; } $this->nocifnif = isset($_REQUEST['nocifnif']); $this->debaja = isset($_REQUEST['debaja']); $this->buscar(); $this->grupos = $this->grupo->all(); }