Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 28, 2022 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/c452f21ebe1839772fa4673c3f3d2dcf to your computer and use it in GitHub Desktop.
Save parzibyte/c452f21ebe1839772fa4673c3f3d2dcf to your computer and use it in GitHub Desktop.
-- MariaDB dump 10.19 Distrib 10.4.20-MariaDB, for Win64 (AMD64)
--
-- Host: localhost Database: spos4
-- ------------------------------------------------------
-- Server version 10.4.20-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `abonos`
--
DROP TABLE IF EXISTS `abonos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `abonos` (
`idAbono` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`monto` decimal(9,2) NOT NULL,
`pago` decimal(9,2) NOT NULL DEFAULT 0.00,
`fecha` varchar(255) NOT NULL,
`idApartado` bigint(20) unsigned NOT NULL,
`idUsuario` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`idAbono`),
KEY `idApartado` (`idApartado`),
KEY `idUsuario` (`idUsuario`),
CONSTRAINT `abonos_ibfk_1` FOREIGN KEY (`idApartado`) REFERENCES `apartados` (`idApartado`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `abonos_ibfk_2` FOREIGN KEY (`idUsuario`) REFERENCES `usuarios` (`idUsuario`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `abonos`
--
LOCK TABLES `abonos` WRITE;
/*!40000 ALTER TABLE `abonos` DISABLE KEYS */;
/*!40000 ALTER TABLE `abonos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `apartados`
--
DROP TABLE IF EXISTS `apartados`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `apartados` (
`idApartado` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`monto` decimal(9,2) NOT NULL,
`pago` decimal(9,2) NOT NULL DEFAULT 0.00,
`abonado` decimal(9,2) NOT NULL,
`anticipo` decimal(9,2) NOT NULL,
`fecha` varchar(255) NOT NULL,
`fechaVencimiento` varchar(255) NOT NULL,
`idCliente` bigint(20) unsigned NOT NULL,
`idUsuario` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`idApartado`),
KEY `idCliente` (`idCliente`),
KEY `idUsuario` (`idUsuario`),
CONSTRAINT `apartados_ibfk_1` FOREIGN KEY (`idCliente`) REFERENCES `clientes` (`idCliente`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `apartados_ibfk_2` FOREIGN KEY (`idUsuario`) REFERENCES `usuarios` (`idUsuario`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `apartados`
--
LOCK TABLES `apartados` WRITE;
/*!40000 ALTER TABLE `apartados` DISABLE KEYS */;
/*!40000 ALTER TABLE `apartados` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `clientes`
--
DROP TABLE IF EXISTS `clientes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clientes` (
`idCliente` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nombreCompleto` varchar(255) NOT NULL,
`numeroTelefono` varchar(20) NOT NULL,
`cedula` varchar(200) NOT NULL,
`fechanac` varchar(200) NOT NULL,
`correoelec` varchar(200) NOT NULL,
`residencia` varchar(200) NOT NULL,
`lugartrab` varchar(200) NOT NULL,
`vendedor` varchar(200) NOT NULL,
`referencia` varchar(200) NOT NULL,
`observaciones` varchar(200) NOT NULL,
PRIMARY KEY (`idCliente`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `clientes`
--
LOCK TABLES `clientes` WRITE;
/*!40000 ALTER TABLE `clientes` DISABLE KEYS */;
INSERT INTO `clientes` VALUES (1,'Mostrador','0000-0000','0-0000-0000','00-00-0000','mostrador@mail.com','Prueba','Testeo','Admin','Mostrador1 0000-0000','Mostrador es un cliente vip'),(2,'Nombre','11111111','222222222','33333333','correo@gmail.com','residencia','trabajo','vendedor','referencia','observaciones');
/*!40000 ALTER TABLE `clientes` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `comun`
--
DROP TABLE IF EXISTS `comun`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `comun` (
`clave` varchar(255) DEFAULT NULL,
`valor` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `comun`
--
LOCK TABLES `comun` WRITE;
/*!40000 ALTER TABLE `comun` DISABLE KEYS */;
INSERT INTO `comun` VALUES ('NOMBRE_IMPRESORA',''),('CREATED_BY','parzibyte'),('MODO_IMPRESION_CODIGOS','codigo'),('MODO_LECTURA_CODIGOS','codigo'),('NUMERO_COPIAS_TICKET_CONTADO','1'),('NUMERO_COPIAS_TICKET_APARTADO','1'),('NUMERO_COPIAS_TICKET_ABONO','1');
/*!40000 ALTER TABLE `comun` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `egresos`
--
DROP TABLE IF EXISTS `egresos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `egresos` (
`monto` decimal(9,2) NOT NULL,
`descripcion` varchar(255) NOT NULL,
`fecha` varchar(255) NOT NULL,
`idUsuario` bigint(20) unsigned NOT NULL,
KEY `idUsuario` (`idUsuario`),
CONSTRAINT `egresos_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuarios` (`idUsuario`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `egresos`
--
LOCK TABLES `egresos` WRITE;
/*!40000 ALTER TABLE `egresos` DISABLE KEYS */;
/*!40000 ALTER TABLE `egresos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `empresa`
--
DROP TABLE IF EXISTS `empresa`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `empresa` (
`nombre` varchar(255) DEFAULT NULL,
`direccion` varchar(255) DEFAULT NULL,
`telefono` varchar(255) DEFAULT NULL,
`mensajePersonal` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `empresa`
--
LOCK TABLES `empresa` WRITE;
/*!40000 ALTER TABLE `empresa` DISABLE KEYS */;
INSERT INTO `empresa` VALUES ('','','','');
/*!40000 ALTER TABLE `empresa` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ingresos`
--
DROP TABLE IF EXISTS `ingresos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ingresos` (
`monto` decimal(9,2) NOT NULL,
`descripcion` varchar(255) NOT NULL,
`fecha` varchar(255) NOT NULL,
`idUsuario` bigint(20) unsigned NOT NULL,
KEY `idUsuario` (`idUsuario`),
CONSTRAINT `ingresos_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuarios` (`idUsuario`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ingresos`
--
LOCK TABLES `ingresos` WRITE;
/*!40000 ALTER TABLE `ingresos` DISABLE KEYS */;
/*!40000 ALTER TABLE `ingresos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `permisos`
--
DROP TABLE IF EXISTS `permisos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permisos` (
`idPermiso` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`clave` varchar(255) NOT NULL,
`descripcion` varchar(255) NOT NULL,
PRIMARY KEY (`idPermiso`),
KEY `clave_permiso` (`clave`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `permisos`
--
LOCK TABLES `permisos` WRITE;
/*!40000 ALTER TABLE `permisos` DISABLE KEYS */;
INSERT INTO `permisos` VALUES (1,'RegistrarVentaContado','Hacer ventas al contado e imprimir tickets de las mismas'),(2,'RegistrarApartado','Hacer apartados y realizar abonos a dichos apartados. También imprimir tickets o\r\ncomprobantes de ambos.'),(3,'VerReporteCaja','Ver e imprimir el reporte de caja general o por usuario'),(4,'VerUsuarios','Ver los usuarios existentes. Necesario para filtrar reportes por usuarios (si lo concede, no supone ningún riesgo)'),(5,'RegistrarUsuario','Agregar un nuevo usuario al sistema, pero no por ello asignarle permisos'),(6,'VerAjustes','Ver los ajustes, como lo son los datos de la empresa, nombre de la impresora, modo de lectura de códigos, entre otros. Necesario para vender.'),(7,'CambiarAjustes','Cambiar ajustes como los datos de la empresa, nombre de la impresora, entre otros'),(8,'VerGraficas','Ver gráficas de ventas por mes o año, así como estadísticas de productos'),(9,'RegistrarIngreso','Registrar un ingreso o entrada de efectivo'),(10,'RegistrarEgreso','Registrar egreso o salida de efectivo'),(11,'VerVentasContado','Ver el reporte de ventas al contado'),(12,'CambiarFechaVencimientoApartado','Cambiar la fecha de vencimiento de un apartado'),(13,'VerApartados','Ver el reporte de apartados, así como de los abonos que se han hecho a los mismos'),(14,'CambiarProductoDeApartado','Cambiar un producto de un apartado por otro de igual o mayor precio'),(15,'VerClientes','Ver los clientes, así como su historial de compras al contado y apartados'),(16,'AutocompletarClientes','Autocompletado de clientes (necesario para hacer ventas o apartados)'),(17,'RegistrarCliente','Registrar un nuevo cliente, ya sea desde el momento de vender o desde Clientes. Necesario para registrar cliente al vender'),(18,'ActualizarCliente','Modificar los datos de un cliente'),(19,'EliminarCliente','Eliminar un cliente y todo su historial'),(20,'VerReporteDeInventario','Ver el reporte general del inventario'),(21,'VerProductos','Ver los detalles de todos los productos existentes, así como exportarlos a CSV o Excel'),(22,'AutocompletarProductos','Autocompletado de productos (necesario para cambiar producto de apartado o para buscar un producto por su descripción al vender)'),(23,'RegistrarProducto','Registrar un producto e importar archivos'),(24,'ActualizarProducto','Modificar o editar un producto, por ejemplo aumentar o disminuir la existencia, cambiar el código de barras, precios, entre otros.'),(25,'ModificarYVerPermisos','Asignar, agregar o modificar permisos de cualquier usuario, incluso del administrador. Se recomienda tener cuidado con esta opción'),(26,'EliminarProducto','Eliminar un producto'),(27,'VerProductoPorCodigoONumero','Ver un producto por código de barras o número. Necesario para realizar ventas al contado y apartados.');
/*!40000 ALTER TABLE `permisos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `permisos_usuarios`
--
DROP TABLE IF EXISTS `permisos_usuarios`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permisos_usuarios` (
`idUsuario` bigint(20) unsigned NOT NULL,
`idPermiso` bigint(20) unsigned NOT NULL,
KEY `idUsuario` (`idUsuario`),
KEY `idPermiso` (`idPermiso`),
CONSTRAINT `permisos_usuarios_ibfk_1` FOREIGN KEY (`idUsuario`) REFERENCES `usuarios` (`idUsuario`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `permisos_usuarios_ibfk_2` FOREIGN KEY (`idPermiso`) REFERENCES `permisos` (`idPermiso`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `permisos_usuarios`
--
LOCK TABLES `permisos_usuarios` WRITE;
/*!40000 ALTER TABLE `permisos_usuarios` DISABLE KEYS */;
INSERT INTO `permisos_usuarios` VALUES (1,18),(1,24),(1,16),(1,22),(1,7),(1,12),(1,14),(1,19),(1,26),(1,25),(1,2),(1,17),(1,10),(1,9),(1,23),(1,5),(1,1),(1,6),(1,13),(1,15),(1,8),(1,27),(1,21),(1,3),(1,20),(1,4),(1,11);
/*!40000 ALTER TABLE `permisos_usuarios` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `productos`
--
DROP TABLE IF EXISTS `productos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `productos` (
`idProducto` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`codigoBarras` varchar(255) DEFAULT NULL,
`descripcion` varchar(255) NOT NULL,
`precioCompra` decimal(9,2) NOT NULL,
`precioVenta` decimal(9,2) NOT NULL,
`existencia` decimal(9,2) NOT NULL,
`stock` decimal(9,2) NOT NULL,
PRIMARY KEY (`idProducto`),
UNIQUE KEY `codigoBarras` (`codigoBarras`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `productos`
--
LOCK TABLES `productos` WRITE;
/*!40000 ALTER TABLE `productos` DISABLE KEYS */;
/*!40000 ALTER TABLE `productos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `productos_apartados`
--
DROP TABLE IF EXISTS `productos_apartados`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `productos_apartados` (
`idApartado` bigint(20) unsigned NOT NULL,
`idProducto` bigint(20) unsigned NOT NULL,
`codigoBarras` varchar(255) DEFAULT NULL,
`descripcion` varchar(255) NOT NULL,
`precioVenta` decimal(9,2) NOT NULL,
`precioVentaOriginal` decimal(9,2) NOT NULL,
`precioCompra` decimal(9,2) NOT NULL,
`cantidadVendida` decimal(9,2) NOT NULL,
KEY `idApartado` (`idApartado`),
KEY `idProducto` (`idProducto`),
CONSTRAINT `productos_apartados_ibfk_1` FOREIGN KEY (`idApartado`) REFERENCES `apartados` (`idApartado`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `productos_apartados_ibfk_2` FOREIGN KEY (`idProducto`) REFERENCES `productos` (`idProducto`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `productos_apartados`
--
LOCK TABLES `productos_apartados` WRITE;
/*!40000 ALTER TABLE `productos_apartados` DISABLE KEYS */;
/*!40000 ALTER TABLE `productos_apartados` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `productos_vendidos`
--
DROP TABLE IF EXISTS `productos_vendidos`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `productos_vendidos` (
`idProducto` bigint(20) unsigned NOT NULL,
`codigoBarras` varchar(255) DEFAULT NULL,
`idVenta` bigint(20) unsigned NOT NULL,
`descripcion` varchar(255) NOT NULL,
`precioCompra` decimal(9,2) NOT NULL,
`precioVenta` decimal(9,2) NOT NULL,
`precioVentaOriginal` decimal(9,2) NOT NULL,
`cantidadVendida` decimal(9,2) NOT NULL,
KEY `idVenta_indice` (`idVenta`),
CONSTRAINT `productos_vendidos_ibfk_1` FOREIGN KEY (`idVenta`) REFERENCES `ventas_contado` (`idVenta`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `productos_vendidos`
--
LOCK TABLES `productos_vendidos` WRITE;
/*!40000 ALTER TABLE `productos_vendidos` DISABLE KEYS */;
/*!40000 ALTER TABLE `productos_vendidos` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuarios`
--
DROP TABLE IF EXISTS `usuarios`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuarios` (
`idUsuario` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`nombre` varchar(255) NOT NULL,
`contraseña` varchar(255) NOT NULL,
PRIMARY KEY (`idUsuario`),
UNIQUE KEY `nombre` (`nombre`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuarios`
--
LOCK TABLES `usuarios` WRITE;
/*!40000 ALTER TABLE `usuarios` DISABLE KEYS */;
INSERT INTO `usuarios` VALUES (1,'admin','$2a$10$yFRKq.alpc7nYNDluOBPYO2FtbYr9p8TBfWtccnbj/JihPO/c8F2e');
/*!40000 ALTER TABLE `usuarios` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ventas_contado`
--
DROP TABLE IF EXISTS `ventas_contado`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ventas_contado` (
`idVenta` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`monto` decimal(9,2) NOT NULL,
`pago` decimal(9,2) NOT NULL DEFAULT 0.00,
`fecha` varchar(255) NOT NULL,
`idCliente` bigint(20) unsigned NOT NULL,
`idUsuario` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`idVenta`),
KEY `idCliente` (`idCliente`),
KEY `idUsuario` (`idUsuario`),
CONSTRAINT `ventas_contado_ibfk_1` FOREIGN KEY (`idCliente`) REFERENCES `clientes` (`idCliente`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `ventas_contado_ibfk_2` FOREIGN KEY (`idUsuario`) REFERENCES `usuarios` (`idUsuario`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ventas_contado`
--
LOCK TABLES `ventas_contado` WRITE;
/*!40000 ALTER TABLE `ventas_contado` DISABLE KEYS */;
/*!40000 ALTER TABLE `ventas_contado` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-04-28 17:59:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment