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

START TRANSACTION;



--
-- Banco de dados: `trocacheque`
--

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

--
-- Estrutura para tabela `cheques`
--

CREATE TABLE `cheques` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `cliente` varchar(100) NOT NULL,
  `numero_cheque` varchar(50) DEFAULT NULL,
  `banco` varchar(100) DEFAULT NULL,
  `valor` decimal(10,2) NOT NULL,
  `taxa_juros` decimal(10,2) DEFAULT NULL,
  `data_troca` date NOT NULL,
  `data_vencimento` date NOT NULL,
  `dias` int(11) DEFAULT NULL,
  `juros` decimal(10,2) NOT NULL,
  `valor_liquido` decimal(10,2) NOT NULL,
  `status_pagamento` enum('pendente','pago') DEFAULT 'pendente',
  `data_pagamento` datetime DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `cheques`
--

INSERT INTO `cheques` (`id`, `user_id`, `cliente`, `numero_cheque`, `banco`, `valor`, `taxa_juros`, `data_troca`, `data_vencimento`, `dias`, `juros`, `valor_liquido`, `status_pagamento`, `data_pagamento`, `created_at`) VALUES
(1, 1, 'ALISSON', '123456', 'AAAA', 4900.00, NULL, '2025-01-29', '2025-03-04', NULL, 166.60, 4733.40, 'pago', '2025-02-10 00:36:54', '2025-02-10 02:06:11'),
(2, 1, 'TESTE', 'AAAAAA', 'XXXXXX', 4900.00, NULL, '2025-01-29', '2025-03-04', NULL, 166.60, 4733.40, 'pago', '2025-02-09 23:09:20', '2025-02-10 02:07:58'),
(3, 1, 'TESTE 11', '21131', 'AAAXXX', 160.00, NULL, '2025-02-09', '2025-03-09', NULL, 4.48, 155.52, 'pago', '2025-02-09 23:28:59', '2025-02-10 02:21:46'),
(6, 1, 'DSADASD', 'ASDASD', 'DSADAS', 1677.00, NULL, '2025-02-10', '2025-02-21', NULL, 18.45, 1658.55, 'pago', '2025-02-10 00:35:45', '2025-02-10 03:33:20'),
(9, 1, 'ALISSON', '019101', 'SASAS', 760.00, NULL, '2025-02-10', '2025-02-13', NULL, 2.28, 757.72, 'pago', '2025-02-10 00:42:14', '2025-02-10 03:42:10'),
(11, 1, 'TETE', '', '', 5590.00, NULL, '2025-01-29', '2025-03-18', NULL, 268.32, 5321.68, 'pago', '2025-02-10 00:49:44', '2025-02-10 03:48:52'),
(13, 1, 'AAA', 'Q1', 'AA', 100.00, NULL, '2025-02-10', '2025-02-12', NULL, 0.20, 99.80, 'pago', '2025-02-10 00:54:15', '2025-02-10 03:54:09'),
(14, 1, '11', '12', 'Q', 2000.00, NULL, '2025-02-10', '2025-02-28', NULL, 36.00, 1964.00, 'pago', '2025-02-10 01:09:29', '2025-02-10 03:54:38'),
(19, 1, 'TESTE', NULL, NULL, 1600.00, NULL, '2025-02-10', '2025-02-28', NULL, 28.80, 1571.20, 'pago', '2025-02-10 01:59:02', '2025-02-10 03:59:27'),
(22, 1, 'TEST ETS', NULL, NULL, 3325.00, NULL, '2025-02-10', '2025-02-20', NULL, 44.33, 3280.67, 'pago', NULL, '2025-02-10 06:11:03'),
(23, 1, 'TESTE 234', 'Q1234345', 'BANCO LIMA', 1150.00, NULL, '2025-02-10', '2025-02-20', NULL, 15.33, 1134.67, 'pago', NULL, '2025-02-10 06:15:10'),
(28, 1, 'TESTE VALTENCI 11111', '11111', 'BBBB', 4900.00, 3.50, '2025-01-29', '2025-03-04', 34, 194.37, 4705.63, 'pago', NULL, '2025-02-11 03:05:21');

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

--
-- Estrutura para tabela `taxa_juros`
--

CREATE TABLE `taxa_juros` (
  `id` int(11) NOT NULL,
  `usuario_id` int(11) NOT NULL,
  `taxa_mensal` decimal(5,2) DEFAULT 0.00,
  `taxa_diaria` decimal(5,2) DEFAULT 0.00,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `data_criacao` datetime DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Despejando dados para a tabela `taxa_juros`
--

INSERT INTO `taxa_juros` (`id`, `usuario_id`, `taxa_mensal`, `taxa_diaria`, `created_at`, `updated_at`, `data_criacao`) VALUES
(1, 1, 3.00, 0.10, '2025-02-11 00:36:16', '2025-02-11 00:36:16', '2025-02-10 22:47:27');

--
-- Índices para tabelas despejadas
--

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

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

--
-- AUTO_INCREMENT para tabelas despejadas
--

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

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

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

--
-- Restrições para tabelas `taxa_juros`
--
ALTER TABLE `taxa_juros`
  ADD CONSTRAINT `taxa_juros_ibfk_1` FOREIGN KEY (`usuario_id`) REFERENCES `users` (`id`);
COMMIT;

