-- https://www.phpmyadmin.net/
--
-- Tempo de geração: 04/05/2025 às 00:15
-- Versão do servidor: 10.4.32-MariaDB
-- Versão do PHP: 8.2.12

START TRANSACTION;



--
-- Banco de dados: `fluxo_financeiro`
--

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

--
-- Estrutura para tabela `clients`
--

CREATE TABLE `clients` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `email` varchar(100) NOT NULL,
  `phone` varchar(20) NOT NULL,
  `monthly_fee` decimal(10,2) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `clients`
--

INSERT INTO `clients` (`id`, `name`, `email`, `phone`, `monthly_fee`, `created_at`) VALUES
(1, 'A P DE ABREU - ME', '', '', 180.00, '2025-05-03 01:34:43'),
(2, 'AGUA SANTA CLARA ME', '', '', 160.00, '2025-05-03 01:34:43'),
(3, 'ANA MARIA GOMES CAMPOS', '', '', 130.00, '2025-05-03 01:34:43'),
(4, 'ANTONIA EDILEUZA DE AQUINO - ME', '', '', 130.00, '2025-05-03 01:34:43'),
(5, 'ANTONIO EDIVAR DE AQUINO', '', '', 130.00, '2025-05-03 01:34:43'),
(6, 'E. R. DOS SANTOS BEZERRA - EIRELI - ME', '', '', 100.00, '2025-05-03 01:34:43'),
(7, 'ELIFAN SOARES DE SOUSA', '', '', 130.00, '2025-05-03 01:34:43'),
(8, 'ANA PATRICIA DA COSTA (CLIENTE BOA VISTA)', '', '', 100.00, '2025-05-03 01:34:43'),
(9, 'F J DE LIRA - ME (SHOPPING DA PRETINHA)', '', '', 193.33, '2025-05-03 01:34:43'),
(10, 'J F DE LIRA (SHOPPING DA PRETINHA MESSSEJANA-CE)', '', '', 193.33, '2025-05-03 01:34:43'),
(11, 'J F DE LIRA (SHOPPING DA PRETINHA PACAJUS-CE)', '', '', 193.34, '2025-05-03 01:34:43'),
(12, 'FAZENDA MORRO PINTADO LTDA - ME', '', '', 200.00, '2025-05-03 01:34:43'),
(13, 'RADIANT COSMÉTICOS', '', '', 150.00, '2025-05-03 01:34:43'),
(14, 'FLAVIO - SAPATARIA 3 IRMAOS', '', '', 150.00, '2025-05-03 01:34:43'),
(15, 'FRANCISCO ANISIO DE SOUZA ME', '', '', 130.00, '2025-05-03 01:34:43'),
(16, 'FRANCISCO JOSE DA SILVA (PANIFICADORA O PAO)', '', '', 200.00, '2025-05-03 01:34:43'),
(17, 'HONORIO E JUSCIANO MD. E MAT CONSTRUÇÃO', '', '', 120.00, '2025-05-03 01:34:43'),
(18, 'J S DE FREITAS FILHO ME (PLAY BOY SPORTS)', '', '', 290.00, '2025-05-03 01:34:43'),
(19, 'LISANA LISBELA MODA FEMININA', '', '', 150.00, '2025-05-03 01:34:43'),
(20, 'JOAO PAULO (PILOES)', '', '', 130.00, '2025-05-03 01:34:43'),
(21, 'JOSE EDIMAR DE AQUINO ME (LIDUINA)', '', '', 160.00, '2025-05-03 01:34:43'),
(22, 'IGFIT', '', '', 100.00, '2025-05-03 01:34:43'),
(23, 'M E DE AQUINO - ME (RIAN BABY)', '', '', 170.00, '2025-05-03 01:34:43'),
(24, 'M N ARTIGOS DO VESTUARIO LTDA', '', '', 120.00, '2025-05-03 01:34:43'),
(25, 'MARIA DE LOURDES FILHA ME', '', '', 170.00, '2025-05-03 01:34:43'),
(26, 'MARIA LUIZA DE SOUZA', '', '', 130.00, '2025-05-03 01:34:43'),
(27, 'MIGUEL ARCANJO DE FREITAS (SB COSMETICOS)', '', '', 110.00, '2025-05-03 01:34:43'),
(28, 'BRUNA DELICIAS DA ROÇA', '', '', 150.00, '2025-05-03 01:34:43'),
(29, 'RAIMUNDO NONATO MAIA', '', '', 0.00, '2025-05-03 01:34:43'),
(30, 'RAIMUNDO OTAVIO REBOUCAS', '', '', 200.00, '2025-05-03 01:34:43'),
(31, 'SAO MIGUEL GOLD', '', '', 240.00, '2025-05-03 01:34:43'),
(32, 'SEBASTIAO BEZERRA FRANCA - ME (SS PAES E MASSAS)', '', '', 100.00, '2025-05-03 01:34:43'),
(33, 'A PADARIA PAO NOBRE', '', '', 150.00, '2025-05-03 01:34:43'),
(34, 'NEIDE (CHEIROS D A NEGA)', '', '', 100.00, '2025-05-03 01:34:43'),
(35, 'BENEDITO', '', '', 100.00, '2025-05-03 01:34:43'),
(36, 'NAARA TUANY TORRES DUTRA LTDA', '', '', 150.00, '2025-05-03 01:34:43'),
(37, 'ANDRE DE ALMEIDA FERREIRA', '', '', 200.00, '2025-05-03 01:34:43'),
(38, 'JOSE ALVES SOBRINHO (BOI NA BRASA)', '', '', 160.00, '2025-05-03 01:34:43'),
(39, 'CLOVES MORAIS DE QUEIROZ -EPP', '', '', 120.00, '2025-05-03 01:34:43'),
(40, 'PAULO E J DE LIRA (PRETINHA UTILIDADES)', '', '', 1000.00, '2025-05-03 01:34:43'),
(41, 'CHICA FULO', '', '', 120.00, '2025-05-03 01:34:43'),
(42, 'ELETRONICA TELEVIDEO', '', '', 0.00, '2025-05-03 01:34:43'),
(43, 'FERNANDA TELEVIDEO', '', '', 0.00, '2025-05-03 01:34:43'),
(44, 'REQUINTE DA MODA MOSSORO', '', '', 60.00, '2025-05-03 01:34:43'),
(45, 'REQUINTE DA MODA ASSU', '', '', 60.00, '2025-05-03 01:34:43'),
(46, 'REQUINTE DA MODA PAU DOS FERROS', '', '', 60.00, '2025-05-03 01:34:43'),
(47, 'ISMAEL DEP PAI (PACAJUS)', '', '', 180.00, '2025-05-03 01:34:43'),
(48, 'ISMAEL DEP (PACAJUS)', '', '', 180.00, '2025-05-03 01:34:43'),
(49, 'KBOO (PALOMA)', '', '', 150.00, '2025-05-03 01:34:43'),
(50, 'DEP GAS CEL JOAO PESSOA', '', '', 130.00, '2025-05-03 01:34:43'),
(51, 'ENTRE PATAS', '', '', 100.00, '2025-05-03 01:34:43'),
(52, 'MARIA DELICIAS DO PAO', '', '', 130.00, '2025-05-03 01:34:43'),
(53, 'RAYANE LOJA ROUPAS', '', '', 150.00, '2025-05-03 01:34:43'),
(54, 'PISICOLOGA LOJA DE ROUPAS(ROBERTA)', '', '', 150.00, '2025-05-03 01:34:43'),
(55, 'ELORA LOJA', '', '', 100.00, '2025-05-03 01:34:43'),
(56, 'AMIGA DE HELORA', '', '', 100.00, '2025-05-03 01:34:43'),
(57, 'NATHANNE', '', '', 150.00, '2025-05-03 01:34:43'),
(58, 'HALISSON', '', '', 120.00, '2025-05-03 01:34:43'),
(59, 'UZZIJOIAS', '', '', 150.00, '2025-05-03 01:34:43'),
(60, 'CEZARIO', '', '', 110.00, '2025-05-03 01:34:43'),
(61, 'ANA PATRICIA LOJA DE ROUPAS PLUS', '', '', 100.00, '2025-05-03 01:34:43');

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

--
-- Estrutura para tabela `installments`
--

CREATE TABLE `installments` (
  `id` int(11) NOT NULL,
  `movement_id` int(11) NOT NULL,
  `installment_number` int(11) NOT NULL,
  `amount` decimal(10,2) NOT NULL,
  `due_date` date NOT NULL,
  `status` enum('pending','paid','overdue') NOT NULL DEFAULT 'pending',
  `paid_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `installments`
--

INSERT INTO `installments` (`id`, `movement_id`, `installment_number`, `amount`, `due_date`, `status`, `paid_at`) VALUES
(1, 1, 1, 170.00, '2025-05-03', 'paid', '2025-05-02 23:04:07'),
(2, 1, 2, 170.00, '2025-07-03', 'paid', '2025-05-02 00:00:00'),
(3, 1, 3, 170.00, '2025-08-03', 'pending', NULL),
(4, 1, 4, 170.00, '2025-09-03', 'pending', NULL),
(5, 1, 5, 170.00, '2025-10-03', 'pending', NULL),
(6, 1, 6, 170.00, '2025-11-03', 'pending', NULL),
(7, 1, 7, 170.00, '2025-12-03', 'pending', NULL),
(8, 1, 8, 170.00, '2026-01-03', 'pending', NULL),
(9, 1, 9, 170.00, '2026-02-03', 'pending', NULL),
(10, 1, 10, 170.00, '2026-03-03', 'pending', NULL),
(11, 1, 11, 170.00, '2026-04-03', 'pending', NULL),
(12, 1, 12, 170.00, '2026-05-03', 'pending', NULL),
(13, 2, 1, 1020.00, '2025-06-03', 'pending', NULL),
(14, 2, 2, 1020.00, '2025-07-03', 'pending', NULL);

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

--
-- Estrutura para tabela `movements`
--

CREATE TABLE `movements` (
  `id` int(11) NOT NULL,
  `client_id` int(11) NOT NULL,
  `description` varchar(255) NOT NULL,
  `total_amount` decimal(10,2) NOT NULL,
  `installments` int(11) NOT NULL,
  `created_at` datetime NOT NULL,
  `movement_date` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `movements`
--

INSERT INTO `movements` (`id`, `client_id`, `description`, `total_amount`, `installments`, `created_at`, `movement_date`) VALUES
(1, 1, 'MENSALIDADE DO SISTEMA', 2040.00, 12, '2025-04-05 22:38:34', NULL),
(2, 33, 'MENSALIDADE DO SISTEMA', 2040.00, 2, '2025-04-03 00:00:00', '2025-04-03');

--
-- Índices para tabelas despejadas
--

--
-- Índices de tabela `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `installments`
--
ALTER TABLE `installments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `movement_id` (`movement_id`);

--
-- Índices de tabela `movements`
--
ALTER TABLE `movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `client_id` (`client_id`);

--
-- AUTO_INCREMENT para tabelas despejadas
--

--
-- AUTO_INCREMENT de tabela `clients`
--
ALTER TABLE `clients`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=62;

--
-- AUTO_INCREMENT de tabela `installments`
--
ALTER TABLE `installments`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT de tabela `movements`
--
ALTER TABLE `movements`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Restrições para tabelas despejadas
--

--
-- Restrições para tabelas `installments`
--
ALTER TABLE `installments`
  ADD CONSTRAINT `installments_ibfk_1` FOREIGN KEY (`movement_id`) REFERENCES `movements` (`id`) ON DELETE CASCADE;

--
-- Restrições para tabelas `movements`
--
ALTER TABLE `movements`
  ADD CONSTRAINT `movements_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`);
COMMIT;

