-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 21-03-2025 a las 06:38:42
-- Versión del servidor: 10.4.28-MariaDB
-- Versión de PHP: 8.2.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!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 */;

--
-- Base de datos: `heladeria`
--

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `cierre_ventas`
--

CREATE TABLE `cierre_ventas` (
  `id` int(11) NOT NULL,
  `fecha` date NOT NULL,
  `efectivo_bs` decimal(10,2) NOT NULL,
  `efectivo_usd` decimal(10,2) NOT NULL,
  `otros_metodos` decimal(10,2) NOT NULL,
  `total_general` decimal(10,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `cierre_ventas`
--

INSERT INTO `cierre_ventas` (`id`, `fecha`, `efectivo_bs`, `efectivo_usd`, `otros_metodos`, `total_general`, `created_at`) VALUES
(2, '2025-02-20', 60.00, 1.00, 202.51, 325.72, '2025-02-20 16:16:38');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `cierre_ventas_mes`
--

CREATE TABLE `cierre_ventas_mes` (
  `id` int(11) NOT NULL,
  `mes` varchar(7) NOT NULL,
  `efectivo_bs` decimal(10,2) NOT NULL,
  `efectivo_usd` decimal(10,2) NOT NULL,
  `otros_metodos` decimal(10,2) NOT NULL,
  `total_general` decimal(10,2) NOT NULL,
  `created_at` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `cierre_ventas_mes`
--

INSERT INTO `cierre_ventas_mes` (`id`, `mes`, `efectivo_bs`, `efectivo_usd`, `otros_metodos`, `total_general`, `created_at`) VALUES
(2, '2025-02', 60.00, 1.00, 202.51, 325.72, '2025-02-20 16:16:49');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `consumibles`
--

CREATE TABLE `consumibles` (
  `id` int(11) NOT NULL,
  `nombre` varchar(255) NOT NULL,
  `descripcion` text DEFAULT NULL,
  `cantidad` int(11) NOT NULL,
  `precio` decimal(10,2) NOT NULL,
  `fecha_creacion` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `consumibles`
--

INSERT INTO `consumibles` (`id`, `nombre`, `descripcion`, `cantidad`, `precio`, `fecha_creacion`) VALUES
(1, 'Servilleta', NULL, 25, 0.00, '2025-01-03 01:44:32'),
(11, 'silla', NULL, 19, 0.00, '2025-01-14 18:48:26');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `detalle_venta`
--

CREATE TABLE `detalle_venta` (
  `id` int(11) NOT NULL,
  `venta_id` int(11) DEFAULT NULL,
  `producto_id` int(11) DEFAULT NULL,
  `consumible_id` int(11) DEFAULT NULL,
  `cantidad_producto` int(11) DEFAULT NULL,
  `cantidad_consumible` int(11) DEFAULT NULL,
  `precio` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `detalle_ventas`
--

CREATE TABLE `detalle_ventas` (
  `id` int(11) NOT NULL,
  `venta_id` int(11) NOT NULL,
  `producto_id` int(11) DEFAULT NULL,
  `consumible_id` int(11) DEFAULT NULL,
  `cantidad` int(11) NOT NULL,
  `subtotal` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `detalle_ventas`
--

INSERT INTO `detalle_ventas` (`id`, `venta_id`, `producto_id`, `consumible_id`, `cantidad`, `subtotal`) VALUES
(1, 1, 46, NULL, 1, 1.00),
(2, 1, NULL, 1, 1, 0.00),
(3, 1, NULL, 11, 1, 0.00),
(4, 2, 47, NULL, 1, 100.00),
(5, 2, 46, NULL, 1, 1.00),
(6, 3, 46, NULL, 1, 1.00),
(7, 3, 47, NULL, 1, 100.00),
(8, 4, 47, NULL, 1, 100.00),
(9, 4, 46, NULL, 1, 1.00),
(10, 5, 47, NULL, 1, 100.00),
(11, 5, 46, NULL, 1, 1.00),
(12, 6, 47, NULL, 1, 100.00),
(13, 6, 46, NULL, 1, 1.00),
(14, 7, 46, NULL, 1, 1.00),
(15, 7, 47, NULL, 1, 100.00),
(16, 7, NULL, 1, 1, 0.00),
(17, 8, 46, NULL, 3, 3.00),
(18, 9, 46, NULL, 1, 1.00),
(19, 9, 47, NULL, 1, 100.00),
(20, 14, 46, NULL, 1, 1.00),
(21, 14, 47, NULL, 1, 100.00),
(22, 15, 47, NULL, 1, 100.00),
(23, 16, 47, NULL, 1, 100.00),
(24, 16, NULL, 1, 1, 0.00),
(25, 17, 46, NULL, 2, 2.00),
(26, 17, NULL, 1, 2, 0.00),
(27, 17, 47, NULL, 2, 200.00),
(28, 18, 47, NULL, 1, 100.00),
(29, 21, 47, NULL, 1, 100.00),
(30, 21, 46, NULL, 1, 1.00),
(31, 22, 46, NULL, 1, 1.00),
(32, 22, 47, NULL, 1, 100.00);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `historial_inventario`
--

CREATE TABLE `historial_inventario` (
  `id` int(11) NOT NULL,
  `producto_id` int(11) DEFAULT NULL,
  `consumible_id` int(11) DEFAULT NULL,
  `cantidad` int(11) DEFAULT NULL,
  `tipo_cambio` enum('entrada','salida') DEFAULT NULL,
  `fecha` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `historial_inventario`
--

INSERT INTO `historial_inventario` (`id`, `producto_id`, `consumible_id`, `cantidad`, `tipo_cambio`, `fecha`) VALUES
(4, 15, NULL, 12, 'entrada', '2025-01-11 13:13:30'),
(5, 16, NULL, 12, 'entrada', '2025-01-11 13:15:04'),
(6, 17, NULL, 12, 'entrada', '2025-01-11 13:15:20'),
(7, 18, NULL, 19, 'entrada', '2025-01-11 13:24:57'),
(8, 19, NULL, 19, 'entrada', '2025-01-11 13:25:36'),
(9, 20, NULL, 19, 'entrada', '2025-01-11 13:26:35');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `inventario`
--

CREATE TABLE `inventario` (
  `id` int(11) NOT NULL,
  `producto_id` int(11) NOT NULL,
  `consumible_id` int(11) NOT NULL,
  `cantidad` int(11) NOT NULL,
  `tipo_cambio` enum('agregado','vendido') NOT NULL,
  `fecha` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `metodos_pago`
--

CREATE TABLE `metodos_pago` (
  `id` int(11) NOT NULL,
  `venta_id` int(11) NOT NULL,
  `tipo` enum('efectivo_bs','efectivo_usd','tarjeta','pago_movil','bio_pago') NOT NULL,
  `monto` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `metodos_pago`
--

INSERT INTO `metodos_pago` (`id`, `venta_id`, `tipo`, `monto`) VALUES
(1, 5, 'efectivo_usd', 1.00),
(2, 5, 'efectivo_bs', 100.00),
(3, 6, 'tarjeta', 159.99),
(4, 7, 'efectivo_usd', 1.00),
(5, 7, 'pago_movil', 100.00),
(6, 8, 'efectivo_usd', 3.00),
(7, 9, 'efectivo_bs', 200.00),
(8, 14, 'efectivo_usd', 1.00),
(9, 14, 'efectivo_bs', 200.00),
(10, 14, '', -50.00),
(11, 15, 'efectivo_bs', 150.00),
(12, 15, '', -50.00),
(13, 16, '', -100.00),
(14, 17, 'tarjeta', 300.00),
(15, 17, 'efectivo_bs', 50.00),
(16, 17, '', -25.00),
(17, 19, 'efectivo_bs', 100.00),
(18, 20, 'efectivo_bs', 100.00),
(19, 21, 'tarjeta', 102.00),
(20, 21, 'efectivo_bs', 60.00),
(21, 22, 'efectivo_usd', 1.00),
(22, 22, 'tarjeta', 100.00);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `productos`
--

CREATE TABLE `productos` (
  `id` int(11) NOT NULL,
  `nombre` varchar(255) NOT NULL,
  `descripcion` text DEFAULT NULL,
  `cantidad` int(11) NOT NULL,
  `precio` decimal(10,2) NOT NULL,
  `fecha_creacion` timestamp NOT NULL DEFAULT current_timestamp(),
  `moneda` varchar(300) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `productos`
--

INSERT INTO `productos` (`id`, `nombre`, `descripcion`, `cantidad`, `precio`, `fecha_creacion`, `moneda`) VALUES
(46, 'barquilla', NULL, 10, 1.00, '2025-01-16 22:40:50', 'dolares'),
(47, 'helado', NULL, 10, 100.00, '2025-01-16 22:41:25', 'bolivares');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `registro_cambios`
--

CREATE TABLE `registro_cambios` (
  `id` int(11) NOT NULL,
  `producto_id` int(11) DEFAULT NULL,
  `accion` enum('agregar','eliminar','editar') DEFAULT NULL,
  `fecha` datetime DEFAULT current_timestamp(),
  `cantidad` int(11) DEFAULT NULL,
  `cantidad_anterior` int(11) DEFAULT NULL,
  `cantidad_nueva` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `registro_cambios`
--

INSERT INTO `registro_cambios` (`id`, `producto_id`, `accion`, `fecha`, `cantidad`, `cantidad_anterior`, `cantidad_nueva`) VALUES
(1, 24, 'agregar', '2025-01-11 15:04:33', 3, NULL, NULL),
(2, 9, 'agregar', '2025-01-11 15:06:20', 2, NULL, NULL),
(3, 25, 'agregar', '2025-01-11 15:10:01', 1, NULL, NULL),
(4, 25, 'eliminar', '2025-01-11 15:10:14', 1, NULL, NULL),
(5, 10, 'agregar', '2025-01-11 15:11:36', 2, NULL, NULL),
(6, 10, 'eliminar', '2025-01-11 15:11:39', 2, NULL, NULL),
(7, 23, 'editar', '2025-01-11 15:18:19', NULL, 6, 6),
(8, 23, 'eliminar', '2025-01-11 15:18:52', 6, NULL, NULL),
(9, 26, 'agregar', '2025-01-11 15:19:04', 2, NULL, NULL),
(10, 26, 'editar', '2025-01-11 15:19:24', NULL, 2, 4),
(11, 1, 'editar', '2025-01-11 15:22:39', NULL, 1, 4),
(12, 27, 'agregar', '2025-01-14 12:58:18', 20, NULL, NULL),
(13, 26, 'editar', '2025-01-14 12:58:47', NULL, 4, 7),
(14, 27, 'editar', '2025-01-14 12:58:55', NULL, 20, 10),
(15, 26, 'editar', '2025-01-14 13:02:29', NULL, 7, 30),
(16, 26, '', '2025-01-14 14:35:13', 10, NULL, NULL),
(17, 27, '', '2025-01-14 14:36:00', 10, NULL, NULL),
(18, 11, 'agregar', '2025-01-14 14:48:26', 10, NULL, NULL),
(19, 12, 'agregar', '2025-01-14 15:25:46', 123, NULL, NULL),
(20, 12, 'eliminar', '2025-01-14 15:25:53', 123, NULL, NULL),
(21, 28, 'agregar', '2025-01-16 17:19:30', 3, NULL, NULL),
(22, 28, 'editar', '2025-01-16 17:21:13', NULL, 3, 3),
(23, 28, 'eliminar', '2025-01-16 17:21:44', 3, NULL, NULL),
(24, 29, 'agregar', '2025-01-16 17:21:59', 12, NULL, NULL),
(25, 29, 'eliminar', '2025-01-16 17:24:56', 12, NULL, NULL),
(26, 30, 'agregar', '2025-01-16 17:25:56', 12, NULL, NULL),
(27, 30, 'editar', '2025-01-16 17:34:01', NULL, 12, 12),
(28, 30, 'eliminar', '2025-01-16 17:34:12', 12, NULL, NULL),
(29, 31, 'agregar', '2025-01-16 17:34:41', 10, NULL, NULL),
(30, 31, 'eliminar', '2025-01-16 17:51:30', 10, NULL, NULL),
(31, 32, 'agregar', '2025-01-16 17:55:10', 10, NULL, NULL),
(32, 32, 'eliminar', '2025-01-16 17:55:18', 10, NULL, NULL),
(33, 33, 'agregar', '2025-01-16 17:55:41', 12, NULL, NULL),
(34, 33, 'eliminar', '2025-01-16 17:57:38', 12, NULL, NULL),
(35, 34, 'agregar', '2025-01-16 17:57:59', 13, NULL, NULL),
(36, 34, 'eliminar', '2025-01-16 18:06:50', 13, NULL, NULL),
(37, 27, 'eliminar', '2025-01-16 18:06:57', 10, NULL, NULL),
(38, 26, 'eliminar', '2025-01-16 18:07:00', 40, NULL, NULL),
(39, 35, 'agregar', '2025-01-16 18:07:09', 12, NULL, NULL),
(40, 36, 'agregar', '2025-01-16 18:07:48', 12, NULL, NULL),
(41, 36, 'eliminar', '2025-01-16 18:09:03', 12, NULL, NULL),
(42, 35, 'eliminar', '2025-01-16 18:09:07', 12, NULL, NULL),
(43, 37, 'agregar', '2025-01-16 18:10:32', 12, NULL, NULL),
(44, 38, 'agregar', '2025-01-16 18:17:10', 12, NULL, NULL),
(45, 38, 'editar', '2025-01-16 18:17:26', NULL, 12, 12),
(46, 38, 'eliminar', '2025-01-16 18:26:06', 12, NULL, NULL),
(47, 37, 'eliminar', '2025-01-16 18:26:09', 22, NULL, NULL),
(48, 39, 'agregar', '2025-01-16 18:26:22', 12, NULL, NULL),
(49, 39, 'editar', '2025-01-16 18:26:35', NULL, 12, 12),
(50, 39, 'eliminar', '2025-01-16 18:26:40', 12, NULL, NULL),
(51, 40, 'agregar', '2025-01-16 18:27:03', 14, NULL, NULL),
(52, 40, 'eliminar', '2025-01-16 18:27:25', 14, NULL, NULL),
(53, 41, 'agregar', '2025-01-16 18:27:31', 12, NULL, NULL),
(54, 41, 'eliminar', '2025-01-16 18:27:44', 12, NULL, NULL),
(55, 42, 'agregar', '2025-01-16 18:30:14', 14, NULL, NULL),
(56, 42, 'eliminar', '2025-01-16 18:30:21', 14, NULL, NULL),
(57, 43, 'agregar', '2025-01-16 18:30:30', 12, NULL, NULL),
(58, 43, 'editar', '2025-01-16 18:30:39', NULL, 12, 12),
(59, 44, 'agregar', '2025-01-16 18:31:14', 15, NULL, NULL),
(60, 44, 'eliminar', '2025-01-16 18:33:52', 15, NULL, NULL),
(61, 43, 'eliminar', '2025-01-16 18:33:55', 12, NULL, NULL),
(62, 45, 'agregar', '2025-01-16 18:34:01', 12, NULL, NULL),
(63, 45, 'eliminar', '2025-01-16 18:40:44', 12, NULL, NULL),
(64, 46, 'agregar', '2025-01-16 18:40:50', 12, NULL, NULL),
(65, 47, 'agregar', '2025-01-16 18:41:25', 14, NULL, NULL),
(66, 46, 'editar', '2025-02-17 17:29:10', NULL, -1, 2),
(67, 46, 'editar', '2025-03-21 01:30:53', NULL, -4, 10),
(68, 47, 'editar', '2025-03-21 01:31:01', NULL, -1, 10);

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `registro_cambios_consumibles`
--

CREATE TABLE `registro_cambios_consumibles` (
  `id` int(11) NOT NULL,
  `consumible_id` int(11) NOT NULL,
  `cantidad_anterior` int(11) NOT NULL,
  `cantidad_agregada` int(11) NOT NULL,
  `cantidad_disminuida` int(11) NOT NULL,
  `cantidad_actual` int(11) NOT NULL,
  `fecha` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `registro_cambios_consumibles`
--

INSERT INTO `registro_cambios_consumibles` (`id`, `consumible_id`, `cantidad_anterior`, `cantidad_agregada`, `cantidad_disminuida`, `cantidad_actual`, `fecha`) VALUES
(1, 1, 30, 9, 0, 39, '2025-01-14 19:31:06'),
(2, 1, 39, 0, 9, 30, '2025-01-14 19:31:18'),
(3, 11, 22, 0, 2, 20, '2025-01-14 19:31:25');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `registro_cambios_productos`
--

CREATE TABLE `registro_cambios_productos` (
  `id` int(11) NOT NULL,
  `producto_id` int(11) NOT NULL,
  `cantidad_anterior` int(11) NOT NULL,
  `cantidad_agregada` int(11) NOT NULL,
  `cantidad_disminuida` int(11) NOT NULL,
  `cantidad_actual` int(11) NOT NULL,
  `fecha` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `registro_cambios_productos`
--

INSERT INTO `registro_cambios_productos` (`id`, `producto_id`, `cantidad_anterior`, `cantidad_agregada`, `cantidad_disminuida`, `cantidad_actual`, `fecha`) VALUES
(5, 46, 12, 7, 0, 19, '2025-01-17 18:59:37'),
(6, 46, 19, 0, 10, 9, '2025-01-17 18:59:52');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `reportes`
--

CREATE TABLE `reportes` (
  `id` int(11) NOT NULL,
  `tipo` enum('diario','general') NOT NULL,
  `fecha_inicio` datetime NOT NULL,
  `fecha_fin` datetime NOT NULL,
  `monto_total` decimal(10,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `reportes_ventas`
--

CREATE TABLE `reportes_ventas` (
  `id` int(11) NOT NULL,
  `fecha` datetime NOT NULL,
  `tipo_reporte` enum('diario','general','factura') NOT NULL,
  `datos` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `usuarios`
--

CREATE TABLE `usuarios` (
  `id` int(11) NOT NULL,
  `nombre` varchar(255) NOT NULL,
  `correo` varchar(255) NOT NULL,
  `contraseña` varchar(255) NOT NULL,
  `rol` enum('admin','user') NOT NULL,
  `fecha_creacion` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `usuarios`
--

INSERT INTO `usuarios` (`id`, `nombre`, `correo`, `contraseña`, `rol`, `fecha_creacion`) VALUES
(1, 'admin', 'admin@gmail.com', '$2y$10$fERxLiF/BCJmoQqBgAe6SOa9aOEApJCSEkYtHpXz5IN7fPtrqofYi', 'admin', '2024-12-29 03:03:01'),
(8, 'Salvatore', 'salvatoreberticci19@gmail.com', '$2y$10$3IbXUs9stNSGIfuGS2789u6myPjObCdkNQAzhiVrPN43019nD2me.', 'user', '2025-01-03 00:34:18');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `ventas`
--

CREATE TABLE `ventas` (
  `id` int(11) NOT NULL,
  `fecha` datetime NOT NULL,
  `total` decimal(10,2) NOT NULL,
  `tipo_pago` enum('efectivo_bs','efectivo_usd','tarjeta','pago_movil','bio_pago') NOT NULL,
  `vuelto` decimal(10,2) DEFAULT 0.00,
  `usuario_id` int(11) DEFAULT NULL,
  `total_dolares` decimal(10,2) NOT NULL,
  `total_bolivares` decimal(10,2) NOT NULL,
  `total_general` decimal(10,2) NOT NULL,
  `vuelto_bs` decimal(10,2) DEFAULT 0.00,
  `vuelto_usd` decimal(10,2) DEFAULT 0.00,
  `efectivo_bs` decimal(10,2) DEFAULT 0.00,
  `efectivo_usd` decimal(10,2) DEFAULT 0.00,
  `total_efectivo` decimal(10,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Volcado de datos para la tabla `ventas`
--

INSERT INTO `ventas` (`id`, `fecha`, `total`, `tipo_pago`, `vuelto`, `usuario_id`, `total_dolares`, `total_bolivares`, `total_general`, `vuelto_bs`, `vuelto_usd`, `efectivo_bs`, `efectivo_usd`, `total_efectivo`) VALUES
(21, '2025-02-20 16:11:23', 0.00, 'efectivo_bs', 0.00, 1, 1.00, 100.00, 162.51, 0.00, 0.00, 60.00, 0.00, 60.00),
(22, '2025-02-20 16:15:32', 0.00, 'efectivo_bs', 0.00, 1, 1.00, 100.00, 163.21, 0.00, 0.00, 0.00, 1.00, -63.21);

--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `cierre_ventas`
--
ALTER TABLE `cierre_ventas`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `cierre_ventas_mes`
--
ALTER TABLE `cierre_ventas_mes`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `consumibles`
--
ALTER TABLE `consumibles`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
  ADD PRIMARY KEY (`id`),
  ADD KEY `venta_id` (`venta_id`),
  ADD KEY `producto_id` (`producto_id`),
  ADD KEY `consumible_id` (`consumible_id`);

--
-- Indices de la tabla `detalle_ventas`
--
ALTER TABLE `detalle_ventas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `venta_id` (`venta_id`),
  ADD KEY `producto_id` (`producto_id`),
  ADD KEY `consumible_id` (`consumible_id`);

--
-- Indices de la tabla `historial_inventario`
--
ALTER TABLE `historial_inventario`
  ADD PRIMARY KEY (`id`),
  ADD KEY `producto_id` (`producto_id`),
  ADD KEY `consumible_id` (`consumible_id`);

--
-- Indices de la tabla `inventario`
--
ALTER TABLE `inventario`
  ADD PRIMARY KEY (`id`),
  ADD KEY `producto_id` (`producto_id`),
  ADD KEY `consumible_id` (`consumible_id`);

--
-- Indices de la tabla `metodos_pago`
--
ALTER TABLE `metodos_pago`
  ADD PRIMARY KEY (`id`),
  ADD KEY `venta_id` (`venta_id`);

--
-- Indices de la tabla `productos`
--
ALTER TABLE `productos`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `registro_cambios`
--
ALTER TABLE `registro_cambios`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `registro_cambios_consumibles`
--
ALTER TABLE `registro_cambios_consumibles`
  ADD PRIMARY KEY (`id`),
  ADD KEY `consumible_id` (`consumible_id`);

--
-- Indices de la tabla `registro_cambios_productos`
--
ALTER TABLE `registro_cambios_productos`
  ADD PRIMARY KEY (`id`),
  ADD KEY `producto_id` (`producto_id`);

--
-- Indices de la tabla `reportes`
--
ALTER TABLE `reportes`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `reportes_ventas`
--
ALTER TABLE `reportes_ventas`
  ADD PRIMARY KEY (`id`);

--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `correo` (`correo`);

--
-- Indices de la tabla `ventas`
--
ALTER TABLE `ventas`
  ADD PRIMARY KEY (`id`),
  ADD KEY `usuario_id` (`usuario_id`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `cierre_ventas`
--
ALTER TABLE `cierre_ventas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de la tabla `cierre_ventas_mes`
--
ALTER TABLE `cierre_ventas_mes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT de la tabla `consumibles`
--
ALTER TABLE `consumibles`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT de la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `detalle_ventas`
--
ALTER TABLE `detalle_ventas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

--
-- AUTO_INCREMENT de la tabla `historial_inventario`
--
ALTER TABLE `historial_inventario`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT de la tabla `inventario`
--
ALTER TABLE `inventario`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `metodos_pago`
--
ALTER TABLE `metodos_pago`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- AUTO_INCREMENT de la tabla `productos`
--
ALTER TABLE `productos`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=48;

--
-- AUTO_INCREMENT de la tabla `registro_cambios`
--
ALTER TABLE `registro_cambios`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;

--
-- AUTO_INCREMENT de la tabla `registro_cambios_consumibles`
--
ALTER TABLE `registro_cambios_consumibles`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT de la tabla `registro_cambios_productos`
--
ALTER TABLE `registro_cambios_productos`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT de la tabla `reportes`
--
ALTER TABLE `reportes`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `reportes_ventas`
--
ALTER TABLE `reportes_ventas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE `usuarios`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT de la tabla `ventas`
--
ALTER TABLE `ventas`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;

--
-- Restricciones para tablas volcadas
--

--
-- Filtros para la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
  ADD CONSTRAINT `detalle_venta_ibfk_1` FOREIGN KEY (`venta_id`) REFERENCES `ventas` (`id`),
  ADD CONSTRAINT `detalle_venta_ibfk_2` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id`),
  ADD CONSTRAINT `detalle_venta_ibfk_3` FOREIGN KEY (`consumible_id`) REFERENCES `consumibles` (`id`);

--
-- Filtros para la tabla `detalle_ventas`
--
ALTER TABLE `detalle_ventas`
  ADD CONSTRAINT `detalle_ventas_ibfk_1` FOREIGN KEY (`venta_id`) REFERENCES `ventas` (`id`),
  ADD CONSTRAINT `detalle_ventas_ibfk_2` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id`),
  ADD CONSTRAINT `detalle_ventas_ibfk_3` FOREIGN KEY (`consumible_id`) REFERENCES `consumibles` (`id`);

--
-- Filtros para la tabla `historial_inventario`
--
ALTER TABLE `historial_inventario`
  ADD CONSTRAINT `historial_inventario_ibfk_1` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id`),
  ADD CONSTRAINT `historial_inventario_ibfk_2` FOREIGN KEY (`consumible_id`) REFERENCES `consumibles` (`id`);

--
-- Filtros para la tabla `inventario`
--
ALTER TABLE `inventario`
  ADD CONSTRAINT `inventario_ibfk_1` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id`),
  ADD CONSTRAINT `inventario_ibfk_2` FOREIGN KEY (`consumible_id`) REFERENCES `consumibles` (`id`);

--
-- Filtros para la tabla `metodos_pago`
--
ALTER TABLE `metodos_pago`
  ADD CONSTRAINT `metodos_pago_ibfk_1` FOREIGN KEY (`venta_id`) REFERENCES `ventas` (`id`);

--
-- Filtros para la tabla `registro_cambios_consumibles`
--
ALTER TABLE `registro_cambios_consumibles`
  ADD CONSTRAINT `registro_cambios_consumibles_ibfk_1` FOREIGN KEY (`consumible_id`) REFERENCES `consumibles` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `registro_cambios_productos`
--
ALTER TABLE `registro_cambios_productos`
  ADD CONSTRAINT `registro_cambios_productos_ibfk_1` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id`) ON DELETE CASCADE;

--
-- Filtros para la tabla `ventas`
--
ALTER TABLE `ventas`
  ADD CONSTRAINT `ventas_ibfk_1` FOREIGN KEY (`usuario_id`) REFERENCES `usuarios` (`id`);
COMMIT;

/*!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 */;
