-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `salary_app`
--

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

--
-- Table structure for table `advances`
--

CREATE TABLE `advances` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('advance','loan') NOT NULL DEFAULT 'advance',
  `amount` decimal(12,2) NOT NULL COMMENT 'Requested / approved principal amount',
  `reason` text DEFAULT NULL,
  `request_date` date NOT NULL,
  `installments` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Number of monthly installments',
  `installment_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'amount / installments, auto-deducted each payroll run',
  `amount_repaid` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Total deducted from salary so far',
  `remaining_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'amount - amount_repaid',
  `status` enum('pending','approved','rejected','disbursed','completed','cancelled') NOT NULL DEFAULT 'pending',
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `disbursed_at` timestamp NULL DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `advances`
--

INSERT INTO `advances` (`id`, `employee_id`, `type`, `amount`, `reason`, `request_date`, `installments`, `installment_amount`, `amount_repaid`, `remaining_amount`, `status`, `approved_by`, `approved_at`, `rejection_reason`, `disbursed_at`, `notes`, `created_at`, `updated_at`) VALUES
(1, 1, 'advance', 5000.00, 'medical emergency', '2026-07-18', 12, 416.67, 2083.35, 2916.65, 'disbursed', 3, '2026-07-18 15:18:53', NULL, '2026-07-18 15:19:55', NULL, '2026-07-18 15:18:29', '2026-07-31 12:32:59'),
(2, 2, 'loan', 10000.00, 'g3qg', '2026-07-19', 1, 10000.00, 10000.00, 0.00, 'completed', 3, '2026-07-19 05:01:30', NULL, '2026-07-19 05:04:57', 'q3g34g', '2026-07-19 05:01:24', '2026-07-19 05:05:12'),
(3, 3, 'advance', 600.00, 'salary advance', '2026-07-31', 3, 200.00, 0.00, 600.00, 'approved', 3, '2026-08-01 11:29:49', NULL, NULL, NULL, '2026-08-01 11:29:24', '2026-08-01 11:29:49');

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

--
-- Table structure for table `advance_deductions`
--

CREATE TABLE `advance_deductions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `advance_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `salary_id` bigint(20) UNSIGNED DEFAULT NULL,
  `year` year(4) NOT NULL,
  `month` tinyint(3) UNSIGNED NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `advance_deductions`
--

INSERT INTO `advance_deductions` (`id`, `advance_id`, `employee_id`, `salary_id`, `year`, `month`, `amount`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 35, '2026', 1, 416.67, '2026-07-18 15:20:31', '2026-07-18 15:20:31'),
(2, 1, 1, 38, '2026', 7, 416.67, '2026-07-18 15:20:38', '2026-07-18 15:20:38'),
(3, 1, 1, 41, '2026', 6, 416.67, '2026-07-19 05:01:57', '2026-07-19 05:01:57'),
(4, 2, 2, 45, '2026', 2, 10000.00, '2026-07-19 05:05:12', '2026-07-19 05:05:12'),
(5, 1, 1, 46, '2026', 4, 416.67, '2026-07-21 12:28:58', '2026-07-21 12:28:58'),
(6, 1, 1, 50, '2026', 3, 416.67, '2026-07-31 12:32:59', '2026-07-31 12:32:59');

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

--
-- Table structure for table `application_answers`
--

CREATE TABLE `application_answers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `job_application_id` bigint(20) UNSIGNED NOT NULL,
  `job_question_id` bigint(20) UNSIGNED NOT NULL,
  `answer_text` text DEFAULT NULL,
  `is_correct` tinyint(1) DEFAULT NULL,
  `points_awarded` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `application_interviews`
--

CREATE TABLE `application_interviews` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `job_application_id` bigint(20) UNSIGNED NOT NULL,
  `interview_stage_id` bigint(20) UNSIGNED NOT NULL,
  `interviewer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `scheduled_at` datetime DEFAULT NULL,
  `mode` enum('onsite','phone','video') NOT NULL DEFAULT 'video',
  `result` enum('pending','passed','failed') NOT NULL DEFAULT 'pending',
  `rating` decimal(3,2) DEFAULT NULL,
  `feedback` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `attendances`
--

CREATE TABLE `attendances` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `check_in` time DEFAULT NULL,
  `check_out` time DEFAULT NULL,
  `total_hours` decimal(5,2) DEFAULT NULL,
  `is_leave` tinyint(1) NOT NULL DEFAULT 0,
  `source` varchar(255) NOT NULL DEFAULT 'manual',
  `device_synced_at` timestamp NULL DEFAULT NULL,
  `leave_comment` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `attendances`
--

INSERT INTO `attendances` (`id`, `employee_id`, `date`, `check_in`, `check_out`, `total_hours`, `is_leave`, `source`, `device_synced_at`, `leave_comment`, `created_at`, `updated_at`) VALUES
(3, 1, '2026-07-01', '10:43:40', '20:17:57', 9.34, 0, 'manual', NULL, NULL, '2026-07-01 08:29:40', '2026-07-01 14:17:57'),
(5, 1, '2026-06-30', '10:29:40', '18:48:06', 8.40, 0, 'manual', NULL, NULL, '2026-07-01 08:29:40', '2026-07-01 08:29:40'),
(24, 1, '2026-06-29', '10:00:40', '18:30:00', 8.29, 0, 'manual', NULL, NULL, '2026-07-01 08:29:40', '2026-07-01 08:29:40'),
(25, 1, '2026-06-27', '10:43:40', '20:40:27', 9.95, 0, 'manual', NULL, NULL, '2026-07-01 08:29:40', '2026-07-01 08:35:01'),
(26, 1, '2026-07-05', NULL, NULL, 0.00, 1, 'manual', NULL, NULL, '2026-07-01 15:36:29', '2026-07-01 15:36:29'),
(27, 1, '2026-07-02', '11:31:53', '18:31:50', 8.00, 0, 'manual', NULL, NULL, '2026-07-02 05:31:53', '2026-07-02 05:31:53'),
(28, 3, '2026-07-02', '11:31:57', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-02 05:31:57', '2026-07-02 05:31:57'),
(29, 2, '2026-07-02', NULL, NULL, 0.00, 1, 'manual', NULL, NULL, '2026-07-02 06:22:31', '2026-07-02 06:22:31'),
(46, 1, '2026-07-04', '00:32:00', '00:32:08', 0.00, 0, 'manual', NULL, NULL, '2026-07-03 18:32:00', '2026-07-03 18:32:08'),
(47, 1, '2026-07-06', '10:41:17', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-06 05:41:17', '2026-07-06 05:41:17'),
(48, 3, '2026-07-06', '10:41:22', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-06 05:41:22', '2026-07-06 05:41:22'),
(49, 3, '2026-07-05', '10:00:22', '18:30:06', 8.00, 0, 'manual', NULL, NULL, '2026-07-06 05:41:22', '2026-07-06 05:41:22'),
(50, 2, '2026-07-06', '12:18:54', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-06 06:18:54', '2026-07-06 06:18:54'),
(53, 1, '2026-07-09', '13:14:24', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-09 07:14:24', '2026-07-09 07:14:24'),
(54, 2, '2026-07-09', '13:14:35', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-09 07:14:35', '2026-07-09 07:14:35'),
(55, 3, '2026-07-09', '13:14:37', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-09 07:14:37', '2026-07-09 07:14:37'),
(56, 1, '2026-07-13', '16:08:53', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-13 10:08:53', '2026-07-13 10:08:53'),
(57, 2, '2026-07-13', '17:10:27', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-13 11:10:27', '2026-07-13 11:10:27'),
(58, 3, '2026-07-13', '17:10:29', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-13 11:10:29', '2026-07-13 11:10:29'),
(59, 1, '2026-07-14', '14:19:11', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-14 08:19:11', '2026-07-14 08:19:11'),
(60, 2, '2026-07-14', '14:19:14', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-14 08:19:14', '2026-07-14 08:19:14'),
(61, 3, '2026-07-14', '14:19:16', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-14 08:19:16', '2026-07-14 08:19:16'),
(62, 1, '2026-07-17', '18:25:50', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-17 12:25:50', '2026-07-17 12:25:50'),
(63, 2, '2026-07-17', '18:25:54', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-17 12:25:54', '2026-07-17 12:25:54'),
(64, 3, '2026-07-17', '18:25:57', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-17 12:25:57', '2026-07-17 12:25:57'),
(65, 1, '2026-07-18', '00:18:32', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-17 18:18:32', '2026-07-17 18:18:32'),
(66, 2, '2026-07-18', '00:18:34', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-17 18:18:34', '2026-07-17 18:18:34'),
(67, 3, '2026-07-18', '00:18:39', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-17 18:18:39', '2026-07-17 18:18:39'),
(77, 1, '2026-07-23', '10:27:50', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-23 08:27:50', '2026-07-23 08:27:50'),
(79, 3, '2026-07-23', '10:27:55', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-23 08:27:55', '2026-07-23 08:27:55'),
(80, 2, '2026-07-23', '14:29:16', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-23 08:29:16', '2026-07-23 08:29:16'),
(81, 1, '2026-07-27', '10:51:48', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-27 04:51:48', '2026-07-27 04:51:48'),
(82, 3, '2026-07-27', '10:51:48', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-27 04:51:48', '2026-07-27 04:51:48'),
(83, 2, '2026-07-27', '12:08:05', NULL, NULL, 0, 'manual', NULL, NULL, '2026-07-27 06:08:05', '2026-07-27 06:08:05'),
(84, 1, '2026-07-31', '12:51:50', '12:52:01', 0.00, 0, 'manual', NULL, NULL, '2026-07-31 06:51:50', '2026-07-31 06:52:01'),
(85, 2, '2026-07-31', '12:51:50', '12:52:01', 0.00, 0, 'manual', NULL, NULL, '2026-07-31 06:51:50', '2026-07-31 06:52:01'),
(86, 3, '2026-07-31', '12:51:50', '12:52:01', 0.00, 0, 'manual', NULL, NULL, '2026-07-31 06:51:50', '2026-07-31 06:52:01'),
(87, 1, '2026-08-01', '19:13:02', '19:13:04', 0.00, 0, 'manual', NULL, NULL, '2026-08-01 13:13:02', '2026-08-01 13:13:04'),
(88, 2, '2026-08-01', '19:13:02', '19:13:04', 0.00, 0, 'manual', NULL, NULL, '2026-08-01 13:13:02', '2026-08-01 13:13:04'),
(89, 3, '2026-08-01', '19:13:02', '19:13:04', 0.00, 0, 'manual', NULL, NULL, '2026-08-01 13:13:02', '2026-08-01 13:13:04');

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

--
-- Table structure for table `brands`
--

CREATE TABLE `brands` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `logo` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `brands`
--

INSERT INTO `brands` (`id`, `name`, `slug`, `logo`, `created_at`, `updated_at`) VALUES
(2, 'Bata', 'bata', NULL, '2026-07-27 15:28:41', '2026-07-27 15:28:41');

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

--
-- Table structure for table `calendar_notes`
--

CREATE TABLE `calendar_notes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `date` date NOT NULL,
  `title` varchar(255) NOT NULL,
  `note` text DEFAULT NULL,
  `color` varchar(20) NOT NULL DEFAULT 'blue',
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `calendar_notes`
--

INSERT INTO `calendar_notes` (`id`, `date`, `title`, `note`, `color`, `employee_id`, `created_at`, `updated_at`) VALUES
(1, '2026-11-09', 'Tanvir Birthday', 'Tanvir Hasan Tonmoy', 'green', 1, '2026-07-19 06:00:12', '2026-07-19 06:00:12'),
(2, '2026-11-19', 'chowa birthday', 'chowa birthday at 19 november', 'red', NULL, '2026-07-19 06:19:53', '2026-07-19 06:19:53');

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

--
-- Table structure for table `categories`
--

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `categories`
--

INSERT INTO `categories` (`id`, `name`, `slug`, `description`, `created_at`, `updated_at`) VALUES
(2, 'Cloths', 'cloths', 'Cloths', '2026-07-27 15:28:30', '2026-07-27 15:28:30');

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

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `company` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customers`
--

INSERT INTO `customers` (`id`, `name`, `email`, `phone`, `company`, `address`, `employee_id`, `created_at`, `updated_at`) VALUES
(4, 'Test', 'Test@gmail.com', '01812732936', 'Test', '4/88 rupnagar mirpur', 1, '2026-07-14 05:33:21', '2026-07-14 05:33:21');

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

--
-- Table structure for table `customer_purchases`
--

CREATE TABLE `customer_purchases` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `quantity` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `unit_price` decimal(10,2) NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `purchase_date` date NOT NULL,
  `expiry_date` date DEFAULT NULL,
  `payment_status` enum('paid','pending','partial','refunded') NOT NULL DEFAULT 'paid',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_purchases`
--

INSERT INTO `customer_purchases` (`id`, `customer_id`, `employee_id`, `product_name`, `description`, `quantity`, `unit_price`, `amount`, `purchase_date`, `expiry_date`, `payment_status`, `notes`, `created_at`, `updated_at`) VALUES
(2, 4, 1, 'domain', 'drhgdrh', 1, 1500.00, 1500.00, '2026-07-01', '2026-07-30', 'paid', 'thdth', '2026-07-14 09:22:21', '2026-07-14 09:22:52'),
(3, 4, 1, 'hosting', 'esrgdrg', 1, 5000.00, 5000.00, '2025-07-01', '2026-06-30', 'paid', 'drgdsrg', '2026-07-14 09:23:41', '2026-07-14 09:23:41');

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

--
-- Table structure for table `customer_tasks`
--

CREATE TABLE `customer_tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `priority` enum('low','medium','high') NOT NULL DEFAULT 'medium',
  `assigned_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `status` enum('pending','in_progress','completed','expired','cancelled') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_tasks`
--

INSERT INTO `customer_tasks` (`id`, `employee_id`, `customer_id`, `title`, `description`, `priority`, `assigned_date`, `expiry_date`, `completed_at`, `status`, `notes`, `created_at`, `updated_at`) VALUES
(2, 1, 4, 'Visited on site 7-8-2026', 'Visited customer office at 7-8-2026 2026', 'low', '2026-07-08', '2026-07-08', '2026-07-14 06:00:53', 'completed', 'Next Visite customer office at 8-8-2026 2026', '2026-07-14 06:00:53', '2026-07-14 06:00:53');

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

--
-- Table structure for table `departments`
--

CREATE TABLE `departments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `departments`
--

INSERT INTO `departments` (`id`, `name`, `code`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Accounts', 'ACC', 'Accounting Depertment', 1, '2026-07-13 09:53:45', '2026-07-13 09:54:53'),
(2, 'Development', 'DEV', 'Software Developers', 1, '2026-07-13 09:54:34', '2026-07-13 09:54:34');

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

--
-- Table structure for table `designations`
--

CREATE TABLE `designations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `designations`
--

INSERT INTO `designations` (`id`, `name`, `department_id`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Full stack Developer', 2, 'Full stack Developer', 1, '2026-07-13 09:55:19', '2026-07-13 09:55:43'),
(2, 'Accountants', 1, 'Accountants of PnH', 1, '2026-07-13 09:56:13', '2026-07-13 11:08:06');

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

--
-- Table structure for table `email_messages`
--

CREATE TABLE `email_messages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `imap_account_id` bigint(20) UNSIGNED NOT NULL,
  `uid` bigint(20) UNSIGNED NOT NULL,
  `message_id` varchar(255) DEFAULT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `from_name` varchar(255) DEFAULT NULL,
  `from_email` varchar(255) DEFAULT NULL,
  `to` text DEFAULT NULL,
  `cc` text DEFAULT NULL,
  `body_text` longtext DEFAULT NULL,
  `body_html` longtext DEFAULT NULL,
  `snippet` varchar(255) DEFAULT NULL,
  `has_attachments` tinyint(1) NOT NULL DEFAULT 0,
  `is_seen` tinyint(1) NOT NULL DEFAULT 0,
  `folder` varchar(255) NOT NULL DEFAULT 'INBOX',
  `received_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `employees`
--

CREATE TABLE `employees` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `device_user_id` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `profile_photo` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `gender` varchar(255) DEFAULT NULL,
  `base_salary` decimal(10,2) NOT NULL,
  `working_start` time NOT NULL,
  `working_end` time NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `designation_id` bigint(20) UNSIGNED DEFAULT NULL,
  `role_id` bigint(20) UNSIGNED DEFAULT NULL,
  `joining_date` date DEFAULT NULL,
  `status` enum('active','inactive','terminated','resigned') NOT NULL DEFAULT 'active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `employees`
--

INSERT INTO `employees` (`id`, `device_user_id`, `name`, `email`, `profile_photo`, `phone`, `address`, `dob`, `gender`, `base_salary`, `working_start`, `working_end`, `created_at`, `updated_at`, `department_id`, `designation_id`, `role_id`, `joining_date`, `status`) VALUES
(1, NULL, 'Tanvir Hasan Tonmoy', 'tonmoy199844@gmail.com', 'http://127.0.0.1:8000/employe/1783574973_d0U26RBGHL.png', '01821732936', 'Road 4 , House 89,. Mirpur Rupnagar, Dhaka-1216, Bangladesh', '2002-03-02', 'male', 25000.00, '10:00:00', '18:30:00', '2026-06-29 18:13:46', '2026-07-31 11:45:33', 2, 1, 1, '2026-03-07', 'active'),
(2, NULL, 'Fuad Hasan', 'fuad.pnh@gmail.com', 'http://127.0.0.1:8000/employe/1783574990_nsIyF6AR9a.jpeg', NULL, NULL, NULL, NULL, 10000.00, '10:00:00', '18:30:00', '2026-07-01 01:31:52', '2026-07-13 11:12:38', 2, 1, 2, NULL, 'active'),
(3, NULL, 'Sraboni Saha', 'sraboni.pnh@gmail.com', 'http://127.0.0.1:8000/employe/1783574996_IzUGX3eMt2.png', NULL, NULL, NULL, NULL, 20000.00, '10:00:00', '18:30:00', '2026-07-01 09:01:58', '2026-07-13 11:12:47', 1, 2, 2, NULL, 'active');

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

--
-- Table structure for table `employee_documents`
--

CREATE TABLE `employee_documents` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `document_type` varchar(255) NOT NULL,
  `file_name` varchar(255) NOT NULL,
  `file_path` varchar(255) NOT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `employee_exits`
--

CREATE TABLE `employee_exits` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `exit_date` date NOT NULL,
  `exit_type` enum('resignation','termination','retirement') DEFAULT NULL,
  `reason` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `employee_exits`
--

INSERT INTO `employee_exits` (`id`, `employee_id`, `exit_date`, `exit_type`, `reason`, `notes`, `created_at`, `updated_at`) VALUES
(5, 7, '2026-07-09', 'termination', '32rw', 'wrw', '2026-07-09 11:07:04', '2026-07-09 11:07:04');

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

--
-- Table structure for table `expenses`
--

CREATE TABLE `expenses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `expense_category_id` bigint(20) UNSIGNED NOT NULL,
  `source` enum('manual','auto') NOT NULL DEFAULT 'manual',
  `expense_number` varchar(255) DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `purchase_order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `stock_receiving_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` int(255) DEFAULT NULL,
  `expense_date` date NOT NULL,
  `next_due_date` date DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `payment_method` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `attachment_path` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `submitted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expenses`
--

INSERT INTO `expenses` (`id`, `expense_category_id`, `source`, `expense_number`, `vendor_id`, `purchase_order_id`, `stock_receiving_id`, `employee_id`, `customer_id`, `created_by`, `expense_date`, `next_due_date`, `amount`, `paid_amount`, `payment_method`, `description`, `attachment_path`, `status`, `submitted_by`, `approved_by`, `approved_at`, `rejection_reason`, `created_at`, `updated_at`) VALUES
(13, 13, 'manual', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2026-07-27', NULL, 500.00, 500.00, 'cash', NULL, NULL, 'approved', 3, 3, '2026-07-27 07:06:00', NULL, '2026-07-27 07:05:42', '2026-07-31 14:23:02'),
(17, 14, 'auto', 'EXP-000001', 6, 9, 17, NULL, NULL, 3, '2026-07-27', NULL, 2500.00, 2500.00, NULL, 'Auto-entry for GRN-000001 (PO-000001) from Pran Deler', NULL, 'approved', NULL, NULL, '2026-07-27 15:39:10', NULL, '2026-07-27 15:39:10', '2026-07-31 14:30:06');

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

--
-- Table structure for table `expense_categories`
--

CREATE TABLE `expense_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expense_categories`
--

INSERT INTO `expense_categories` (`id`, `name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(13, 'test expense category', 'test expense category', 1, '2026-07-27 07:05:24', '2026-07-27 07:05:24'),
(14, 'Purchases', NULL, 1, '2026-07-27 08:51:53', '2026-07-27 08:51:53');

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

--
-- Table structure for table `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `incomes`
--

CREATE TABLE `incomes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `income_category_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `income_date` date NOT NULL,
  `next_due_date` date DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `source` varchar(255) DEFAULT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `attachment_path` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `income_categories`
--

CREATE TABLE `income_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `income_categories`
--

INSERT INTO `income_categories` (`id`, `name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(4, 'test income', 'test income', 1, '2026-07-27 06:58:51', '2026-07-27 06:58:51');

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

--
-- Table structure for table `interview_stages`
--

CREATE TABLE `interview_stages` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `job_posting_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `investments`
--

CREATE TABLE `investments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `investor_id` bigint(20) UNSIGNED NOT NULL,
  `investment_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `profit_percentage` decimal(5,2) DEFAULT NULL,
  `months` int(11) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `proof_image` varchar(255) DEFAULT NULL,
  `attachment_path` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `investment_withdrawals`
--

CREATE TABLE `investment_withdrawals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `investment_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `note` text DEFAULT NULL,
  `proof_image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `investors`
--

CREATE TABLE `investors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `status` enum('active','inactive') DEFAULT 'active',
  `profile_photo` varchar(255) DEFAULT NULL,
  `documents` longtext DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `jobs`
--

CREATE TABLE `jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `queue` varchar(255) NOT NULL,
  `payload` longtext NOT NULL,
  `attempts` tinyint(3) UNSIGNED NOT NULL,
  `reserved_at` int(10) UNSIGNED DEFAULT NULL,
  `available_at` int(10) UNSIGNED NOT NULL,
  `created_at` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `job_applications`
--

CREATE TABLE `job_applications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `job_posting_id` bigint(20) UNSIGNED NOT NULL,
  `full_name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `cover_letter` text DEFAULT NULL,
  `cv_path` varchar(255) DEFAULT NULL,
  `auto_score` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `max_score` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `interview_rating` decimal(3,2) DEFAULT NULL,
  `current_stage_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` enum('applied','screening','shortlisted','interview','offered','hired','rejected','withdrawn') NOT NULL DEFAULT 'applied',
  `rejection_reason` text DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `applied_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `job_batches`
--

CREATE TABLE `job_batches` (
  `id` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `total_jobs` int(11) NOT NULL,
  `pending_jobs` int(11) NOT NULL,
  `failed_jobs` int(11) NOT NULL,
  `failed_job_ids` longtext NOT NULL,
  `options` mediumtext DEFAULT NULL,
  `cancelled_at` int(11) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `finished_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `job_postings`
--

CREATE TABLE `job_postings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `designation_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text DEFAULT NULL,
  `requirements` text DEFAULT NULL,
  `responsibilities` text DEFAULT NULL,
  `location` varchar(255) DEFAULT NULL,
  `employment_type` enum('full_time','part_time','contract','internship','temporary') NOT NULL DEFAULT 'full_time',
  `visibility` enum('public','private') NOT NULL DEFAULT 'public',
  `status` enum('draft','open','closed') NOT NULL DEFAULT 'draft',
  `positions_count` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `salary_min` decimal(10,2) DEFAULT NULL,
  `salary_max` decimal(10,2) DEFAULT NULL,
  `application_deadline` date DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `job_questions`
--

CREATE TABLE `job_questions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `job_posting_id` bigint(20) UNSIGNED NOT NULL,
  `question` text NOT NULL,
  `type` enum('text','textarea','mcq','yesno') NOT NULL DEFAULT 'text',
  `options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`options`)),
  `correct_answer` varchar(255) DEFAULT NULL,
  `points` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `is_required` tinyint(1) NOT NULL DEFAULT 1,
  `order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `loans`
--

CREATE TABLE `loans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('given','taken') NOT NULL,
  `party_name` varchar(255) NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `principal_amount` decimal(12,2) NOT NULL,
  `interest_rate` decimal(5,2) DEFAULT NULL,
  `issue_date` date NOT NULL,
  `tenure_months` int(10) UNSIGNED NOT NULL,
  `installment_amount` decimal(12,2) NOT NULL,
  `status` enum('pending','approved','rejected','active','closed') NOT NULL DEFAULT 'pending',
  `submitted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `loans`
--

INSERT INTO `loans` (`id`, `type`, `party_name`, `employee_id`, `principal_amount`, `interest_rate`, `issue_date`, `tenure_months`, `installment_amount`, `status`, `submitted_by`, `approved_by`, `approved_at`, `rejection_reason`, `notes`, `created_at`, `updated_at`) VALUES
(1, 'given', 'Test user', 1, 50000.00, 10.00, '2026-07-28', 12, 4166.67, 'active', 3, 3, '2026-07-28 05:54:00', NULL, NULL, '2026-07-28 05:53:47', '2026-07-28 05:54:00'),
(2, 'taken', 'Brak Bank', NULL, 5000.00, 12.00, '2026-07-28', 12, 416.67, 'active', 3, NULL, NULL, NULL, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35');

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

--
-- Table structure for table `loan_installments`
--

CREATE TABLE `loan_installments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `loan_id` bigint(20) UNSIGNED NOT NULL,
  `installment_no` int(10) UNSIGNED NOT NULL,
  `due_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `paid_amount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `paid_date` date DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `loan_installments`
--

INSERT INTO `loan_installments` (`id`, `loan_id`, `installment_no`, `due_date`, `amount`, `paid_amount`, `paid_date`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2026-08-28', 4166.67, 4166.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:57:10'),
(2, 1, 2, '2026-09-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(3, 1, 3, '2026-10-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(4, 1, 4, '2026-11-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(5, 1, 5, '2026-12-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(6, 1, 6, '2027-01-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(7, 1, 7, '2027-02-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(8, 1, 8, '2027-03-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(9, 1, 9, '2027-04-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(10, 1, 10, '2027-05-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(11, 1, 11, '2027-06-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(12, 1, 12, '2027-07-28', 4166.67, 0.00, NULL, '2026-07-28 05:54:00', '2026-07-28 05:54:00'),
(13, 2, 1, '2026-08-28', 416.67, 416.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:05:03'),
(14, 2, 2, '2026-09-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(15, 2, 3, '2026-10-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(16, 2, 4, '2026-11-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(17, 2, 5, '2026-12-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(18, 2, 6, '2027-01-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(19, 2, 7, '2027-02-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(20, 2, 8, '2027-03-28', 416.67, 0.00, NULL, '2026-07-28 06:04:35', '2026-07-28 06:04:35'),
(21, 2, 9, '2027-04-28', 416.67, 0.00, NULL, '2026-07-28 06:04:36', '2026-07-28 06:04:36'),
(22, 2, 10, '2027-05-28', 416.67, 0.00, NULL, '2026-07-28 06:04:36', '2026-07-28 06:04:36'),
(23, 2, 11, '2027-06-28', 416.67, 0.00, NULL, '2026-07-28 06:04:36', '2026-07-28 06:04:36'),
(24, 2, 12, '2027-07-28', 416.67, 0.00, NULL, '2026-07-28 06:04:36', '2026-07-28 06:04:36');

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

--
-- Table structure for table `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2026_07_01_052644_create_personal_access_tokens_table', 1),
(5, '2026_07_01_052658_create_employees_table', 2),
(6, '2026_07_01_052658_create_attendances_table', 3),
(7, '2026_07_01_052658_create_leaves_table', 3),
(9, '2026_07_01_052659_create_salaries_table', 4),
(10, '2026_07_02_124416_create_shifts_table', 5),
(11, '2026_07_02_130145_add_leave_comment_to_attendances_table', 6),
(12, '2026_07_02_141654_add_employee_management_fields_to_employees_table', 7),
(13, '2026_07_02_141715_create_departments_table', 7),
(14, '2026_07_02_141737_create_designations_table', 7),
(15, '2026_07_02_141756_create_roles_table', 7),
(16, '2026_07_02_141811_create_employee_documents_table', 7),
(17, '2026_07_02_141836_create_employee_exits_table', 7),
(18, '2026_07_03_130238_create_settings_table', 8),
(19, '2026_07_05_220209_create_personal_access_tokens_table', 9),
(20, '2026_07_09_173509_create_tasks_table', 9),
(21, '2026_07_14_000322_create_customers_table', 10),
(22, '2026_07_15_090000_create_customer_tasks_table', 11),
(23, '2026_07_15_090001_create_lockers_table', 11),
(25, '2026_07_16_090000_create_customer_purchases_table', 12),
(26, '2026_07_15_000001_create_imap_accounts_table', 13),
(27, '2026_07_15_000002_create_email_messages_table', 13),
(28, '2026_07_16_000001_create_projects_table', 14),
(29, '2026_07_16_000002_create_milestones_table', 14),
(30, '2026_07_16_000003_create_project_tasks_table', 14),
(31, '2026_07_16_000004_create_task_images_table', 15),
(32, '2026_07_17_000001_create_reminders_table', 16),
(33, '2026_07_17_000002_create_reminder_notifications_table', 16),
(34, '2026_07_16_164528_make_employee_id_nullable_in_reminders_table', 17),
(35, '2026_07_16_170104_add_user_id_to_reminders_table', 18),
(36, '2026_07_16_170137_add_user_id_to_reminder_notifications_table', 18),
(37, '2026_07_17_232038_create_employee_advances_table', 19),
(38, '2026_07_17_232310_add_advance_deduction_to_salaries_table', 19),
(39, '2026_07_18_101500_create_advances_table', 20),
(40, '2026_07_18_101600_create_advance_deductions_table', 20),
(41, '2026_07_18_101700_add_advance_deduction_to_salaries_table', 21),
(42, '2026_07_19_115216_create_calendar_notes', 22),
(43, '2026_07_20_000001_create_job_postings_table', 23),
(44, '2026_07_20_000002_create_job_questions_table', 23),
(45, '2026_07_20_000003_create_interview_stages_table', 23),
(46, '2026_07_20_000004_create_job_applications_table', 23),
(47, '2026_07_20_000005_create_application_answers_table', 23),
(48, '2026_07_20_000006_create_application_interviews_table', 23),
(50, '2026_07_20_000007_create_performance_reviews_table', 24),
(51, '2026_07_22_090000_add_device_user_id_to_employees_table', 25),
(52, '2026_07_22_090100_add_device_source_to_attendances_table', 25),
(53, '2026_07_23_000001_create_income_categories_table', 26),
(54, '2026_07_23_000001_create_vendors_table', 26),
(55, '2026_07_23_000002_create_expense_categories_table', 26),
(56, '2026_07_23_000002_create_purchase_orders_table', 26),
(57, '2026_07_23_000003_create_incomes_table', 26),
(58, '2026_07_23_000003_create_purchase_order_items_table', 26),
(59, '2026_07_23_000004_create_expenses_table', 26),
(60, '2026_07_23_000004_create_stock_receivings_table', 26),
(61, '2026_07_23_000005_create_sales_incomes_table', 26),
(62, '2026_07_23_000005_create_stock_receiving_items_table', 26),
(63, '2026_07_23_000006_create_purchase_returns_table', 26),
(64, '2026_07_23_000007_create_purchase_return_items_table', 26),
(65, '2026_07_23_000008_create_vendor_payments_table', 26),
(66, '2026_07_23_000009_create_or_extend_expenses_table', 27),
(67, '2026_07_23_090000_create_categories_table', 28),
(68, '2026_07_23_090001_create_brands_table', 28),
(69, '2026_07_23_090002_create_units_table', 28),
(70, '2026_07_23_090003_create_warehouses_table', 28),
(71, '2026_07_23_090004_create_products_table', 28),
(72, '2026_07_23_090005_create_product_stocks_table', 28),
(73, '2026_07_23_090006_create_stock_movements_table', 28),
(74, '2026_07_23_090007_create_stock_ins_table', 28),
(75, '2026_07_23_090008_create_stock_outs_table', 28),
(76, '2026_07_23_090009_create_stock_transfers_table', 28),
(77, '2026_07_23_090010_create_stock_adjustments_table', 28),
(78, '2026_07_23_090011_create_quotations_table', 28),
(79, '2026_07_25_090000_create_product_variants_table', 29),
(80, '2026_07_25_090001_add_variant_id_to_stock_tables', 30),
(81, '2026_07_26_000001_add_paid_amount_to_incomes_table', 31),
(82, '2026_07_26_000002_add_paid_amount_to_expenses_table', 31),
(83, '2026_07_26_000003_create_payments_table', 31),
(84, '2026_07_27_000001_add_vendor_payment_id_to_payments_table', 32),
(85, '2026_07_27_000002_create_loans_table', 32),
(86, '2026_07_27_000003_create_loan_installments_table', 32),
(87, '2026_07_26_090003_add_vendor_and_party_columns', 33),
(88, '2026_07_26_090004_add_warehouse_id_to_purchase_orders_and_returns', 33),
(89, '2026_07_29_090000_add_transaction_tracking_columns', 34),
(90, '2026_07_29_090001_add_next_due_date_to_income_and_expense', 34),
(91, '2026_08_01_010603_add_customer_id_to_incomes_table', 35),
(92, '2026_08_01_010604_create_investors_table', 35),
(93, '2026_08_01_010606_create_investments_table', 35),
(94, '2026_08_01_010607_create_profit_distributions_table', 35),
(95, '2026_08_01_015049_add_customer_id_to_expenses_table', 36),
(96, '2026_08_03_075820_add_status_to_investors_table', 37),
(97, '2026_08_03_075830_add_proof_image_to_investments_table', 37),
(98, '2026_08_03_081427_change_documents_to_longtext_in_investors', 38),
(99, '2026_08_03_133423_create_investment_withdrawals_table', 39);

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

--
-- Table structure for table `milestones`
--

CREATE TABLE `milestones` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `project_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `status` enum('pending','in_progress','completed','delayed') NOT NULL DEFAULT 'pending',
  `sort_order` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `completed_at` timestamp NULL DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `milestones`
--

INSERT INTO `milestones` (`id`, `project_id`, `title`, `description`, `due_date`, `status`, `sort_order`, `completed_at`, `notes`, `created_at`, `updated_at`) VALUES
(1, 1, '1st milestone', '1st milestone', '2026-07-16', 'completed', 1, '2026-07-27 06:11:19', '1st milestone', '2026-07-16 07:16:08', '2026-07-27 06:11:19'),
(2, 1, 'website design milestone', 'website design milestone', '2026-07-20', 'pending', 2, NULL, 'website design milestone', '2026-07-16 07:17:45', '2026-07-16 07:17:45');

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

--
-- Table structure for table `payments`
--

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `transaction_id` varchar(255) DEFAULT NULL,
  `payable_type` varchar(255) NOT NULL,
  `vendor_payment_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payable_id` bigint(20) UNSIGNED NOT NULL,
  `payment_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `note` text DEFAULT NULL,
  `paid_by_employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `paid_by_customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `payments`
--

INSERT INTO `payments` (`id`, `transaction_id`, `payable_type`, `vendor_payment_id`, `payable_id`, `payment_date`, `amount`, `payment_method`, `note`, `paid_by_employee_id`, `paid_by_customer_id`, `created_at`, `updated_at`) VALUES
(2, NULL, 'App\\Models\\Income', NULL, 2, '2026-07-27', 7999.00, 'srdsrg', 'drgdrg', NULL, NULL, '2026-07-27 05:23:18', '2026-07-27 05:23:18'),
(3, NULL, 'App\\Models\\Income', NULL, 4, '2026-07-27', 500.00, NULL, NULL, NULL, NULL, '2026-07-27 05:38:59', '2026-07-27 05:38:59'),
(4, NULL, 'App\\Models\\Expense', NULL, 10, '2026-07-27', 55.00, NULL, NULL, NULL, NULL, '2026-07-27 05:40:27', '2026-07-27 05:40:27'),
(5, NULL, 'App\\Models\\Expense', NULL, 1, '2026-07-27', 2000.00, NULL, NULL, NULL, NULL, '2026-07-27 05:40:38', '2026-07-27 05:40:38'),
(6, NULL, 'App\\Models\\Expense', NULL, 2, '2026-07-27', 500.00, NULL, NULL, NULL, NULL, '2026-07-27 05:40:59', '2026-07-27 05:40:59'),
(7, NULL, 'App\\Models\\Expense', NULL, 3, '2026-07-27', 100.00, NULL, NULL, NULL, NULL, '2026-07-27 05:41:06', '2026-07-27 05:41:06'),
(8, NULL, 'App\\Models\\Expense', NULL, 12, '2026-07-27', 200.00, NULL, NULL, NULL, NULL, '2026-07-27 05:43:37', '2026-07-27 05:43:37'),
(9, NULL, 'App\\Models\\Income', NULL, 5, '2026-07-27', 5000.00, 'payment recive tanvir cash', 'next payment next month end', NULL, NULL, '2026-07-27 07:03:06', '2026-07-27 07:03:06'),
(19, NULL, 'App\\Models\\Expense', NULL, 15, '2026-07-27', 400.00, 'bank_transfer', 'Synced from vendor payment VP-000001', NULL, NULL, '2026-07-27 09:20:50', '2026-07-27 09:20:50'),
(21, NULL, 'App\\Models\\Expense', NULL, 16, '2026-07-27', 2500.00, NULL, NULL, NULL, NULL, '2026-07-27 09:26:57', '2026-07-27 09:26:57'),
(22, NULL, 'App\\Models\\Expense', 22, 17, '2026-07-27', 2000.00, 'cash', 'Synced from vendor payment VP-000001', NULL, NULL, '2026-07-27 15:45:14', '2026-07-27 15:45:14'),
(24, NULL, 'App\\Models\\LoanInstallment', NULL, 1, '2026-07-28', 4166.00, 'Aug 28, 2026', 'Aug 28, 2026 installment', NULL, NULL, '2026-07-28 05:57:10', '2026-07-28 05:57:10'),
(25, NULL, 'App\\Models\\LoanInstallment', NULL, 13, '2026-07-28', 416.00, NULL, NULL, NULL, NULL, '2026-07-28 06:05:03', '2026-07-28 06:05:03'),
(26, 'TXN-000001', 'App\\Models\\Income', NULL, 5, '2026-07-31', 5000.00, NULL, NULL, NULL, NULL, '2026-07-31 14:22:27', '2026-07-31 14:22:27'),
(27, 'TXN-000002', 'App\\Models\\Expense', NULL, 13, '2026-07-31', 500.00, NULL, NULL, NULL, NULL, '2026-07-31 14:23:02', '2026-07-31 14:23:02'),
(29, 'TXN-000003', 'App\\Models\\Expense', 26, 17, '2026-07-31', 400.00, 'other', 'Synced from vendor payment VP-000002', NULL, NULL, '2026-07-31 14:28:22', '2026-07-31 14:28:22'),
(30, 'TXN-000004', 'App\\Models\\Expense', 27, 17, '2026-07-31', 100.00, 'other', 'Synced from vendor payment VP-000003', NULL, NULL, '2026-07-31 14:30:06', '2026-07-31 14:30:06'),
(31, 'TXN-000005', 'App\\Models\\Income', NULL, 6, '2026-08-01', 56565.00, NULL, NULL, 2, NULL, '2026-08-01 07:09:04', '2026-08-01 07:09:04');

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

--
-- Table structure for table `performance_reviews`
--

CREATE TABLE `performance_reviews` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `reviewer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `period_start` date NOT NULL,
  `period_end` date NOT NULL,
  `criteria_scores` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`criteria_scores`)),
  `overall_rating` decimal(3,2) DEFAULT NULL,
  `strengths` text DEFAULT NULL,
  `improvements` text DEFAULT NULL,
  `goals_next_period` text DEFAULT NULL,
  `status` enum('draft','submitted','acknowledged') NOT NULL DEFAULT 'draft',
  `acknowledged_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `performance_reviews`
--

INSERT INTO `performance_reviews` (`id`, `employee_id`, `reviewer_id`, `period_start`, `period_end`, `criteria_scores`, `overall_rating`, `strengths`, `improvements`, `goals_next_period`, `status`, `acknowledged_at`, `created_at`, `updated_at`) VALUES
(1, 1, 3, '2026-07-01', '2026-07-31', '[{\"criteria\":\"Quality of work\",\"score\":5},{\"criteria\":\"Productivity\",\"score\":3},{\"criteria\":\"Communication\",\"score\":3},{\"criteria\":\"Teamwork\",\"score\":3}]', 3.50, 'fthfth', 'thfdth', 'thfth', 'acknowledged', NULL, '2026-07-20 11:03:01', '2026-07-27 06:10:03');

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

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `sku` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `unit_id` bigint(20) UNSIGNED DEFAULT NULL,
  `cost_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `selling_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `reorder_level` int(11) NOT NULL DEFAULT 0,
  `description` text DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`id`, `name`, `sku`, `barcode`, `category_id`, `brand_id`, `unit_id`, `cost_price`, `selling_price`, `reorder_level`, `description`, `image`, `status`, `created_at`, `updated_at`) VALUES
(2, 'Mens Tshirt', 'MENSTSHI-6113', 'MENSTSHI-6113', 2, NULL, 3, 799.00, 999.00, 0, 'Product Description', 'http://127.0.0.1:8000/products/CPlIuzpwXBPuQVUydEvT.jpg', 'active', '2026-07-27 15:30:46', '2026-07-27 15:30:46'),
(3, 'Pran Lichi Drink', 'PRANLICH-4410', NULL, NULL, NULL, NULL, 25.00, 25.00, 0, NULL, NULL, 'active', '2026-07-27 15:39:10', '2026-07-27 15:39:10');

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

--
-- Table structure for table `product_stocks`
--

CREATE TABLE `product_stocks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `variant_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(14,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_stocks`
--

INSERT INTO `product_stocks` (`id`, `product_id`, `variant_id`, `warehouse_id`, `quantity`, `created_at`, `updated_at`) VALUES
(4, 3, NULL, 4, 69.00, '2026-07-27 15:39:10', '2026-08-01 12:32:46'),
(5, 3, NULL, 5, 51.00, '2026-07-27 15:59:43', '2026-08-01 12:42:03');

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

--
-- Table structure for table `product_variants`
--

CREATE TABLE `product_variants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `color` varchar(255) DEFAULT NULL,
  `size` varchar(255) DEFAULT NULL,
  `sku` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `additional_cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `additional_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `image` varchar(255) DEFAULT NULL,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_variants`
--

INSERT INTO `product_variants` (`id`, `product_id`, `color`, `size`, `sku`, `barcode`, `additional_cost`, `additional_price`, `image`, `status`, `created_at`, `updated_at`) VALUES
(5, 2, 'White', 'L', 'MENSTSHI6113-WHITE-L', 'MENSTSHI6113-WHITE-L', 0.00, 0.00, NULL, 'active', '2026-07-27 15:31:19', '2026-07-27 15:31:19'),
(6, 2, 'White', 'XL', 'MENSTSHI6113-WHITE-XL', 'MENSTSHI6113-WHITE-XL', 0.00, 0.00, NULL, 'active', '2026-07-27 15:31:30', '2026-07-27 15:31:30'),
(7, 2, 'Black', 'L', 'MENSTSHI6113-BLACK-L', 'MENSTSHI6113-BLACK-L', 0.00, 0.00, NULL, 'active', '2026-07-27 15:31:38', '2026-07-27 15:31:38'),
(8, 2, 'Black', 'XL', 'MENSTSHI6113-BLACK-XL', 'MENSTSHI6113-BLACK-XL', 0.00, 0.00, NULL, 'active', '2026-07-27 15:31:49', '2026-07-27 15:31:49');

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

--
-- Table structure for table `profit_distributions`
--

CREATE TABLE `profit_distributions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `investment_id` bigint(20) UNSIGNED NOT NULL,
  `distribution_date` date NOT NULL,
  `amount` decimal(12,2) NOT NULL,
  `attachment_path` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `projects`
--

CREATE TABLE `projects` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `status` enum('planning','in_progress','on_hold','completed','cancelled') NOT NULL DEFAULT 'planning',
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `budget` decimal(12,2) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `projects`
--

INSERT INTO `projects` (`id`, `customer_id`, `employee_id`, `name`, `description`, `status`, `start_date`, `end_date`, `budget`, `notes`, `created_at`, `updated_at`) VALUES
(1, 4, 2, 'website design and development', 'website design and development work in laravel', 'in_progress', '2026-07-16', '2026-07-31', 5000.00, 'Need to complete before deadline', '2026-07-16 07:15:27', '2026-07-16 07:15:27');

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

--
-- Table structure for table `project_tasks`
--

CREATE TABLE `project_tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `milestone_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `priority` enum('low','medium','high') NOT NULL DEFAULT 'medium',
  `status` enum('pending','in_progress','completed','cancelled') NOT NULL DEFAULT 'pending',
  `due_date` date DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `project_tasks`
--

INSERT INTO `project_tasks` (`id`, `milestone_id`, `employee_id`, `title`, `description`, `priority`, `status`, `due_date`, `completed_at`, `notes`, `created_at`, `updated_at`) VALUES
(1, 1, NULL, 'design find', 'design find in code canyon', 'medium', 'completed', '2026-07-13', '2026-07-16 07:16:40', 'svse', '2026-07-16 07:16:40', '2026-07-27 06:11:39'),
(2, 2, NULL, 'website design in html', 'website design in html', 'medium', 'pending', '2026-07-21', NULL, 'website design in html', '2026-07-16 07:18:03', '2026-07-16 07:18:03'),
(3, 2, NULL, 'backend development', 'drhgdrh', 'high', 'pending', '2026-07-16', NULL, 'drhdrh', '2026-07-16 07:18:19', '2026-07-16 07:18:25');

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

--
-- Table structure for table `purchase_orders`
--

CREATE TABLE `purchase_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `po_number` varchar(255) NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_date` date NOT NULL,
  `expected_date` date DEFAULT NULL,
  `status` enum('draft','ordered','partially_received','received','cancelled') NOT NULL DEFAULT 'draft',
  `subtotal` decimal(14,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(14,2) NOT NULL DEFAULT 0.00,
  `shipping_cost` decimal(14,2) NOT NULL DEFAULT 0.00,
  `total` decimal(14,2) NOT NULL DEFAULT 0.00,
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_orders`
--

INSERT INTO `purchase_orders` (`id`, `po_number`, `vendor_id`, `warehouse_id`, `order_date`, `expected_date`, `status`, `subtotal`, `discount`, `tax`, `shipping_cost`, `total`, `notes`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(9, 'PO-000001', 6, 4, '2026-07-26', '2026-07-26', 'received', 2500.00, 0.00, 0.00, 0.00, 2500.00, NULL, 3, '2026-07-27 15:33:07', '2026-07-27 15:39:10', NULL);

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

--
-- Table structure for table `purchase_order_items`
--

CREATE TABLE `purchase_order_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `item_name` varchar(255) NOT NULL,
  `unit` varchar(255) DEFAULT NULL,
  `qty_ordered` decimal(12,2) NOT NULL,
  `qty_received` decimal(12,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(14,2) NOT NULL,
  `tax_percent` decimal(5,2) NOT NULL DEFAULT 0.00,
  `subtotal` decimal(14,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_order_items`
--

INSERT INTO `purchase_order_items` (`id`, `purchase_order_id`, `product_id`, `item_name`, `unit`, `qty_ordered`, `qty_received`, `unit_cost`, `tax_percent`, `subtotal`, `created_at`, `updated_at`) VALUES
(17, 9, 3, 'Pran Lichi Drink', '10', 100.00, 100.00, 25.00, 0.00, 2500.00, '2026-07-27 15:33:34', '2026-07-27 15:39:10');

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

--
-- Table structure for table `purchase_returns`
--

CREATE TABLE `purchase_returns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `return_number` varchar(255) NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `return_date` date NOT NULL,
  `reason` text DEFAULT NULL,
  `status` enum('completed','void') NOT NULL DEFAULT 'completed',
  `total` decimal(14,2) NOT NULL DEFAULT 0.00,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_returns`
--

INSERT INTO `purchase_returns` (`id`, `return_number`, `purchase_order_id`, `vendor_id`, `warehouse_id`, `return_date`, `reason`, `status`, `total`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(3, 'PR-000001', 9, 6, 4, '2026-07-27', 'damaged', 'void', 250.00, 3, '2026-07-27 15:52:37', '2026-07-31 14:31:12', NULL);

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

--
-- Table structure for table `purchase_return_items`
--

CREATE TABLE `purchase_return_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_return_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `item_name` varchar(255) NOT NULL,
  `qty` decimal(12,2) NOT NULL,
  `unit_cost` decimal(14,2) NOT NULL,
  `subtotal` decimal(14,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `purchase_return_items`
--

INSERT INTO `purchase_return_items` (`id`, `purchase_return_id`, `product_id`, `item_name`, `qty`, `unit_cost`, `subtotal`, `created_at`, `updated_at`) VALUES
(3, 3, 3, 'Pran Lichi Drink', 10.00, 25.00, 250.00, '2026-07-27 15:52:37', '2026-07-27 15:52:37');

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

--
-- Table structure for table `quotations`
--

CREATE TABLE `quotations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `quotation_no` varchar(255) NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) NOT NULL,
  `customer_email` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(255) DEFAULT NULL,
  `status` enum('draft','sent','accepted','rejected','expired') NOT NULL DEFAULT 'draft',
  `date` date NOT NULL,
  `valid_until` date DEFAULT NULL,
  `subtotal` decimal(14,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(14,2) NOT NULL DEFAULT 0.00,
  `total` decimal(14,2) NOT NULL DEFAULT 0.00,
  `note` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotations`
--

INSERT INTO `quotations` (`id`, `quotation_no`, `warehouse_id`, `customer_id`, `customer_name`, `customer_email`, `customer_phone`, `status`, `date`, `valid_until`, `subtotal`, `discount`, `tax`, `total`, `note`, `created_by`, `created_at`, `updated_at`) VALUES
(2, 'QT-000001', 4, 4, 'Test', 'Test@gmail.com', '01812732936', 'accepted', '2026-07-27', '2026-07-31', 99900.00, 0.00, 0.00, 99900.00, NULL, 3, '2026-07-27 16:11:16', '2026-07-27 16:11:20');

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

--
-- Table structure for table `quotation_items`
--

CREATE TABLE `quotation_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `quotation_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(14,2) NOT NULL,
  `unit_price` decimal(12,2) NOT NULL,
  `discount` decimal(12,2) NOT NULL DEFAULT 0.00,
  `total` decimal(14,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotation_items`
--

INSERT INTO `quotation_items` (`id`, `quotation_id`, `product_id`, `quantity`, `unit_price`, `discount`, `total`, `created_at`, `updated_at`) VALUES
(2, 2, 2, 100.00, 999.00, 0.00, 99900.00, '2026-07-27 16:11:16', '2026-07-27 16:11:16');

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

--
-- Table structure for table `reminders`
--

CREATE TABLE `reminders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `start_date` datetime NOT NULL,
  `expire_date` datetime NOT NULL,
  `repeat_minutes` int(10) UNSIGNED NOT NULL DEFAULT 60,
  `status` enum('active','expired','cancelled') NOT NULL DEFAULT 'active',
  `last_notified_at` datetime DEFAULT NULL,
  `next_notify_at` datetime DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `reminder_notifications`
--

CREATE TABLE `reminder_notifications` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reminder_id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `message` text DEFAULT NULL,
  `is_read` tinyint(1) NOT NULL DEFAULT 0,
  `notified_at` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `display_name` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `roles`
--

INSERT INTO `roles` (`id`, `name`, `display_name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Super Admin', 'Super Admin', 'Super Admin', '2026-07-13 09:56:39', '2026-07-13 09:57:09'),
(2, 'Admin', 'Admin', 'Admin', '2026-07-13 09:57:17', '2026-07-13 09:57:17');

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

--
-- Table structure for table `salaries`
--

CREATE TABLE `salaries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `year` year(4) NOT NULL,
  `month` tinyint(3) UNSIGNED NOT NULL,
  `base_salary` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Employee''s monthly base salary',
  `working_days` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Total working days in the month (Mon-Thu)',
  `daily_rate` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Base salary / working days',
  `hourly_rate` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Daily rate / standard hours (8)',
  `regular_days` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Days worked on Mon-Thu',
  `gross_salary` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Regular days × daily rate',
  `leave_days` decimal(5,2) NOT NULL DEFAULT 0.00 COMMENT 'Days marked as leave in attendance',
  `leave_deduction` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Leave days × daily rate',
  `holiday_hours` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT 'Hours worked on Fri/Sat (holidays)',
  `overtime_hours` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT 'Extra hours beyond 8 on regular days',
  `total_overtime_hours` decimal(8,2) NOT NULL DEFAULT 0.00 COMMENT 'Holiday hours + overtime hours',
  `overtime_rate` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Hourly rate × 2 (double rate)',
  `overtime_amount` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Total overtime hours × overtime rate',
  `bonus` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Any additional bonus',
  `deductions` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Total deductions',
  `advance_deduction` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Amount auto-deducted this month for active advances/loans',
  `net_salary` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT 'Gross + Overtime - Deductions + Bonus',
  `status` enum('draft','generated','paid') NOT NULL DEFAULT 'draft',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `salaries`
--

INSERT INTO `salaries` (`id`, `employee_id`, `year`, `month`, `base_salary`, `working_days`, `daily_rate`, `hourly_rate`, `regular_days`, `gross_salary`, `leave_days`, `leave_deduction`, `holiday_hours`, `overtime_hours`, `total_overtime_hours`, `overtime_rate`, `overtime_amount`, `bonus`, `deductions`, `advance_deduction`, `net_salary`, `status`, `created_at`, `updated_at`) VALUES
(35, 1, '2026', 1, 25000.00, 21.00, 1190.48, 148.81, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 297.62, 0.00, 0.00, 0.00, 416.67, 0.00, 'generated', '2026-07-18 15:20:31', '2026-07-18 15:20:31'),
(36, 2, '2026', 1, 10000.00, 21.00, 476.19, 59.52, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 119.05, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-18 15:20:31', '2026-07-18 15:20:31'),
(37, 3, '2026', 1, 20000.00, 21.00, 952.38, 119.05, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 238.10, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-18 15:20:31', '2026-07-18 15:20:31'),
(38, 1, '2026', 7, 25000.00, 22.00, 1136.36, 142.05, 2.00, 2272.73, 1.00, 1136.36, 0.00, 0.84, 0.84, 284.09, 238.64, 0.00, 1136.36, 416.67, 958.33, 'generated', '2026-07-18 15:20:38', '2026-07-18 15:20:38'),
(39, 2, '2026', 7, 10000.00, 22.00, 454.55, 56.82, 0.00, 0.00, 1.00, 454.55, 0.00, 0.00, 0.00, 113.64, 0.00, 0.00, 454.55, 0.00, 0.00, 'generated', '2026-07-18 15:20:38', '2026-07-18 15:20:38'),
(40, 3, '2026', 7, 20000.00, 22.00, 909.09, 113.64, 1.00, 909.09, 0.00, 0.00, 0.00, 0.00, 0.00, 227.27, 0.00, 0.00, 0.00, 0.00, 909.09, 'generated', '2026-07-18 15:20:38', '2026-07-18 15:20:38'),
(41, 1, '2026', 6, 25000.00, 22.00, 1136.36, 142.05, 2.00, 2272.73, 0.00, 0.00, 9.95, 0.00, 9.95, 284.09, 2826.70, 0.00, 0.00, 416.67, 4682.76, 'generated', '2026-07-19 05:01:57', '2026-07-19 05:01:57'),
(42, 2, '2026', 6, 10000.00, 22.00, 454.55, 56.82, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 113.64, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-19 05:01:57', '2026-07-19 05:01:57'),
(43, 3, '2026', 6, 20000.00, 22.00, 909.09, 113.64, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 227.27, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-19 05:01:57', '2026-07-19 05:01:57'),
(44, 2, '2026', 5, 10000.00, 21.00, 476.19, 59.52, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 119.05, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-19 05:03:33', '2026-07-19 05:03:33'),
(45, 2, '2026', 2, 10000.00, 20.00, 500.00, 62.50, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 125.00, 0.00, 0.00, 0.00, 10000.00, 0.00, 'generated', '2026-07-19 05:05:12', '2026-07-19 05:05:12'),
(46, 1, '2026', 4, 25000.00, 22.00, 1136.36, 142.05, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 284.09, 0.00, 0.00, 0.00, 416.67, 0.00, 'generated', '2026-07-21 12:28:58', '2026-07-21 12:28:58'),
(47, 2, '2026', 4, 10000.00, 22.00, 454.55, 56.82, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 113.64, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-21 12:28:58', '2026-07-21 12:28:58'),
(48, 3, '2026', 4, 20000.00, 22.00, 909.09, 113.64, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 227.27, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-21 12:28:58', '2026-07-21 12:28:58'),
(49, 9, '2026', 4, 5000.00, 22.00, 227.27, 28.41, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 56.82, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-21 12:28:58', '2026-07-21 12:28:58'),
(50, 1, '2026', 3, 25000.00, 23.00, 1086.96, 135.87, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 271.74, 0.00, 0.00, 0.00, 416.67, 0.00, 'generated', '2026-07-31 12:32:59', '2026-07-31 12:32:59'),
(51, 2, '2026', 3, 10000.00, 23.00, 434.78, 54.35, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 108.70, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-31 12:32:59', '2026-07-31 12:32:59'),
(52, 3, '2026', 3, 20000.00, 23.00, 869.57, 108.70, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 217.39, 0.00, 0.00, 0.00, 0.00, 0.00, 'generated', '2026-07-31 12:32:59', '2026-07-31 12:32:59');

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

--
-- Table structure for table `sales_incomes`
--

CREATE TABLE `sales_incomes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `order_reference` varchar(255) DEFAULT NULL,
  `amount` decimal(12,2) NOT NULL,
  `sale_date` date NOT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sessions`
--

CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `payload` longtext NOT NULL,
  `last_activity` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('08vDs4WwgtbNtJIqn1P6NuEYTMduTToJmvayytFy', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoibVl1eWhJZ1lpSzFUOXg3Uk1sZ05JUTNTSnV5bG96cEg2YmNXSGF5QyI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1784019804),
('5nvANa5ZdrxAv2GxCHdvLEYM5nln0KjvkFImiwzJ', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiQ3lRajhpOGFLdHBsWnN4REgzTkZNSFc4VE40THA1d0JPcEY2TFpHbyI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783066074),
('5xaEr6HyKJ0Q4tsQX3mIpFhe08fWooMMdu0OYWNQ', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiVkNENG9rWWlnNkJiZWRONHVQNTZyMVI0WEJvSXZCMXJNN0tsQVduRyI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783921239),
('ANjc3qVR5DSQiqJlGSDUJ8tSY17mAWZDNJlC2lm9', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiYnViS1RkdmRTZXVLWHFNdmR6eWxVdDdHM3ltdWlYS0dhY1JrVEp4ZiI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1782973574),
('BMIzwD6LLwCYmNAtzhLUuuxnm2i4Xc609W09AHsn', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiTUEwSjlNZGE4clFMRjZoUEozV0VvcUVMalFXMGJWTWhSaFFtT1Z3biI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783068521),
('CyTMTpvTxySVPUQtYwoUzU5T9WhK33sedI4jtEex', NULL, '127.0.0.1', 'Mozilla/5.0 (Linux; Android 15; Pixel 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Mobile Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiSExycXY1cmZlMzFzWGJaVFpaVTdGVzhleThUbzYxbk5nMXRtMlpaYSI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783068924),
('JeaXGui6Rilh971dMYMeifXLPDV4qjsnxGh6voFO', NULL, '127.0.0.1', 'PostmanRuntime/7.54.0', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiTjh5NkZQbHBuaXg4MUlqUGNLaFRvTTJMUzRYT0tZc3hoYXVNeWhtWiI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1782886315),
('JR3FC5VgCwCegp53dsmQJlG9YKV9bPNmoXPmXi0h', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiWVhDVGlpSkF6UTFkdXNVelBqTXdQVlpxMUtuQThvMUsyVkxabGhYZCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1782886053),
('jXX4sgh8TXQKiSToHxfPRtLgJCzYsARdyhRmAvUm', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiSGd3aTVhRmlmWFdwcmxqTXh2QWFIQ2NQTkNVemRnNzVSSTdUNlhGRSI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783093359),
('lXjUVJ2yIIuiB5vjhw69j1NYGGCEGz07mrwMuNgh', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiT0pjUUNlR0xVWmY0T2tIeE5uRHByeDB3MVNDeWtva0NlaXRRUm1hSCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1782914998),
('ODDBMZLZUmS5DqYTByI2nRB9nMPGyrSEzK1F74da', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiR042N3dDVjlZMkQ1VnZuME1mY09OTUwzUjAzMGtocUpYejNkQ3poQSI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783068797),
('Oxz6o58qWaHllE42Nl4tBJ1K2bS72S8Msk9MZrWZ', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiZ055VjhtQ3p4cllkOUdzbGE2NzRJSUtQbGt3bWs3ZWFTWERzdUJWZiI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783320577),
('R3MMIN7itPKNv9kjhJgOWlrWlV2B2wYAfICqXcTB', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiU2lBT1U5ekpyTkNkN3Y2elVVSkE4V1hPYWdyQU9ieVVuZEM3eHE0WCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MjE6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1782918811),
('ShdaijcTpaz3FYXzfnxCHzABbf7m3vt60EFvNU1A', NULL, '127.0.0.1', 'Mozilla/5.0 (Linux; Android 15; Pixel 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Mobile Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoibnEyZWcxU3ZjeUFKM1NsbkpCTHdhUkU2VFlhVlUyckRQdHRRcXRnbyI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783069132),
('tuC7xoWuazGOr4e0RzNKa8dGqiGUIPjKH2hMtK7O', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiZDd4VzA4OW0wMlkwenZIcEZnRHhtcENuYk9hWFBJWW50WVFLMk51dSI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783574910),
('vOQbjPq8rQT5qxvwRFr2Ea1GX7hcBX3bmoMjBWfb', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiekFHUjFIQkc4V1BjSnBCRnZWUE96a0hsVlp3bWhRc3g5MmFmbmt6NiI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783068422),
('XV5NAPWsb41xRSMRN4Ryk7DLaizacQZ5lZeLFvDO', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoidlg2V1UwOTZ3d0xDbnEzaTMxZHdBcnBXS1pVTTdWSUIxVjR1VWQ4WSI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783068401),
('ZbmiWC7OKDFFgQBuF4FNEwnMWEn8JRJvopKReyUb', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiSDZXV25zTm8zaXAwSERjTlQ1bXE2NXBnVnRkMlFKdlBmQXk3bkU3WCI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzA6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vdmVydmlldyI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1783068691);

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

--
-- Table structure for table `stock_adjustments`
--

CREATE TABLE `stock_adjustments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reference_no` varchar(255) NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `date` date NOT NULL,
  `note` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_adjustments`
--

INSERT INTO `stock_adjustments` (`id`, `reference_no`, `warehouse_id`, `reason`, `date`, `note`, `created_by`, `created_at`, `updated_at`) VALUES
(6, 'ADJ-000001', 4, '5', '2026-07-27', 'company meeting spend', 3, '2026-07-27 16:05:54', '2026-07-27 16:05:54'),
(7, 'ADJ-000002', 4, 'Inernal use', '2026-07-27', 'Inernal  meeting  use', 3, '2026-07-27 16:06:40', '2026-07-27 16:06:40'),
(8, 'ADJ-000003', 4, 'damaged', '2026-07-27', 'damaged', 3, '2026-07-27 16:08:02', '2026-07-27 16:08:02'),
(9, 'ADJ-000004', 4, 'dgdg', '2026-07-27', 'awgasgsgs', 3, '2026-07-27 16:09:09', '2026-07-27 16:09:09');

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

--
-- Table structure for table `stock_adjustment_items`
--

CREATE TABLE `stock_adjustment_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_adjustment_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity_before` decimal(14,2) NOT NULL,
  `quantity_after` decimal(14,2) NOT NULL,
  `difference` decimal(14,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_adjustment_items`
--

INSERT INTO `stock_adjustment_items` (`id`, `stock_adjustment_id`, `product_id`, `quantity_before`, `quantity_after`, `difference`, `created_at`, `updated_at`) VALUES
(6, 6, 3, 59.00, 5.00, -54.00, '2026-07-27 16:05:54', '2026-07-27 16:05:54'),
(7, 7, 3, 5.00, 4.00, -1.00, '2026-07-27 16:06:40', '2026-07-27 16:06:40'),
(8, 8, 3, 4.00, 5.00, 1.00, '2026-07-27 16:08:02', '2026-07-27 16:08:02'),
(9, 9, 3, 5.00, 60.00, 55.00, '2026-07-27 16:09:09', '2026-07-27 16:09:09');

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

--
-- Table structure for table `stock_ins`
--

CREATE TABLE `stock_ins` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reference_no` varchar(255) NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_name` varchar(255) DEFAULT NULL,
  `date` date NOT NULL,
  `note` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_ins`
--

INSERT INTO `stock_ins` (`id`, `reference_no`, `warehouse_id`, `vendor_id`, `supplier_name`, `date`, `note`, `created_by`, `created_at`, `updated_at`) VALUES
(2, 'SI-000001', 4, 6, NULL, '2026-07-27', 'More stock In', 3, '2026-07-27 15:46:36', '2026-07-27 15:46:36');

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

--
-- Table structure for table `stock_in_items`
--

CREATE TABLE `stock_in_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_in_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(14,2) NOT NULL,
  `unit_cost` decimal(12,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_in_items`
--

INSERT INTO `stock_in_items` (`id`, `stock_in_id`, `product_id`, `quantity`, `unit_cost`, `created_at`, `updated_at`) VALUES
(2, 2, 3, 20.00, 25.00, '2026-07-27 15:46:36', '2026-07-27 15:46:36');

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

--
-- Table structure for table `stock_movements`
--

CREATE TABLE `stock_movements` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `variant_id` bigint(20) UNSIGNED DEFAULT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('in','out','transfer_in','transfer_out','adjustment') NOT NULL,
  `quantity` decimal(14,2) NOT NULL,
  `balance_after` decimal(14,2) NOT NULL,
  `reference_type` varchar(255) DEFAULT NULL,
  `reference_id` bigint(20) UNSIGNED DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_movements`
--

INSERT INTO `stock_movements` (`id`, `product_id`, `variant_id`, `warehouse_id`, `type`, `quantity`, `balance_after`, `reference_type`, `reference_id`, `note`, `created_by`, `created_at`, `updated_at`) VALUES
(12, 3, NULL, 4, 'in', 100.00, 100.00, 'stock_receiving', 17, 'Received on GRN-000001 (PO-000001)', 3, '2026-07-27 15:39:10', '2026-07-27 15:39:10'),
(13, 3, NULL, 4, 'in', 20.00, 120.00, 'stock_in', 2, 'Stock in SI-000001', 3, '2026-07-27 15:46:36', '2026-07-27 15:46:36'),
(14, 3, NULL, 4, 'out', -10.00, 110.00, 'purchase_return', 3, 'Returned via PR-000001', 3, '2026-07-27 15:52:37', '2026-07-27 15:52:37'),
(15, 3, NULL, 4, 'out', -1.00, 109.00, 'stock_out', 5, 'Stock out SO-000001', 3, '2026-07-27 15:55:19', '2026-07-27 15:55:19'),
(16, 3, NULL, 4, 'transfer_out', -50.00, 59.00, 'transfer', 5, 'Transfer out TR-000001', 3, '2026-07-27 15:59:40', '2026-07-27 15:59:40'),
(17, 3, NULL, 5, 'transfer_in', 50.00, 50.00, 'transfer', 5, 'Transfer in TR-000001', 3, '2026-07-27 15:59:43', '2026-07-27 15:59:43'),
(18, 3, NULL, 4, 'adjustment', -54.00, 5.00, 'adjustment', 6, 'Stock adjustment ADJ-000001', 3, '2026-07-27 16:05:54', '2026-07-27 16:05:54'),
(19, 3, NULL, 4, 'adjustment', -1.00, 4.00, 'adjustment', 7, 'Stock adjustment ADJ-000002', 3, '2026-07-27 16:06:40', '2026-07-27 16:06:40'),
(20, 3, NULL, 4, 'adjustment', 1.00, 5.00, 'adjustment', 8, 'Stock adjustment ADJ-000003', 3, '2026-07-27 16:08:02', '2026-07-27 16:08:02'),
(21, 3, NULL, 4, 'adjustment', 55.00, 60.00, 'adjustment', 9, 'Stock adjustment ADJ-000004', 3, '2026-07-27 16:09:09', '2026-07-27 16:09:09'),
(22, 3, NULL, 4, 'in', 10.00, 70.00, 'purchase_return_void', 3, 'Voided PR-000001 — stock restored', NULL, '2026-07-31 14:31:12', '2026-07-31 14:31:12'),
(23, 3, NULL, 4, 'transfer_out', -1.00, 69.00, 'transfer', 6, 'Transfer out TR-000002', 3, '2026-08-01 12:32:46', '2026-08-01 12:32:46'),
(24, 3, NULL, 5, 'transfer_in', 1.00, 51.00, 'transfer', 6, 'Transfer in TR-000002', 3, '2026-08-01 12:42:03', '2026-08-01 12:42:03');

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

--
-- Table structure for table `stock_outs`
--

CREATE TABLE `stock_outs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reference_no` varchar(255) NOT NULL,
  `warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `employee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `date` date NOT NULL,
  `note` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_outs`
--

INSERT INTO `stock_outs` (`id`, `reference_no`, `warehouse_id`, `customer_id`, `employee_id`, `customer_name`, `reason`, `date`, `note`, `created_by`, `created_at`, `updated_at`) VALUES
(5, 'SO-000001', 4, NULL, 1, NULL, 'used', '2026-07-27', NULL, 3, '2026-07-27 15:55:19', '2026-07-27 15:55:19');

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

--
-- Table structure for table `stock_out_items`
--

CREATE TABLE `stock_out_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_out_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(14,2) NOT NULL,
  `unit_price` decimal(12,2) NOT NULL DEFAULT 0.00,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_out_items`
--

INSERT INTO `stock_out_items` (`id`, `stock_out_id`, `product_id`, `quantity`, `unit_price`, `created_at`, `updated_at`) VALUES
(5, 5, 3, 1.00, 0.00, '2026-07-27 15:55:19', '2026-07-27 15:55:19');

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

--
-- Table structure for table `stock_receivings`
--

CREATE TABLE `stock_receivings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `grn_number` varchar(255) NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED NOT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `received_date` date NOT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `status` enum('completed','void') NOT NULL DEFAULT 'completed',
  `total_received_value` decimal(14,2) NOT NULL DEFAULT 0.00,
  `notes` text DEFAULT NULL,
  `received_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_receivings`
--

INSERT INTO `stock_receivings` (`id`, `grn_number`, `purchase_order_id`, `vendor_id`, `received_date`, `reference_no`, `status`, `total_received_value`, `notes`, `received_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(17, 'GRN-000001', 9, 6, '2026-07-27', 'invoice 1', 'completed', 2500.00, 'product recived', 3, '2026-07-27 15:39:10', '2026-07-27 15:39:10', NULL);

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

--
-- Table structure for table `stock_receiving_items`
--

CREATE TABLE `stock_receiving_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_receiving_id` bigint(20) UNSIGNED NOT NULL,
  `purchase_order_item_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `item_name` varchar(255) NOT NULL,
  `qty_received` decimal(12,2) NOT NULL,
  `unit_cost` decimal(14,2) NOT NULL,
  `subtotal` decimal(14,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_receiving_items`
--

INSERT INTO `stock_receiving_items` (`id`, `stock_receiving_id`, `purchase_order_item_id`, `product_id`, `item_name`, `qty_received`, `unit_cost`, `subtotal`, `created_at`, `updated_at`) VALUES
(29, 17, 17, 3, 'Pran Lichi Drink', 100.00, 25.00, 2500.00, '2026-07-27 15:39:10', '2026-07-27 15:39:10');

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

--
-- Table structure for table `stock_transfers`
--

CREATE TABLE `stock_transfers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `reference_no` varchar(255) NOT NULL,
  `from_warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `to_warehouse_id` bigint(20) UNSIGNED NOT NULL,
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `date` date NOT NULL,
  `note` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `completed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_transfers`
--

INSERT INTO `stock_transfers` (`id`, `reference_no`, `from_warehouse_id`, `to_warehouse_id`, `status`, `date`, `note`, `created_by`, `completed_at`, `created_at`, `updated_at`) VALUES
(5, 'TR-000001', 4, 5, 'completed', '2026-07-27', 'transfer', 3, '2026-07-27 15:59:43', '2026-07-27 15:59:40', '2026-07-27 15:59:43'),
(6, 'TR-000002', 4, 5, 'completed', '2026-08-01', 'tgh', 3, '2026-08-01 12:42:03', '2026-08-01 12:32:46', '2026-08-01 12:42:03');

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

--
-- Table structure for table `stock_transfer_items`
--

CREATE TABLE `stock_transfer_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_transfer_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(14,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `stock_transfer_items`
--

INSERT INTO `stock_transfer_items` (`id`, `stock_transfer_id`, `product_id`, `quantity`, `created_at`, `updated_at`) VALUES
(5, 5, 3, 50.00, '2026-07-27 15:59:40', '2026-07-27 15:59:40'),
(6, 6, 3, 1.00, '2026-08-01 12:32:46', '2026-08-01 12:32:46');

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

--
-- Table structure for table `tasks`
--

CREATE TABLE `tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `assigned_date` date NOT NULL,
  `expected_completion_date` date NOT NULL,
  `actual_completion_date` date DEFAULT NULL,
  `status` enum('pending','in_progress','completed','cancelled') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `tasks`
--

INSERT INTO `tasks` (`id`, `employee_id`, `title`, `description`, `assigned_date`, `expected_completion_date`, `actual_completion_date`, `status`, `notes`, `created_at`, `updated_at`) VALUES
(1, 1, 'Zamanstore visit ad Office Task 7-7-2026', 'Zamanstore visit in khilkhet. kathuriabd website design , alhikman madrasa backup restore and live on cpanel. Mohiuddin Sir DnD Investor Add.', '2026-07-07', '2026-07-07', '2026-07-07', 'completed', NULL, '2026-07-09 11:49:32', '2026-07-09 11:51:00'),
(2, 1, 'Office Task - 7-8-2026', 'Basir Sir Dnd Investor add , alhikman madrasa website content update , kathuriabd website content update.', '2026-07-08', '2026-07-08', '2026-07-08', 'completed', NULL, '2026-07-09 11:50:36', '2026-07-09 11:50:36'),
(3, 1, 'Office Task - 7-9-2026', 'DnD Ecomerce site pathau , redex and stedfast intregation , alhikma madrasa content update and about us fix.', '2026-07-09', '2026-07-12', NULL, 'completed', NULL, '2026-07-09 11:51:47', '2026-07-13 10:09:05'),
(5, 1, 'Office Work - 7-13-2026', 'DnD Ecomerce site pathau , redex and stedfast intregation & etclbd Email creation', '2026-07-12', '2026-07-12', '2026-07-12', 'in_progress', 'DnD Ecomerce site pathau , redex and stedfast intregation & etclbd Email creation', '2026-07-13 11:10:16', '2026-07-13 11:10:16'),
(7, 3, 'work fast', 'work fast', '2026-08-01', '2026-08-02', NULL, 'in_progress', NULL, '2026-08-01 11:44:18', '2026-08-01 11:44:42');

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

--
-- Table structure for table `task_images`
--

CREATE TABLE `task_images` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `project_task_id` bigint(20) UNSIGNED NOT NULL,
  `image_path` varchar(255) NOT NULL,
  `image_url` varchar(255) NOT NULL,
  `original_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `units`
--

CREATE TABLE `units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `short_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `units`
--

INSERT INTO `units` (`id`, `name`, `short_name`, `created_at`, `updated_at`) VALUES
(3, 'Pieces', 'Pcs', '2026-07-27 15:29:27', '2026-07-27 15:29:27');

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

--
-- Table structure for table `vendors`
--

CREATE TABLE `vendors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `vendor_code` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `company_name` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `tax_number` varchar(255) DEFAULT NULL,
  `opening_balance` decimal(14,2) NOT NULL DEFAULT 0.00,
  `balance` decimal(14,2) NOT NULL DEFAULT 0.00,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vendors`
--

INSERT INTO `vendors` (`id`, `vendor_code`, `name`, `company_name`, `email`, `phone`, `address`, `tax_number`, `opening_balance`, `balance`, `status`, `notes`, `created_at`, `updated_at`, `deleted_at`) VALUES
(6, 'VEN-00001', 'Pran Deler', 'Pran Deler', 'pran@gmail.com', '01821732936', '4/89 rupnagar tinset mirpur dhaka', 'wf5345545tergeg', 0.00, 0.00, 'active', NULL, '2026-07-27 15:27:28', '2026-07-31 14:31:12', NULL);

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

--
-- Table structure for table `vendor_payments`
--

CREATE TABLE `vendor_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `payment_number` varchar(255) NOT NULL,
  `transaction_id` varchar(255) DEFAULT NULL,
  `vendor_id` bigint(20) UNSIGNED NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` decimal(14,2) NOT NULL,
  `payment_date` date NOT NULL,
  `method` enum('cash','bank_transfer','cheque','card','other') NOT NULL DEFAULT 'cash',
  `reference_no` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `vendor_payments`
--

INSERT INTO `vendor_payments` (`id`, `payment_number`, `transaction_id`, `vendor_id`, `purchase_order_id`, `amount`, `payment_date`, `method`, `reference_no`, `notes`, `created_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
(22, 'VP-000001', NULL, 6, 9, 2000.00, '2026-07-27', 'cash', 'Cash by hand', 'vendor tamim has been paid by hand cash', 3, '2026-07-27 15:45:14', '2026-07-27 15:45:14', NULL),
(26, 'VP-000002', 'TXN-000001', 6, 9, 400.00, '2026-07-31', 'other', NULL, 'record from expenses', 3, '2026-07-31 14:28:22', '2026-07-31 14:28:22', NULL),
(27, 'VP-000003', 'TXN-000002', 6, 9, 100.00, '2026-07-31', 'other', NULL, 'record from creditors', 3, '2026-07-31 14:30:06', '2026-07-31 14:30:06', NULL);

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

--
-- Table structure for table `warehouses`
--

CREATE TABLE `warehouses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `address` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `warehouses`
--

INSERT INTO `warehouses` (`id`, `name`, `code`, `address`, `phone`, `is_default`, `is_active`, `created_at`, `updated_at`) VALUES
(4, 'Mirpur Warehouse', 'MW-01', 'Rupnagar Tinset road 4 , house 88', '01533665116', 1, 1, '2026-07-27 15:28:04', '2026-07-27 15:28:04'),
(5, 'Chittagong Warehouse', 'CW-01', 'Chittagong', '01821732936', 0, 1, '2026-07-27 15:56:52', '2026-07-27 15:56:52');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `advances`
--
ALTER TABLE `advances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `advances_employee_id_foreign` (`employee_id`),
  ADD KEY `advances_approved_by_foreign` (`approved_by`);

--
-- Indexes for table `advance_deductions`
--
ALTER TABLE `advance_deductions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `advance_deductions_advance_id_year_month_unique` (`advance_id`,`year`,`month`),
  ADD KEY `advance_deductions_employee_id_foreign` (`employee_id`),
  ADD KEY `advance_deductions_salary_id_foreign` (`salary_id`);

--
-- Indexes for table `application_answers`
--
ALTER TABLE `application_answers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `application_answers_job_application_id_foreign` (`job_application_id`),
  ADD KEY `application_answers_job_question_id_foreign` (`job_question_id`);

--
-- Indexes for table `application_interviews`
--
ALTER TABLE `application_interviews`
  ADD PRIMARY KEY (`id`),
  ADD KEY `application_interviews_job_application_id_foreign` (`job_application_id`),
  ADD KEY `application_interviews_interview_stage_id_foreign` (`interview_stage_id`),
  ADD KEY `application_interviews_interviewer_id_foreign` (`interviewer_id`);

--
-- Indexes for table `attendances`
--
ALTER TABLE `attendances`
  ADD PRIMARY KEY (`id`),
  ADD KEY `attendances_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `brands_slug_unique` (`slug`);

--
-- Indexes for table `calendar_notes`
--
ALTER TABLE `calendar_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `calendar_notes_employee_id_foreign` (`employee_id`),
  ADD KEY `calendar_notes_date_index` (`date`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `categories_slug_unique` (`slug`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customers_email_unique` (`email`),
  ADD KEY `customers_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `customer_purchases`
--
ALTER TABLE `customer_purchases`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_purchases_employee_id_foreign` (`employee_id`),
  ADD KEY `customer_purchases_purchase_date_index` (`purchase_date`),
  ADD KEY `customer_purchases_customer_id_purchase_date_index` (`customer_id`,`purchase_date`);

--
-- Indexes for table `customer_tasks`
--
ALTER TABLE `customer_tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_tasks_employee_id_foreign` (`employee_id`),
  ADD KEY `customer_tasks_customer_id_foreign` (`customer_id`),
  ADD KEY `customer_tasks_status_expiry_date_index` (`status`,`expiry_date`);

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

--
-- Indexes for table `designations`
--
ALTER TABLE `designations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `designations_department_id_foreign` (`department_id`);

--
-- Indexes for table `email_messages`
--
ALTER TABLE `email_messages`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `email_messages_imap_account_id_uid_folder_unique` (`imap_account_id`,`uid`,`folder`),
  ADD KEY `email_messages_imap_account_id_is_seen_index` (`imap_account_id`,`is_seen`);

--
-- Indexes for table `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `employees_email_unique` (`email`),
  ADD UNIQUE KEY `employees_device_user_id_unique` (`device_user_id`);

--
-- Indexes for table `employee_documents`
--
ALTER TABLE `employee_documents`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_documents_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `employee_exits`
--
ALTER TABLE `employee_exits`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_exits_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD KEY `expenses_expense_category_id_foreign` (`expense_category_id`),
  ADD KEY `expenses_employee_id_foreign` (`employee_id`),
  ADD KEY `expenses_submitted_by_foreign` (`submitted_by`),
  ADD KEY `expenses_approved_by_foreign` (`approved_by`),
  ADD KEY `expenses_expense_date_status_index` (`expense_date`,`status`),
  ADD KEY `expenses_vendor_id_foreign` (`vendor_id`),
  ADD KEY `expenses_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `expenses_stock_receiving_id_foreign` (`stock_receiving_id`),
  ADD KEY `expenses_customer_id_foreign` (`customer_id`);

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

--
-- Indexes for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indexes for table `incomes`
--
ALTER TABLE `incomes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `incomes_income_category_id_foreign` (`income_category_id`),
  ADD KEY `incomes_employee_id_foreign` (`employee_id`),
  ADD KEY `incomes_income_date_index` (`income_date`),
  ADD KEY `incomes_customer_id_foreign` (`customer_id`);

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

--
-- Indexes for table `interview_stages`
--
ALTER TABLE `interview_stages`
  ADD PRIMARY KEY (`id`),
  ADD KEY `interview_stages_job_posting_id_foreign` (`job_posting_id`);

--
-- Indexes for table `investments`
--
ALTER TABLE `investments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `investments_investor_id_foreign` (`investor_id`);

--
-- Indexes for table `investment_withdrawals`
--
ALTER TABLE `investment_withdrawals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `investment_withdrawals_investment_id_foreign` (`investment_id`);

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

--
-- Indexes for table `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indexes for table `job_applications`
--
ALTER TABLE `job_applications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `job_applications_job_posting_id_foreign` (`job_posting_id`),
  ADD KEY `job_applications_current_stage_id_foreign` (`current_stage_id`),
  ADD KEY `job_applications_employee_id_foreign` (`employee_id`);

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

--
-- Indexes for table `job_postings`
--
ALTER TABLE `job_postings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `job_postings_slug_unique` (`slug`),
  ADD KEY `job_postings_department_id_foreign` (`department_id`),
  ADD KEY `job_postings_designation_id_foreign` (`designation_id`),
  ADD KEY `job_postings_created_by_foreign` (`created_by`);

--
-- Indexes for table `job_questions`
--
ALTER TABLE `job_questions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `job_questions_job_posting_id_foreign` (`job_posting_id`);

--
-- Indexes for table `loans`
--
ALTER TABLE `loans`
  ADD PRIMARY KEY (`id`),
  ADD KEY `loans_employee_id_foreign` (`employee_id`),
  ADD KEY `loans_submitted_by_foreign` (`submitted_by`),
  ADD KEY `loans_approved_by_foreign` (`approved_by`),
  ADD KEY `loans_type_status_index` (`type`,`status`);

--
-- Indexes for table `loan_installments`
--
ALTER TABLE `loan_installments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `loan_installments_loan_id_due_date_index` (`loan_id`,`due_date`);

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

--
-- Indexes for table `milestones`
--
ALTER TABLE `milestones`
  ADD PRIMARY KEY (`id`),
  ADD KEY `milestones_project_id_foreign` (`project_id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payments_transaction_id_unique` (`transaction_id`),
  ADD KEY `payments_payable_type_payable_id_index` (`payable_type`,`payable_id`),
  ADD KEY `payments_payment_date_index` (`payment_date`),
  ADD KEY `payments_vendor_payment_id_foreign` (`vendor_payment_id`),
  ADD KEY `payments_paid_by_employee_id_foreign` (`paid_by_employee_id`),
  ADD KEY `payments_paid_by_customer_id_foreign` (`paid_by_customer_id`);

--
-- Indexes for table `performance_reviews`
--
ALTER TABLE `performance_reviews`
  ADD PRIMARY KEY (`id`),
  ADD KEY `performance_reviews_employee_id_foreign` (`employee_id`),
  ADD KEY `performance_reviews_reviewer_id_foreign` (`reviewer_id`);

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `products_sku_unique` (`sku`),
  ADD UNIQUE KEY `products_barcode_unique` (`barcode`),
  ADD KEY `products_category_id_foreign` (`category_id`),
  ADD KEY `products_brand_id_foreign` (`brand_id`),
  ADD KEY `products_unit_id_foreign` (`unit_id`);

--
-- Indexes for table `product_stocks`
--
ALTER TABLE `product_stocks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_stocks_product_id_variant_id_warehouse_id_unique` (`product_id`,`variant_id`,`warehouse_id`),
  ADD KEY `product_stocks_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `product_stocks_variant_id_foreign` (`variant_id`);

--
-- Indexes for table `product_variants`
--
ALTER TABLE `product_variants`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_variants_sku_unique` (`sku`),
  ADD UNIQUE KEY `product_variants_product_id_color_size_unique` (`product_id`,`color`,`size`),
  ADD UNIQUE KEY `product_variants_barcode_unique` (`barcode`);

--
-- Indexes for table `profit_distributions`
--
ALTER TABLE `profit_distributions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `profit_distributions_investment_id_foreign` (`investment_id`),
  ADD KEY `profit_distributions_approved_by_foreign` (`approved_by`);

--
-- Indexes for table `projects`
--
ALTER TABLE `projects`
  ADD PRIMARY KEY (`id`),
  ADD KEY `projects_customer_id_foreign` (`customer_id`),
  ADD KEY `projects_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `project_tasks`
--
ALTER TABLE `project_tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_tasks_milestone_id_foreign` (`milestone_id`),
  ADD KEY `project_tasks_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchase_orders_po_number_unique` (`po_number`),
  ADD KEY `purchase_orders_created_by_foreign` (`created_by`),
  ADD KEY `purchase_orders_vendor_id_status_index` (`vendor_id`,`status`),
  ADD KEY `purchase_orders_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `purchase_order_items`
--
ALTER TABLE `purchase_order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_order_items_purchase_order_id_foreign` (`purchase_order_id`);

--
-- Indexes for table `purchase_returns`
--
ALTER TABLE `purchase_returns`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchase_returns_return_number_unique` (`return_number`),
  ADD KEY `purchase_returns_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `purchase_returns_vendor_id_foreign` (`vendor_id`),
  ADD KEY `purchase_returns_created_by_foreign` (`created_by`),
  ADD KEY `purchase_returns_warehouse_id_foreign` (`warehouse_id`);

--
-- Indexes for table `purchase_return_items`
--
ALTER TABLE `purchase_return_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_return_items_purchase_return_id_foreign` (`purchase_return_id`);

--
-- Indexes for table `quotations`
--
ALTER TABLE `quotations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `quotations_quotation_no_unique` (`quotation_no`),
  ADD KEY `quotations_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `quotations_created_by_foreign` (`created_by`),
  ADD KEY `quotations_customer_id_foreign` (`customer_id`);

--
-- Indexes for table `quotation_items`
--
ALTER TABLE `quotation_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `quotation_items_quotation_id_foreign` (`quotation_id`),
  ADD KEY `quotation_items_product_id_foreign` (`product_id`);

--
-- Indexes for table `reminders`
--
ALTER TABLE `reminders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reminders_employee_id_foreign` (`employee_id`),
  ADD KEY `reminders_created_by_foreign` (`created_by`),
  ADD KEY `reminders_status_next_notify_at_index` (`status`,`next_notify_at`),
  ADD KEY `reminders_user_id_foreign` (`user_id`);

--
-- Indexes for table `reminder_notifications`
--
ALTER TABLE `reminder_notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `reminder_notifications_reminder_id_foreign` (`reminder_id`),
  ADD KEY `reminder_notifications_employee_id_foreign` (`employee_id`),
  ADD KEY `reminder_notifications_is_read_notified_at_index` (`is_read`,`notified_at`),
  ADD KEY `reminder_notifications_user_id_foreign` (`user_id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_unique` (`name`);

--
-- Indexes for table `salaries`
--
ALTER TABLE `salaries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `salaries_employee_id_year_month_unique` (`employee_id`,`year`,`month`);

--
-- Indexes for table `sales_incomes`
--
ALTER TABLE `sales_incomes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_incomes_employee_id_foreign` (`employee_id`),
  ADD KEY `sales_incomes_sale_date_index` (`sale_date`);

--
-- Indexes for table `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indexes for table `stock_adjustments`
--
ALTER TABLE `stock_adjustments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_adjustments_reference_no_unique` (`reference_no`),
  ADD KEY `stock_adjustments_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_adjustments_created_by_foreign` (`created_by`);

--
-- Indexes for table `stock_adjustment_items`
--
ALTER TABLE `stock_adjustment_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_adjustment_items_stock_adjustment_id_foreign` (`stock_adjustment_id`),
  ADD KEY `stock_adjustment_items_product_id_foreign` (`product_id`);

--
-- Indexes for table `stock_ins`
--
ALTER TABLE `stock_ins`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_ins_reference_no_unique` (`reference_no`),
  ADD KEY `stock_ins_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_ins_created_by_foreign` (`created_by`),
  ADD KEY `stock_ins_vendor_id_foreign` (`vendor_id`);

--
-- Indexes for table `stock_in_items`
--
ALTER TABLE `stock_in_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_in_items_stock_in_id_foreign` (`stock_in_id`),
  ADD KEY `stock_in_items_product_id_foreign` (`product_id`);

--
-- Indexes for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_movements_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_movements_created_by_foreign` (`created_by`),
  ADD KEY `stock_movements_product_id_warehouse_id_index` (`product_id`,`warehouse_id`),
  ADD KEY `stock_movements_reference_type_reference_id_index` (`reference_type`,`reference_id`),
  ADD KEY `stock_movements_variant_id_foreign` (`variant_id`);

--
-- Indexes for table `stock_outs`
--
ALTER TABLE `stock_outs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_outs_reference_no_unique` (`reference_no`),
  ADD KEY `stock_outs_warehouse_id_foreign` (`warehouse_id`),
  ADD KEY `stock_outs_created_by_foreign` (`created_by`),
  ADD KEY `stock_outs_customer_id_foreign` (`customer_id`),
  ADD KEY `stock_outs_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `stock_out_items`
--
ALTER TABLE `stock_out_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_out_items_stock_out_id_foreign` (`stock_out_id`),
  ADD KEY `stock_out_items_product_id_foreign` (`product_id`);

--
-- Indexes for table `stock_receivings`
--
ALTER TABLE `stock_receivings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_receivings_grn_number_unique` (`grn_number`),
  ADD KEY `stock_receivings_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `stock_receivings_vendor_id_foreign` (`vendor_id`),
  ADD KEY `stock_receivings_received_by_foreign` (`received_by`);

--
-- Indexes for table `stock_receiving_items`
--
ALTER TABLE `stock_receiving_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_receiving_items_stock_receiving_id_foreign` (`stock_receiving_id`),
  ADD KEY `stock_receiving_items_purchase_order_item_id_foreign` (`purchase_order_item_id`);

--
-- Indexes for table `stock_transfers`
--
ALTER TABLE `stock_transfers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_transfers_reference_no_unique` (`reference_no`),
  ADD KEY `stock_transfers_from_warehouse_id_foreign` (`from_warehouse_id`),
  ADD KEY `stock_transfers_to_warehouse_id_foreign` (`to_warehouse_id`),
  ADD KEY `stock_transfers_created_by_foreign` (`created_by`);

--
-- Indexes for table `stock_transfer_items`
--
ALTER TABLE `stock_transfer_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_transfer_items_stock_transfer_id_foreign` (`stock_transfer_id`),
  ADD KEY `stock_transfer_items_product_id_foreign` (`product_id`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`),
  ADD KEY `tasks_employee_id_foreign` (`employee_id`);

--
-- Indexes for table `task_images`
--
ALTER TABLE `task_images`
  ADD PRIMARY KEY (`id`),
  ADD KEY `task_images_project_task_id_foreign` (`project_task_id`);

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

--
-- Indexes for table `vendors`
--
ALTER TABLE `vendors`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendors_vendor_code_unique` (`vendor_code`);

--
-- Indexes for table `vendor_payments`
--
ALTER TABLE `vendor_payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vendor_payments_payment_number_unique` (`payment_number`),
  ADD UNIQUE KEY `vendor_payments_transaction_id_unique` (`transaction_id`),
  ADD KEY `vendor_payments_vendor_id_foreign` (`vendor_id`),
  ADD KEY `vendor_payments_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `vendor_payments_created_by_foreign` (`created_by`);

--
-- Indexes for table `warehouses`
--
ALTER TABLE `warehouses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `warehouses_code_unique` (`code`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `advances`
--
ALTER TABLE `advances`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `advance_deductions`
--
ALTER TABLE `advance_deductions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `application_answers`
--
ALTER TABLE `application_answers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `application_interviews`
--
ALTER TABLE `application_interviews`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `attendances`
--
ALTER TABLE `attendances`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=90;

--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `calendar_notes`
--
ALTER TABLE `calendar_notes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `categories`
--
ALTER TABLE `categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `customer_purchases`
--
ALTER TABLE `customer_purchases`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `customer_tasks`
--
ALTER TABLE `customer_tasks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `designations`
--
ALTER TABLE `designations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `email_messages`
--
ALTER TABLE `email_messages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `employees`
--
ALTER TABLE `employees`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `employee_documents`
--
ALTER TABLE `employee_documents`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `employee_exits`
--
ALTER TABLE `employee_exits`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `expenses`
--
ALTER TABLE `expenses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `expense_categories`
--
ALTER TABLE `expense_categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `failed_jobs`
--
ALTER TABLE `failed_jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `incomes`
--
ALTER TABLE `incomes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `income_categories`
--
ALTER TABLE `income_categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `interview_stages`
--
ALTER TABLE `interview_stages`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `investments`
--
ALTER TABLE `investments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `investment_withdrawals`
--
ALTER TABLE `investment_withdrawals`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `investors`
--
ALTER TABLE `investors`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `jobs`
--
ALTER TABLE `jobs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `job_applications`
--
ALTER TABLE `job_applications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `job_postings`
--
ALTER TABLE `job_postings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `job_questions`
--
ALTER TABLE `job_questions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `loans`
--
ALTER TABLE `loans`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `loan_installments`
--
ALTER TABLE `loan_installments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=100;

--
-- AUTO_INCREMENT for table `milestones`
--
ALTER TABLE `milestones`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `payments`
--
ALTER TABLE `payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;

--
-- AUTO_INCREMENT for table `performance_reviews`
--
ALTER TABLE `performance_reviews`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `product_stocks`
--
ALTER TABLE `product_stocks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `product_variants`
--
ALTER TABLE `product_variants`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `profit_distributions`
--
ALTER TABLE `profit_distributions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `projects`
--
ALTER TABLE `projects`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `project_tasks`
--
ALTER TABLE `project_tasks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `purchase_order_items`
--
ALTER TABLE `purchase_order_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `purchase_returns`
--
ALTER TABLE `purchase_returns`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `purchase_return_items`
--
ALTER TABLE `purchase_return_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `quotations`
--
ALTER TABLE `quotations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `quotation_items`
--
ALTER TABLE `quotation_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `reminders`
--
ALTER TABLE `reminders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `reminder_notifications`
--
ALTER TABLE `reminder_notifications`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=149;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `salaries`
--
ALTER TABLE `salaries`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

--
-- AUTO_INCREMENT for table `sales_incomes`
--
ALTER TABLE `sales_incomes`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `stock_adjustments`
--
ALTER TABLE `stock_adjustments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `stock_adjustment_items`
--
ALTER TABLE `stock_adjustment_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `stock_ins`
--
ALTER TABLE `stock_ins`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `stock_in_items`
--
ALTER TABLE `stock_in_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `stock_movements`
--
ALTER TABLE `stock_movements`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=25;

--
-- AUTO_INCREMENT for table `stock_outs`
--
ALTER TABLE `stock_outs`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `stock_out_items`
--
ALTER TABLE `stock_out_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `stock_receivings`
--
ALTER TABLE `stock_receivings`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `stock_receiving_items`
--
ALTER TABLE `stock_receiving_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;

--
-- AUTO_INCREMENT for table `stock_transfers`
--
ALTER TABLE `stock_transfers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `stock_transfer_items`
--
ALTER TABLE `stock_transfer_items`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `tasks`
--
ALTER TABLE `tasks`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `task_images`
--
ALTER TABLE `task_images`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `units`
--
ALTER TABLE `units`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `vendors`
--
ALTER TABLE `vendors`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `vendor_payments`
--
ALTER TABLE `vendor_payments`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

--
-- AUTO_INCREMENT for table `warehouses`
--
ALTER TABLE `warehouses`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `advances`
--
ALTER TABLE `advances`
  ADD CONSTRAINT `advances_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `advances_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `advance_deductions`
--
ALTER TABLE `advance_deductions`
  ADD CONSTRAINT `advance_deductions_advance_id_foreign` FOREIGN KEY (`advance_id`) REFERENCES `advances` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `advance_deductions_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `advance_deductions_salary_id_foreign` FOREIGN KEY (`salary_id`) REFERENCES `salaries` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `application_answers`
--
ALTER TABLE `application_answers`
  ADD CONSTRAINT `application_answers_job_application_id_foreign` FOREIGN KEY (`job_application_id`) REFERENCES `job_applications` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `application_answers_job_question_id_foreign` FOREIGN KEY (`job_question_id`) REFERENCES `job_questions` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `application_interviews`
--
ALTER TABLE `application_interviews`
  ADD CONSTRAINT `application_interviews_interview_stage_id_foreign` FOREIGN KEY (`interview_stage_id`) REFERENCES `interview_stages` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `application_interviews_interviewer_id_foreign` FOREIGN KEY (`interviewer_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `application_interviews_job_application_id_foreign` FOREIGN KEY (`job_application_id`) REFERENCES `job_applications` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `attendances`
--
ALTER TABLE `attendances`
  ADD CONSTRAINT `attendances_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `calendar_notes`
--
ALTER TABLE `calendar_notes`
  ADD CONSTRAINT `calendar_notes_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `customers_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `customer_purchases`
--
ALTER TABLE `customer_purchases`
  ADD CONSTRAINT `customer_purchases_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_purchases_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `customer_tasks`
--
ALTER TABLE `customer_tasks`
  ADD CONSTRAINT `customer_tasks_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_tasks_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `designations`
--
ALTER TABLE `designations`
  ADD CONSTRAINT `designations_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `email_messages`
--
ALTER TABLE `email_messages`
  ADD CONSTRAINT `email_messages_imap_account_id_foreign` FOREIGN KEY (`imap_account_id`) REFERENCES `imap_accounts` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employee_documents`
--
ALTER TABLE `employee_documents`
  ADD CONSTRAINT `employee_documents_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_expense_category_id_foreign` FOREIGN KEY (`expense_category_id`) REFERENCES `expense_categories` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `expenses_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_stock_receiving_id_foreign` FOREIGN KEY (`stock_receiving_id`) REFERENCES `stock_receivings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_submitted_by_foreign` FOREIGN KEY (`submitted_by`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `incomes`
--
ALTER TABLE `incomes`
  ADD CONSTRAINT `incomes_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `incomes_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `incomes_income_category_id_foreign` FOREIGN KEY (`income_category_id`) REFERENCES `income_categories` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `interview_stages`
--
ALTER TABLE `interview_stages`
  ADD CONSTRAINT `interview_stages_job_posting_id_foreign` FOREIGN KEY (`job_posting_id`) REFERENCES `job_postings` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `investments`
--
ALTER TABLE `investments`
  ADD CONSTRAINT `investments_investor_id_foreign` FOREIGN KEY (`investor_id`) REFERENCES `investors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `investment_withdrawals`
--
ALTER TABLE `investment_withdrawals`
  ADD CONSTRAINT `investment_withdrawals_investment_id_foreign` FOREIGN KEY (`investment_id`) REFERENCES `investments` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `job_applications`
--
ALTER TABLE `job_applications`
  ADD CONSTRAINT `job_applications_current_stage_id_foreign` FOREIGN KEY (`current_stage_id`) REFERENCES `interview_stages` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `job_applications_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `job_applications_job_posting_id_foreign` FOREIGN KEY (`job_posting_id`) REFERENCES `job_postings` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `job_postings`
--
ALTER TABLE `job_postings`
  ADD CONSTRAINT `job_postings_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `job_postings_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `job_postings_designation_id_foreign` FOREIGN KEY (`designation_id`) REFERENCES `designations` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `job_questions`
--
ALTER TABLE `job_questions`
  ADD CONSTRAINT `job_questions_job_posting_id_foreign` FOREIGN KEY (`job_posting_id`) REFERENCES `job_postings` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `loans`
--
ALTER TABLE `loans`
  ADD CONSTRAINT `loans_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `loans_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `loans_submitted_by_foreign` FOREIGN KEY (`submitted_by`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `loan_installments`
--
ALTER TABLE `loan_installments`
  ADD CONSTRAINT `loan_installments_loan_id_foreign` FOREIGN KEY (`loan_id`) REFERENCES `loans` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `milestones`
--
ALTER TABLE `milestones`
  ADD CONSTRAINT `milestones_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_paid_by_customer_id_foreign` FOREIGN KEY (`paid_by_customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_paid_by_employee_id_foreign` FOREIGN KEY (`paid_by_employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_vendor_payment_id_foreign` FOREIGN KEY (`vendor_payment_id`) REFERENCES `vendor_payments` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `performance_reviews`
--
ALTER TABLE `performance_reviews`
  ADD CONSTRAINT `performance_reviews_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `performance_reviews_reviewer_id_foreign` FOREIGN KEY (`reviewer_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `products_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `product_stocks`
--
ALTER TABLE `product_stocks`
  ADD CONSTRAINT `product_stocks_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_stocks_variant_id_foreign` FOREIGN KEY (`variant_id`) REFERENCES `product_variants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_stocks_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `product_variants`
--
ALTER TABLE `product_variants`
  ADD CONSTRAINT `product_variants_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `profit_distributions`
--
ALTER TABLE `profit_distributions`
  ADD CONSTRAINT `profit_distributions_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `profit_distributions_investment_id_foreign` FOREIGN KEY (`investment_id`) REFERENCES `investments` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `projects`
--
ALTER TABLE `projects`
  ADD CONSTRAINT `projects_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `projects_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `project_tasks`
--
ALTER TABLE `project_tasks`
  ADD CONSTRAINT `project_tasks_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `project_tasks_milestone_id_foreign` FOREIGN KEY (`milestone_id`) REFERENCES `milestones` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD CONSTRAINT `purchase_orders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_orders_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_orders_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `purchase_order_items`
--
ALTER TABLE `purchase_order_items`
  ADD CONSTRAINT `purchase_order_items_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `purchase_returns`
--
ALTER TABLE `purchase_returns`
  ADD CONSTRAINT `purchase_returns_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_returns_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_returns_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_returns_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `purchase_return_items`
--
ALTER TABLE `purchase_return_items`
  ADD CONSTRAINT `purchase_return_items_purchase_return_id_foreign` FOREIGN KEY (`purchase_return_id`) REFERENCES `purchase_returns` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `quotations`
--
ALTER TABLE `quotations`
  ADD CONSTRAINT `quotations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `quotations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `quotations_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `quotation_items`
--
ALTER TABLE `quotation_items`
  ADD CONSTRAINT `quotation_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `quotation_items_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `reminders`
--
ALTER TABLE `reminders`
  ADD CONSTRAINT `reminders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `reminders_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reminders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `reminder_notifications`
--
ALTER TABLE `reminder_notifications`
  ADD CONSTRAINT `reminder_notifications_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reminder_notifications_reminder_id_foreign` FOREIGN KEY (`reminder_id`) REFERENCES `reminders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `reminder_notifications_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `sales_incomes`
--
ALTER TABLE `sales_incomes`
  ADD CONSTRAINT `sales_incomes_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stock_adjustments`
--
ALTER TABLE `stock_adjustments`
  ADD CONSTRAINT `stock_adjustments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_adjustments_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stock_adjustment_items`
--
ALTER TABLE `stock_adjustment_items`
  ADD CONSTRAINT `stock_adjustment_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stock_adjustment_items_stock_adjustment_id_foreign` FOREIGN KEY (`stock_adjustment_id`) REFERENCES `stock_adjustments` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_ins`
--
ALTER TABLE `stock_ins`
  ADD CONSTRAINT `stock_ins_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_ins_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_ins_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stock_in_items`
--
ALTER TABLE `stock_in_items`
  ADD CONSTRAINT `stock_in_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stock_in_items_stock_in_id_foreign` FOREIGN KEY (`stock_in_id`) REFERENCES `stock_ins` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD CONSTRAINT `stock_movements_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_movements_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_movements_variant_id_foreign` FOREIGN KEY (`variant_id`) REFERENCES `product_variants` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_movements_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_outs`
--
ALTER TABLE `stock_outs`
  ADD CONSTRAINT `stock_outs_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_outs_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_outs_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_outs_warehouse_id_foreign` FOREIGN KEY (`warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stock_out_items`
--
ALTER TABLE `stock_out_items`
  ADD CONSTRAINT `stock_out_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stock_out_items_stock_out_id_foreign` FOREIGN KEY (`stock_out_id`) REFERENCES `stock_outs` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_receivings`
--
ALTER TABLE `stock_receivings`
  ADD CONSTRAINT `stock_receivings_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_receivings_received_by_foreign` FOREIGN KEY (`received_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_receivings_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_receiving_items`
--
ALTER TABLE `stock_receiving_items`
  ADD CONSTRAINT `stock_receiving_items_purchase_order_item_id_foreign` FOREIGN KEY (`purchase_order_item_id`) REFERENCES `purchase_order_items` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_receiving_items_stock_receiving_id_foreign` FOREIGN KEY (`stock_receiving_id`) REFERENCES `stock_receivings` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_transfers`
--
ALTER TABLE `stock_transfers`
  ADD CONSTRAINT `stock_transfers_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_transfers_from_warehouse_id_foreign` FOREIGN KEY (`from_warehouse_id`) REFERENCES `warehouses` (`id`),
  ADD CONSTRAINT `stock_transfers_to_warehouse_id_foreign` FOREIGN KEY (`to_warehouse_id`) REFERENCES `warehouses` (`id`);

--
-- Constraints for table `stock_transfer_items`
--
ALTER TABLE `stock_transfer_items`
  ADD CONSTRAINT `stock_transfer_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  ADD CONSTRAINT `stock_transfer_items_stock_transfer_id_foreign` FOREIGN KEY (`stock_transfer_id`) REFERENCES `stock_transfers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `tasks`
--
ALTER TABLE `tasks`
  ADD CONSTRAINT `tasks_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `task_images`
--
ALTER TABLE `task_images`
  ADD CONSTRAINT `task_images_project_task_id_foreign` FOREIGN KEY (`project_task_id`) REFERENCES `project_tasks` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `vendor_payments`
--
ALTER TABLE `vendor_payments`
  ADD CONSTRAINT `vendor_payments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `vendor_payments_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `vendor_payments_vendor_id_foreign` FOREIGN KEY (`vendor_id`) REFERENCES `vendors` (`id`) ON DELETE CASCADE;
COMMIT;

