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

CREATE TABLE `categoria_produtos` (
  `id` int(11) NOT NULL,
  `categoria` varchar(200) NOT NULL,
  `data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `compras` (
  `id` int(11) NOT NULL,
  `descricao` varchar(255) NOT NULL,
  `valor` decimal(10,2) NOT NULL,
  `data` date NOT NULL,
  `hora` time NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `entrega` (
  `identrega` int(11) NOT NULL,
  `produtoentrega` varchar(255) NOT NULL,
  `qtdentrega` int(11) NOT NULL,
  `precoentrega` decimal(10,2) NOT NULL,
  `totalentrega` decimal(10,2) NOT NULL,
  `clienteentrega` int(11) NOT NULL,
  `usuarioentrega` int(11) NOT NULL,
  `pedidoentrega` int(11) NOT NULL,
  `datavenda` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `filadeespera` (
  `idfiladeespera` int(11) NOT NULL,
  `produtofiladeespera` varchar(255) NOT NULL,
  `qtdfiladeespera` int(11) NOT NULL,
  `precofiladeespera` double NOT NULL,
  `totalfiladeespera` double NOT NULL,
  `usuariofiladeespera` int(11) NOT NULL,
  `data` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `funcionario` (
  `idfuncionario` int(11) NOT NULL,
  `nomefuncionario` varchar(255) NOT NULL,
  `apelidofuncionario` varchar(255) NOT NULL,
  `sexofuncionario` varchar(10) NOT NULL,
  `bi` varchar(17) NOT NULL,
  `enderecofuncionario` varchar(255) NOT NULL,
  `contactofuncionario` varchar(20) NOT NULL,
  `nuit` int(20) NOT NULL,
  `emailfuncionario` varchar(50) NOT NULL,
  `empresafuncionario` int(11) NOT NULL,
  `data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Extraindo dados da tabela `funcionario`
--

INSERT INTO `funcionario` (`idfuncionario`, `nomefuncionario`, `apelidofuncionario`, `sexofuncionario`, `bi`, `enderecofuncionario`, `contactofuncionario`, `nuit`, `emailfuncionario`, `empresafuncionario`, `data`) VALUES
(1, 'consumidor', 'final', 'qualquer', '0', 'cidade de tete', '878884862', 0, 'milagrelazaro1@gmail.com', 1, '2021-07-13 00:41:08'),


CREATE TABLE `inventario` (
  `id` int(11) NOT NULL,
  `artigo` varchar(500) NOT NULL,
  `1` int(11) NOT NULL,
  `2` int(11) NOT NULL,
  `3` int(11) NOT NULL,
  `4` int(11) NOT NULL,
  `5` int(11) NOT NULL,
  `6` int(11) NOT NULL,
  `7` int(11) NOT NULL,
  `8` int(11) NOT NULL,
  `9` int(11) NOT NULL,
  `10` int(11) NOT NULL,
  `11` int(11) NOT NULL,
  `12` int(11) NOT NULL,
  `13` int(11) NOT NULL,
  `14` int(11) NOT NULL,
  `15` int(11) NOT NULL,
  `16` int(11) NOT NULL,
  `17` int(11) NOT NULL,
  `18` int(11) NOT NULL,
  `19` int(11) NOT NULL,
  `20` int(11) NOT NULL,
  `21` int(11) NOT NULL,
  `22` int(11) NOT NULL,
  `23` int(11) NOT NULL,
  `24` int(11) NOT NULL,
  `25` int(11) NOT NULL,
  `26` int(11) NOT NULL,
  `27` int(11) NOT NULL,
  `28` int(11) NOT NULL,
  `29` int(11) NOT NULL,
  `30` int(11) NOT NULL,
  `31` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `itens_comprados` (
  `id` int(11) NOT NULL,
  `id_artigo` int(11) NOT NULL,
  `qtd` int(11) NOT NULL,
  `id_compra` int(11) NOT NULL,
  `data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `pedido` (
  `idpedido` int(11) NOT NULL,
  `descpedido` datetime NOT NULL,
  `pagamentopedido` decimal(10,2) NOT NULL,
  `trocopedido` decimal(10,2) NOT NULL,
  `disconto` decimal(10,2) NOT NULL,
  `clientepedido` int(11) NOT NULL,
  `userpedido` int(11) NOT NULL,
  `data` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `periodo` (
  `idperiodo` int(11) NOT NULL,
  `diaperiodo` varchar(7) NOT NULL DEFAULT 'fechado',
  `aberturaperiodo` decimal(10,0) DEFAULT NULL,
  `fechoperiodo` decimal(10,0) DEFAULT NULL,
  `dataaberturaperiodo` datetime NOT NULL,
  `datafechoperiodo` datetime NOT NULL,
  `usuario` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `produto` (
  `idproduto` int(11) NOT NULL,
  `nomeproduto` varchar(255) NOT NULL,
  `stock` int(11) NOT NULL,
  `preco_compra` decimal(10,2) NOT NULL,
  `preco` decimal(10,2) NOT NULL,
  `iva` float NOT NULL DEFAULT '0',
  `img` text NOT NULL,
  `codbar` text NOT NULL,
  `id_catgeoria` int(11) NOT NULL,
  `data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Extraindo dados da tabela `produto`
--

INSERT INTO `produto` (`idproduto`, `nomeproduto`, `stock`, `preco_compra`, `preco`, `iva`, `img`, `codbar`, `id_catgeoria`, `data`) VALUES
(3, '2M A GARRAFA', 44, '0.00', '60.00', 0.17, '_DSF0684.png', '6007497004584', 1, '2023-03-22 15:50:57'),
(4, 'IMPALA', 5, '0.00', '40.00', 0, '1036451-854x1080.png', '', 1, '2023-02-25 16:15:06'),
(5, '2M A LATA', 27, '0.00', '65.00', 0, '2M-lata.jpg\n', '', 1, '2023-03-20 15:59:25'),
(6, 'MANICA A LATA', 23, '0.00', '65.00', 0, 'Manica-Lata-24x330ml.jpg', '', 1, '2023-02-24 18:25:52'),
(7, 'PRETA TXOTI', 22, '0.00', '50.00', 0, 'laurentina-preta-curta.jpg', '', 1, '2023-02-24 18:25:57'),
(8, 'LITE PEQUENO', 2, '0.00', '70.00', 0, 'lite.jpg', '', 1, '2023-03-25 17:39:28'),
(9, '2M FLO A GARRAFA', 5, '0.00', '50.00', 0, '2M-Flow.jpg', '', 1, '2023-03-23 05:30:53'),
(10, 'HEINEKEN A LATA', 22, '0.00', '70.00', 0, '625f0bfe35cab39ed2b91b9c.png', '', 1, '2023-03-22 16:09:12'),
(11, 'HEINEKEN CURTA', 11, '0.00', '80.00', 0, 'heineken.png', '', 1, '2023-03-02 17:10:01'),
(12, 'HEINEKEN RETORNAVEL', 11, '0.00', '50.00', 0, 'cerveja-heineken-600-ml1-b4723f8fa38b73d53b15676918580599-640-0.jpg', '', 1, '2023-02-28 05:59:29'),
(13, 'REFRESCO PEQUENO', 0, '0.00', '20.00', 0, 'Coca-Cola-Garrafa-500ml.png', '', 2, '2023-02-24 18:26:20'),
(14, 'REFRESCO A LATA', 5, '0.00', '40.00', 0, 'refrigerante-coca-cola-lata-350ml-80c.jpg', '', 2, '2023-03-21 18:44:11'),
(15, 'REFRESCO 1L', 2, '0.00', '70.00', 0, 'intellibrand_000000000000986231-LT_1_big.jpg', '', 2, '2023-02-24 18:26:29'),
(16, 'REFRESCO 2L', 11, '0.00', '100.00', 0, '1145.jpg', '', 2, '2023-03-22 15:14:58'),
(17, 'SAVANA', 6, '0.00', '90.00', 0, 'savanna-dry-330ml.jpg', '', 1, '2023-03-20 15:58:11'),
(18, 'HUNTERS GOLD', 1, '0.00', '90.00', 0, 'Hunters Website hunters-gold.png', '', 1, '2023-02-24 18:26:39'),
(19, 'MENUTE A LATA', 7, '0.00', '55.00', 0, 'dasxczzxcczxc.png', '', 2, '2023-02-24 18:26:58'),
(20, 'BONAQUA GRANDE', 8, '0.00', '50.00', 0, 'Bonaqua-Agua-Purificada-2.5L.jpg', '', 2, '2023-02-24 18:27:32'),
(21, 'FRESH UPP', 0, '0.00', '30.00', 0, '09415767033511_C1N1.png', '', 2, '2023-02-24 18:27:56'),
(22, 'SANTAL MEDIO', 1, '0.00', '60.00', 0, 'sumo_santal_tropical_500ml_-_3550_-_copy.jpg', '', 2, '2023-03-02 17:10:01'),
(52, 'CERES GRANDE', 4, '0.00', '120.00', 0, 'ceres3.jpg', '', 2, '2023-02-24 18:28:05'),
(53, 'MENUTE PEQUENO', 2, '0.00', '35.00', 0, '450.jpg', '', 2, '2023-02-24 18:28:08'),
(54, 'MENUTE 1L', 2, '0.00', '70.00', 0, '91FA-NBcswL._SY550_.jpg', '', 2, '2023-02-24 18:28:13'),
(55, 'PRETA A LATA', 16, '0.00', '65.00', 0, 'Preta-Lata-24x330ml.png', '', 1, '2023-02-24 18:28:16'),
(56, 'MOJO', 18, '0.00', '20.00', 0, 'mojo-hot-dazur.jpg', '', 2, '2023-02-24 18:28:20'),
(57, 'TXILAR A LATA', 19, '0.00', '50.00', 0, 'Txilar-Lata-1.jpg', '', 1, '2023-02-24 18:28:34'),
(58, 'REFRESCO A GARRAFA', 6, '0.00', '25.00', 0, 'png-transparent-coca-cola-coca-cola-bottle-glass-bottles.png', '', 2, '2023-02-24 18:28:43'),
(59, 'TXILAR GRANDE', 0, '0.00', '50.00', 0, '1034132-854x1080.png', '', 1, '2023-02-24 18:28:46'),
(60, 'KUMBUSHA', 12, '0.00', '60.00', 0, 'revin_power.jpg', '', 2, '2023-02-24 18:28:50'),
(61, 'REFRESCO MEDIO', 10, '0.00', '30.00', 0, 'Coca-Cola-Garrafa-500ml.png', '', 0, '2023-02-19 11:37:51'),
(62, 'MANICA GRANDE', 0, '0.00', '65.00', 0, '_DSF0683.png', '', 0, '2023-02-13 07:43:17'),
(63, 'COMPAL GRANDE', 0, '0.00', '120.00', 0, 'umex_a-sia_ananas.png', '', 0, '2023-01-29 19:39:01'),
(64, 'BONAQUA PEQUENA', 0, '0.00', '25.00', 0, 'Bonaqua-Agua-Purificada-500ml.jpg', '', 0, '2023-02-13 07:44:12'),
(65, 'VUMBA PEQUENA', 17, '0.00', '25.00', 0, '8_5.jpg', '', 0, '2023-02-23 12:23:03'),
(66, 'VUMBA GRANDE', 5, '0.00', '50.00', 0, 'Vumba-Agua-Mineral-15L.jpg', '', 0, '2023-02-21 13:52:37'),
(67, 'LEPO COPO', 43, '0.00', '10.00', 0, 'download.jfif', '', 0, '2023-02-21 17:12:33'),
(68, 'SUPER SHAKE GRANDE', 8, '0.00', '50.00', 0, 'shake-n-sip-1.png', '', 0, '2023-02-21 11:37:04'),
(69, 'SUPER SHAKE PEQUENO', 19, '0.00', '25.00', 0, 'shake-n-sip-1.png', '', 0, '2023-02-21 17:44:12'),
(70, 'FIZZ', 1, '0.00', '20.00', 0, '20200330_175042.jpg', '', 0, '2023-02-19 17:47:19'),
(71, 'FROZY', 25, '0.00', '25.00', 0, 'download (1).jfif', '', 0, '2023-02-21 14:42:47'),
(72, 'FRUTICANA', 13, '0.00', '40.00', 0, 'Fruiticana-Bottle_Mango.png', '', 0, '2023-02-21 15:17:08'),
(73, 'DRAGON A LATA', 0, '0.00', '50.00', 0, 'Energetico lo carbo Monster 473ml-500x500.jpg', '', 0, '2023-02-13 07:48:07'),
(74, 'AGUA TONICA', 11, '0.00', '50.00', 0, 'BEB0079.jpg', '', 0, '2023-02-23 12:23:27'),
(75, 'COMPAL MEDIO', 9, '0.00', '70.00', 0, '6877759_nectar-classico-pessego-compal-20cl_550.png', '', 0, '2023-02-13 07:49:02'),
(76, '2M A CAIXA', 5, '0.00', '580.00', 0, 'img061395-135-20170406-103231.jpg', '', 0, '2023-02-23 12:23:27'),
(77, 'IMPALA A CAIXA', 13, '0.00', '420.00', 0, 'img061395-135-20170406-103231.jpg', '', 0, '2023-02-23 12:23:28'),
(78, 'REFRESCO A CAIXA', 6, '0.00', '420.00', 0, 'png-transparent-coca-cola-cherry-the-coca-cola-company-erythroxylum-coca-coca-cola-furniture-supermarket-cola.png', '', 0, '2023-02-21 17:18:51'),
(79, 'AGUA 6L', 5, '0.00', '70.00', 0, '2569855.jpg', '', 0, '2023-02-21 06:40:16'),
(80, 'MANICA A CAIXA', 0, '0.00', '640.00', 0, 'img061395-135-20170406-103231.jpg', '', 0, '2023-02-13 07:58:27');



CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `nome` varchar(255) NOT NULL,
  `user` varchar(255) NOT NULL,
  `pass` varchar(255) NOT NULL,
  `categoria` varchar(255) NOT NULL,
  `data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



INSERT INTO `users` (`id`, `nome`, `user`, `pass`, `categoria`, `data`) VALUES
(1, 'milagre nicodemos', 'admin', '12', 'admin', '2023-03-20 15:47:00');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `categoria_produtos`
--
ALTER TABLE `categoria_produtos`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `compras`
--
ALTER TABLE `compras`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `entrega`
--
ALTER TABLE `entrega`
  ADD PRIMARY KEY (`identrega`);

--
-- Indexes for table `filadeespera`
--
ALTER TABLE `filadeespera`
  ADD PRIMARY KEY (`idfiladeespera`);

--
-- Indexes for table `funcionario`
--
ALTER TABLE `funcionario`
  ADD PRIMARY KEY (`idfuncionario`);

--
-- Indexes for table `inventario`
--
ALTER TABLE `inventario`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `itens_comprados`
--
ALTER TABLE `itens_comprados`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `pedido`
--
ALTER TABLE `pedido`
  ADD PRIMARY KEY (`idpedido`);

--
-- Indexes for table `periodo`
--
ALTER TABLE `periodo`
  ADD PRIMARY KEY (`idperiodo`);

--
-- Indexes for table `produto`
--
ALTER TABLE `produto`
  ADD PRIMARY KEY (`idproduto`),
  ADD UNIQUE KEY `nomeproduto` (`nomeproduto`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `categoria_produtos`
--
ALTER TABLE `categoria_produtos`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `compras`
--
ALTER TABLE `compras`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `entrega`
--
ALTER TABLE `entrega`
  MODIFY `identrega` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `filadeespera`
--
ALTER TABLE `filadeespera`
  MODIFY `idfiladeespera` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `funcionario`
--
ALTER TABLE `funcionario`
  MODIFY `idfuncionario` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `inventario`
--
ALTER TABLE `inventario`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `itens_comprados`
--
ALTER TABLE `itens_comprados`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `pedido`
--
ALTER TABLE `pedido`
  MODIFY `idpedido` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `periodo`
--
ALTER TABLE `periodo`
  MODIFY `idperiodo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT for table `produto`
--
ALTER TABLE `produto`
  MODIFY `idproduto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=81;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;