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--; } } }
/** * Vuelca en la salida estándar el buffer de tickets pendientes de imprimir. */ function remote_printer() { if (isset($_REQUEST['terminal'])) { require_model('terminal_caja.php'); $t0 = new terminal_caja(); $terminal = $t0->get($_REQUEST['terminal']); if ($terminal) { echo $terminal->tickets; $terminal->tickets = ''; $terminal->save(); } else { echo 'ERROR: terminal no encontrado.'; } } }
protected function private_core() { $this->share_extensions(); /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->articulo = new articulo(); $this->cliente = new cliente(); $this->cliente_s = FALSE; $this->familia = new familia(); $this->impuesto = new impuesto(); $this->results = array(); if (isset($_REQUEST['buscar_cliente'])) { $this->buscar_cliente(); } else { if (isset($_REQUEST['datoscliente'])) { $this->datos_cliente(); } else { if ($this->query != '') { $this->new_search(); } else { if (isset($_REQUEST['referencia4precios'])) { $this->get_precios_articulo(); } else { $this->agente = $this->user->get_agente(); $this->almacen = new almacen(); $this->divisa = new divisa(); $this->ejercicio = new ejercicio(); $this->forma_pago = new forma_pago(); $this->serie = new serie(); $this->imprimir_descripciones = isset($_COOKIE['imprimir_desc']); $this->imprimir_observaciones = isset($_COOKIE['imprimir_obs']); if ($this->agente) { $this->caja = FALSE; $this->terminal = FALSE; $caja = new caja(); $terminal0 = new terminal_caja(); foreach ($caja->all_by_agente($this->agente->codagente) as $cj) { if ($cj->abierta()) { $this->caja = $cj; $this->terminal = $terminal0->get($cj->fs_id); break; } } if (!$this->caja) { if (isset($_POST['terminal'])) { $this->terminal = $terminal0->get($_POST['terminal']); if (!$this->terminal) { $this->new_error_msg('Terminal no encontrado.'); } else { if ($this->terminal->disponible()) { $this->caja = new caja(); $this->caja->fs_id = $this->terminal->id; $this->caja->codagente = $this->agente->codagente; $this->caja->dinero_inicial = floatval($_POST['d_inicial']); $this->caja->dinero_fin = floatval($_POST['d_inicial']); if ($this->caja->save()) { $this->new_message("Caja iniciada con " . $this->show_precio($this->caja->dinero_inicial)); } else { $this->new_error_msg("¡Imposible guardar los datos de caja!"); } } else { $this->new_error_msg('El terminal ya no está disponible.'); } } } else { if (isset($_GET['terminal'])) { $this->terminal = $terminal0->get($_GET['terminal']); if ($this->terminal) { $this->terminal->abrir_cajon(); $this->terminal->save(); } else { $this->new_error_msg('Terminal no encontrado.'); } } } } if ($this->caja) { if (isset($_POST['cliente'])) { $this->cliente_s = $this->cliente->get($_POST['cliente']); } else { if ($this->terminal) { $this->cliente_s = $this->cliente->get($this->terminal->codcliente); } } if (!$this->cliente_s) { foreach ($this->cliente->all() as $cli) { $this->cliente_s = $cli; break; } } if (isset($_GET['abrir_caja'])) { $this->abrir_caja(); } else { if (isset($_GET['cerrar_caja'])) { $this->cerrar_caja(); } else { if (isset($_POST['cliente'])) { if (intval($_POST['numlineas']) > 0) { $this->nueva_factura_cliente(); } } else { if (isset($_GET['reticket'])) { $this->reimprimir_ticket(); } } } } } else { $this->results = $terminal0->disponibles(); } } else { $this->new_error_msg('No tienes un <a href="' . $this->user->url() . '">agente asociado</a> a tu usuario, y por tanto no puedes hacer tickets.'); } } } } } }
protected function private_core() { /// ¿El usuario tiene permiso para eliminar en esta página? $this->allow_delete = $this->user->allow_delete_on(__CLASS__); $this->almacen = new almacen(); $this->caja = new caja(); $this->serie = new serie(); $this->terminal = new terminal_caja(); $this->ncf_rango = new ncf_rango(); $terminal = new terminal_caja(); if (isset($_POST['nuevot'])) { $terminal->codalmacen = $_POST['codalmacen']; $terminal->codserie = $_POST['codserie']; $terminal->area_impresion = $_POST['area_impresion']; $terminal->codcliente = NULL; if ($_POST['codcliente'] != '') { $terminal->codcliente = $_POST['codcliente']; } $terminal->anchopapel = intval($_POST['anchopapel']); $terminal->comandoapertura = $_POST['comandoapertura']; $terminal->comandocorte = $_POST['comandocorte']; $terminal->num_tickets = intval($_POST['num_tickets']); $terminal->sin_comandos = isset($_POST['sin_comandos']); if ($terminal->save()) { $this->new_message('Terminal añadido correctamente.'); header('Location: index.php?page=tpv_recambios'); } else { $this->new_error_msg('Error al guardar los datos.'); } } else { if (isset($_POST['idt'])) { $t2 = $terminal->get($_POST['idt']); if ($t2) { $t2->codalmacen = $_POST['codalmacen']; $t2->codserie = $_POST['codserie']; $t2->area_impresion = $_POST['area_impresion']; $t2->codcliente = NULL; if ($_POST['codcliente'] != '') { $t2->codcliente = $_POST['codcliente']; } $t2->anchopapel = intval($_POST['anchopapel']); $t2->comandoapertura = $_POST['comandoapertura']; $t2->comandocorte = $_POST['comandocorte']; $t2->num_tickets = intval($_POST['num_tickets']); $t2->sin_comandos = isset($_POST['sin_comandos']); if ($t2->save()) { $this->new_message('Datos guardados correctamente.'); } else { $this->new_error_msg('Error al guardar los datos.'); } } else { $this->new_error_msg('Terminal no encontrado.'); } } else { if (isset($_GET['deletet'])) { if ($this->user->admin) { $t2 = $terminal->get($_GET['deletet']); if ($t2) { if ($t2->delete()) { $this->new_message('Terminal eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el terminal.'); } } else { $this->new_error_msg('Terminal no encontrado.'); } } else { $this->new_error_msg("Tienes que ser administrador para poder eliminar terminales."); } } else { if (isset($_GET['delete'])) { if ($this->user->admin) { $caja2 = $this->caja->get($_GET['delete']); if ($caja2) { if ($caja2->delete()) { $this->new_message("Arqueo eliminado correctamente."); } else { $this->new_error_msg("¡Imposible eliminar el arqueo!"); } } else { $this->new_error_msg("Arqueo no encontrado."); } } else { $this->new_error_msg("Tienes que ser administrador para poder eliminar arqueos."); } } else { if (isset($_GET['cerrar'])) { if ($this->user->admin) { $caja2 = $this->caja->get($_GET['cerrar']); if ($caja2) { $caja2->fecha_fin = Date('d-m-Y H:i:s'); if ($caja2->save()) { $this->new_message("Arqueo cerrado correctamente."); } else { $this->new_error_msg("¡Imposible cerrar el arqueo!"); } } else { $this->new_error_msg("Arqueo no encontrado."); } } else { $this->new_error_msg("Tienes que ser administrador para poder cerrar arqueos."); } } } } } } $this->offset = 0; if (isset($_GET['offset'])) { $this->offset = intval($_GET['offset']); } $this->resultados = $this->caja->all($this->offset); $this->terminales = $terminal->all(); }
public function deleteTerminalAction() { $terminal = new terminal_caja(); if ($this->user->admin) { $t2 = $terminal->get($_GET['deletet']); if ($t2) { if ($t2->delete()) { $this->new_message('Terminal eliminado correctamente.'); } else { $this->new_error_msg('Error al eliminar el terminal.'); } } else { $this->new_error_msg('Terminal no encontrado.'); } } else { $this->new_error_msg("Tienes que ser administrador para poder eliminar terminales."); } }