-- https://www.phpmyadmin.net/
--
-- Anamakine: localhost:3306
-- Üretim Zamanı: 05 Mar 2026, 17:32:59
-- 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_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',
  `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`, `due_at`, `critical_at`, `created_at`, `updated_at`) VALUES
(1, 2026, 2, 'banks_global', 0, '2026-03-07 17:00:00', '2026-03-12 17:00:00', '2026-02-21 17:49:08', '2026-02-21 23:00:00'),
(2, 2026, 2, 'docs_global', 0, '2026-03-07 17:00:00', '2026-03-06 17:00:00', '2026-02-21 17:49:08', '2026-02-21 23:00:00'),
(3, 2026, 2, 'decl', 3, '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-02-21 17:49:08', '2026-02-21 23:00:00'),
(4, 2026, 2, 'sub', 6, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 17:49:08', '2026-02-21 23:00:00'),
(7, 2026, 2, 'decl', 12, '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-02-21 17:56:35', '2026-02-21 23:00:00'),
(23, 2026, 2, 'decl', 7, '2026-05-01 17:00:00', '2026-05-31 17:00:00', '2026-02-21 18:00:40', '2026-02-21 22:01:58'),
(26, 2026, 1, 'banks_global', 0, '2026-02-07 17:00:00', '2026-02-15 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(27, 2026, 1, 'docs_global', 0, '2026-02-07 17:00:00', '2026-02-15 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(28, 2026, 1, 'decl', 12, '2026-02-20 17:00:00', '2026-02-26 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(29, 2026, 1, 'decl', 7, '2026-02-12 17:00:00', '2026-02-17 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(30, 2026, 1, 'decl', 1, '2026-02-20 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(31, 2026, 1, 'decl', 3, '2026-02-20 17:00:00', '2026-02-25 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(32, 2026, 1, 'decl', 2, '2026-02-20 17:00:00', '2026-02-26 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(33, 2026, 1, 'decl', 4, '2026-02-20 17:00:00', '2026-02-26 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(34, 2026, 1, 'main', 4, '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(35, 2026, 1, 'sub', 6, '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(36, 2026, 1, 'sub', 7, '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(37, 2026, 1, 'sub', 8, '2026-02-25 17:00:00', '2026-02-28 17:00:00', '2026-02-21 22:01:58', '2026-02-21 23:00:00'),
(59, 2026, 2, 'decl', 1, '2026-03-20 17:00:00', '2026-03-28 17:00:00', '2026-02-21 23:00:00', '2026-02-21 23:00:00'),
(61, 2026, 2, 'decl', 2, '2026-03-20 17:00:00', '2026-03-26 17:00:00', '2026-02-21 23:00:00', '2026-02-21 23:00:00'),
(62, 2026, 2, 'decl', 4, '2026-03-20 17:00:00', '2026-03-26 17:00:00', '2026-02-21 23:00:00', '2026-02-21 23:00:00'),
(63, 2026, 2, 'main', 4, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 23:00:00', '2026-02-21 23:00:00'),
(65, 2026, 2, 'sub', 7, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 23:00:00', '2026-02-21 23:00:00'),
(66, 2026, 2, 'sub', 8, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-02-21 23:00:00', '2026-02-21 23:00:00');

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

--
-- 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);

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

--
-- 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);

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

--
-- 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
(4, 'Genel Kontrol', 1, 1),
(5, 'Anıl 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
(6, 4, 'Mizan', 0, NULL, 1),
(7, 4, 'Amortisman', 0, NULL, 1),
(8, 4, 'Gelecek Aylara Ait Giderler', 0, NULL, 1),
(9, 5, 'Kur Farkı Değerleme', 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');

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

--
-- 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 döküm verisi `firm_banks`
--

INSERT INTO `firm_banks` (`firm_id`, `bank_id`) VALUES
(29, 2),
(29, 4);

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

--
-- 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 döküm verisi `firm_declaration_types`
--

INSERT INTO `firm_declaration_types` (`firm_id`, `declaration_type_id`) VALUES
(29, 1),
(29, 2);

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

--
-- 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 döküm verisi `firm_document_types`
--

INSERT INTO `firm_document_types` (`firm_id`, `document_type_id`) VALUES
(29, 3),
(29, 4);

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

--
-- 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 döküm verisi `firm_sub_categories`
--

INSERT INTO `firm_sub_categories` (`id`, `firm_id`, `sub_category_id`, `created_at`) VALUES
(19, 3, 7, '2026-03-04 15:14:51'),
(20, 5, 9, '2026-03-04 15:57:32');

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

--
-- 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
(12, 2026, 2, 'open', '2026-03-04 13:11:48');

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

--
-- 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,
  `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`, `due_day`, `due_time`, `due_month_offset`, `critical_day`, `critical_time`, `critical_month_offset`, `due_at`, `critical_at`, `created_at`, `updated_at`) VALUES
(153, 12, 'banks_global', 0, NULL, NULL, 0, NULL, NULL, 0, '2026-03-01 17:00:00', '2026-03-04 17:00:00', '2026-03-04 13:11:48', '2026-03-05 15:50:12'),
(154, 12, 'docs_global', 0, NULL, NULL, 0, NULL, NULL, 0, '2026-03-07 17:00:00', '2026-03-06 17:00:00', '2026-03-04 13:11:48', '2026-03-05 15:50:12'),
(155, 12, 'decl', 3, NULL, NULL, 0, NULL, NULL, 0, '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-03-04 13:11:48', '2026-03-05 15:50:12'),
(156, 12, 'sub', 6, NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(157, 12, 'decl', 12, NULL, NULL, 0, NULL, NULL, 0, '2026-03-20 17:00:00', '2026-03-25 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(158, 12, 'decl', 7, NULL, NULL, 0, NULL, NULL, 0, '2026-05-01 17:00:00', '2026-05-31 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(159, 12, 'decl', 1, NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(160, 12, 'decl', 2, NULL, NULL, 0, NULL, NULL, 0, '2026-03-20 17:00:00', '2026-03-26 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(161, 12, 'decl', 4, NULL, NULL, 0, NULL, NULL, 0, '2026-03-20 17:00:00', '2026-03-26 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(162, 12, 'main', 4, NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(163, 12, 'sub', 7, NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(164, 12, 'sub', 8, NULL, NULL, 0, NULL, NULL, 0, '2026-03-25 17:00:00', '2026-03-31 17:00:00', '2026-03-04 13:11:49', '2026-03-05 15:50:12'),
(167, 12, 'main', 5, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(169, 12, 'sub', 9, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(174, 12, 'decl', 8, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(176, 12, 'decl', 9, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(177, 12, 'decl', 5, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(180, 12, 'decl', 11, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(181, 12, 'decl', 6, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12'),
(184, 12, 'decl', 10, NULL, NULL, 0, NULL, NULL, 0, NULL, NULL, '2026-03-05 15:49:36', '2026-03-05 15:50:12');

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

--
-- 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
(18, 12, 29, 'in_progress', '2026-03-05 12:45:51'),
(19, 12, 37, 'not_started', '2026-03-05 12:54:37'),
(20, 12, 7, 'not_started', '2026-03-05 13:02:50'),
(21, 12, 8, 'not_started', '2026-03-05 13:19:18'),
(22, 12, 9, 'not_started', '2026-03-05 13:19:50'),
(23, 12, 10, 'not_started', '2026-03-05 13:20:28'),
(24, 12, 11, 'not_started', '2026-03-05 13:20:57'),
(25, 12, 12, 'not_started', '2026-03-05 13:21:28'),
(26, 12, 13, 'not_started', '2026-03-05 13:22:05'),
(27, 12, 14, 'not_started', '2026-03-05 13:22:31'),
(28, 12, 15, 'not_started', '2026-03-05 13:23:01'),
(29, 12, 16, 'not_started', '2026-03-05 13:23:23'),
(30, 12, 17, 'not_started', '2026-03-05 13:24:10'),
(31, 12, 18, 'not_started', '2026-03-05 13:24:55'),
(32, 12, 19, 'not_started', '2026-03-05 13:25:16'),
(33, 12, 20, 'not_started', '2026-03-05 13:25:45'),
(34, 12, 21, 'not_started', '2026-03-05 13:25:59'),
(35, 12, 77, 'not_started', '2026-03-05 13:26:50'),
(36, 12, 23, 'not_started', '2026-03-05 13:27:12'),
(37, 12, 24, 'not_started', '2026-03-05 13:27:39'),
(38, 12, 25, 'not_started', '2026-03-05 13:30:10'),
(39, 12, 26, 'not_started', '2026-03-05 13:33:27'),
(40, 12, 27, 'not_started', '2026-03-05 13:36:14'),
(41, 12, 28, 'not_started', '2026-03-05 13:36:41'),
(42, 12, 30, 'not_started', '2026-03-05 13:37:53'),
(43, 12, 31, 'not_started', '2026-03-05 13:38:28'),
(44, 12, 32, 'not_started', '2026-03-05 13:38:51'),
(45, 12, 33, 'not_started', '2026-03-05 13:39:14'),
(46, 12, 34, 'not_started', '2026-03-05 13:40:00'),
(47, 12, 35, 'not_started', '2026-03-05 13:40:25'),
(48, 12, 36, 'not_started', '2026-03-05 13:40:48'),
(49, 12, 38, 'not_started', '2026-03-05 13:42:08'),
(50, 12, 39, 'not_started', '2026-03-05 13:42:33'),
(51, 12, 40, 'not_started', '2026-03-05 13:43:02'),
(52, 12, 41, 'not_started', '2026-03-05 13:43:24'),
(53, 12, 42, 'not_started', '2026-03-05 13:43:49'),
(54, 12, 43, 'not_started', '2026-03-05 13:44:16'),
(55, 12, 44, 'not_started', '2026-03-05 13:44:53'),
(56, 12, 45, 'not_started', '2026-03-05 13:45:50'),
(57, 12, 46, 'not_started', '2026-03-05 13:47:51'),
(58, 12, 47, 'not_started', '2026-03-05 13:49:26'),
(59, 12, 48, 'not_started', '2026-03-05 13:49:51'),
(60, 12, 49, 'not_started', '2026-03-05 13:50:40'),
(61, 12, 50, 'not_started', '2026-03-05 13:51:01'),
(62, 12, 51, 'not_started', '2026-03-05 13:51:13'),
(63, 12, 52, 'not_started', '2026-03-05 13:51:59'),
(64, 12, 53, 'not_started', '2026-03-05 13:52:47'),
(65, 12, 54, 'not_started', '2026-03-05 13:54:33'),
(66, 12, 55, 'not_started', '2026-03-05 13:55:19'),
(67, 12, 56, 'not_started', '2026-03-05 13:55:52'),
(68, 12, 57, 'not_started', '2026-03-05 13:56:19'),
(69, 12, 58, 'not_started', '2026-03-05 13:57:13'),
(70, 12, 59, 'not_started', '2026-03-05 13:57:49'),
(71, 12, 60, 'not_started', '2026-03-05 13:58:11'),
(72, 12, 61, 'not_started', '2026-03-05 13:58:41'),
(73, 12, 62, 'not_started', '2026-03-05 13:59:32'),
(74, 12, 63, 'not_started', '2026-03-05 13:59:52'),
(75, 12, 64, 'not_started', '2026-03-05 14:00:26'),
(76, 12, 66, 'not_started', '2026-03-05 14:01:07'),
(77, 12, 67, 'not_started', '2026-03-05 14:01:40'),
(78, 12, 68, 'not_started', '2026-03-05 14:02:06'),
(79, 12, 69, 'not_started', '2026-03-05 14:02:29'),
(80, 12, 70, 'not_started', '2026-03-05 14:02:59'),
(81, 12, 71, 'not_started', '2026-03-05 14:03:26'),
(82, 12, 72, 'not_started', '2026-03-05 14:03:52'),
(83, 12, 73, 'not_started', '2026-03-05 14:04:17'),
(84, 12, 74, 'not_started', '2026-03-05 14:04:43'),
(85, 12, 75, 'not_started', '2026-03-05 14:05:05'),
(86, 12, 65, 'not_started', '2026-03-05 15:31:28');

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

--
-- 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 döküm verisi `period_firm_banks`
--

INSERT INTO `period_firm_banks` (`id`, `period_firm_id`, `bank_id`, `status`, `received_at`, `transferred_at`, `processed_status`, `done_at`, `processed_at`) VALUES
(306, 18, 2, 'pending', '2026-03-05 17:21:21', '2026-03-05 17:21:23', 'pending', NULL, NULL),
(307, 18, 4, 'done', '2026-03-05 17:21:03', '2026-03-05 17:21:11', 'pending', '2026-03-05 17:21:16', NULL);

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

--
-- 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 döküm verisi `period_firm_declarations`
--

INSERT INTO `period_firm_declarations` (`id`, `period_firm_id`, `declaration_type_id`, `status`, `done_at`) VALUES
(462, 18, 1, 'done', '2026-03-05 17:23:11'),
(463, 18, 2, 'pending', NULL);

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

--
-- 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 döküm verisi `period_firm_documents`
--

INSERT INTO `period_firm_documents` (`id`, `period_firm_id`, `document_type_id`, `status`, `received_at`, `transferred_at`, `done_at`, `processed_status`, `processed_at`) VALUES
(320, 18, 3, 'pending', NULL, NULL, NULL, 'pending', NULL),
(321, 18, 4, 'pending', '2026-03-05 16:28:11', NULL, NULL, 'pending', NULL);

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

--
-- 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,
  `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`, `created_at`) VALUES
(329, 18, 'Mehmet İrfanoğlu', ' Evrak: Gelen E Arşiv geldi işaretlendi', '2026-03-05 12:46:00'),
(330, 18, 'Mehmet İrfanoğlu', 'Evrak: Gelen E Arşiv işaretlendi', '2026-03-05 12:46:02'),
(331, 18, 'Mehmet İrfanoğlu', 'Evrak: Gelen E Arşiv kaldırıldı', '2026-03-05 12:46:02'),
(332, 18, 'Mehmet İrfanoğlu', ' Evrak: Gelen E Arşiv geldi kaldırıldı', '2026-03-05 12:46:03'),
(333, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank geldi işaretlendi', '2026-03-05 15:31:54'),
(334, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi işaretlendi', '2026-03-05 15:31:57'),
(335, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi kaldırıldı', '2026-03-05 15:36:37'),
(336, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi işaretlendi', '2026-03-05 15:36:41'),
(337, 18, 'Mehmet İrfanoğlu', ' Evrak: Gelen E Fatura geldi işaretlendi', '2026-03-05 15:36:49'),
(338, 18, 'Mehmet İrfanoğlu', ' Evrak: Giden E Fatura geldi işaretlendi', '2026-03-05 15:36:51'),
(339, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank işaretlendi', '2026-03-05 15:38:10'),
(340, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank işaretlendi', '2026-03-05 15:38:13'),
(341, 18, 'Mehmet İrfanoğlu', 'Evrak: Gelen E Fatura işaretlendi', '2026-03-05 15:38:18'),
(342, 18, 'Mehmet İrfanoğlu', 'Evrak: Giden E Fatura işaretlendi', '2026-03-05 15:38:20'),
(343, 18, 'Mehmet İrfanoğlu', ' Beyanname: KDV 1 işaretlendi', '2026-03-05 15:38:23'),
(344, 18, 'Mehmet İrfanoğlu', ' Beyanname: Muhtasar 1003 A işaretlendi', '2026-03-05 15:38:30'),
(345, 18, 'Mehmet İrfanoğlu', ' Beyanname: KDV 1 kaldırıldı', '2026-03-05 15:38:41'),
(346, 18, 'Mehmet İrfanoğlu', ' Beyanname: KDV 1 işaretlendi', '2026-03-05 15:39:27'),
(347, 18, 'Eda Baş', ' Beyanname: KDV 1 kaldırıldı', '2026-03-05 15:42:17'),
(348, 18, 'Eda Baş', ' Beyanname: Muhtasar 1003 A kaldırıldı', '2026-03-05 15:42:18'),
(349, 18, 'Eda Baş', ' Beyanname: Muhtasar 1003 A işaretlendi', '2026-03-05 15:43:11'),
(350, 18, 'Eda Baş', ' Beyanname: KDV 1 işaretlendi', '2026-03-05 15:43:12'),
(351, 18, 'Eda Baş', ' Beyanname: KDV 1 kaldırıldı', '2026-03-05 15:46:57'),
(352, 18, 'Eda Baş', ' Beyanname: Muhtasar 1003 A kaldırıldı', '2026-03-05 15:46:57'),
(353, 18, 'Eda Baş', 'Evrak: Gelen E Fatura kaldırıldı', '2026-03-05 15:46:59'),
(354, 18, 'Eda Baş', 'Evrak: Giden E Fatura kaldırıldı', '2026-03-05 15:46:59'),
(355, 18, 'Ezgi Kaçmaz', ' Banka: Akbank geldi kaldırıldı', '2026-03-05 16:25:54'),
(356, 18, 'Ezgi Kaçmaz', ' Banka: Denizbank geldi kaldırıldı', '2026-03-05 16:25:55'),
(357, 18, 'Ezgi Kaçmaz', ' Evrak: Giden E Fatura geldi kaldırıldı', '2026-03-05 16:25:57'),
(358, 18, 'Ezgi Kaçmaz', ' Evrak: Gelen E Fatura geldi kaldırıldı', '2026-03-05 16:25:57'),
(359, 18, 'Ezgi Kaçmaz', ' Evrak: Gelen E Fatura geldi işaretlendi', '2026-03-05 16:28:11'),
(360, 18, 'Ezgi Kaçmaz', ' Evrak: Giden E Fatura geldi işaretlendi', '2026-03-05 16:28:11'),
(361, 18, 'Ezgi Kaçmaz', ' Banka: Akbank geldi işaretlendi', '2026-03-05 16:28:34'),
(362, 18, 'Ezgi Kaçmaz', ' Banka: Denizbank geldi işaretlendi', '2026-03-05 16:28:36'),
(363, 18, 'Ezgi Kaçmaz', ' Banka: Denizbank geldi kaldırıldı', '2026-03-05 16:28:36'),
(364, 18, 'Ezgi Kaçmaz', ' Banka: Denizbank geldi işaretlendi', '2026-03-05 16:28:49'),
(365, 18, 'Ezgi Kaçmaz', ' Evrak: Gelen E Fatura geldi kaldırıldı', '2026-03-05 16:31:44'),
(366, 18, 'Ezgi Kaçmaz', ' Evrak: Gelen E Fatura geldi işaretlendi', '2026-03-05 16:31:44'),
(367, 18, 'Ezgi Kaçmaz', ' Evrak: Gelen E Fatura geldi kaldırıldı', '2026-03-05 16:33:47'),
(368, 18, 'Ezgi Kaçmaz', 'vatandaş bankaları göndermekten imtina ediyor', '2026-03-05 16:39:49'),
(369, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank geldi kaldırıldı', '2026-03-05 16:40:57'),
(370, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi kaldırıldı', '2026-03-05 16:40:59'),
(371, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank geldi işaretlendi', '2026-03-05 17:05:58'),
(372, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi işaretlendi', '2026-03-05 17:06:00'),
(373, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank geldi kaldırıldı', '2026-03-05 17:06:00'),
(374, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi kaldırıldı', '2026-03-05 17:06:01'),
(375, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank geldi işaretlendi', '2026-03-05 17:21:03'),
(376, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank aktarıldı işaretlendi', '2026-03-05 17:21:07'),
(377, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank aktarıldı kaldırıldı', '2026-03-05 17:21:08'),
(378, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank aktarıldı işaretlendi', '2026-03-05 17:21:11'),
(379, 18, 'Mehmet İrfanoğlu', ' Banka: Akbank işaretlendi', '2026-03-05 17:21:16'),
(380, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank geldi işaretlendi', '2026-03-05 17:21:21'),
(381, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank aktarıldı işaretlendi', '2026-03-05 17:21:23'),
(382, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank işaretlendi', '2026-03-05 17:21:24'),
(383, 18, 'Mehmet İrfanoğlu', ' Banka: Denizbank kaldırıldı', '2026-03-05 17:21:26'),
(384, 18, 'Mehmet İrfanoğlu', ' Beyanname: KDV 1 işaretlendi', '2026-03-05 17:23:11'),
(385, 18, 'Mehmet İrfanoğlu', ' Beyanname: Muhtasar 1003 A işaretlendi', '2026-03-05 17:23:12'),
(386, 18, 'Mehmet İrfanoğlu', ' Beyanname: Muhtasar 1003 A kaldırıldı', '2026-03-05 17:23:13');

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

--
-- 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 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 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, 29),
(7, 3),
(7, 6),
(10, 29),
(14, 5);

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

--
-- 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_toggle_docs` tinyint(1) NOT NULL DEFAULT '0',
  `can_add_remark` tinyint(1) NOT NULL DEFAULT '1',
  `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_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_toggle_docs`, `can_add_remark`, `can_view_all_firms`, `menu_periods`, `menu_defs`, `menu_delay`, `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, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(6, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(7, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(8, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(9, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0),
(10, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0),
(11, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(12, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0),
(13, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0),
(14, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0);

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

--
-- 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_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_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 `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`);

--
-- 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 `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_templates`
--
ALTER TABLE `deadline_templates`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;

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

--
-- 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=8;

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

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

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

--
-- 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=21;

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

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

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

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

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

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

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

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

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

--
-- 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_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ı `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;

