text: -- phpMyAdmin SQL Dump
  -- version 5.0.3
  -- https://www.phpmyadmin.net/
  --
  -- Servidor: 127.0.0.1
  -- Tiempo de generación: 28-12-2020 a las 16:09:00
  -- Versión del servidor: 10.4.14-MariaDB
  -- Versión de PHP: 7.2.34
  
  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: `almacen`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `categories`
  --
  
  CREATE TABLE `categories` (
    `id` int(11) UNSIGNED NOT NULL,
    `name` varchar(60) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  --
  -- Volcado de datos para la tabla `categories`
  --
  
  INSERT INTO `categories` (`id`, `name`) VALUES
  (5, 'Clavos'),
  (7, 'computadora'),
  (1, 'Repuestos'),
  (6, 'Tecnologia'),
  (2, 'Tornillos'),
  (3, 'Tuercas');
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `incomes`
  --
  
  CREATE TABLE `incomes` (
    `id` int(10) UNSIGNED NOT NULL,
    `product_id` int(10) UNSIGNED DEFAULT NULL,
    `qty` int(11) DEFAULT NULL,
    `price` decimal(25,2) DEFAULT NULL,
    `source` varchar(255) DEFAULT NULL,
    `date` datetime DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `media`
  --
  
  CREATE TABLE `media` (
    `id` int(11) UNSIGNED NOT NULL,
    `file_name` varchar(255) NOT NULL,
    `file_type` varchar(100) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Volcado de datos para la tabla `media`
  --
  
  INSERT INTO `media` (`id`, `file_name`, `file_type`) VALUES
  (1, 'filter.jpg', 'image/jpeg'),
  (2, 'tornillo1.jpg', 'image/jpeg'),
  (3, 'tornillo2.jpg', 'image/jpeg'),
  (17, 'tuerca.png', 'image/png');
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `products`
  --
  
  CREATE TABLE `products` (
    `id` int(11) UNSIGNED NOT NULL,
    `name` varchar(255) NOT NULL,
    `partNo` varchar(60) NOT NULL,
    `quantity` int(11) DEFAULT NULL,
    `categorie_id` int(10) UNSIGNED NOT NULL,
    `location` varchar(255) DEFAULT NULL,
    `media_id` int(11) DEFAULT 0,
    `date` datetime NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  --
  -- Volcado de datos para la tabla `products`
  --
  
  INSERT INTO `products` (`id`, `name`, `partNo`, `quantity`, `categorie_id`, `location`, `media_id`, `date`) VALUES
  (24, 'Laptop', 'LP_012', 90, 6, 'Almacén central', 1, '2020-12-24 21:37:09'),
  (25, 'Iphone', 'LP_011', 110, 6, 'Almacén central', 3, '2020-12-24 23:16:05'),
  (26, 'Acer', 'LP_015', 40, 7, 'Almacén central', 3, '2020-12-25 01:03:00');
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `sales`
  --
  
  CREATE TABLE `sales` (
    `id` int(11) UNSIGNED NOT NULL,
    `product_id` int(11) UNSIGNED NOT NULL,
    `qty` int(11) NOT NULL,
    `destination` varchar(255) DEFAULT NULL,
    `date` datetime NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  --
  -- Volcado de datos para la tabla `sales`
  --
  
  INSERT INTO `sales` (`id`, `product_id`, `qty`, `destination`, `date`) VALUES
  (54, 24, 10, 'cede central', '2020-12-24 00:00:00'),
  (55, 26, 15, 'Área de limpieza', '2020-12-25 00:00:00'),
  (56, 26, 5, 'Área de limpieza', '2020-12-25 00:00:00');
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `tbl_customer`
  --
  
  CREATE TABLE `tbl_customer` (
    `CustomerID` int(11) NOT NULL,
    `CustomerName` varchar(250) NOT NULL,
    `Address` text NOT NULL,
    `City` varchar(250) NOT NULL,
    `PostalCode` varchar(30) NOT NULL,
    `Country` varchar(100) NOT NULL
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  
  --
  -- Volcado de datos para la tabla `tbl_customer`
  --
  
  INSERT INTO `tbl_customer` (`CustomerID`, `CustomerName`, `Address`, `City`, `PostalCode`, `Country`) VALUES
  (5, 'Ruben', 'Huascahura', 'Ayacucho', '4635', 'Perú'),
  (7, 'gyovanyñ', 'hud4\"', 'hjuyuyj', 'u787_7', 'peru'),
  (4, 'Pablo', 'Huad', 'Ayacucho', '4633', 'Peru'),
  (3, 'Jhonayker', 'Huascahura', 'Ayacucho', '4354', 'Perú');
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `users`
  --
  
  CREATE TABLE `users` (
    `id` int(11) UNSIGNED NOT NULL,
    `name` varchar(60) NOT NULL,
    `username` varchar(50) NOT NULL,
    `password` varchar(255) NOT NULL,
    `user_level` int(11) NOT NULL,
    `image` varchar(255) DEFAULT 'no_image.jpg',
    `status` int(1) NOT NULL,
    `last_login` datetime DEFAULT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Volcado de datos para la tabla `users`
  --
  
  INSERT INTO `users` (`id`, `name`, `username`, `password`, `user_level`, `image`, `status`, `last_login`) VALUES
  (1, 'Admin User', 'Admin', 'd033e22ae348aeb5660fc2140aec35850c4da997', 1, 'hombre-avatar.jpg', 1, '2020-12-27 17:18:14'),
  (2, 'Juan Hernandez', 'jhernandez', 'b49a5780a99ea81284fc0746a78f84a30e4d5c73', 2, 'no_image.jpg', 1, '2017-06-16 07:11:26'),
  (3, 'Default User', 'User', '12dea96fec20593566ab75692c9949596833adc9', 3, 'no_image.jpg', 1, '2017-06-16 07:11:03'),
  (13, 'Pedro Perez', 'pperez', 'a9993e364706816aba3e25717850c26c9cd0d89d', 3, 'no_image.jpg', 1, '2020-06-11 14:36:33');
  
  -- --------------------------------------------------------
  
  --
  -- Estructura de tabla para la tabla `user_groups`
  --
  
  CREATE TABLE `user_groups` (
    `id` int(11) NOT NULL,
    `group_name` varchar(150) NOT NULL,
    `group_level` int(11) NOT NULL,
    `group_status` int(1) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Volcado de datos para la tabla `user_groups`
  --
  
  INSERT INTO `user_groups` (`id`, `group_name`, `group_level`, `group_status`) VALUES
  (1, 'Admin', 1, 1),
  (2, 'Special', 2, 1),
  (3, 'User', 3, 1);
  
  --
  -- Índices para tablas volcadas
  --
  
  --
  -- Indices de la tabla `categories`
  --
  ALTER TABLE `categories`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `name` (`name`);
  
  --
  -- Indices de la tabla `incomes`
  --
  ALTER TABLE `incomes`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indices de la tabla `media`
  --
  ALTER TABLE `media`
    ADD PRIMARY KEY (`id`),
    ADD KEY `id` (`id`);
  
  --
  -- Indices de la tabla `products`
  --
  ALTER TABLE `products`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `partNo` (`partNo`),
    ADD KEY `categorie_id` (`categorie_id`),
    ADD KEY `media_id` (`media_id`);
  
  --
  -- Indices de la tabla `sales`
  --
  ALTER TABLE `sales`
    ADD PRIMARY KEY (`id`),
    ADD KEY `product_id` (`product_id`);
  
  --
  -- Indices de la tabla `tbl_customer`
  --
  ALTER TABLE `tbl_customer`
    ADD PRIMARY KEY (`CustomerID`),
    ADD UNIQUE KEY `CustomerID` (`CustomerID`);
  
  --
  -- Indices de la tabla `users`
  --
  ALTER TABLE `users`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `username` (`username`),
    ADD KEY `user_level` (`user_level`);
  
  --
  -- Indices de la tabla `user_groups`
  --
  ALTER TABLE `user_groups`
    ADD PRIMARY KEY (`id`),
    ADD UNIQUE KEY `group_level` (`group_level`);
  
  --
  -- AUTO_INCREMENT de las tablas volcadas
  --
  
  --
  -- AUTO_INCREMENT de la tabla `categories`
  --
  ALTER TABLE `categories`
    MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
  
  --
  -- AUTO_INCREMENT de la tabla `incomes`
  --
  ALTER TABLE `incomes`
    MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT de la tabla `media`
  --
  ALTER TABLE `media`
    MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
  
  --
  -- AUTO_INCREMENT de la tabla `products`
  --
  ALTER TABLE `products`
    MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;
  
  --
  -- AUTO_INCREMENT de la tabla `sales`
  --
  ALTER TABLE `sales`
    MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=57;
  
  --
  -- AUTO_INCREMENT de la tabla `tbl_customer`
  --
  ALTER TABLE `tbl_customer`
    MODIFY `CustomerID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
  
  --
  -- AUTO_INCREMENT de la tabla `users`
  --
  ALTER TABLE `users`
    MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
  
  --
  -- AUTO_INCREMENT de la tabla `user_groups`
  --
  ALTER TABLE `user_groups`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
  
  --
  -- Restricciones para tablas volcadas
  --
  
  --
  -- Filtros para la tabla `products`
  --
  ALTER TABLE `products`
    ADD CONSTRAINT `FK_products` FOREIGN KEY (`categorie_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Filtros para la tabla `sales`
  --
  ALTER TABLE `sales`
    ADD CONSTRAINT `SK` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
  
  --
  -- Filtros para la tabla `users`
  --
  ALTER TABLE `users`
    ADD CONSTRAINT `FK_user` FOREIGN KEY (`user_level`) REFERENCES `user_groups` (`group_level`) ON DELETE CASCADE ON UPDATE CASCADE;
  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 */;
  