-- https://www.phpmyadmin.net/
--
-- Anamakine: localhost:3306
-- Üretim Zamanı: 06 Mar 2026, 21:21:28
-- Sunucu sürümü: 8.0.45-cll-lve
-- PHP Sürümü: 8.4.18

START TRANSACTION;



--
-- Veritabanı: `ales9191_kontrol`
--

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

--
-- Tablo için tablo yapısı `deadline_notification_log`
--

CREATE TABLE `deadline_notification_log` (
  `id` int UNSIGNED NOT NULL,
  `log_date` date NOT NULL,
  `period_id` int NOT NULL,
  `user_id` int NOT NULL,
  `level` enum('due','critical') NOT NULL,
  `recipient_email` varchar(190) NOT NULL DEFAULT '',
  `subject` varchar(255) NOT NULL DEFAULT '',
  `item_count` int NOT NULL DEFAULT '0',
  `firm_count` int NOT NULL DEFAULT '0',
  `payload_hash` char(40) NOT NULL,
  `sent_ok` tinyint(1) NOT NULL DEFAULT '0',
  `sent_at` datetime DEFAULT NULL,
  `error_text` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `deadline_notification_log`
--

INSERT INTO `deadline_notification_log` (`id`, `log_date`, `period_id`, `user_id`, `level`, `recipient_email`, `subject`, `item_count`, `firm_count`, `payload_hash`, `sent_ok`, `sent_at`, `error_text`, `created_at`) VALUES
(1, '2026-03-05', 12, 5, 'critical', 'mehmet.irfanoglu@ertadenetim.com', '[KRITIK] 02/2026 - 1 firma / 2 is', 2, 1, 'b08c9fff02a4bc408294025e62b457da8308dff5', 1, '2026-03-05 18:22:03', NULL, '2026-03-05 18:22:03');

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

--
-- Tablo için tablo yapısı `deadline_notification_log_items`
--

CREATE TABLE `deadline_notification_log_items` (
  `id` int UNSIGNED NOT NULL,
  `log_id` int UNSIGNED NOT NULL,
  `firm_id` int NOT NULL,
  `firm_name` varchar(190) NOT NULL DEFAULT '',
  `item_group` varchar(190) NOT NULL DEFAULT '',
  `item_name` varchar(190) NOT NULL DEFAULT '',
  `item_state` varchar(30) NOT NULL DEFAULT '',
  `due_at` datetime DEFAULT NULL,
  `critical_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `deadline_notification_log_items`
--

INSERT INTO `deadline_notification_log_items` (`id`, `log_id`, `firm_id`, `firm_name`, `item_group`, `item_name`, `item_state`, `due_at`, `critical_at`, `created_at`) VALUES
(1, 1, 29, '34 Turizm Yatırım', 'Bankalar', 'Akbank', 'critical', '2026-03-01 17:00:00', '2026-03-04 17:00:00', '2026-03-05 18:22:03'),
(2, 1, 29, '34 Turizm Yatırım', 'Bankalar', 'Denizbank', 'critical', '2026-03-01 17:00:00', '2026-03-04 17:00:00', '2026-03-05 18:22:04');

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

--
-- Tablo için tablo yapısı `deadline_templates`
--

CREATE TABLE `deadline_templates` (
  `id` int NOT NULL,
  `year` int NOT NULL,
  `month` tinyint NOT NULL,
  `scope` varchar(32) NOT NULL,
  `ref_id` int NOT NULL DEFAULT '0',
  `target_at` datetime DEFAULT NULL,
  `due_at` datetime DEFAULT NULL,
  `critical_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `deadline_templates`
--

INSERT INTO `deadline_templates` (`id`, `year`, `month`, `scope`, `ref_id`, `target_at`, `due_at`, `critical_at`, `created_at`, `updated_at`) VALUES
(1, 2026, 2, 'banks_global', 0, '2026-03-07 17:00:00', '2026-03-07 17:00:00', '2026-03-12 17:00:00', '2026-02-21 17:49:08', '2026-03-06 19:01:48'),
(2, 2026, 2, 'docs_global', 0, '2026-03-07 17:00:00', '2026-03-07 17:00:00', '2026-03-12 17:00:00', '2026-02-21 17:49:08', '2026-03-06 19:01:48'),
(3, 2026, 2, 'decl', 3, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-02-21 17:49:08', '2026-03-06 19:01:48'),
(4, 2026, 2, 'sub', 6, '2026-03-25 17:00:00', '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 17:49:08', '2026-03-06 19:01:48'),
(7, 2026, 2, 'decl', 12, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-02-21 17:56:35', '2026-03-06 19:01:48'),
(23, 2026, 2, 'decl', 7, '2026-05-01 17:00:00', '2026-05-01 17:00:00', '2026-05-31 17:00:00', '2026-02-21 18:00:40', '2026-03-06 19:01:48'),
(26, 2026, 1, 'banks_global', 0, '2026-02-07 17:00:00', '2026-02-07 17:00:00', '2026-02-15 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(27, 2026, 1, 'docs_global', 0, '2026-02-07 17:00:00', '2026-02-07 17:00:00', '2026-02-15 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(28, 2026, 1, 'decl', 12, '2026-02-20 17:00:00', '2026-02-20 17:00:00', '2026-02-26 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(29, 2026, 1, 'decl', 7, '2026-02-12 17:00:00', '2026-02-12 17:00:00', '2026-02-17 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(30, 2026, 1, 'decl', 1, '2026-02-20 17:00:00', '2026-02-20 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(31, 2026, 1, 'decl', 3, '2026-02-20 17:00:00', '2026-02-20 17:00:00', '2026-02-25 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(32, 2026, 1, 'decl', 2, '2026-02-20 17:00:00', '2026-02-20 17:00:00', '2026-02-26 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(33, 2026, 1, 'decl', 4, '2026-02-20 17:00:00', '2026-02-20 17:00:00', '2026-02-26 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(34, 2026, 1, 'main', 4, '2026-02-25 17:00:00', '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(35, 2026, 1, 'sub', 6, '2026-02-25 17:00:00', '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(36, 2026, 1, 'sub', 7, '2026-02-25 17:00:00', '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(37, 2026, 1, 'sub', 8, '2026-02-25 17:00:00', '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-03-06 19:01:48'),
(59, 2026, 2, 'decl', 1, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-28 17:00:00', '2026-02-21 23:00:00', '2026-03-06 19:01:48'),
(61, 2026, 2, 'decl', 2, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-26 17:00:00', '2026-02-21 23:00:00', '2026-03-06 19:01:48'),
(62, 2026, 2, 'decl', 4, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-02-21 23:00:00', '2026-03-06 19:01:48'),
(63, 2026, 2, 'main', 4, '2026-03-25 17:00:00', '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 23:00:00', '2026-03-06 19:01:48'),
(65, 2026, 2, 'sub', 7, '2026-03-25 17:00:00', '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 23:00:00', '2026-03-06 19:01:48'),
(66, 2026, 2, 'sub', 8, '2026-03-25 17:00:00', '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 23:00:00', '2026-03-06 19:01:48'),
(83, 2026, 2, 'decl', 9, '2026-03-19 17:00:00', '2026-03-19 17:00:00', '2026-03-25 17:00:00', '2026-03-06 09:23:29', '2026-03-06 19:01:48'),
(84, 2026, 2, 'decl', 5, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-28 17:00:00', '2026-03-06 09:23:29', '2026-03-06 19:01:48'),
(87, 2026, 2, 'decl', 11, '2026-03-20 17:00:00', '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-03-06 09:23:29', '2026-03-06 19:01:48'),
(90, 2026, 2, 'decl', 10, '2026-03-25 17:00:00', '2026-03-25 17:00:00', '2026-03-30 17:00:00', '2026-03-06 09:23:29', '2026-03-06 19:01:48');

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

--
-- Tablo için tablo yapısı `def_banks`
--

CREATE TABLE `def_banks` (
  `id` int NOT NULL,
  `name` varchar(150) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `def_banks`
--

INSERT INTO `def_banks` (`id`, `name`, `is_active`) VALUES
(1, 'Garanti', 1),
(2, 'Denizbank', 1),
(3, 'Yapı Kredi', 1),
(4, 'Akbank', 1),
(5, 'Kuveyt Türk', 1),
(6, 'Teb', 1),
(7, 'Qnb', 1),
(8, 'Enpara', 1),
(9, 'İş Bankası', 1),
(10, 'Vakıfbank', 1),
(11, 'Halkbank', 1),
(12, 'Denizbank 1', 1),
(13, 'Denizbank2', 1);

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

--
-- Tablo için tablo yapısı `def_declaration_types`
--

CREATE TABLE `def_declaration_types` (
  `id` int NOT NULL,
  `name` varchar(150) NOT NULL,
  `due_day` tinyint DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `def_declaration_types`
--

INSERT INTO `def_declaration_types` (`id`, `name`, `due_day`, `is_active`) VALUES
(1, 'KDV 1', NULL, 1),
(2, 'Muhtasar 1003 A', NULL, 1),
(3, 'KDV 2', NULL, 1),
(4, 'Muhtasar 1003 B', NULL, 1),
(5, 'Gelir Vergisi', NULL, 1),
(6, 'Kurumlar Vergisi', NULL, 1),
(7, 'Geçici Vergi', NULL, 1),
(8, 'Emlak Vergisi', NULL, 1),
(9, 'Gekap', NULL, 1),
(10, 'Turizm', NULL, 1),
(11, 'Konaklama', NULL, 1),
(12, 'Damga Vergisi', NULL, 1);

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

--
-- Tablo için tablo yapısı `def_document_types`
--

CREATE TABLE `def_document_types` (
  `id` int NOT NULL,
  `name` varchar(150) NOT NULL,
  `due_day` tinyint DEFAULT NULL,
  `critical_day` tinyint DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `def_document_types`
--

INSERT INTO `def_document_types` (`id`, `name`, `due_day`, `critical_day`, `is_active`) VALUES
(1, 'Yazar Kasa', 7, 15, 1),
(2, 'Makbuzlar', 7, 15, 1),
(3, 'Gelen E Fatura', NULL, NULL, 1),
(4, 'Giden E Fatura', NULL, NULL, 1),
(5, 'Giden E SMM', NULL, NULL, 1),
(6, 'Gelen E Arşiv', NULL, NULL, 1),
(7, 'Giden E Arşiv', NULL, NULL, 1),
(8, 'Gelen SMM', NULL, NULL, 1);

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

--
-- Tablo için tablo yapısı `def_main_categories`
--

CREATE TABLE `def_main_categories` (
  `id` int NOT NULL,
  `name` varchar(150) NOT NULL,
  `sort_order` int NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `def_main_categories`
--

INSERT INTO `def_main_categories` (`id`, `name`, `sort_order`, `is_active`) VALUES
(7, 'Genel Kontrol', 0, 1);

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

--
-- Tablo için tablo yapısı `def_sub_categories`
--

CREATE TABLE `def_sub_categories` (
  `id` int NOT NULL,
  `main_category_id` int NOT NULL,
  `name` varchar(200) NOT NULL,
  `sort_order` int NOT NULL DEFAULT '0',
  `due_day` tinyint DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `def_sub_categories`
--

INSERT INTO `def_sub_categories` (`id`, `main_category_id`, `name`, `sort_order`, `due_day`, `is_active`) VALUES
(16, 7, 'Mizan Kontrol', 0, NULL, 1);

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

--
-- Tablo için tablo yapısı `firms`
--

CREATE TABLE `firms` (
  `id` int NOT NULL,
  `name` varchar(200) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `firms`
--

INSERT INTO `firms` (`id`, `name`, `is_active`, `created_at`) VALUES
(7, 'LS Elektrik', 1, '2026-03-05 12:37:31'),
(8, 'Chi Otel', 1, '2026-03-05 12:37:35'),
(9, 'Kokarca Medya', 1, '2026-03-05 12:37:48'),
(10, 'Edip Kumaş - Bekir Serdar Özakalın', 1, '2026-03-05 12:38:10'),
(11, 'Rina Tekstil', 1, '2026-03-05 12:38:18'),
(12, 'Tenet Danışmanlık', 1, '2026-03-05 12:38:25'),
(13, 'Kensol Teknik', 1, '2026-03-05 12:38:30'),
(14, 'Startupfon Kitle Fonlama', 1, '2026-03-05 12:38:41'),
(15, 'LS Cable Systm', 1, '2026-03-05 12:38:52'),
(16, 'Green Dots', 1, '2026-03-05 12:39:04'),
(17, 'Ozan Boydak', 1, '2026-03-05 12:39:10'),
(18, 'Ulusoy Haşal', 1, '2026-03-05 12:39:15'),
(19, 'Mert Gerçin', 1, '2026-03-05 12:39:20'),
(20, 'Berç Ergeçer', 1, '2026-03-05 12:39:27'),
(21, 'Sedat Çebi', 1, '2026-03-05 12:39:31'),
(23, 'Sibel Taşçıoğlu', 1, '2026-03-05 12:39:43'),
(24, 'Zeynep Tuğba Gerçin', 1, '2026-03-05 12:39:49'),
(25, 'Can Akbulut', 1, '2026-03-05 12:39:55'),
(26, 'Torunlar Turizm', 1, '2026-03-05 12:39:58'),
(27, 'İnci Avm', 1, '2026-03-05 12:40:03'),
(28, 'Halim İnci', 1, '2026-03-05 12:40:08'),
(29, '34 Turizm Yatırım', 1, '2026-03-05 12:40:14'),
(30, 'Almira Pasta ve Ekmek', 1, '2026-03-05 12:40:21'),
(31, 'Barış Ekici', 1, '2026-03-05 12:40:26'),
(32, 'Burak Tatlı', 1, '2026-03-05 12:40:31'),
(33, 'Fahri Çelebi', 1, '2026-03-05 12:40:38'),
(34, 'Handuren Tekstil', 1, '2026-03-05 12:40:44'),
(35, 'İbrahim Kamer', 1, '2026-03-05 12:40:49'),
(36, 'Serhan Örsan Avcı', 1, '2026-03-05 12:40:55'),
(37, 'So Design Works Turizm', 1, '2026-03-05 12:41:01'),
(38, 'Şeküre Çubukcu', 1, '2026-03-05 12:41:07'),
(39, 'Zatay Sağlık', 1, '2026-03-05 12:41:14'),
(40, 'Zeynep Torun', 1, '2026-03-05 12:41:21'),
(41, 'Tuğçe İnce', 1, '2026-03-05 12:41:28'),
(42, 'T1 İlaç ve Gıda', 1, '2026-03-05 12:41:37'),
(43, 'T2 Elektronik ve Medikal', 1, '2026-03-05 12:41:49'),
(44, 'Digi2 Mobi', 1, '2026-03-05 12:41:54'),
(45, 'Endro Health', 1, '2026-03-05 12:42:02'),
(46, 'Sempe', 1, '2026-03-05 12:42:08'),
(47, 'Sanmar', 1, '2026-03-05 12:42:12'),
(48, 'Semsa', 1, '2026-03-05 12:42:15'),
(49, 'Memsa Mak.', 1, '2026-03-05 12:42:22'),
(50, 'Memsa Medikal', 1, '2026-03-05 12:42:26'),
(51, 'Mba', 1, '2026-03-05 12:42:31'),
(52, 'Cevher', 1, '2026-03-05 12:42:35'),
(53, 'Pexli', 1, '2026-03-05 12:42:40'),
(54, 'Artec', 1, '2026-03-05 12:42:43'),
(55, 'Fırat Dindaroğlu', 1, '2026-03-05 12:42:51'),
(56, 'Feyzan Çapa', 1, '2026-03-05 12:42:57'),
(57, 'Barış Şentürk', 1, '2026-03-05 12:43:28'),
(58, 'Etki Tekstil', 1, '2026-03-05 12:43:33'),
(59, 'Jandark Tekstil', 1, '2026-03-05 12:43:39'),
(60, 'Kepek Unlu Ltd', 1, '2026-03-05 12:43:47'),
(61, 'Mehmet Şen', 1, '2026-03-05 12:43:54'),
(62, 'Perama Görsel', 1, '2026-03-05 12:44:00'),
(63, 'ZMT Toros A.Ş.', 1, '2026-03-05 12:44:06'),
(64, 'Sadabad Ekmek A.Ş.', 1, '2026-03-05 12:44:13'),
(65, 'Promeda', 1, '2026-03-05 12:44:18'),
(66, 'A Group Enerji', 1, '2026-03-05 12:44:27'),
(67, 'Abacus Advisory', 1, '2026-03-05 12:44:36'),
(68, 'DRN Ağız ve Diş', 1, '2026-03-05 12:44:44'),
(69, 'Mexx Fashion', 1, '2026-03-05 12:44:50'),
(70, 'Özgüven Süt', 1, '2026-03-05 12:44:55'),
(71, 'Cheese Fabriya', 1, '2026-03-05 12:45:05'),
(72, 'Simya Danışmanlık', 1, '2026-03-05 12:45:11'),
(73, 'Sol Enerji', 1, '2026-03-05 12:45:16'),
(74, 'Tursas Gıda', 1, '2026-03-05 12:45:21'),
(75, 'Zeynep Denizel Dizdar', 1, '2026-03-05 12:45:27'),
(77, 'İrfan İnci', 1, '2026-03-05 13:26:18'),
(83, 'Sportoro Veri İşl.', 1, '2026-03-06 17:04:28'),
(84, 'Viking Eğitim Araçları', 1, '2026-03-06 17:05:04'),
(85, 'Tridge Turkey', 1, '2026-03-06 17:05:12'),
(86, 'Star', 1, '2026-03-06 17:05:17'),
(87, 'Kutsan GKM Adi Ortaklık', 1, '2026-03-06 17:05:25'),
(88, 'Kutsan Yapı', 1, '2026-03-06 17:05:30'),
(89, 'FCS', 1, '2026-03-06 17:05:32'),
(90, 'Erba Diagnostic', 1, '2026-03-06 17:05:38'),
(91, 'CK Yapı Teknik', 1, '2026-03-06 17:05:44'),
(92, 'İbrahim Ozan Güzel', 1, '2026-03-06 17:08:46'),
(93, 'Cax Gayrimenkul', 1, '2026-03-06 17:08:53'),
(94, 'Madnasa', 1, '2026-03-06 17:08:58'),
(95, 'Studio 13', 1, '2026-03-06 17:09:05'),
(96, 'Dex A.Ş.', 1, '2026-03-06 17:09:10'),
(97, 'Topkapı Otomasyon', 1, '2026-03-06 17:09:15'),
(98, 'Tamimi', 1, '2026-03-06 17:09:19'),
(99, 'Sanmark İlaç', 1, '2026-03-06 17:09:29'),
(100, 'Kavak Orman Ürünleri A.Ş.', 1, '2026-03-06 17:09:36'),
(101, 'Tursas', 1, '2026-03-06 17:09:40'),
(102, 'Topkapı Elektrik', 1, '2026-03-06 17:09:47'),
(103, 'Maçka Tekstil', 1, '2026-03-06 17:09:53'),
(104, 'Buse Esenduran', 1, '2026-03-06 17:10:00'),
(105, 'Genç Başarı Eğitim Vakfı', 1, '2026-03-06 17:10:10'),
(106, 'Genç Başarı Eğitim Vakfı İkt. İşlt.', 1, '2026-03-06 17:10:17'),
(107, 'Önder Şengül', 1, '2026-03-06 17:10:21'),
(108, 'Şamil Kafkas', 1, '2026-03-06 17:10:27'),
(109, 'Emin Çetinsoy', 1, '2026-03-06 17:10:31'),
(110, 'Ceren Yetkin', 1, '2026-03-06 17:10:37'),
(111, 'Ali Rıza Bilici', 1, '2026-03-06 17:10:42'),
(112, 'Mustafa Cumhur Tunçer', 1, '2026-03-06 17:10:48'),
(113, 'Kemal Karaman', 1, '2026-03-06 17:10:53'),
(114, 'Alp Cem Tunçer', 1, '2026-03-06 17:10:59'),
(115, 'Aslıhan Albayrak', 1, '2026-03-06 17:11:05'),
(116, 'Ertem Ocaklı', 1, '2026-03-06 17:11:11'),
(117, 'Bora Yıldam', 1, '2026-03-06 17:11:17'),
(118, 'Hamdi Faruk Bafralı', 1, '2026-03-06 17:11:23'),
(119, 'Buğra Bafralı', 1, '2026-03-06 17:11:30'),
(120, 'Emre Can Coşkun', 1, '2026-03-06 17:11:35'),
(121, 'Rıfat Duran', 1, '2026-03-06 17:11:39'),
(122, 'Ali Sarıcık', 1, '2026-03-06 17:11:43'),
(123, 'Erta Bağımsız Denetim YMMM', 1, '2026-03-06 17:11:53'),
(124, 'Erta Grup Bağımsız A.Ş.', 1, '2026-03-06 17:11:59'),
(125, 'Go Global Travel', 1, '2026-03-06 17:12:06'),
(126, 'FMS Group', 1, '2026-03-06 17:12:09'),
(127, 'Erta SMMM A.Ş.', 1, '2026-03-06 17:12:14'),
(128, 'İş Holding', 1, '2026-03-06 17:12:18');

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

--
-- Tablo için tablo yapısı `firm_agenda_notes`
--

CREATE TABLE `firm_agenda_notes` (
  `id` int NOT NULL,
  `firm_id` int NOT NULL,
  `target_year` smallint NOT NULL,
  `target_month` tinyint NOT NULL,
  `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `note_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `created_by_user_id` int NOT NULL,
  `created_by_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `updated_by_user_id` int NOT NULL,
  `updated_by_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `firm_agenda_notes`
--

INSERT INTO `firm_agenda_notes` (`id`, `firm_id`, `target_year`, `target_month`, `title`, `note_text`, `created_by_user_id`, `created_by_name`, `updated_by_user_id`, `updated_by_name`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 29, 2026, 3, 'Deneme', 'not', 5, '0', 5, 'Mehmet İrfanoğlu', 0, '2026-03-06 00:21:53', '2026-03-06 00:22:06'),
(2, 29, 2026, 7, 'test', 'eiauieauia', 10, '0', 10, 'Ezgi Kaçmaz', 0, '2026-03-06 00:31:32', '2026-03-06 00:31:52'),
(3, 29, 2026, 3, 'eia', 'iaue', 5, '0', 5, 'Mehmet İrfanoğlu', 0, '2026-03-06 00:33:05', '2026-03-06 00:38:40'),
(4, 29, 2026, 3, 'beyannameler hatırlatılacak', '', 5, 'Mehmet İrfanoğlu', 5, 'Mehmet İrfanoğlu', 0, '2026-03-06 00:37:23', '2026-03-06 00:38:43'),
(5, 29, 2026, 3, 'kontrol mekanizması', 'herşey yolunda', 5, 'Mehmet İrfanoğlu', 5, 'Mehmet İrfanoğlu', 0, '2026-03-06 00:37:49', '2026-03-06 00:38:47'),
(6, 29, 2026, 3, 'deneme', 'deneme deneme deneme', 5, 'Mehmet İrfanoğlu', 5, 'Mehmet İrfanoğlu', 0, '2026-03-06 00:39:10', '2026-03-06 01:19:05'),
(7, 29, 2026, 3, 'Kontrol', 'Kontrol', 5, 'Mehmet İrfanoğlu', 10, 'Ezgi Kaçmaz', 1, '2026-03-06 01:19:33', '2026-03-06 16:52:00');

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

--
-- Tablo için tablo yapısı `firm_agenda_note_check_items`
--

CREATE TABLE `firm_agenda_note_check_items` (
  `id` int NOT NULL,
  `note_id` int NOT NULL,
  `item_text` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_done` tinyint(1) NOT NULL DEFAULT '0',
  `sort_order` int NOT NULL DEFAULT '0',
  `created_by_user_id` int NOT NULL DEFAULT '0',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `firm_agenda_note_check_items`
--

INSERT INTO `firm_agenda_note_check_items` (`id`, `note_id`, `item_text`, `is_done`, `sort_order`, `created_by_user_id`, `created_at`, `updated_at`) VALUES
(14, 7, 'checklist', 0, 2, 5, '2026-03-06 01:19:43', '2026-03-06 16:51:55'),
(15, 7, 'aaa', 0, 1, 5, '2026-03-06 01:19:46', '2026-03-06 16:51:56');

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

--
-- Tablo için tablo yapısı `firm_agenda_note_recipients`
--

CREATE TABLE `firm_agenda_note_recipients` (
  `id` int NOT NULL,
  `note_id` int NOT NULL,
  `user_id` int NOT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `firm_agenda_note_recipients`
--

INSERT INTO `firm_agenda_note_recipients` (`id`, `note_id`, `user_id`, `created_at`) VALUES
(1, 2, 14, '2026-03-06 00:31:32'),
(3, 3, 6, '2026-03-06 00:36:42'),
(9, 7, 5, '2026-03-06 16:52:00');

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

--
-- Tablo için tablo yapısı `firm_agenda_note_reminders`
--

CREATE TABLE `firm_agenda_note_reminders` (
  `id` int NOT NULL,
  `note_id` int NOT NULL,
  `remind_at` datetime NOT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `firm_agenda_note_reminders`
--

INSERT INTO `firm_agenda_note_reminders` (`id`, `note_id`, `remind_at`, `created_at`) VALUES
(1, 1, '2026-07-17 17:00:00', '2026-03-06 00:21:53'),
(2, 2, '2026-03-28 00:31:00', '2026-03-06 00:31:32'),
(4, 3, '2026-03-20 00:32:00', '2026-03-06 00:36:42'),
(5, 4, '2026-03-29 00:37:00', '2026-03-06 00:37:23'),
(6, 5, '2026-03-31 00:37:00', '2026-03-06 00:37:50'),
(10, 6, '2026-03-31 00:39:00', '2026-03-06 01:03:32'),
(11, 6, '2026-04-30 00:46:00', '2026-03-06 01:03:32'),
(17, 7, '2026-03-06 01:22:00', '2026-03-06 16:52:00');

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

--
-- Tablo için tablo yapısı `firm_agenda_reminder_log`
--

CREATE TABLE `firm_agenda_reminder_log` (
  `id` int NOT NULL,
  `reminder_id` int NOT NULL,
  `note_id` int NOT NULL,
  `to_user_id` int NOT NULL,
  `to_email` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `subject` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  `sent_ok` tinyint(1) NOT NULL DEFAULT '0',
  `error_text` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
  `sent_at` datetime NOT NULL,
  `created_at` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Tablo döküm verisi `firm_agenda_reminder_log`
--

INSERT INTO `firm_agenda_reminder_log` (`id`, `reminder_id`, `note_id`, `to_user_id`, `to_email`, `subject`, `sent_ok`, `error_text`, `sent_at`, `created_at`) VALUES
(1, 15, 7, 5, 'mehmet.irfanoglu@ertadenetim.com', 'Ajanda Hatırlatma - 34 Turizm Yatırım - Kontrol', 1, '', '2026-03-06 01:22:03', '2026-03-06 01:22:03');

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

--
-- Tablo için tablo yapısı `firm_banks`
--

CREATE TABLE `firm_banks` (
  `firm_id` int NOT NULL,
  `bank_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `firm_declaration_types`
--

CREATE TABLE `firm_declaration_types` (
  `firm_id` int NOT NULL,
  `declaration_type_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `firm_document_types`
--

CREATE TABLE `firm_document_types` (
  `firm_id` int NOT NULL,
  `document_type_id` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `firm_integrator_accounts`
--

CREATE TABLE `firm_integrator_accounts` (
  `id` int NOT NULL,
  `firm_id` int NOT NULL,
  `integrator_name` varchar(150) NOT NULL DEFAULT '',
  `integrator_url` varchar(255) DEFAULT NULL,
  `integrator_username` varchar(150) NOT NULL DEFAULT '',
  `integrator_password` varchar(255) NOT NULL DEFAULT '',
  `has_password_confirmation` tinyint(1) NOT NULL DEFAULT '0',
  `confirmation_target` varchar(255) NOT NULL DEFAULT '',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `firm_integrator_accounts`
--

INSERT INTO `firm_integrator_accounts` (`id`, `firm_id`, `integrator_name`, `integrator_url`, `integrator_username`, `integrator_password`, `has_password_confirmation`, `confirmation_target`, `created_at`, `updated_at`) VALUES
(5, 7, 'Atlas Paraşüt', 'https://atlas.parasut.com', 'didem.bas@ertamuhasebe.com', 'didem1905', 0, '', '2026-03-05 13:12:23', '2026-03-05 13:12:23'),
(6, 8, 'Cloud Labs e-Belge Sistemi', 'https://ed.cloudlabs.com.tr', 'asli.akdeniz@ertamuhasebe.com', '30031982ASLI', 0, '', '2026-03-05 13:19:18', '2026-03-05 13:19:18'),
(7, 9, 'Gelir İdaresi Mali Mühür', '', '', '', 0, '', '2026-03-05 13:19:50', '2026-03-05 13:19:50'),
(8, 10, 'E Dönüşüm', 'https://edonusum.uyum.com.tr/Giris?ReturnUrl=%2f', 'BekirSerdar', 'WXOuUGXK', 1, 'Ceyda Hanım', '2026-03-05 13:20:28', '2026-03-05 13:20:28'),
(9, 11, 'Edm Bilişim', 'https://nlbui.edmbilisim.com.tr', '7351800514', '7314', 0, '', '2026-03-05 13:20:57', '2026-03-05 13:20:57'),
(10, 12, 'TÜRMOB Luca e-Belge Portalı', '', '18986304234', 'Tenet2026.', 0, '', '2026-03-05 13:21:28', '2026-03-05 13:21:28'),
(11, 13, 'E Arşiv Portal', 'https://earsivportal.efatura.gov.tr', '81412239', '187007', 0, '', '2026-03-05 13:22:05', '2026-03-05 13:22:05'),
(12, 14, 'Cloud Fit Bulut', 'https://cloud.fitbulut.com', 'gulsum@startupfon.com', 'Startupfon-123', 0, '', '2026-03-05 13:22:31', '2026-03-05 13:22:31'),
(13, 15, 'E Portal Mikro', 'https://eportal.mikrogrup.com', 'iremozdemir@lscns.com', 'Lavinia_07', 0, '', '2026-03-05 13:23:01', '2026-03-05 13:23:01'),
(14, 16, 'TÜRMOB Luca e-Belge Portalı', '', '46525844682', '2026Green.', 0, '', '2026-03-05 13:23:23', '2026-03-05 13:23:23'),
(15, 17, 'MAKBUZTEK', 'https://www.makbuztek.com.tr/#/login?returnUrl=%2F', '34996354328', 'Batak2319', 1, 'ozan boydağa sms gidiyor', '2026-03-05 13:24:10', '2026-03-05 13:24:10'),
(16, 18, 'Makbuztek', 'https://www.makbuztek.com.tr/#/login?returnUrl=%2F', 'tahsin.emre.hasal', 'ege723ege', 1, 'emre haşal sms gidiyor.', '2026-03-05 13:24:55', '2026-03-05 13:24:55'),
(17, 19, 'E Arşiv Portal', '', '', '', 0, '', '2026-03-05 13:25:16', '2026-03-05 13:25:16'),
(18, 20, 'E Arşiv Portal', '', '', '', 0, '', '2026-03-05 13:25:45', '2026-03-05 13:25:45'),
(19, 21, 'E Arşiv Portal', '', '', '', 0, '', '2026-03-05 13:25:59', '2026-03-05 13:25:59'),
(20, 77, 'E Arşiv Portal', '', '', '', 0, '', '2026-03-05 13:26:50', '2026-03-05 13:26:50'),
(21, 23, 'E Arşiv Portal - E İmza', '', '', '', 0, '', '2026-03-05 13:27:12', '2026-03-05 13:27:12'),
(22, 24, 'E Arşviz', '', '', '', 1, 'Mert Gerçin E İmza', '2026-03-05 13:27:39', '2026-03-05 13:27:39'),
(23, 25, 'Mikra E Portal', 'https://eportal.mikrogrup.com/', 'akbulut.can@gmail.com', 'Can202400', 0, '', '2026-03-05 13:30:10', '2026-03-05 13:30:10'),
(26, 26, 'Luca Net Üye No: 12314462', '', 'Admin', 'doğa321', 0, '', '2026-03-05 13:35:19', '2026-03-05 13:35:19'),
(27, 26, 'Nette Fatura', '', '15800832782', 'Doga3642..', 0, '', '2026-03-05 13:35:19', '2026-03-05 13:35:19'),
(28, 27, 'E Logo', 'https://efatura.elogo.com.tr/Account/LoginPage?ReturnUrl=/?_gl=1*1lcay3r*_up*MQ..*_gs*MQ..&gclid=Cj0KCQiA8KTNBhD_ARIsAOvp6DJAYWgIcTT8QOpnjZH4JwgMjaMAkcuhreJbcOlswr0BbOhevMeprAgaAqWKEALw_wcB&gbraid=0AAAAADkMRppIdePvBiQ5-mJRuitXKblv8', 'burhaninci@hotmail.com', 'İnci1234567.', 0, '', '2026-03-05 13:36:14', '2026-03-05 13:36:14'),
(29, 28, 'E Logo', 'https://efatura.elogo.com.tr/Account/LoginPage?ReturnUrl=/?_gl=1*1lcay3r*_up*MQ..*_gs*MQ..&gclid=Cj0KCQiA8KTNBhD_ARIsAOvp6DJAYWgIcTT8QOpnjZH4JwgMjaMAkcuhreJbcOlswr0BbOhevMeprAgaAqWKEALw_wcB&gbraid=0AAAAADkMRppIdePvBiQ5-mJRuitXKblv8', 'inci_avm@hotmail.com', 'halim36', 0, '', '2026-03-05 13:36:41', '2026-03-05 13:36:41'),
(31, 30, 'Edb Bilişim', 'https://www.edmbilisim.com.tr/', '550438072', '0572', 1, 'Tanımlı Olmayan Bilgisayarda Onay İstiyor', '2026-03-05 13:37:53', '2026-03-05 13:37:53'),
(32, 31, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '48382322440', 'Be.20262026', 0, '', '2026-03-05 13:38:28', '2026-03-05 13:38:28'),
(33, 32, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '46954738040', 'Burak2308.', 0, '', '2026-03-05 13:38:51', '2026-03-05 13:38:51'),
(34, 33, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '20417407230', 'Fc.20262026', 0, '', '2026-03-05 13:39:14', '2026-03-05 13:39:14'),
(35, 34, 'Paraşüt', 'https://id.parasut.com/realms/parasut/protocol/openid-connect/auth?client_id=parasut-user-app&code_challenge=ym-eW8qEbkDhvH9GJG5dIdFHStAsyGKuHKZOEvx6eVY&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fuygulama.parasut.com%2Fomniauth%2Fparasut_user%2', 'sanliogay@gmail.com', 'Lalibum5992*', 0, '', '2026-03-05 13:40:00', '2026-03-05 13:40:00'),
(36, 35, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '32137669164', 'i.K23082308.', 0, '', '2026-03-05 13:40:25', '2026-03-05 13:40:25'),
(37, 36, 'Elogo', '', '', '', 1, 'Firma Kendi Gönderiyor', '2026-03-05 13:40:48', '2026-03-05 13:40:48'),
(39, 38, 'Turkcell', 'https://portal.turkcellesirket.com/auth/login/?ReturnUrl=https://edonusum.turkcellesirket.com', 'mocubukcu@yahoo.com', 'Moc23062039@', 1, 'Her Giriş SMS', '2026-03-05 13:42:08', '2026-03-05 13:42:08'),
(40, 39, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '46954738040', 'Burak2308.', 0, '', '2026-03-05 13:42:33', '2026-03-05 13:42:33'),
(41, 40, 'Gib Portal', 'https://earsivportal.efatura.gov.tr/intragiris.html', '85708169', '124578', 0, '', '2026-03-05 13:43:02', '2026-03-05 13:43:02'),
(42, 41, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '', '', 0, '', '2026-03-05 13:43:24', '2026-03-05 13:43:24'),
(43, 42, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '46954738040', 'Burak2308.', 0, '', '2026-03-05 13:43:49', '2026-03-05 13:43:49'),
(44, 43, 'Nette Fatura', 'https://nettefatura.isnet.net.tr/account/login?ReturnUrl=%2f', '46954738040', 'Burak2308.', 0, '', '2026-03-05 13:44:16', '2026-03-05 13:44:16'),
(45, 44, 'Uyumsoft E Dönüşüm', 'https://edonusum.uyum.com.tr', 'Digimobi', 'digi2digi2', 1, '\'tanımlı olmayan bilgisayarda sms istiyor', '2026-03-05 13:44:53', '2026-03-05 13:44:53'),
(46, 45, 'Sovos Türkiye Bulut Portal', 'https://cloud.fitbulut.com/kullanici/giris', 'dsafak@endrohealth.com', '202510Endro**5#', 0, '', '2026-03-05 13:45:50', '2026-03-05 13:45:50'),
(47, 46, 'Uyumsoft', 'https://portal.uyumsoft.com.tr/Giris?ReturnUrl=%2f', 'SempeTurizm', 'Sempe2025', 1, 'Ahmet Bey', '2026-03-05 13:47:51', '2026-03-05 13:47:51'),
(48, 46, 'Edm Bilişim', 'https://www.edmbilisim.com.tr/', 'cc_7610512175', 'Flamm!2025', 0, '', '2026-03-05 13:47:51', '2026-03-05 13:47:51'),
(49, 47, 'Bizim Muhasebeci', 'https://app.bizimmuhasebeci.com/login', 'ahmet.yakar@ertadenetim.com', '643885aB.', 1, 'Girişte PIN İstiyor', '2026-03-05 13:49:26', '2026-03-05 13:49:26'),
(50, 48, 'Gib Portal', '', '', '', 1, 'mali mühür ile giriliyor', '2026-03-05 13:49:51', '2026-03-05 13:49:51'),
(51, 49, 'E Logo', 'https://efatura.elogo.com.tr/Account/LoginPage', 'sevda@memsamakina.com', 'Memsa2026101*', 0, '', '2026-03-05 13:50:40', '2026-03-05 13:50:40'),
(52, 50, 'Gib E Arşiv', '', '', '', 0, '', '2026-03-05 13:51:01', '2026-03-05 13:51:01'),
(53, 51, 'Gib E Arşiv', '', '', '', 0, '', '2026-03-05 13:51:13', '2026-03-05 13:51:13'),
(54, 52, 'Edm Bilişim', 'https://portal4.edmbilisim.com.tr/EFaturaUI/', 'sendoganercan', 'Zeynepnaz25.', 0, '', '2026-03-05 13:51:59', '2026-03-05 13:51:59'),
(57, 53, 'Mikro E Portal', 'https://eportal.mikrogrup.com/', 'info@pexli.net', '4200971292037f69db55055c2e63d18e', 0, '', '2026-03-05 13:53:54', '2026-03-05 13:53:54'),
(58, 53, 'Paraşüt', 'https://id.parasut.com/realms/parasut/protocol/openid-connect/auth?client_id=parasut-user-app&code_challenge=hq58vci9F5p1THJWRD-y0CrI2kVsqf7f6jmZm_qHy8g&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fuygulama.parasut.com%2Fomniauth%2Fparasut_user%2', 'aykut.kavak@ertamuhasebe.com', '231907', 1, '', '2026-03-05 13:53:54', '2026-03-05 13:53:54'),
(59, 54, 'Türmob', '', '10936774692', 'Pexli1193!', 0, '', '2026-03-05 13:54:33', '2026-03-05 13:54:33'),
(60, 55, 'QNB Finansbank', 'https://portal.qnbesolutions.com.tr/yonetim/', 'didem.bas', 'Sergen.2026', 0, '', '2026-03-05 13:55:19', '2026-03-05 13:55:19'),
(61, 56, 'Paraşüt', 'https://id.parasut.com/realms/parasut/protocol/openid-connect/auth?client_id=parasut-user-app&code_challenge=-jWynGjvDrMDqbcIAYwe-tV7DAHF9KXn-MiKW8wynE0&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fuygulama.parasut.com%2Fomniauth%2Fparasut_user%2', 'feyzan@apacco.com.tr', '20260659', 0, '', '2026-03-05 13:55:52', '2026-03-05 13:55:52'),
(62, 57, 'Edb Bilişim', 'https://nlbui.edmbilisim.com.tr/EFaturaUI/', '12308702036', '1236', 0, '', '2026-03-05 13:56:19', '2026-03-05 13:56:19'),
(63, 58, 'Digital Planet', 'https://portal.digitalplanet.com.tr/login/index.html?returnUrl=/', 'adminuser', 'ETK808083etk*', 1, 'Firma Adı : ETKITEKS', '2026-03-05 13:57:13', '2026-03-05 13:57:13'),
(64, 59, 'Uyumsoft', 'https://portal.uyumsoft.com.tr/Giris?ReturnUrl=%2f', 'JandarkTekstil', 'bgA8ijHm', 0, '', '2026-03-05 13:57:49', '2026-03-05 13:57:49'),
(65, 60, 'EDM Bilişim', 'https://nlbui.edmbilisim.com.tr/EFaturaUI/', '5440049333', '5433', 0, '', '2026-03-05 13:58:11', '2026-03-05 13:58:11'),
(66, 61, 'EDM Bilişim', 'https://nlbui.edmbilisim.com.tr/EFaturaUI/', '11285487196', '1196', 0, '', '2026-03-05 13:58:41', '2026-03-05 13:58:41'),
(67, 62, 'E Logo', 'https://efatura.elogo.com.tr/Account/LoginPage', 'hamza@peramagorselsanatlar.com', '3434Muhasebe34…,', 0, '', '2026-03-05 13:59:32', '2026-03-05 13:59:32'),
(68, 63, 'Mikro', 'https://eportal.mikrogrup.com/#!?page=1&recordPerPage=20', 'info@zmttoros.com.tr', 'Ky60DdmN', 0, '', '2026-03-05 13:59:52', '2026-03-05 13:59:52'),
(70, 64, 'Turkcell', 'https://portal.turkcellesirket.com/home', 'Tel No: 5549683861', '', 1, 'Hızlı Giriş Emine Hanım', '2026-03-05 14:00:43', '2026-03-05 14:00:43'),
(71, 64, 'İzibiz', 'https://portal.izibiz.com.tr/auth/login', 'Sadabad', '283477', 0, '', '2026-03-05 14:00:43', '2026-03-05 14:00:43'),
(72, 66, 'Türmob', 'https://turmobefatura.luca.com.tr/account/login?ReturnUrl=%2f', '46864349374', 'Sol/1510', 0, '', '2026-03-05 14:01:07', '2026-03-05 14:01:07'),
(73, 67, 'QNB Finansbank', 'https://internetsubesi.qnb.com.tr/Login/LoginPage.aspx', '54670239', '145216', 1, 'Hikmet Bey', '2026-03-05 14:01:40', '2026-03-05 14:01:40'),
(74, 68, 'E Dönüşüm', 'https://edonusum.uyum.com.tr/Giris', 'HikmetAskan', '#0@oRrAl', 0, '', '2026-03-05 14:02:06', '2026-03-05 14:02:06'),
(75, 69, 'Türmob', 'https://turmobefatura.luca.com.tr/account/login?ReturnUrl=%2f', '32881790244', 'Mexx2025!', 0, '', '2026-03-05 14:02:29', '2026-03-05 14:02:29'),
(76, 70, 'Hızlı Teknoloji', 'https://portal.hizliteknoloji.com.tr/', 'hikmet.askan', 'Eren2007', 1, 'Hikmet Bey', '2026-03-05 14:02:59', '2026-03-05 14:02:59'),
(77, 71, 'Turmob', 'https://turmobefatura.luca.com.tr/account/login?ReturnUrl=%2f', '32347393880', 'Cheese2025.', 0, '', '2026-03-05 14:03:26', '2026-03-05 14:03:26'),
(78, 72, 'QNB Finansbank', 'https://internetsubesi.qnb.com.tr/Login/LoginPage.aspx', '54667495', '145216', 1, 'Hikmet Bey', '2026-03-05 14:03:52', '2026-03-05 14:03:52'),
(79, 73, 'Türmob', 'https://turmobefatura.luca.com.tr/account/login?ReturnUrl=%2f', '46864349374', 'Sol/1510', 0, '', '2026-03-05 14:04:17', '2026-03-05 14:04:17'),
(80, 74, 'Atlas Paraşüt', 'https://atlas.parasut.com', 'hikmet.askan@ertamuhasebe.com', '145214', 0, '', '2026-03-05 14:04:43', '2026-03-05 14:04:43'),
(81, 75, 'Mikro', 'https://eportal.mikrogrup.com/', 'studio.kiiwi@gmail.com', '511026Zzz', 0, '', '2026-03-05 14:05:05', '2026-03-05 14:05:05'),
(117, 29, 'Gib E Arşiv', 'https://earsivportal.efatura.gov.tr/intragiris.html', '00134115', '252688', 0, '', '2026-03-06 21:11:18', '2026-03-06 21:11:18'),
(118, 37, 'Logo', 'https://efatura.elogo.com.tr/Account/LoginPage?ReturnUrl=/Invoice/EInvoiceIncomingList', 'eda.bas@ertamuhasebe.com', 'EdaBas2026.', 0, '', '2026-03-06 21:11:37', '2026-03-06 21:11:37');

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

--
-- Tablo için tablo yapısı `firm_main_categories`
--

CREATE TABLE `firm_main_categories` (
  `id` int UNSIGNED NOT NULL,
  `firm_id` int UNSIGNED NOT NULL,
  `main_category_id` int UNSIGNED NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `firm_sub_categories`
--

CREATE TABLE `firm_sub_categories` (
  `id` int UNSIGNED NOT NULL,
  `firm_id` int UNSIGNED NOT NULL,
  `sub_category_id` int UNSIGNED NOT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `mail_smtp_settings`
--

CREATE TABLE `mail_smtp_settings` (
  `id` tinyint UNSIGNED NOT NULL,
  `is_enabled` tinyint(1) NOT NULL DEFAULT '0',
  `host` varchar(190) NOT NULL DEFAULT '',
  `port` int NOT NULL DEFAULT '587',
  `secure` enum('none','ssl','tls') NOT NULL DEFAULT 'tls',
  `username` varchar(190) NOT NULL DEFAULT '',
  `password` varchar(255) NOT NULL DEFAULT '',
  `from_email` varchar(190) NOT NULL DEFAULT '',
  `from_name` varchar(190) NOT NULL DEFAULT 'Operasyon Takip',
  `timeout_sec` int NOT NULL DEFAULT '15',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `mail_smtp_settings`
--

INSERT INTO `mail_smtp_settings` (`id`, `is_enabled`, `host`, `port`, `secure`, `username`, `password`, `from_email`, `from_name`, `timeout_sec`, `created_at`, `updated_at`) VALUES
(1, 1, 'srvc53.trwww.com', 465, 'ssl', 'kontrol@ertadenetim.com.tr', 'Kontrol159357*', 'kontrol@ertadenetim.com.tr', 'Operasyon Takip', 15, '2026-03-05 17:57:18', '2026-03-05 18:12:27');

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

--
-- Tablo için tablo yapısı `notification_test_log`
--

CREATE TABLE `notification_test_log` (
  `id` int UNSIGNED NOT NULL,
  `to_email` varchar(190) NOT NULL,
  `subject` varchar(255) NOT NULL DEFAULT '',
  `sent_ok` tinyint(1) NOT NULL DEFAULT '0',
  `error_text` varchar(255) DEFAULT NULL,
  `created_by` varchar(100) NOT NULL DEFAULT '',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `notification_test_log`
--

INSERT INTO `notification_test_log` (`id`, `to_email`, `subject`, `sent_ok`, `error_text`, `created_by`, `created_at`) VALUES
(1, 'mehmet.irfanoglu@ertadenetim.com', 'SMTP Test - Operasyon Takip', 1, NULL, 'Mehmet', '2026-03-05 18:12:38');

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

--
-- Tablo için tablo yapısı `periods`
--

CREATE TABLE `periods` (
  `id` int NOT NULL,
  `year` smallint NOT NULL,
  `month` tinyint NOT NULL,
  `status` enum('open','closed') NOT NULL DEFAULT 'open',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `periods`
--

INSERT INTO `periods` (`id`, `year`, `month`, `status`, `created_at`) VALUES
(17, 2026, 2, 'open', '2026-03-06 15:29:08');

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

--
-- Tablo için tablo yapısı `period_deadlines`
--

CREATE TABLE `period_deadlines` (
  `id` int NOT NULL,
  `period_id` int NOT NULL,
  `scope` enum('banks_global','docs_global','decl','main','sub') NOT NULL,
  `ref_id` int NOT NULL,
  `target_at` datetime DEFAULT NULL,
  `due_day` tinyint DEFAULT NULL,
  `due_time` time DEFAULT NULL,
  `due_month_offset` tinyint NOT NULL DEFAULT '0',
  `critical_day` tinyint DEFAULT NULL,
  `critical_time` time DEFAULT NULL,
  `critical_month_offset` tinyint NOT NULL DEFAULT '0',
  `due_at` datetime DEFAULT NULL,
  `critical_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `period_deadlines`
--

INSERT INTO `period_deadlines` (`id`, `period_id`, `scope`, `ref_id`, `target_at`, `due_day`, `due_time`, `due_month_offset`, `critical_day`, `critical_time`, `critical_month_offset`, `due_at`, `critical_at`, `created_at`, `updated_at`) VALUES
(361, 17, 'banks_global', 0, '2026-03-07 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-15 17:00:00', '2026-03-20 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(362, 17, 'docs_global', 0, '2026-03-07 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-15 17:00:00', '2026-03-20 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(363, 17, 'decl', 3, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-21 17:00:00', '2026-03-24 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(364, 17, 'sub', 6, '2026-03-25 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-06 15:29:08', '2026-03-06 15:29:08'),
(365, 17, 'decl', 12, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(366, 17, 'decl', 7, '2026-05-01 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-05-10 17:00:00', '2026-05-15 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(367, 17, 'decl', 1, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-22 17:00:00', '2026-03-28 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(368, 17, 'decl', 2, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-22 17:00:00', '2026-03-25 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(369, 17, 'decl', 4, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-22 17:00:00', '2026-03-25 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(370, 17, 'main', 4, '2026-03-25 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-06 15:29:08', '2026-03-06 15:29:08'),
(371, 17, 'sub', 7, '2026-03-25 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-06 15:29:08', '2026-03-06 15:29:08'),
(372, 17, 'sub', 8, '2026-03-25 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-06 15:29:08', '2026-03-06 15:29:08'),
(373, 17, 'decl', 9, '2026-03-19 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(374, 17, 'decl', 5, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-22 17:00:00', '2026-03-28 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(375, 17, 'decl', 11, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-22 17:00:00', '2026-03-25 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(376, 17, 'decl', 10, '2026-03-25 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-26 17:00:00', '2026-03-29 17:00:00', '2026-03-06 15:29:08', '2026-03-06 21:15:31'),
(379, 17, 'main', 7, NULL, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-06 17:42:08', '2026-03-06 21:15:31'),
(380, 17, 'sub', 16, '2026-03-25 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-27 17:00:00', '2026-03-31 17:00:00', '2026-03-06 17:42:08', '2026-03-06 21:15:31'),
(382, 17, 'decl', 8, '2026-03-20 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-06 17:42:08', '2026-03-06 21:15:31'),
(389, 17, 'decl', 6, '2026-04-15 17:00:00', NULL, NULL, 0, NULL, NULL, 0, '2026-04-20 17:00:00', '2026-04-28 17:00:00', '2026-03-06 17:42:08', '2026-03-06 21:15:31');

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

--
-- Tablo için tablo yapısı `period_firms`
--

CREATE TABLE `period_firms` (
  `id` int NOT NULL,
  `period_id` int NOT NULL,
  `firm_id` int NOT NULL,
  `overall_status` enum('not_started','in_progress','done') NOT NULL DEFAULT 'not_started',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `period_firms`
--

INSERT INTO `period_firms` (`id`, `period_id`, `firm_id`, `overall_status`, `created_at`) VALUES
(372, 17, 7, 'not_started', '2026-03-06 15:29:08'),
(373, 17, 8, 'not_started', '2026-03-06 15:29:08'),
(374, 17, 9, 'not_started', '2026-03-06 15:29:08'),
(375, 17, 10, 'not_started', '2026-03-06 15:29:08'),
(376, 17, 11, 'not_started', '2026-03-06 15:29:08'),
(377, 17, 12, 'not_started', '2026-03-06 15:29:08'),
(378, 17, 13, 'not_started', '2026-03-06 15:29:08'),
(379, 17, 14, 'not_started', '2026-03-06 15:29:08'),
(380, 17, 15, 'not_started', '2026-03-06 15:29:08'),
(381, 17, 16, 'not_started', '2026-03-06 15:29:08'),
(382, 17, 17, 'not_started', '2026-03-06 15:29:08'),
(383, 17, 18, 'not_started', '2026-03-06 15:29:08'),
(384, 17, 19, 'not_started', '2026-03-06 15:29:08'),
(385, 17, 20, 'not_started', '2026-03-06 15:29:08'),
(386, 17, 21, 'not_started', '2026-03-06 15:29:08'),
(387, 17, 23, 'not_started', '2026-03-06 15:29:08'),
(388, 17, 24, 'not_started', '2026-03-06 15:29:08'),
(389, 17, 25, 'not_started', '2026-03-06 15:29:08'),
(390, 17, 26, 'not_started', '2026-03-06 15:29:08'),
(391, 17, 27, 'not_started', '2026-03-06 15:29:08'),
(392, 17, 28, 'not_started', '2026-03-06 15:29:08'),
(393, 17, 29, 'not_started', '2026-03-06 15:29:08'),
(394, 17, 30, 'not_started', '2026-03-06 15:29:08'),
(395, 17, 31, 'not_started', '2026-03-06 15:29:08'),
(396, 17, 32, 'not_started', '2026-03-06 15:29:08'),
(397, 17, 33, 'not_started', '2026-03-06 15:29:08'),
(398, 17, 34, 'not_started', '2026-03-06 15:29:08'),
(399, 17, 35, 'not_started', '2026-03-06 15:29:08'),
(400, 17, 36, 'not_started', '2026-03-06 15:29:08'),
(401, 17, 37, 'not_started', '2026-03-06 15:29:08'),
(402, 17, 38, 'not_started', '2026-03-06 15:29:08'),
(403, 17, 39, 'not_started', '2026-03-06 15:29:08'),
(404, 17, 40, 'not_started', '2026-03-06 15:29:08'),
(405, 17, 41, 'not_started', '2026-03-06 15:29:08'),
(406, 17, 42, 'not_started', '2026-03-06 15:29:08'),
(407, 17, 43, 'not_started', '2026-03-06 15:29:08'),
(408, 17, 44, 'not_started', '2026-03-06 15:29:08'),
(409, 17, 45, 'not_started', '2026-03-06 15:29:08'),
(410, 17, 46, 'not_started', '2026-03-06 15:29:08'),
(411, 17, 47, 'not_started', '2026-03-06 15:29:08'),
(412, 17, 48, 'not_started', '2026-03-06 15:29:08'),
(413, 17, 49, 'not_started', '2026-03-06 15:29:08'),
(414, 17, 50, 'not_started', '2026-03-06 15:29:08'),
(415, 17, 51, 'not_started', '2026-03-06 15:29:08'),
(416, 17, 52, 'not_started', '2026-03-06 15:29:08'),
(417, 17, 53, 'not_started', '2026-03-06 15:29:08'),
(418, 17, 54, 'not_started', '2026-03-06 15:29:08'),
(419, 17, 55, 'not_started', '2026-03-06 15:29:08'),
(420, 17, 56, 'not_started', '2026-03-06 15:29:08'),
(421, 17, 57, 'not_started', '2026-03-06 15:29:08'),
(422, 17, 58, 'not_started', '2026-03-06 15:29:08'),
(423, 17, 59, 'not_started', '2026-03-06 15:29:08'),
(424, 17, 60, 'not_started', '2026-03-06 15:29:08'),
(425, 17, 61, 'not_started', '2026-03-06 15:29:08'),
(426, 17, 62, 'not_started', '2026-03-06 15:29:08'),
(427, 17, 63, 'not_started', '2026-03-06 15:29:08'),
(428, 17, 64, 'not_started', '2026-03-06 15:29:08'),
(429, 17, 65, 'not_started', '2026-03-06 15:29:08'),
(430, 17, 66, 'not_started', '2026-03-06 15:29:08'),
(431, 17, 67, 'not_started', '2026-03-06 15:29:08'),
(432, 17, 68, 'not_started', '2026-03-06 15:29:08'),
(433, 17, 69, 'not_started', '2026-03-06 15:29:08'),
(434, 17, 70, 'not_started', '2026-03-06 15:29:08'),
(435, 17, 71, 'not_started', '2026-03-06 15:29:08'),
(436, 17, 72, 'not_started', '2026-03-06 15:29:08'),
(437, 17, 73, 'not_started', '2026-03-06 15:29:08'),
(438, 17, 74, 'not_started', '2026-03-06 15:29:08'),
(439, 17, 75, 'not_started', '2026-03-06 15:29:08'),
(440, 17, 77, 'not_started', '2026-03-06 15:29:08'),
(443, 17, 83, 'not_started', '2026-03-06 17:04:29'),
(444, 17, 84, 'not_started', '2026-03-06 17:12:20'),
(445, 17, 85, 'not_started', '2026-03-06 17:12:20'),
(446, 17, 86, 'not_started', '2026-03-06 17:12:20'),
(447, 17, 87, 'not_started', '2026-03-06 17:12:20'),
(448, 17, 88, 'not_started', '2026-03-06 17:12:20'),
(449, 17, 89, 'not_started', '2026-03-06 17:12:20'),
(450, 17, 90, 'not_started', '2026-03-06 17:12:20'),
(451, 17, 91, 'not_started', '2026-03-06 17:12:20'),
(452, 17, 92, 'not_started', '2026-03-06 17:12:20'),
(453, 17, 93, 'not_started', '2026-03-06 17:12:20'),
(454, 17, 94, 'not_started', '2026-03-06 17:12:20'),
(455, 17, 95, 'not_started', '2026-03-06 17:12:20'),
(456, 17, 96, 'not_started', '2026-03-06 17:12:20'),
(457, 17, 97, 'not_started', '2026-03-06 17:12:20'),
(458, 17, 98, 'not_started', '2026-03-06 17:12:20'),
(459, 17, 99, 'not_started', '2026-03-06 17:12:20'),
(460, 17, 100, 'not_started', '2026-03-06 17:12:20'),
(461, 17, 101, 'not_started', '2026-03-06 17:12:20'),
(462, 17, 102, 'not_started', '2026-03-06 17:12:20'),
(463, 17, 103, 'not_started', '2026-03-06 17:12:20'),
(464, 17, 104, 'not_started', '2026-03-06 17:12:20'),
(465, 17, 105, 'not_started', '2026-03-06 17:12:20'),
(466, 17, 106, 'not_started', '2026-03-06 17:12:20'),
(467, 17, 107, 'not_started', '2026-03-06 17:12:20'),
(468, 17, 108, 'not_started', '2026-03-06 17:12:20'),
(469, 17, 109, 'not_started', '2026-03-06 17:12:20'),
(470, 17, 110, 'not_started', '2026-03-06 17:12:20'),
(471, 17, 111, 'not_started', '2026-03-06 17:12:20'),
(472, 17, 112, 'not_started', '2026-03-06 17:12:20'),
(473, 17, 113, 'not_started', '2026-03-06 17:12:20'),
(474, 17, 114, 'not_started', '2026-03-06 17:12:20'),
(475, 17, 115, 'not_started', '2026-03-06 17:12:20'),
(476, 17, 116, 'not_started', '2026-03-06 17:12:20'),
(477, 17, 117, 'not_started', '2026-03-06 17:12:20'),
(478, 17, 118, 'not_started', '2026-03-06 17:12:20'),
(479, 17, 119, 'not_started', '2026-03-06 17:12:20'),
(480, 17, 120, 'not_started', '2026-03-06 17:12:20'),
(481, 17, 121, 'not_started', '2026-03-06 17:12:20'),
(482, 17, 122, 'not_started', '2026-03-06 17:12:20'),
(483, 17, 123, 'not_started', '2026-03-06 17:12:20'),
(484, 17, 124, 'not_started', '2026-03-06 17:12:20'),
(485, 17, 125, 'not_started', '2026-03-06 17:12:20'),
(486, 17, 126, 'not_started', '2026-03-06 17:12:20'),
(487, 17, 127, 'not_started', '2026-03-06 17:12:20'),
(488, 17, 128, 'not_started', '2026-03-06 17:12:20');

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

--
-- Tablo için tablo yapısı `period_firm_banks`
--

CREATE TABLE `period_firm_banks` (
  `id` int NOT NULL,
  `period_firm_id` int NOT NULL,
  `bank_id` int NOT NULL,
  `status` enum('pending','done') NOT NULL DEFAULT 'pending',
  `received_at` datetime DEFAULT NULL,
  `transferred_at` datetime DEFAULT NULL,
  `processed_status` enum('pending','done') NOT NULL DEFAULT 'pending',
  `done_at` datetime DEFAULT NULL,
  `processed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `period_firm_declarations`
--

CREATE TABLE `period_firm_declarations` (
  `id` int NOT NULL,
  `period_firm_id` int NOT NULL,
  `declaration_type_id` int NOT NULL,
  `status` enum('pending','done','partial') NOT NULL DEFAULT 'pending',
  `done_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `period_firm_documents`
--

CREATE TABLE `period_firm_documents` (
  `id` int NOT NULL,
  `period_firm_id` int NOT NULL,
  `document_type_id` int NOT NULL,
  `status` enum('pending','done') NOT NULL DEFAULT 'pending',
  `received_at` datetime DEFAULT NULL,
  `transferred_at` datetime DEFAULT NULL,
  `done_at` datetime DEFAULT NULL,
  `processed_status` enum('pending','done') NOT NULL DEFAULT 'pending',
  `processed_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

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

--
-- Tablo için tablo yapısı `period_firm_remarks`
--

CREATE TABLE `period_firm_remarks` (
  `id` int NOT NULL,
  `period_firm_id` int NOT NULL,
  `created_by` varchar(100) NOT NULL DEFAULT 'system',
  `remark` text NOT NULL,
  `remark_topic` varchar(20) NOT NULL DEFAULT 'general',
  `remark_item` varchar(100) NOT NULL DEFAULT '',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `period_firm_remarks`
--

INSERT INTO `period_firm_remarks` (`id`, `period_firm_id`, `created_by`, `remark`, `remark_topic`, `remark_item`, `created_at`) VALUES
(741, 393, 'Mehmet İrfanoğlu', 'Ajanda notu güncellendi: Kontrol', 'general', 'Ajanda', '2026-03-06 16:46:18'),
(742, 393, 'Mehmet İrfanoğlu', ' Evrak: Giden E Arşiv geldi işaretlendi', 'doc', 'Giden E Arşiv', '2026-03-06 16:46:26'),
(743, 393, 'Mehmet İrfanoğlu', ' Evrak: Giden E Arşiv geldi kaldırıldı', 'doc', 'Giden E Arşiv', '2026-03-06 16:46:30'),
(757, 393, 'Ezgi Kaçmaz', 'Ajanda notu güncellendi: Kontrol', 'general', 'Ajanda', '2026-03-06 16:52:00');

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

--
-- Tablo için tablo yapısı `tasks`
--

CREATE TABLE `tasks` (
  `id` int NOT NULL,
  `period_firm_id` int NOT NULL,
  `main_category_id` int NOT NULL,
  `sub_category_id` int NOT NULL,
  `role` enum('operation','control','manager') NOT NULL,
  `status` enum('pending','done') NOT NULL DEFAULT 'pending',
  `done_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `deactivated_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `tasks`
--

INSERT INTO `tasks` (`id`, `period_firm_id`, `main_category_id`, `sub_category_id`, `role`, `status`, `done_at`, `created_at`, `is_active`, `deactivated_at`) VALUES
(51, 393, 7, 16, 'control', 'pending', NULL, '2026-03-06 17:42:27', 0, NULL);

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

--
-- Tablo için tablo yapısı `task_events`
--

CREATE TABLE `task_events` (
  `id` bigint NOT NULL,
  `task_id` int NOT NULL,
  `event_type` enum('created','checked_done','unchecked_done') NOT NULL,
  `event_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `note` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `task_events`
--

INSERT INTO `task_events` (`id`, `task_id`, `event_type`, `event_at`, `note`) VALUES
(165, 51, 'created', '2026-03-06 17:42:27', NULL);

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

--
-- Tablo için tablo yapısı `users`
--

CREATE TABLE `users` (
  `id` int NOT NULL,
  `username` varchar(50) NOT NULL,
  `password_hash` varchar(255) DEFAULT NULL,
  `full_name` varchar(120) DEFAULT NULL,
  `email` varchar(190) DEFAULT NULL,
  `role` enum('ops','control','manager','director') NOT NULL DEFAULT 'ops',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `users`
--

INSERT INTO `users` (`id`, `username`, `password_hash`, `full_name`, `email`, `role`, `is_active`, `created_at`) VALUES
(7, 'hikmet', '$2y$10$ubcdF6cgMKxsij6AKwiJUeMw.e0kIcUl5nJ0ImFziedpXzOV7UEVa', 'hikmet', '', 'manager', 1, '2026-02-21 15:34:21'),
(5, 'Mehmet', '$2y$10$ZpZCyArcJwGfUXP1/d1AGuz6gxgJPVq694t3r55hYAk/b60JQ/vR2', 'Mehmet', 'mehmet.irfanoglu@ertadenetim.com', 'director', 1, '2026-02-21 13:28:21'),
(6, 'Eda', '$2y$10$ja0xNku.RFMmK3GxswfTGex03z5RP7/OqQai.ixKxRe0xMOAIHhpO', 'Eda', '', 'control', 1, '2026-02-21 13:41:22'),
(8, 'sergen', NULL, 'sergen', '', 'ops', 1, '2026-02-23 07:31:43'),
(9, 'yavuz', NULL, 'Yavuz', '', 'ops', 1, '2026-03-04 07:48:10'),
(10, 'ezgi', '$2y$10$bV/WuarL6ZG28BwPHtDWxe/Fg.GMJzKBQCkhBkPaAI4V0fmK4.5/2', 'Ezgi', '', 'ops', 1, '2026-03-04 07:48:28'),
(11, 'Aysegul', '$2y$10$KkjCTMQu2KHPLmJPmCp37OJVs5nFjYg3ecqbb37AT2.Tgx7CceAk.', 'Ayşegül', '', 'ops', 1, '2026-03-04 07:48:46'),
(12, 'asli', '$2y$10$r1E2FQY8pCEe45p0vWpRPuQqcK0ROoZZ9.HAZntA1kpxVidl8eYBS', 'Aslı', '', 'control', 1, '2026-03-04 09:55:03'),
(13, 'ozhan', '$2y$10$bN/Z/iWiHdbyrNe5HCebyOjGVZnHcJ8kOmj7lGb.hOK0YEhPjrtka', 'Özhan', '', 'control', 1, '2026-03-04 09:55:11'),
(14, 'didem', '$2y$10$Ys7E3AkXCxyytpCQxpbiVOSfIhZzgofq78hA4ydsjeRIUVUFdcy02', 'didem', '', 'ops', 1, '2026-03-04 09:55:21'),
(15, 'nilsu', NULL, 'nilsu', '', 'ops', 1, '2026-03-05 17:58:42'),
(16, 'anil', NULL, 'Anıl', '', 'director', 1, '2026-03-06 14:32:27');

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

--
-- Tablo için tablo yapısı `user_firms`
--

CREATE TABLE `user_firms` (
  `user_id` int NOT NULL,
  `firm_id` int NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `user_firms`
--

INSERT INTO `user_firms` (`user_id`, `firm_id`) VALUES
(6, 27),
(6, 29),
(6, 30),
(6, 31),
(6, 32),
(6, 33),
(6, 34),
(6, 35),
(6, 38),
(6, 39),
(6, 41),
(6, 42),
(6, 43),
(6, 44),
(6, 46),
(6, 93),
(6, 94),
(6, 95),
(6, 96),
(6, 97),
(6, 98),
(8, 54),
(8, 55),
(8, 56),
(8, 105),
(8, 106),
(8, 107),
(8, 108),
(8, 109),
(8, 110),
(8, 111),
(8, 112),
(8, 113),
(8, 114),
(8, 115),
(8, 116),
(8, 117),
(8, 118),
(8, 119),
(8, 120),
(8, 121),
(8, 122),
(12, 7),
(12, 9),
(12, 10),
(12, 11),
(12, 12),
(12, 13),
(12, 14),
(12, 15),
(12, 16),
(12, 45),
(12, 66),
(12, 67),
(12, 72),
(12, 73),
(12, 83),
(12, 84),
(12, 85),
(12, 86),
(12, 87),
(12, 88),
(12, 89),
(12, 90),
(13, 48),
(13, 51),
(13, 52),
(13, 57),
(13, 58),
(13, 59),
(13, 60),
(13, 61),
(13, 62),
(13, 63),
(13, 64),
(13, 65),
(13, 70),
(13, 71),
(13, 74),
(13, 77),
(13, 99),
(13, 100),
(13, 102),
(13, 103),
(13, 104),
(14, 8),
(14, 17),
(14, 18),
(14, 19),
(14, 20),
(14, 21),
(14, 23),
(14, 24),
(14, 25),
(14, 26),
(14, 28),
(14, 36),
(14, 37),
(14, 40),
(14, 49),
(14, 50),
(14, 53),
(14, 68),
(14, 69),
(14, 91),
(14, 92);

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

--
-- Tablo için tablo yapısı `user_permissions`
--

CREATE TABLE `user_permissions` (
  `user_id` int NOT NULL,
  `can_toggle_tasks` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_banks` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_decls` tinyint(1) NOT NULL DEFAULT '0',
  `can_add_dynamic_decl` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_docs` tinyint(1) NOT NULL DEFAULT '0',
  `can_add_remark` tinyint(1) NOT NULL DEFAULT '1',
  `can_view_firm_agenda` tinyint(1) NOT NULL DEFAULT '0',
  `can_add_firm_agenda` tinyint(1) NOT NULL DEFAULT '0',
  `can_edit_firm_agenda` tinyint(1) NOT NULL DEFAULT '0',
  `can_view_all_firms` tinyint(1) NOT NULL DEFAULT '0',
  `menu_periods` tinyint(1) NOT NULL DEFAULT '0',
  `menu_defs` tinyint(1) NOT NULL DEFAULT '0',
  `menu_delay` tinyint(1) NOT NULL DEFAULT '0',
  `menu_stats` tinyint(1) NOT NULL DEFAULT '0',
  `menu_users` tinyint(1) NOT NULL DEFAULT '0',
  `menu_deadline` tinyint(1) NOT NULL DEFAULT '0',
  `menu_firms` tinyint(1) NOT NULL DEFAULT '0',
  `can_generate_month` tinyint(1) NOT NULL DEFAULT '0',
  `notify_email_enabled` tinyint(1) NOT NULL DEFAULT '0',
  `notify_deadline_due_email` tinyint(1) NOT NULL DEFAULT '1',
  `notify_deadline_critical_email` tinyint(1) NOT NULL DEFAULT '1',
  `notify_include_all_firms` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_docs_received` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_docs_transferred` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_docs_done` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_docs_processed` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_banks_received` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_banks_transferred` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_banks_done` tinyint(1) NOT NULL DEFAULT '0',
  `can_toggle_banks_processed` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Tablo döküm verisi `user_permissions`
--

INSERT INTO `user_permissions` (`user_id`, `can_toggle_tasks`, `can_toggle_banks`, `can_toggle_decls`, `can_add_dynamic_decl`, `can_toggle_docs`, `can_add_remark`, `can_view_firm_agenda`, `can_add_firm_agenda`, `can_edit_firm_agenda`, `can_view_all_firms`, `menu_periods`, `menu_defs`, `menu_delay`, `menu_stats`, `menu_users`, `menu_deadline`, `menu_firms`, `can_generate_month`, `notify_email_enabled`, `notify_deadline_due_email`, `notify_deadline_critical_email`, `notify_include_all_firms`, `can_toggle_docs_received`, `can_toggle_docs_transferred`, `can_toggle_docs_done`, `can_toggle_docs_processed`, `can_toggle_banks_received`, `can_toggle_banks_transferred`, `can_toggle_banks_done`, `can_toggle_banks_processed`) VALUES
(5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(6, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(8, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(9, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0),
(10, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0),
(11, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0),
(12, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0),
(13, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0),
(14, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(15, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0),
(16, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

--
-- Dökümü yapılmış tablolar için indeksler
--

--
-- Tablo için indeksler `deadline_notification_log`
--
ALTER TABLE `deadline_notification_log`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_deadline_mail_once` (`log_date`,`period_id`,`user_id`,`level`,`payload_hash`),
  ADD KEY `idx_deadline_mail_user` (`user_id`,`log_date`),
  ADD KEY `idx_deadline_mail_period` (`period_id`,`log_date`);

--
-- Tablo için indeksler `deadline_notification_log_items`
--
ALTER TABLE `deadline_notification_log_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_log_items_log` (`log_id`),
  ADD KEY `idx_log_items_firm` (`firm_id`);

--
-- Tablo için indeksler `deadline_templates`
--
ALTER TABLE `deadline_templates`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_tpl` (`year`,`month`,`scope`,`ref_id`);

--
-- Tablo için indeksler `def_banks`
--
ALTER TABLE `def_banks`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `def_declaration_types`
--
ALTER TABLE `def_declaration_types`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `def_document_types`
--
ALTER TABLE `def_document_types`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `def_main_categories`
--
ALTER TABLE `def_main_categories`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `def_sub_categories`
--
ALTER TABLE `def_sub_categories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_sub_main` (`main_category_id`);

--
-- Tablo için indeksler `firms`
--
ALTER TABLE `firms`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `firm_agenda_notes`
--
ALTER TABLE `firm_agenda_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_firm_agenda_notes_firm` (`firm_id`),
  ADD KEY `idx_firm_agenda_notes_period` (`target_year`,`target_month`),
  ADD KEY `idx_firm_agenda_notes_active` (`is_active`);

--
-- Tablo için indeksler `firm_agenda_note_check_items`
--
ALTER TABLE `firm_agenda_note_check_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_firm_agenda_note_check_items_note` (`note_id`),
  ADD KEY `idx_firm_agenda_note_check_items_sort` (`note_id`,`sort_order`,`id`);

--
-- Tablo için indeksler `firm_agenda_note_recipients`
--
ALTER TABLE `firm_agenda_note_recipients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_firm_agenda_note_user` (`note_id`,`user_id`),
  ADD KEY `idx_firm_agenda_note_recipients_user` (`user_id`);

--
-- Tablo için indeksler `firm_agenda_note_reminders`
--
ALTER TABLE `firm_agenda_note_reminders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_firm_agenda_note_reminders_due` (`remind_at`),
  ADD KEY `idx_firm_agenda_note_reminders_note` (`note_id`);

--
-- Tablo için indeksler `firm_agenda_reminder_log`
--
ALTER TABLE `firm_agenda_reminder_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_firm_agenda_reminder_log_lookup` (`reminder_id`,`to_user_id`,`sent_ok`),
  ADD KEY `idx_firm_agenda_reminder_log_note` (`note_id`);

--
-- Tablo için indeksler `firm_banks`
--
ALTER TABLE `firm_banks`
  ADD PRIMARY KEY (`firm_id`,`bank_id`),
  ADD KEY `fk_fb_bank` (`bank_id`);

--
-- Tablo için indeksler `firm_declaration_types`
--
ALTER TABLE `firm_declaration_types`
  ADD PRIMARY KEY (`firm_id`,`declaration_type_id`),
  ADD KEY `fk_fdt_type` (`declaration_type_id`);

--
-- Tablo için indeksler `firm_document_types`
--
ALTER TABLE `firm_document_types`
  ADD PRIMARY KEY (`firm_id`,`document_type_id`),
  ADD KEY `fk_fdoc_type` (`document_type_id`);

--
-- Tablo için indeksler `firm_integrator_accounts`
--
ALTER TABLE `firm_integrator_accounts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_firm_integrator_firm` (`firm_id`);

--
-- Tablo için indeksler `firm_main_categories`
--
ALTER TABLE `firm_main_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_firm_main` (`firm_id`,`main_category_id`),
  ADD KEY `idx_firm` (`firm_id`),
  ADD KEY `idx_main` (`main_category_id`);

--
-- Tablo için indeksler `firm_sub_categories`
--
ALTER TABLE `firm_sub_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_firm_sub` (`firm_id`,`sub_category_id`),
  ADD KEY `idx_firm` (`firm_id`),
  ADD KEY `idx_sub` (`sub_category_id`);

--
-- Tablo için indeksler `mail_smtp_settings`
--
ALTER TABLE `mail_smtp_settings`
  ADD PRIMARY KEY (`id`);

--
-- Tablo için indeksler `notification_test_log`
--
ALTER TABLE `notification_test_log`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_notification_test_created` (`created_at`);

--
-- Tablo için indeksler `periods`
--
ALTER TABLE `periods`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_period` (`year`,`month`);

--
-- Tablo için indeksler `period_deadlines`
--
ALTER TABLE `period_deadlines`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uniq_period_scope_ref` (`period_id`,`scope`,`ref_id`),
  ADD KEY `idx_period` (`period_id`);

--
-- Tablo için indeksler `period_firms`
--
ALTER TABLE `period_firms`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_period_firm` (`period_id`,`firm_id`),
  ADD KEY `fk_pf_firm` (`firm_id`);

--
-- Tablo için indeksler `period_firm_banks`
--
ALTER TABLE `period_firm_banks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_pfb` (`period_firm_id`,`bank_id`),
  ADD KEY `fk_pfb_bank` (`bank_id`);

--
-- Tablo için indeksler `period_firm_declarations`
--
ALTER TABLE `period_firm_declarations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_pfd` (`period_firm_id`,`declaration_type_id`),
  ADD KEY `fk_pfd_decl` (`declaration_type_id`);

--
-- Tablo için indeksler `period_firm_documents`
--
ALTER TABLE `period_firm_documents`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `uq_pfdc` (`period_firm_id`,`document_type_id`),
  ADD KEY `fk_pfdc_doc` (`document_type_id`);

--
-- Tablo için indeksler `period_firm_remarks`
--
ALTER TABLE `period_firm_remarks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_pfr_pf` (`period_firm_id`),
  ADD KEY `idx_period_firm_remarks_topic` (`remark_topic`);

--
-- Tablo için indeksler `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_t_pf` (`period_firm_id`),
  ADD KEY `fk_t_main` (`main_category_id`),
  ADD KEY `fk_t_sub` (`sub_category_id`),
  ADD KEY `idx_t_status` (`status`),
  ADD KEY `idx_t_role` (`role`);

--
-- Tablo için indeksler `task_events`
--
ALTER TABLE `task_events`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_te_task` (`task_id`),
  ADD KEY `idx_te_time` (`event_at`);

--
-- Tablo için indeksler `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- Tablo için indeksler `user_firms`
--
ALTER TABLE `user_firms`
  ADD PRIMARY KEY (`user_id`,`firm_id`),
  ADD KEY `firm_id` (`firm_id`);

--
-- Tablo için indeksler `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD PRIMARY KEY (`user_id`);

--
-- Dökümü yapılmış tablolar için AUTO_INCREMENT değeri
--

--
-- Tablo için AUTO_INCREMENT değeri `deadline_notification_log`
--
ALTER TABLE `deadline_notification_log`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Tablo için AUTO_INCREMENT değeri `deadline_notification_log_items`
--
ALTER TABLE `deadline_notification_log_items`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Tablo için AUTO_INCREMENT değeri `deadline_templates`
--
ALTER TABLE `deadline_templates`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=95;

--
-- Tablo için AUTO_INCREMENT değeri `def_banks`
--
ALTER TABLE `def_banks`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- Tablo için AUTO_INCREMENT değeri `def_declaration_types`
--
ALTER TABLE `def_declaration_types`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- Tablo için AUTO_INCREMENT değeri `def_document_types`
--
ALTER TABLE `def_document_types`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- Tablo için AUTO_INCREMENT değeri `def_main_categories`
--
ALTER TABLE `def_main_categories`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- Tablo için AUTO_INCREMENT değeri `def_sub_categories`
--
ALTER TABLE `def_sub_categories`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- Tablo için AUTO_INCREMENT değeri `firms`
--
ALTER TABLE `firms`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=130;

--
-- Tablo için AUTO_INCREMENT değeri `firm_agenda_notes`
--
ALTER TABLE `firm_agenda_notes`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- Tablo için AUTO_INCREMENT değeri `firm_agenda_note_check_items`
--
ALTER TABLE `firm_agenda_note_check_items`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- Tablo için AUTO_INCREMENT değeri `firm_agenda_note_recipients`
--
ALTER TABLE `firm_agenda_note_recipients`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- Tablo için AUTO_INCREMENT değeri `firm_agenda_note_reminders`
--
ALTER TABLE `firm_agenda_note_reminders`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- Tablo için AUTO_INCREMENT değeri `firm_agenda_reminder_log`
--
ALTER TABLE `firm_agenda_reminder_log`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Tablo için AUTO_INCREMENT değeri `firm_integrator_accounts`
--
ALTER TABLE `firm_integrator_accounts`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=119;

--
-- Tablo için AUTO_INCREMENT değeri `firm_main_categories`
--
ALTER TABLE `firm_main_categories`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- Tablo için AUTO_INCREMENT değeri `firm_sub_categories`
--
ALTER TABLE `firm_sub_categories`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;

--
-- Tablo için AUTO_INCREMENT değeri `notification_test_log`
--
ALTER TABLE `notification_test_log`
  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- Tablo için AUTO_INCREMENT değeri `periods`
--
ALTER TABLE `periods`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- Tablo için AUTO_INCREMENT değeri `period_deadlines`
--
ALTER TABLE `period_deadlines`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=697;

--
-- Tablo için AUTO_INCREMENT değeri `period_firms`
--
ALTER TABLE `period_firms`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=507;

--
-- Tablo için AUTO_INCREMENT değeri `period_firm_banks`
--
ALTER TABLE `period_firm_banks`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=411;

--
-- Tablo için AUTO_INCREMENT değeri `period_firm_declarations`
--
ALTER TABLE `period_firm_declarations`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=598;

--
-- Tablo için AUTO_INCREMENT değeri `period_firm_documents`
--
ALTER TABLE `period_firm_documents`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=553;

--
-- Tablo için AUTO_INCREMENT değeri `period_firm_remarks`
--
ALTER TABLE `period_firm_remarks`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=758;

--
-- Tablo için AUTO_INCREMENT değeri `tasks`
--
ALTER TABLE `tasks`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;

--
-- Tablo için AUTO_INCREMENT değeri `task_events`
--
ALTER TABLE `task_events`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=166;

--
-- Tablo için AUTO_INCREMENT değeri `users`
--
ALTER TABLE `users`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;

--
-- Dökümü yapılmış tablolar için kısıtlamalar
--

--
-- Tablo kısıtlamaları `def_sub_categories`
--
ALTER TABLE `def_sub_categories`
  ADD CONSTRAINT `fk_sub_main` FOREIGN KEY (`main_category_id`) REFERENCES `def_main_categories` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `firm_agenda_notes`
--
ALTER TABLE `firm_agenda_notes`
  ADD CONSTRAINT `fk_firm_agenda_notes_firm` FOREIGN KEY (`firm_id`) REFERENCES `firms` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `firm_agenda_note_check_items`
--
ALTER TABLE `firm_agenda_note_check_items`
  ADD CONSTRAINT `fk_firm_agenda_note_check_items_note` FOREIGN KEY (`note_id`) REFERENCES `firm_agenda_notes` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `firm_agenda_note_recipients`
--
ALTER TABLE `firm_agenda_note_recipients`
  ADD CONSTRAINT `fk_firm_agenda_note_recipients_note` FOREIGN KEY (`note_id`) REFERENCES `firm_agenda_notes` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `firm_agenda_note_reminders`
--
ALTER TABLE `firm_agenda_note_reminders`
  ADD CONSTRAINT `fk_firm_agenda_note_reminders_note` FOREIGN KEY (`note_id`) REFERENCES `firm_agenda_notes` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `firm_banks`
--
ALTER TABLE `firm_banks`
  ADD CONSTRAINT `fk_fb_bank` FOREIGN KEY (`bank_id`) REFERENCES `def_banks` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_fb_firm` FOREIGN KEY (`firm_id`) REFERENCES `firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `firm_declaration_types`
--
ALTER TABLE `firm_declaration_types`
  ADD CONSTRAINT `fk_fdt_firm` FOREIGN KEY (`firm_id`) REFERENCES `firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_fdt_type` FOREIGN KEY (`declaration_type_id`) REFERENCES `def_declaration_types` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `firm_document_types`
--
ALTER TABLE `firm_document_types`
  ADD CONSTRAINT `fk_fdoc_firm` FOREIGN KEY (`firm_id`) REFERENCES `firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_fdoc_type` FOREIGN KEY (`document_type_id`) REFERENCES `def_document_types` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `firm_integrator_accounts`
--
ALTER TABLE `firm_integrator_accounts`
  ADD CONSTRAINT `fk_firm_integrator_firm` FOREIGN KEY (`firm_id`) REFERENCES `firms` (`id`) ON DELETE CASCADE;

--
-- Tablo kısıtlamaları `period_deadlines`
--
ALTER TABLE `period_deadlines`
  ADD CONSTRAINT `fk_pd_period` FOREIGN KEY (`period_id`) REFERENCES `periods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `period_firms`
--
ALTER TABLE `period_firms`
  ADD CONSTRAINT `fk_pf_firm` FOREIGN KEY (`firm_id`) REFERENCES `firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_pf_period` FOREIGN KEY (`period_id`) REFERENCES `periods` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `period_firm_banks`
--
ALTER TABLE `period_firm_banks`
  ADD CONSTRAINT `fk_pfb_bank` FOREIGN KEY (`bank_id`) REFERENCES `def_banks` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_pfb_pf` FOREIGN KEY (`period_firm_id`) REFERENCES `period_firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `period_firm_declarations`
--
ALTER TABLE `period_firm_declarations`
  ADD CONSTRAINT `fk_pfd_decl` FOREIGN KEY (`declaration_type_id`) REFERENCES `def_declaration_types` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_pfd_pf` FOREIGN KEY (`period_firm_id`) REFERENCES `period_firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `period_firm_documents`
--
ALTER TABLE `period_firm_documents`
  ADD CONSTRAINT `fk_pfdc_doc` FOREIGN KEY (`document_type_id`) REFERENCES `def_document_types` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_pfdc_pf` FOREIGN KEY (`period_firm_id`) REFERENCES `period_firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `period_firm_remarks`
--
ALTER TABLE `period_firm_remarks`
  ADD CONSTRAINT `fk_pfr_pf` FOREIGN KEY (`period_firm_id`) REFERENCES `period_firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `tasks`
--
ALTER TABLE `tasks`
  ADD CONSTRAINT `fk_t_main` FOREIGN KEY (`main_category_id`) REFERENCES `def_main_categories` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_t_pf` FOREIGN KEY (`period_firm_id`) REFERENCES `period_firms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_t_sub` FOREIGN KEY (`sub_category_id`) REFERENCES `def_sub_categories` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

--
-- Tablo kısıtlamaları `task_events`
--
ALTER TABLE `task_events`
  ADD CONSTRAINT `fk_te_task` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

