-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 26, 2026 at 12:43 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 8.1.25

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `jevapos`
--

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

--
-- Table structure for table `accommodation_bookings`
--

CREATE TABLE `accommodation_bookings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `room_id` bigint(20) UNSIGNED NOT NULL,
  `rate_plan_id` bigint(20) UNSIGNED DEFAULT NULL,
  `meal_plan_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `booking_no` varchar(255) NOT NULL,
  `confirmation_no` varchar(255) DEFAULT NULL,
  `guest_name` varchar(255) NOT NULL,
  `guest_phone` varchar(255) DEFAULT NULL,
  `nationality` varchar(255) DEFAULT NULL,
  `id_passport_no` varchar(255) DEFAULT NULL,
  `adults` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `children` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `child_ages` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`child_ages`)),
  `source` varchar(255) NOT NULL DEFAULT 'walk_in',
  `check_in_at` datetime NOT NULL,
  `expected_check_out_at` datetime NOT NULL,
  `actual_check_out_at` datetime DEFAULT NULL,
  `reserved_at` timestamp NULL DEFAULT NULL,
  `nights` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `rate` decimal(14,2) NOT NULL DEFAULT 0.00,
  `base_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `occupancy_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `extras_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `rate_snapshot` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`rate_snapshot`)),
  `total_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `paid_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `payment_method_id` bigint(20) UNSIGNED DEFAULT NULL,
  `charge_type_id` bigint(20) UNSIGNED DEFAULT NULL,
  `balance_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `payment_status` varchar(255) NOT NULL DEFAULT 'unpaid',
  `status` varchar(255) NOT NULL DEFAULT 'checked_in',
  `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 `accommodation_charge_types`
--

CREATE TABLE `accommodation_charge_types` (
  `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 `accommodation_charge_types`
--

INSERT INTO `accommodation_charge_types` (`id`, `name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'BED ONLY', NULL, 1, '2026-09-10 15:07:42', '2026-09-10 15:07:42'),
(2, 'BED AND BREAKFAST', NULL, 1, '2026-09-10 15:07:42', '2026-09-10 15:07:42'),
(3, 'DEPOSIT', NULL, 1, '2026-09-10 15:07:42', '2026-09-10 15:07:42'),
(4, 'PARTIAL PAYMENT', NULL, 1, '2026-09-10 15:07:42', '2026-09-10 15:07:42');

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

--
-- Table structure for table `accommodation_child_rates`
--

CREATE TABLE `accommodation_child_rates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `rate_plan_id` bigint(20) UNSIGNED NOT NULL,
  `minimum_age` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `maximum_age` int(10) UNSIGNED NOT NULL DEFAULT 17,
  `pricing_type` varchar(255) NOT NULL DEFAULT 'free',
  `amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `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;

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

--
-- Table structure for table `accommodation_floors`
--

CREATE TABLE `accommodation_floors` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `hotel_id` bigint(20) UNSIGNED DEFAULT 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 `accommodation_floors`
--

INSERT INTO `accommodation_floors` (`id`, `hotel_id`, `name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 1, '1ST', NULL, 1, '2026-09-10 14:37:11', '2026-09-10 14:37:11'),
(2, 1, '2ND', NULL, 1, '2026-09-10 14:37:11', '2026-09-10 14:37:11'),
(3, 1, '3RD', NULL, 1, '2026-09-10 14:37:11', '2026-09-10 14:37:11'),
(4, 1, '4TH', NULL, 1, '2026-09-10 14:37:11', '2026-09-10 14:37:11');

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

--
-- Table structure for table `accommodation_hotels`
--

CREATE TABLE `accommodation_hotels` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `expected_rooms` int(10) UNSIGNED 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 `accommodation_hotels`
--

INSERT INTO `accommodation_hotels` (`id`, `name`, `phone`, `email`, `address`, `expected_rooms`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'JL MOTEL', '0712345678', 'jl@gmail.com', 'Kakamega', 10, 1, '2026-09-10 13:54:36', '2026-09-10 13:54:36');

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

--
-- Table structure for table `accommodation_meal_plans`
--

CREATE TABLE `accommodation_meal_plans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(40) NOT NULL,
  `name` varchar(255) NOT NULL,
  `includes_breakfast` tinyint(1) NOT NULL DEFAULT 0,
  `includes_lunch` tinyint(1) NOT NULL DEFAULT 0,
  `includes_dinner` tinyint(1) NOT NULL DEFAULT 0,
  `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 `accommodation_meal_plans`
--

INSERT INTO `accommodation_meal_plans` (`id`, `code`, `name`, `includes_breakfast`, `includes_lunch`, `includes_dinner`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'BED_ONLY', 'Bed Only', 0, 0, 0, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16'),
(2, 'BED_BREAKFAST', 'Bed and Breakfast', 1, 0, 0, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16'),
(3, 'HALF_BOARD', 'Half Board', 1, 0, 1, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16'),
(4, 'FULL_BOARD', 'Full Board', 1, 1, 1, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16');

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

--
-- Table structure for table `accommodation_rate_plans`
--

CREATE TABLE `accommodation_rate_plans` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `hotel_id` bigint(20) UNSIGNED DEFAULT NULL,
  `room_type_id` bigint(20) UNSIGNED NOT NULL,
  `meal_plan_id` bigint(20) UNSIGNED DEFAULT NULL,
  `code` varchar(60) NOT NULL,
  `name` varchar(255) NOT NULL,
  `base_rate` decimal(14,2) NOT NULL DEFAULT 0.00,
  `base_adults` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `extra_adult_rate` decimal(14,2) NOT NULL DEFAULT 0.00,
  `minimum_stay` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `maximum_stay` int(10) UNSIGNED DEFAULT NULL,
  `is_refundable` tinyint(1) NOT NULL DEFAULT 1,
  `cancellation_policy` 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 `accommodation_rate_plans`
--

INSERT INTO `accommodation_rate_plans` (`id`, `hotel_id`, `room_type_id`, `meal_plan_id`, `code`, `name`, `base_rate`, `base_adults`, `extra_adult_rate`, `minimum_stay`, `maximum_stay`, `is_refundable`, `cancellation_policy`, `is_active`, `created_at`, `updated_at`) VALUES
(1, NULL, 1, 1, 'BED-1-SINGLE', 'Single - Bed Only', 1000.00, 1, 0.00, 1, NULL, 1, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16'),
(2, NULL, 2, 1, 'BED-2-DOUBLE', 'Double - Bed Only', 1200.00, 2, 0.00, 1, NULL, 1, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16'),
(3, NULL, 3, 1, 'BED-3-FAMILY', 'Family - Bed Only', 1500.00, 2, 0.00, 1, NULL, 1, NULL, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16');

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

--
-- Table structure for table `accommodation_rooms`
--

CREATE TABLE `accommodation_rooms` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `hotel_id` bigint(20) UNSIGNED DEFAULT NULL,
  `floor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `room_type_id` bigint(20) UNSIGNED DEFAULT NULL,
  `room_no` varchar(255) NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `floor` varchar(255) DEFAULT NULL,
  `rate` decimal(14,2) NOT NULL DEFAULT 0.00,
  `status` varchar(255) NOT NULL DEFAULT 'vacant',
  `notes` 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;

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

--
-- Table structure for table `accommodation_room_types`
--

CREATE TABLE `accommodation_room_types` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `default_rate` decimal(14,2) NOT NULL DEFAULT 0.00,
  `capacity` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `standard_adults` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `max_adults` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `max_children` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `max_occupancy` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `allows_children` tinyint(1) NOT NULL DEFAULT 1,
  `minimum_guest_age` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `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 `accommodation_room_types`
--

INSERT INTO `accommodation_room_types` (`id`, `name`, `default_rate`, `capacity`, `standard_adults`, `max_adults`, `max_children`, `max_occupancy`, `allows_children`, `minimum_guest_age`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Single', 1000.00, 1, 1, 1, 0, 1, 1, 0, NULL, 1, '2026-09-09 22:18:46', '2026-09-09 22:18:46'),
(2, 'Double', 1200.00, 2, 2, 2, 1, 2, 1, 0, NULL, 1, '2026-09-09 22:19:03', '2026-09-09 22:19:03'),
(3, 'Family', 1500.00, 5, 2, 5, 4, 5, 1, 0, NULL, 1, '2026-09-09 22:19:16', '2026-09-09 22:19:16');

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

--
-- Table structure for table `accommodation_seasonal_rates`
--

CREATE TABLE `accommodation_seasonal_rates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `rate_plan_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `starts_on` date NOT NULL,
  `ends_on` date NOT NULL,
  `nightly_rate` decimal(14,2) NOT 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;

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

--
-- Table structure for table `accounts`
--

CREATE TABLE `accounts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `gl_code` varchar(255) DEFAULT NULL,
  `account_name` varchar(255) DEFAULT NULL,
  `account_type` varchar(255) DEFAULT NULL,
  `sub_account_type` varchar(255) DEFAULT NULL,
  `parent_account_id` bigint(20) UNSIGNED DEFAULT NULL,
  `currency` varchar(255) NOT NULL DEFAULT 'KES',
  `opening_date` datetime 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 `accounts`
--

INSERT INTO `accounts` (`id`, `gl_code`, `account_name`, `account_type`, `sub_account_type`, `parent_account_id`, `currency`, `opening_date`, `is_active`, `created_at`, `updated_at`) VALUES
(2, '1011', 'Cash in Hand', 'asset', 'cash', NULL, 'KES', '2026-05-18 14:18:00', 1, '2026-05-18 08:18:31', '2026-09-22 18:01:46'),
(3, '1000', 'KCB Bank', 'asset', 'bank', NULL, 'KES', '2026-05-18 14:41:00', 1, '2026-05-18 08:41:33', '2026-09-22 18:01:46'),
(4, '1012', 'Petty Cash', 'asset', 'petty_cash', 2, 'KES', '2026-05-18 14:53:00', 1, '2026-05-18 08:53:39', '2026-09-22 18:01:46'),
(5, '1111', 'M-Pesa', 'asset', 'mobile_money', NULL, 'KES', '2026-05-19 18:42:00', 1, '2026-05-19 12:42:57', '2026-09-22 18:01:46'),
(7, '1010', 'Legacy M-Pesa / Mobile Money #7', 'asset', NULL, NULL, 'KES', NULL, 0, '2026-09-15 18:13:08', '2026-09-22 18:01:46'),
(8, '1020', 'Bank / Card Collections', 'asset', 'bank', NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-22 18:01:46'),
(9, '1030', 'Cash Sales Clearing', 'asset', 'clearing', NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-22 18:01:46'),
(10, '1100', 'Accounts Receivable', 'asset', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(11, '1200', 'Inventory', 'asset', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(12, '1300', 'Input VAT', 'asset', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(13, '2000', 'Accounts Payable', 'liability', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(14, '2100', 'Output VAT', 'liability', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(15, '4000', 'Sales Revenue', 'income', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(16, '4010', 'Sales Returns', 'income', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(17, '5000', 'Cost of Goods Sold', 'expense', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(18, '6000', 'Operating Expenses', 'expense', NULL, NULL, 'KES', NULL, 1, '2026-09-15 18:13:08', '2026-09-15 18:13:08'),
(19, '1001', 'Legacy Cash in Hand #19', 'asset', NULL, NULL, 'KES', NULL, 0, '2026-09-15 18:14:13', '2026-09-22 18:01:46'),
(22, 'CUSTODIA', 'Custodian Inventory', 'asset', NULL, NULL, 'KES', NULL, 1, '2026-09-21 20:15:22', '2026-09-21 20:15:22'),
(23, 'HOUSEKEE', 'Housekeeping Supplies', 'expense', NULL, NULL, 'KES', NULL, 1, '2026-09-21 20:22:19', '2026-09-21 20:22:19'),
(24, 'TRBANK', 'Legacy Main Bank Account #24', 'asset', 'cash_and_cash_equivalents', NULL, 'KES', '2026-09-22 20:20:32', 0, '2026-09-22 17:20:32', '2026-09-22 18:01:46');

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

--
-- Table structure for table `attendance_days`
--

CREATE TABLE `attendance_days` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `work_date` date NOT NULL,
  `first_in` datetime DEFAULT NULL,
  `last_out` datetime DEFAULT NULL,
  `worked_minutes` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `late_minutes` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `overtime_minutes` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `status` varchar(255) NOT NULL DEFAULT 'present',
  `source` varchar(255) NOT NULL DEFAULT 'biometric',
  `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;

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

--
-- Table structure for table `attendance_sync_logs`
--

CREATE TABLE `attendance_sync_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `device_id` bigint(20) UNSIGNED NOT NULL,
  `started_at` datetime NOT NULL,
  `completed_at` datetime DEFAULT NULL,
  `imported_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `skipped_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `error_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `status` varchar(255) NOT NULL DEFAULT 'running',
  `message` 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 `audit_logs`
--

CREATE TABLE `audit_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `module` varchar(255) NOT NULL,
  `action` varchar(255) NOT NULL,
  `auditable_type` varchar(255) DEFAULT NULL,
  `auditable_id` bigint(20) UNSIGNED DEFAULT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `old_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`old_values`)),
  `new_values` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`new_values`)),
  `reason` text DEFAULT NULL,
  `ip_address` varchar(255) DEFAULT NULL,
  `user_agent` 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 `audit_logs`
--

INSERT INTO `audit_logs` (`id`, `user_id`, `branch_id`, `module`, `action`, `auditable_type`, `auditable_id`, `reference_no`, `old_values`, `new_values`, `reason`, `ip_address`, `user_agent`, `created_at`, `updated_at`) VALUES
(1, 3, 2, 'users', 'updated', 'App\\Models\\User', 3, 'JEVATECH SOLUTIONS', '{\"department_id\":2,\"first_name\":\"Valentine\",\"last_name\":\"Muteshi\",\"name\":\"Valentine Muteshi\",\"password\":\"[hidden]\"}', '{\"department_id\":\"1\",\"first_name\":\"JEVATECH\",\"last_name\":\"SOLUTIONS\",\"name\":\"JEVATECH SOLUTIONS\",\"password\":\"[hidden]\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 21:54:04', '2026-09-25 21:54:04'),
(2, 3, 2, 'auth', 'logout', 'App\\Models\\User', 3, NULL, NULL, '{\"username\":\"user\",\"name\":\"JEVATECH SOLUTIONS\"}', 'User logged out', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 21:54:29', '2026-09-25 21:54:29'),
(3, 3, 2, 'auth', 'login', 'App\\Models\\User', 3, NULL, NULL, '{\"username\":\"user\",\"name\":\"JEVATECH SOLUTIONS\"}', 'Successful login', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 21:54:36', '2026-09-25 21:54:36'),
(4, 3, 2, 'auth', 'logout', 'App\\Models\\User', 3, NULL, NULL, '{\"username\":\"user\",\"name\":\"JEVATECH SOLUTIONS\"}', 'User logged out', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 21:57:19', '2026-09-25 21:57:19'),
(5, 3, 2, 'auth', 'login', 'App\\Models\\User', 3, NULL, NULL, '{\"username\":\"user\",\"name\":\"JEVATECH SOLUTIONS\"}', 'Successful login', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 21:57:27', '2026-09-25 21:57:27'),
(6, 3, 2, 'users', 'updated', 'App\\Models\\User', 3, 'JEVATECH SOLUTIONS', '{\"middle_name\":null,\"phone\":\"12345678\",\"password\":\"[hidden]\",\"job_title\":null,\"employee_number\":null,\"hire_date\":null,\"id_number\":null,\"kra_pin\":null,\"nssf_number\":null,\"sha_number\":null,\"bank_name\":null,\"bank_account_number\":null,\"basic_salary\":null,\"physical_address\":null,\"next_of_kin\":null,\"emergency_contact\":null}', '{\"middle_name\":\"JEVA\",\"phone\":\"254741479897\",\"password\":\"[hidden]\",\"job_title\":\"TECHNICIAN\",\"employee_number\":\"01\",\"hire_date\":\"2025-09-26\",\"id_number\":\"12345\",\"kra_pin\":\"A12345L\",\"nssf_number\":\"12345\",\"sha_number\":\"12345\",\"bank_name\":\"KCB\",\"bank_account_number\":\"12345\",\"basic_salary\":\"1000\",\"physical_address\":\"NAIROBI\",\"next_of_kin\":\"JEVATECH\",\"emergency_contact\":\"25471234\"}', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 22:06:48', '2026-09-25 22:06:48'),
(7, 3, 2, 'auth', 'logout', 'App\\Models\\User', 3, NULL, NULL, '{\"username\":\"user\",\"name\":\"JEVATECH SOLUTIONS\"}', 'User logged out', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 22:37:00', '2026-09-25 22:37:00'),
(8, 3, 2, 'auth', 'login', 'App\\Models\\User', 3, NULL, NULL, '{\"username\":\"user\",\"name\":\"JEVATECH SOLUTIONS\"}', 'Successful login', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36', '2026-09-25 22:37:49', '2026-09-25 22:37:49');

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

--
-- Table structure for table `biometric_devices`
--

CREATE TABLE `biometric_devices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `vendor` varchar(255) NOT NULL DEFAULT 'generic',
  `connection_type` varchar(255) NOT NULL DEFAULT 'webhook',
  `base_url` varchar(255) DEFAULT NULL,
  `device_serial` varchar(255) DEFAULT NULL,
  `ip_address` varchar(255) DEFAULT NULL,
  `port` int(10) UNSIGNED DEFAULT NULL,
  `username` varchar(255) DEFAULT NULL,
  `credential` text DEFAULT NULL,
  `api_key_hash` varchar(64) NOT NULL,
  `timezone` varchar(255) NOT NULL DEFAULT 'Africa/Nairobi',
  `last_sync_at` datetime DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'not_tested',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`settings`)),
  `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 `biometric_employee_mappings`
--

CREATE TABLE `biometric_employee_mappings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `device_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `device_user_id` varchar(255) NOT NULL,
  `employee_no` 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 `biometric_punches`
--

CREATE TABLE `biometric_punches` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `device_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `device_user_id` varchar(255) DEFAULT NULL,
  `employee_no` varchar(255) DEFAULT NULL,
  `punch_time` datetime NOT NULL,
  `punch_type` varchar(255) NOT NULL DEFAULT 'unknown',
  `verify_mode` varchar(255) DEFAULT NULL,
  `external_uid` varchar(255) NOT NULL,
  `raw_payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`raw_payload`)),
  `imported_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 `branches`
--

CREATE TABLE `branches` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `city` varchar(255) DEFAULT NULL,
  `country` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `is_main` 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 `branches`
--

INSERT INTO `branches` (`id`, `name`, `code`, `phone`, `email`, `city`, `country`, `address`, `is_main`, `is_active`, `created_at`, `updated_at`) VALUES
(2, 'JEVATECH SOLUTIONS', NULL, '254741479897', 'jevatechsolutions@gmail.com', 'NAIROBI', 'KENYA', 'CBD', 1, 1, '2026-05-13 13:34:58', '2026-09-05 15:46:16');

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

--
-- Table structure for table `branch_user`
--

CREATE TABLE `branch_user` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED 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 `branch_user`
--

INSERT INTO `branch_user` (`id`, `user_id`, `branch_id`, `created_at`, `updated_at`) VALUES
(2, 3, 2, '2026-09-11 21:16:07', '2026-09-11 21:16:07');

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

--
-- Table structure for table `business_modules`
--

CREATE TABLE `business_modules` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_id` bigint(20) UNSIGNED DEFAULT NULL,
  `module_id` bigint(20) UNSIGNED NOT NULL,
  `is_enabled` 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 `business_modules`
--

INSERT INTO `business_modules` (`id`, `business_id`, `module_id`, `is_enabled`, `created_at`, `updated_at`) VALUES
(1, NULL, 1, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(2, NULL, 2, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(3, NULL, 3, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(4, NULL, 4, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(5, NULL, 5, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(6, NULL, 6, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(7, NULL, 7, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(8, NULL, 8, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(9, NULL, 9, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(10, NULL, 10, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(11, NULL, 11, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(12, NULL, 12, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(13, NULL, 13, 1, '2026-04-15 11:36:49', '2026-09-09 21:50:50'),
(14, NULL, 14, 1, '2026-05-13 04:02:43', '2026-09-09 21:50:50'),
(15, NULL, 15, 1, '2026-09-05 17:34:49', '2026-09-09 21:50:50'),
(16, NULL, 16, 1, '2026-09-08 13:55:26', '2026-09-15 17:12:01'),
(17, NULL, 17, 1, '2026-09-09 13:33:29', '2026-09-09 21:50:50'),
(18, NULL, 18, 1, '2026-09-09 13:55:03', '2026-09-09 21:50:50'),
(20, NULL, 20, 1, '2026-09-09 15:15:40', '2026-09-09 21:50:50'),
(21, NULL, 21, 1, '2026-09-09 21:27:17', '2026-09-09 21:50:50'),
(22, NULL, 22, 1, '2026-09-09 21:27:17', '2026-09-09 21:50:50'),
(23, NULL, 23, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(24, NULL, 24, 1, '2026-09-11 20:04:38', '2026-09-11 20:04:38'),
(25, NULL, 25, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(26, NULL, 26, 1, '2026-09-14 19:41:58', '2026-09-15 17:12:01'),
(27, NULL, 27, 1, '2026-09-15 10:21:21', '2026-09-15 17:12:01'),
(28, NULL, 28, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(29, NULL, 29, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(30, NULL, 30, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56');

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

--
-- Table structure for table `business_settings`
--

CREATE TABLE `business_settings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `business_name` varchar(255) NOT NULL DEFAULT 'JEVAPOS',
  `business_mode` enum('retail','hotel','hybrid') NOT NULL DEFAULT 'retail',
  `currency` varchar(255) NOT NULL DEFAULT 'KES',
  `tax_name` varchar(255) NOT NULL DEFAULT 'VAT',
  `tax_rate` decimal(8,2) NOT NULL DEFAULT 16.00,
  `default_price_tier` varchar(255) NOT NULL DEFAULT 'retail',
  `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 `call_records`
--

CREATE TABLE `call_records` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `call_no` varchar(255) NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `receiver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `category` enum('sales','inquiry','complain','support','message','other') NOT NULL DEFAULT 'inquiry',
  `subject` varchar(255) NOT NULL,
  `caller_name` varchar(255) NOT NULL,
  `caller_number` varchar(255) DEFAULT NULL,
  `caller_email` varchar(255) DEFAULT NULL,
  `receiver_name` varchar(255) DEFAULT NULL,
  `media_mode` varchar(255) DEFAULT NULL,
  `call_date` datetime NOT NULL,
  `description` text DEFAULT NULL,
  `status` enum('new','attended','pending','solved','completed','other') NOT NULL DEFAULT 'new',
  `next_follow_up_at` datetime DEFAULT NULL,
  `recording_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 `categories`
--

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT 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;

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

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

CREATE TABLE `customers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `tax_pin` varchar(100) DEFAULT NULL,
  `nationality` varchar(255) DEFAULT NULL,
  `id_passport_no` varchar(255) 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 `customers`
--

INSERT INTO `customers` (`id`, `branch_id`, `name`, `phone`, `email`, `address`, `tax_pin`, `nationality`, `id_passport_no`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 2, 'Walk in', '12345678', 'asdfg@gmail.com', NULL, 'P345678987V', NULL, NULL, 1, '2026-09-09 22:02:57', '2026-09-25 19:40:04');

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

--
-- Table structure for table `damaged_products`
--

CREATE TABLE `damaged_products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `damage_no` varchar(255) NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `quantity` decimal(15,2) NOT NULL,
  `stock_before` decimal(15,2) NOT NULL DEFAULT 0.00,
  `stock_after` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `damage_date` datetime NOT NULL,
  `responsible_person` varchar(255) DEFAULT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `note` 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 `deals`
--

CREATE TABLE `deals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `deal_no` varchar(255) NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `assigned_to` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `source` varchar(255) DEFAULT NULL,
  `subject` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `expected_value` decimal(15,2) NOT NULL DEFAULT 0.00,
  `stage` enum('new','contacted','follow_up','quotation','won','lost') NOT NULL DEFAULT 'new',
  `status` enum('pending','ongoing','won','lost','closed') NOT NULL DEFAULT 'pending',
  `next_follow_up_at` datetime DEFAULT NULL,
  `last_follow_up_at` datetime DEFAULT NULL,
  `last_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 `deal_follow_ups`
--

CREATE TABLE `deal_follow_ups` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `deal_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `follow_up_type` enum('call','sms','email','visit','demo','quotation','support','other') NOT NULL DEFAULT 'call',
  `follow_up_at` datetime NOT NULL,
  `next_follow_up_at` datetime DEFAULT NULL,
  `outcome` enum('pending','done','interested','not_interested','no_response','won','lost') NOT NULL DEFAULT 'done',
  `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 `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, 'IT', NULL, NULL, 1, '2026-05-13 06:09:26', '2026-05-13 06:09:26'),
(2, 'SALES', NULL, NULL, 1, '2026-05-13 07:13:52', '2026-05-13 07:13:52');

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

--
-- Table structure for table `disciplinary_cases`
--

CREATE TABLE `disciplinary_cases` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `reported_by` bigint(20) UNSIGNED NOT NULL,
  `incident_date` date NOT NULL,
  `category` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `action_taken` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'open',
  `resolved_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 `employee_contracts`
--

CREATE TABLE `employee_contracts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `contract_type` varchar(255) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `salary` decimal(15,2) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'active',
  `terms` 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_notes`
--

CREATE TABLE `employee_notes` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `employee_id` bigint(20) UNSIGNED NOT NULL,
  `posted_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `note_date` date NOT NULL,
  `note_type` varchar(255) NOT NULL DEFAULT 'performance',
  `note` text 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 `employee_reviews`
--

CREATE TABLE `employee_reviews` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `reviewer_id` bigint(20) UNSIGNED NOT NULL,
  `period_start` date NOT NULL,
  `period_end` date NOT NULL,
  `score` decimal(5,2) NOT NULL DEFAULT 0.00,
  `rating` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'draft',
  `strengths` text DEFAULT NULL,
  `improvements` text DEFAULT NULL,
  `goals` text DEFAULT NULL,
  `employee_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;

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

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

CREATE TABLE `expenses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `expense_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `shift_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_method_id` bigint(20) UNSIGNED DEFAULT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `expense_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `paid_to` varchar(255) DEFAULT NULL,
  `amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `reference_no` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `expense_date` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `delete_reason` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

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

--
-- 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 `internal_stock_issues`
--

CREATE TABLE `internal_stock_issues` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `issue_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `issued_by` bigint(20) UNSIGNED NOT NULL,
  `receiver_id` bigint(20) UNSIGNED DEFAULT NULL,
  `received_by` bigint(20) UNSIGNED DEFAULT NULL,
  `issue_type` varchar(30) NOT NULL,
  `status` varchar(30) NOT NULL DEFAULT 'issued',
  `issue_date` datetime NOT NULL,
  `received_at` datetime DEFAULT NULL,
  `purpose` varchar(255) NOT NULL,
  `note` text DEFAULT NULL,
  `total_cost` decimal(15,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;

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

--
-- Table structure for table `internal_stock_issue_items`
--

CREATE TABLE `internal_stock_issue_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `internal_stock_issue_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity_issued` decimal(15,2) NOT NULL,
  `quantity_consumed` decimal(15,2) NOT NULL DEFAULT 0.00,
  `quantity_returned` decimal(15,2) NOT NULL DEFAULT 0.00,
  `quantity_lost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `stock_before` decimal(15,2) NOT NULL DEFAULT 0.00,
  `stock_after` decimal(15,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;

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

--
-- Table structure for table `internal_stock_transactions`
--

CREATE TABLE `internal_stock_transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `internal_stock_issue_item_id` bigint(20) UNSIGNED NOT NULL,
  `hotel_id` bigint(20) UNSIGNED DEFAULT NULL,
  `room_id` bigint(20) UNSIGNED DEFAULT NULL,
  `booking_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `transaction_type` varchar(30) NOT NULL,
  `quantity` decimal(15,2) NOT NULL,
  `balance_before` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance_after` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `transaction_date` datetime NOT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `note` 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 `journal_entries`
--

CREATE TABLE `journal_entries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `entry_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `entry_date` datetime NOT NULL,
  `source_type` varchar(255) DEFAULT NULL,
  `source_id` bigint(20) UNSIGNED DEFAULT NULL,
  `event` varchar(255) DEFAULT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'posted',
  `reversal_of_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;

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

--
-- Table structure for table `journal_entry_lines`
--

CREATE TABLE `journal_entry_lines` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `journal_entry_id` bigint(20) UNSIGNED NOT NULL,
  `account_id` bigint(20) UNSIGNED NOT NULL,
  `account_name` varchar(255) NOT NULL,
  `account_type` varchar(255) DEFAULT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `credit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `memo` 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 `leave_requests`
--

CREATE TABLE `leave_requests` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `leave_type_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date NOT NULL,
  `days` decimal(6,2) NOT NULL,
  `reason` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `reviewed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `reviewed_at` datetime DEFAULT NULL,
  `decision_note` 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 `leave_types`
--

CREATE TABLE `leave_types` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `days_per_year` decimal(6,2) NOT NULL DEFAULT 0.00,
  `is_paid` tinyint(1) NOT NULL DEFAULT 1,
  `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 `leave_types`
--

INSERT INTO `leave_types` (`id`, `name`, `days_per_year`, `is_paid`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Annual Leave', 21.00, 1, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32'),
(2, 'Sick Leave', 14.00, 1, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32'),
(3, 'Maternity Leave', 90.00, 1, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32'),
(4, 'Paternity Leave', 14.00, 1, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32'),
(5, 'Compassionate Leave', 5.00, 1, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32'),
(6, 'Unpaid Leave', 0.00, 0, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32');

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

--
-- Table structure for table `license_activations`
--

CREATE TABLE `license_activations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `activation_no` varchar(255) NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `client_name` varchar(255) NOT NULL,
  `contact_person` varchar(255) DEFAULT NULL,
  `technician_name` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `computer_serial` varchar(255) DEFAULT NULL,
  `generated_serial` varchar(255) DEFAULT NULL,
  `binding_type` varchar(20) DEFAULT NULL,
  `binding_value` varchar(255) DEFAULT NULL,
  `installation_id` varchar(255) DEFAULT NULL,
  `license_key` text DEFAULT NULL,
  `status` enum('pending','active','rejected','expired') NOT NULL DEFAULT 'pending',
  `requested_at` timestamp NULL DEFAULT NULL,
  `activated_at` timestamp NULL DEFAULT NULL,
  `expires_at` date DEFAULT NULL,
  `requested_by` bigint(20) UNSIGNED DEFAULT NULL,
  `activated_by` bigint(20) UNSIGNED 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 `license_activations`
--

INSERT INTO `license_activations` (`id`, `activation_no`, `customer_id`, `client_name`, `contact_person`, `technician_name`, `phone`, `email`, `computer_serial`, `generated_serial`, `binding_type`, `binding_value`, `installation_id`, `license_key`, `status`, `requested_at`, `activated_at`, `expires_at`, `requested_by`, `activated_by`, `notes`, `created_at`, `updated_at`) VALUES
(1, 'ACT0001', NULL, 'JEVATECH SOLUTIONS ERP', 'VALENTINE', NULL, '0741479897', 'vallshitakha@gmail.com', 'JEV-EFDA-MYR2', 'JEV-EFDA-MYR2', NULL, NULL, NULL, '7DE6A-07BF6-95E86-9CC5F', 'expired', '2026-09-15 13:18:28', '2026-09-15 13:20:00', '2026-09-15', NULL, 3, 'jvtch', '2026-09-15 13:18:28', '2026-09-15 13:20:33'),
(2, 'ACT0002', NULL, 'sample', 'test', NULL, '0988', 'fgh@gmail.com', 'JEV-EFDA-MYR2', 'JEV-EFDA-MYR2', NULL, NULL, NULL, '5F45E-C44C0-CBA2A-1EFDE', 'active', '2026-09-15 13:24:40', '2026-09-15 13:25:19', '2026-09-30', NULL, 3, 'ertyu', '2026-09-15 13:24:40', '2026-09-15 13:25:19'),
(3, 'ACT0003', NULL, 'test', 'hjfdf', NULL, '355422', NULL, 'JEV-EFDA-MYR2', 'JEV-EFDA-MYR2', NULL, NULL, NULL, '28B70-D71AC-97181-2ACB2', 'expired', '2026-09-15 13:28:15', '2026-09-15 13:28:19', '2026-09-14', 3, 3, NULL, '2026-09-15 13:28:15', '2026-09-15 13:28:35'),
(4, 'ACT0004', NULL, 'JEVATECH', 'VALENTINE', 'VALENTINE', '0741479897', 'vallshitakha@gmail.com', 'JEV-EFDA-MYR2', 'JEV-EFDA-MYR2', NULL, NULL, NULL, 'JVL-eyJ2IjoxLCJhY3RpdmF0aW9uX25vIjoiQUNUMDAwNCIsImNsaWVudF9uYW1lIjoiSkVWQVRFQ0giLCJjb21wdXRlcl9zZXJpYWwiOiJKRVYtRUZEQS1NWVIyIiwiZXhwaXJlc19hdCI6bnVsbCwiaXNzdWVkX2F0IjoiMjAyNi0wOS0xNiAxNDoyMDozMSJ9.e1f6d63aac24fb26b6657395ea25978706d257730d1bf41fab502fbdc021fb32', 'active', '2026-09-16 11:15:38', '2026-09-16 11:20:31', '2030-09-16', NULL, 3, 'erp', '2026-09-16 11:15:38', '2026-09-16 11:20:31'),
(5, 'ACT0005', NULL, 'JEVATECH', 'JEVATECH SOLUTIONS', 'JEVATECH SOLUTIONS', '254727109484', NULL, 'SRV-69543B2BF9B89BF2B568', 'JEV-EFDA-MYR2', 'server', 'srv-69543b2bf9b89bf2b568', 'JEV-EFDA-MYR2', 'JVL-eyJ2IjoyLCJhY3RpdmF0aW9uX25vIjoiQUNUMDAwNSIsImNsaWVudF9uYW1lIjoiSkVWQVRFQ0giLCJjb21wdXRlcl9zZXJpYWwiOiJTUlYtNjk1NDNCMkJGOUI4OUJGMkI1NjgiLCJpbnN0YWxsYXRpb25faWQiOiJKRVYtRUZEQS1NWVIyIiwiYmluZGluZ190eXBlIjoic2VydmVyIiwiYmluZGluZ192YWx1ZSI6InNydi02OTU0M2IyYmY5Yjg5YmYyYjU2OCIsImV4cGlyZXNfYXQiOm51bGwsImlzc3VlZF9hdCI6IjIwMjYtMDktMjYgMDE6MjY6MTUifQ.WORPv6HV0MUI_jPzjA4gWWqi1cAhotOhraen9E1uwsN1mK3v-1lPtJ_JcajIIQzYEbQJAw_nNy9XioiHbMQ86Roi5v7qbfuzVDtsuLZoMfDOk0M-1PZFJ9SS0Uy0zhcQaPKZFlyYLSeUo2pgKSz4Wgt-2ttDMig_bd2YaALxdEVujq5XXVMPVDVEBxc_knisCuKqw8trTpxIl0baqv18QzpJYc_MFUC7wTFQ7oUZ95zv9MSfl9XhLRvJfveRRDqedpqfuBnHskA3Udh5SQaOYO-14ey1gntS59j6sWLSiQE6lpIG2XR31Qt6SI00Q7KNcr-DPHMgq7JfvSBKZsmCrS1o5KOi76m1le7yXWJgvt6E8JkMEjvfsl1lFjvfjzqb1xtMqiCe8fqUcXzCeFYrBULNEulk7ZUR2_eeXhYRmCDuwAWv32SMu4F1vjYAigsHVz5VEYtrWIdquO8ChcUQLH2HYCdVtWnD3QSkWCVRw_vVM7CahVgRRUfE_g9i5cEk', 'active', '2026-09-25 22:26:15', '2026-09-25 22:26:15', NULL, NULL, 3, NULL, '2026-09-25 22:26:15', '2026-09-25 22:26:15');

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

--
-- 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, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_reset_tokens_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2019_12_14_000001_create_personal_access_tokens_table', 1),
(5, '2026_04_11_121628_create_business_settings_table', 1),
(6, '2026_04_11_121659_create_system_modules_table', 1),
(7, '2026_04_11_121722_create_business_modules_table', 1),
(8, '2026_04_11_121744_create_roles_table', 1),
(9, '2026_04_11_121808_create_role_module_permissions_table', 1),
(10, '2026_04_11_121823_create_price_tiers_table', 1),
(11, '2026_04_11_121841_create_product_prices_table', 1),
(12, '2026_04_11_142214_create_products_table', 1),
(13, '2026_04_13_140242_create_categories_table', 1),
(14, '2026_04_13_142223_create_sub_categories_table', 1),
(15, '2026_04_19_123101_create_permissions_table', 2),
(16, '2026_04_19_123906_create_role_permissions_table', 3),
(17, '2026_05_13_051543_add_extra_fields_to_users_table', 4),
(18, '2026_05_13_065639_create_departments_table', 5),
(19, '2026_05_13_093535_create_branches_table', 6),
(20, '2026_05_13_182607_add_department_id_to_users_table', 7),
(21, '2026_05_13_191137_create_accounts_table', 8),
(22, '2026_05_18_111133_add_chart_fields_to_accounts_table', 9),
(23, '2026_05_18_115520_create_payment_methods_table', 10),
(24, '2026_05_19_053045_add_employee_details_to_users_table', 11),
(25, '2026_05_19_113052_create_system_settings_table', 12),
(26, '2026_05_19_182837_add_pin_to_users_table', 13),
(27, '2026_05_25_121551_create_unit_of_measures_table', 14),
(28, '2026_05_25_141059_add_unit_of_measure_id_to_products_table', 15),
(29, '2026_05_27_164616_create_sales_table', 16),
(30, '2026_05_27_165434_create_sale_items_table', 17),
(31, '2026_05_27_165905_create_payments_table', 18),
(32, '2026_09_05_000001_add_customer_lpo_description_to_sales_table', 19),
(33, '2026_09_06_000002_add_tendered_and_change_to_sales_table', 20),
(34, '2026_09_06_000003_create_restaurant_tables_table', 21),
(35, '2026_09_06_000004_create_restaurant_orders_table', 22),
(36, '2026_09_06_000005_add_sale_id_to_restaurant_orders_table', 23),
(37, '2026_09_07_000010_add_merge_tracking_to_sales_table', 24),
(38, '2026_09_08_000020_create_purchases_table', 25),
(39, '2026_09_08_000021_create_purchase_items_table', 25),
(40, '2026_09_08_000022_create_purchase_payments_table', 25),
(41, '2026_09_08_000023_add_returned_quantity_to_purchase_items_table', 26),
(42, '2026_09_08_000024_create_purchase_returns_table', 26),
(43, '2026_09_08_000025_create_purchase_return_items_table', 26),
(44, '2026_09_09_000030_create_expenses_table', 27),
(45, '2026_09_09_000031_create_expense_categories_table', 28),
(46, '2026_09_09_000032_add_department_to_expenses_table', 28),
(47, '2026_09_09_000033_create_shifts_table', 29),
(48, '2026_09_09_000034_add_shift_id_to_sales_payments_expenses', 29),
(49, '2026_09_09_000035_add_shift_id_to_sale_items_table', 29),
(50, '2026_09_09_000036_create_shift_stock_counts_table', 30),
(51, '2026_09_10_000001_create_customers_and_suppliers_tables', 31),
(52, '2026_09_10_000002_create_bulk_sms_tables', 32),
(53, '2026_09_10_000003_create_accommodation_tables', 33),
(54, '2026_09_10_000004_add_payment_method_to_accommodation_bookings_and_credit_method', 34),
(55, '2026_09_10_000005_add_guest_identity_fields', 35),
(56, '2026_09_10_000006_create_accommodation_hotels_table', 36),
(57, '2026_09_10_000007_create_accommodation_floors_table', 37),
(58, '2026_09_10_000008_create_accommodation_charge_types_table', 38),
(59, '2026_09_11_000010_create_task_management_tables', 39),
(60, '2026_09_11_000011_create_quotations_tables', 40),
(61, '2026_09_12_000001_create_branch_user_table', 41),
(62, '2026_09_14_000001_create_mpesa_transactions_table', 42),
(63, '2026_09_14_000002_create_stock_takings_tables', 43),
(64, '2026_09_14_000003_add_branch_id_to_master_records', 44),
(65, '2026_09_14_000004_create_stock_transfers_tables', 45),
(66, '2026_09_14_000005_create_tax_rates_table', 46),
(67, '2026_09_14_000006_create_deals_management_tables', 47),
(68, '2026_09_15_000001_create_call_centre_tables', 48),
(69, '2026_09_15_000002_create_damaged_products_table', 49),
(70, '2026_09_15_000003_add_responsible_person_to_damaged_products_table', 50),
(71, '2026_09_15_000004_create_license_activations_table', 51),
(72, '2026_09_15_000005_add_technician_name_to_license_activations_table', 52),
(73, '2026_09_15_000006_ensure_task_management_permissions', 53),
(74, '2026_09_15_000007_ensure_all_module_permissions', 54),
(75, '2026_09_15_000008_ensure_missing_modules_and_permissions', 55),
(76, '2026_09_15_000009_separate_stock_transfer_and_damaged_permissions', 56),
(77, '2026_09_15_000010_remove_legacy_inventory_transfer_damage_permissions', 57),
(78, '2026_09_15_000011_create_audit_and_journal_foundation', 58),
(79, '2026_09_15_000012_add_accounting_foundation_permissions', 58),
(80, '2026_09_15_000013_seed_default_accounting_accounts', 59),
(81, '2026_09_15_000014_ensure_cash_in_hand_account', 60),
(82, '2026_09_15_000015_link_credit_payment_method_to_receivables', 61),
(83, '2026_09_16_000001_expand_license_key_storage', 62),
(84, '2026_09_16_000003_add_balance_sheet_permission', 63),
(85, '2026_09_16_000004_add_branch_id_to_restaurant_tables', 64),
(86, '2026_09_16_000005_add_performance_indexes', 65),
(87, '2026_09_16_000006_add_backup_permissions', 66),
(88, '2026_09_21_000001_add_website_product_fields_and_settings_permission', 67),
(89, '2026_09_21_000002_upgrade_accommodation_pricing_and_reservations', 68),
(90, '2026_09_21_000003_create_internal_stock_issues_tables', 69),
(91, '2026_09_21_000004_add_housekeeping_view_all_permission', 70),
(92, '2026_09_22_000001_create_treasury_projects_hr_attendance_foundation', 71),
(93, '2026_09_22_000002_add_payroll_and_hr_defaults', 72),
(94, '2026_09_22_000003_clean_operational_cash_accounts', 73),
(95, '2026_09_22_000004_add_hr_subpage_permissions', 74),
(96, '2026_09_22_000005_expand_hr_payroll_workspace', 75),
(97, '2026_09_22_000006_reorder_system_modules', 76),
(98, '2026_09_23_000001_add_product_import_permission', 77),
(99, '2026_09_25_000001_add_supplier_opening_balances', 78),
(100, '2026_09_25_000002_add_tax_pin_to_customers', 79),
(101, '2026_09_25_000003_set_global_default_entries', 80),
(102, '2026_09_26_000001_add_modem_mpesa_integration', 81),
(103, '2026_09_26_000002_add_mpesa_transaction_indexes', 82),
(104, '2026_09_26_000003_add_license_installation_binding', 83);

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

--
-- Table structure for table `mpesa_transactions`
--

CREATE TABLE `mpesa_transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `type` varchar(30) NOT NULL,
  `source` varchar(30) NOT NULL DEFAULT 'daraja',
  `status` varchar(30) NOT NULL DEFAULT 'received',
  `merchant_request_id` varchar(255) DEFAULT NULL,
  `checkout_request_id` varchar(255) DEFAULT NULL,
  `transaction_code` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `account_reference` varchar(255) DEFAULT NULL,
  `amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `sale_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `sms_in_id` bigint(20) UNSIGNED DEFAULT NULL,
  `claimed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `claimed_at` timestamp NULL DEFAULT NULL,
  `payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`payload`)),
  `result_description` text DEFAULT NULL,
  `processed_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 `password_reset_tokens`
--

CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sale_id` bigint(20) UNSIGNED NOT NULL,
  `shift_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_method_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `reference_no` varchar(255) DEFAULT NULL,
  `note` text DEFAULT NULL,
  `received_by` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_date` 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 `payment_methods`
--

CREATE TABLE `payment_methods` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `account_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `bank_name` 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 `payment_methods`
--

INSERT INTO `payment_methods` (`id`, `name`, `account_id`, `branch_id`, `bank_name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(2, 'Cash', 2, 2, 'Cash', NULL, 1, '2026-05-18 09:12:12', '2026-05-18 09:12:12'),
(3, 'Mpesa', 5, 2, NULL, NULL, 1, '2026-05-19 12:43:45', '2026-05-19 12:43:45'),
(6, 'Credit', 10, NULL, NULL, 'Customer will pay later. The transaction remains pending.', 1, '2026-09-09 22:39:48', '2026-09-15 18:15:02');

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

--
-- Table structure for table `payroll_components`
--

CREATE TABLE `payroll_components` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `type` enum('earning','deduction') NOT NULL,
  `calculation` enum('fixed','percentage') NOT NULL DEFAULT 'fixed',
  `value` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `is_statutory` 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;

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

--
-- Table structure for table `payroll_entries`
--

CREATE TABLE `payroll_entries` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `payroll_run_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `basic_salary` decimal(15,2) NOT NULL DEFAULT 0.00,
  `allowances` decimal(15,2) NOT NULL DEFAULT 0.00,
  `other_payments` decimal(15,2) NOT NULL DEFAULT 0.00,
  `gross_pay` decimal(15,2) NOT NULL DEFAULT 0.00,
  `paye` decimal(15,2) NOT NULL DEFAULT 0.00,
  `nssf` decimal(15,2) NOT NULL DEFAULT 0.00,
  `shif` decimal(15,2) NOT NULL DEFAULT 0.00,
  `housing_levy` decimal(15,2) NOT NULL DEFAULT 0.00,
  `advance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `loan` decimal(15,2) NOT NULL DEFAULT 0.00,
  `helb_sacco` decimal(15,2) NOT NULL DEFAULT 0.00,
  `damages` decimal(15,2) NOT NULL DEFAULT 0.00,
  `statutory_deductions` decimal(15,2) NOT NULL DEFAULT 0.00,
  `other_deductions` decimal(15,2) NOT NULL DEFAULT 0.00,
  `net_pay` decimal(15,2) NOT NULL DEFAULT 0.00,
  `payment_method` varchar(255) DEFAULT NULL,
  `bank_name` varchar(255) DEFAULT NULL,
  `bank_account_number` varchar(255) DEFAULT NULL,
  `component_breakdown` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`component_breakdown`)),
  `note` 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 `payroll_runs`
--

CREATE TABLE `payroll_runs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `payroll_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `period_start` date NOT NULL,
  `period_end` date NOT NULL,
  `pay_date` date NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'draft',
  `gross_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `deduction_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `net_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `finalized_by` bigint(20) UNSIGNED DEFAULT NULL,
  `finalized_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 `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `module_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `sort_order` int(11) 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 `permissions`
--

INSERT INTO `permissions` (`id`, `module_id`, `name`, `code`, `description`, `sort_order`, `is_active`, `created_at`, `updated_at`) VALUES
(162, 4, 'View Products', 'products.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(163, 4, 'Create Product', 'products.create', NULL, 2, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(164, 4, 'Update Product', 'products.update', NULL, 3, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(165, 4, 'Delete Product', 'products.delete', NULL, 4, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(166, 4, 'Adjust Stock', 'products.adjust_stock', NULL, 5, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(167, 5, 'View Categories', 'categories.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(168, 5, 'Create Category', 'categories.create', NULL, 2, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(169, 5, 'Update Category', 'categories.update', NULL, 3, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(170, 5, 'Delete Category', 'categories.delete', NULL, 4, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(171, 12, 'View Users', 'users.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(172, 12, 'Create User', 'users.create', NULL, 2, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(173, 12, 'Update User', 'users.update', NULL, 3, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(174, 12, 'Delete User', 'users.delete', NULL, 4, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(175, 12, 'Reset User Password', 'users.reset_password', NULL, 5, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(176, 12, 'View Roles', 'roles.view', NULL, 6, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(177, 12, 'Create Role', 'roles.create', NULL, 7, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(178, 12, 'Update Role', 'roles.update', NULL, 8, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(179, 12, 'Delete Role', 'roles.delete', NULL, 9, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(180, 12, 'Assign Role Permissions', 'roles.assign_permissions', NULL, 10, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(181, 14, 'View Human Resource', 'human_resource.view', NULL, 50, 1, '2026-05-19 06:57:41', '2026-09-22 17:15:56'),
(182, 18, 'View Departments', 'departments.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(183, 18, 'Create Department', 'departments.create', NULL, 2, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(184, 18, 'Update Department', 'departments.update', NULL, 3, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(185, 18, 'Delete Department', 'departments.delete', NULL, 4, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(186, 13, 'View Settings', 'settings.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(187, 13, 'View Branches', 'branches.view', NULL, 2, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(188, 13, 'Create Branch', 'branches.create', NULL, 3, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(189, 13, 'Update Branch', 'branches.update', NULL, 4, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(190, 13, 'Delete Branch', 'branches.delete', NULL, 5, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(191, 9, 'View Accounting', 'accounting.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(192, 9, 'View Chart of Accounts', 'accounts.view', NULL, 3, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(193, 9, 'Create Account', 'accounts.create', NULL, 4, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(194, 9, 'Update Account', 'accounts.update', NULL, 5, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(195, 9, 'Delete Account', 'accounts.delete', NULL, 6, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(196, 9, 'View Payment Methods', 'payment_methods.view', NULL, 7, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(197, 9, 'Create Payment Method', 'payment_methods.create', NULL, 8, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(198, 9, 'Update Payment Method', 'payment_methods.update', NULL, 9, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(199, 9, 'Delete Payment Method', 'payment_methods.delete', NULL, 10, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(200, 2, 'View Retail POS', 'retail_pos.view', NULL, 1, 1, '2026-05-19 06:57:41', '2026-09-15 17:02:34'),
(201, 23, 'View Task Categories', 'task_categories.view', NULL, 1, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(202, 23, 'Create Task Category', 'task_categories.create', NULL, 2, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(203, 23, 'Update Task Category', 'task_categories.update', NULL, 3, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(204, 23, 'Delete Task Category', 'task_categories.delete', NULL, 4, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(205, 23, 'Add Own Task', 'tasks.create_own', NULL, 5, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(206, 23, 'View Own Tasks', 'tasks.view_own', NULL, 6, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(207, 23, 'Update Own Task', 'tasks.update_own', NULL, 7, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(208, 23, 'Delete Own Task', 'tasks.delete_own', NULL, 8, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(209, 23, 'Post Specific Task', 'tasks.post_specific', NULL, 9, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(210, 23, 'Post General Task', 'tasks.post_general', NULL, 10, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(211, 23, 'View Others Specific Tasks', 'tasks.view_others_specific', NULL, 11, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(212, 23, 'View Others General Tasks', 'tasks.view_others_general', NULL, 12, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(213, 23, 'Assign Task', 'tasks.assign', NULL, 13, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(214, 23, 'Post Task For Others', 'tasks.post_for_others', NULL, 14, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(215, 23, 'Post Employee Notes For Others', 'tasks.employee_notes_for_others', NULL, 15, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(216, 23, 'Clear Overall Pending Tasks For Anyone', 'tasks.clear_any_pending', NULL, 16, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(217, 23, 'View Task Reports', 'tasks.reports', NULL, 17, 1, '2026-09-11 17:31:30', '2026-09-15 17:02:34'),
(218, 1, 'View Dashboard', 'dashboard.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(219, 2, 'Create Retail Sale', 'retail_pos.sell', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(220, 2, 'Save Retail Sale', 'retail_pos.save', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(221, 2, 'Save And Print Retail Sale', 'retail_pos.save_print', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(222, 2, 'Post Credit Sale', 'retail_pos.credit_sale', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(223, 2, 'Create Retail Quotation', 'retail_pos.quotation', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(224, 2, 'Suspend Retail Bill', 'retail_pos.suspend_bill', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(225, 2, 'Unsuspend Retail Bill', 'retail_pos.unsuspend_bill', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(226, 2, 'Add Customer From Retail POS', 'retail_pos.add_customer', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(227, 2, 'Use M-Pesa STK Push', 'retail_pos.mpesa_stk', NULL, 10, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(228, 3, 'View Wholesale POS', 'wholesale.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(229, 3, 'Create Wholesale Sale', 'wholesale.sell', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(230, 3, 'Save Wholesale Sale', 'wholesale.save', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(231, 3, 'Save And Print Wholesale Sale', 'wholesale.save_print', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(232, 3, 'Post Wholesale Credit Sale', 'wholesale.credit_sale', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(233, 3, 'Create Wholesale Quotation', 'wholesale.quotation', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(234, 3, 'Suspend Wholesale Bill', 'wholesale.suspend_bill', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(235, 3, 'Unsuspend Wholesale Bill', 'wholesale.unsuspend_bill', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(236, 3, 'Add Customer From Wholesale POS', 'wholesale.add_customer', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(237, 3, 'Use Wholesale M-Pesa STK Push', 'wholesale.mpesa_stk', NULL, 10, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(238, 15, 'View Sales', 'sales.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(239, 15, 'View Sale Details', 'sales.details', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(240, 15, 'Edit Sale / Add Items', 'sales.edit_add_items', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(241, 15, 'Print Receipt', 'sales.print_receipt', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(242, 15, 'Print A4 Invoice', 'sales.print_a4_invoice', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(243, 15, 'Print Delivery Note', 'sales.print_delivery_note', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(244, 15, 'Receive Payment', 'sales.receive_payment', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(245, 15, 'Bulk Clear Bills', 'sales.bulk_clear', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(246, 15, 'Void / Sale Return', 'sales.void', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(247, 15, 'Delete Sale', 'sales.delete', NULL, 10, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(248, 15, 'View End Of Day / Shift Report', 'sales.end_day_report', NULL, 11, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(249, 21, 'View Customers', 'customers.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(250, 21, 'Create Customer', 'customers.create', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(251, 21, 'Update Customer', 'customers.update', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(252, 21, 'Delete Customer', 'customers.delete', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(253, 21, 'Receive Customer Payment', 'customers.receive_payment', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(254, 21, 'View Customer Statement', 'customers.statement', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(255, 21, 'View Customer Invoices', 'customers.invoices', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(256, 21, 'Manage License Activation', 'customers.license_activation', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(257, 24, 'View Quotations', 'quotations.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(258, 24, 'Create Quotation', 'quotations.create', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(259, 24, 'Print Quotation', 'quotations.print', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(260, 24, 'Convert Quotation to Invoice', 'quotations.convert', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(261, 24, 'Delete Quotation', 'quotations.delete', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(262, 22, 'View Suppliers', 'suppliers.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(263, 22, 'Create Supplier', 'suppliers.create', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(264, 22, 'Update Supplier', 'suppliers.update', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(265, 22, 'Delete Supplier', 'suppliers.delete', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(266, 4, 'View Product Stock', 'products.stock_view', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(267, 5, 'View Expense Categories', 'expense_categories.view', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(268, 5, 'Create Expense Category', 'expense_categories.create', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(269, 5, 'Update Expense Category', 'expense_categories.update', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(270, 5, 'Delete Expense Category', 'expense_categories.delete', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(271, 17, 'View Expenses', 'expenses.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(272, 17, 'Create Expense', 'expenses.create', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(273, 17, 'Delete Expense', 'expenses.delete', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(274, 20, 'View Shifts', 'shifts.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(275, 20, 'Open Shift', 'shifts.open', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(276, 20, 'Close Own Shift', 'shifts.close', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(277, 20, 'Close Any Shift', 'shifts.close_any', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(278, 20, 'View Shift Reports', 'shifts.reports', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(279, 20, 'Enter Shift Stock Counts', 'shifts.stock_counts', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(280, 6, 'View Restaurant / Bar', 'restaurant_bar.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(281, 6, 'Create Restaurant Order', 'restaurant_bar.order', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(282, 6, 'Edit Restaurant Order', 'restaurant_bar.edit_order', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(283, 6, 'Print Bill', 'restaurant_bar.print_bill', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(284, 6, 'Close Table', 'restaurant_bar.close_table', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(285, 6, 'Merge Bills', 'restaurant_bar.merge_bills', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(286, 6, 'View Open Bills', 'restaurant_bar.open_bills', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(287, 6, 'View Uncleared Bills', 'restaurant_bar.uncleared_bills', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(288, 6, 'Manage Restaurant Setup', 'restaurant_bar.setup', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(289, 7, 'View Accommodation', 'accommodation.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(290, 7, 'Manage Hotels', 'accommodation.hotels', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(291, 7, 'Manage Floors', 'accommodation.floors', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(292, 7, 'Manage Room Types', 'accommodation.room_types', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(293, 7, 'Manage Rooms', 'accommodation.rooms', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(294, 7, 'Create Guest', 'accommodation.create_guest', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(295, 7, 'Check In Guest', 'accommodation.check_in', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(296, 7, 'Check Out Guest', 'accommodation.check_out', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(297, 7, 'Receive Accommodation Payment', 'accommodation.receive_payment', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(298, 7, 'Print Accommodation Receipt', 'accommodation.print_receipt', NULL, 10, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(299, 7, 'View Accommodation Reports', 'accommodation.reports', NULL, 11, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(300, 8, 'View Inventory', 'inventory.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(301, 8, 'View Stock Value Report', 'inventory.stock_value', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(302, 8, 'View Low Stock Report', 'inventory.low_stock', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(303, 8, 'View Opening And Closing Stock', 'inventory.opening_closing', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(304, 8, 'Start Stock Taking', 'inventory.stock_taking_start', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(305, 8, 'Update Stock Taking', 'inventory.stock_taking_update', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(306, 8, 'Adjust Stock Taking', 'inventory.stock_taking_adjust', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(307, 8, 'Close Stock Taking', 'inventory.stock_taking_close', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(311, 9, 'View VAT / Tax Report', 'accounting.vat_report', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(312, 9, 'View Tax Rates', 'tax_rates.view', NULL, 11, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(313, 9, 'Create Tax Rate', 'tax_rates.create', NULL, 12, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(314, 9, 'Update Tax Rate', 'tax_rates.update', NULL, 13, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(315, 9, 'Delete Tax Rate', 'tax_rates.delete', NULL, 14, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(316, 10, 'View Reports', 'reports.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(317, 10, 'View Sales Reports', 'reports.sales', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(318, 10, 'View Purchase Reports', 'reports.purchases', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(319, 10, 'View Inventory Reports', 'reports.inventory', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(320, 10, 'View Customer Reports', 'reports.customers', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(321, 10, 'View Supplier Reports', 'reports.suppliers', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(322, 10, 'View User Reports', 'reports.users', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(323, 10, 'Export Reports', 'reports.export', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(324, 10, 'Print Reports', 'reports.print', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(325, 11, 'View Bulk SMS', 'bulk_sms.view', NULL, 1, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(326, 11, 'Create SMS Campaign', 'bulk_sms.create_campaign', NULL, 2, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(327, 11, 'View SMS Campaigns', 'bulk_sms.view_campaigns', NULL, 3, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(328, 11, 'Manage SMS Templates', 'bulk_sms.templates', NULL, 4, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(329, 11, 'Send SMS', 'bulk_sms.send', NULL, 5, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(330, 13, 'Update System Configuration', 'settings.system_configuration', NULL, 6, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(331, 13, 'Update Invoice Setup', 'settings.invoice_setup', NULL, 7, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(332, 13, 'Update M-Pesa Settings', 'settings.mpesa', NULL, 8, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(333, 13, 'Update Bulk SMS Settings', 'settings.bulk_sms', NULL, 9, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(334, 13, 'Manage Unit Of Measures', 'settings.unit_of_measures', NULL, 10, 1, '2026-09-15 17:02:34', '2026-09-15 17:02:34'),
(335, 16, 'View Purchases', 'purchases.view', NULL, 1, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(336, 16, 'Create Purchase', 'purchases.create', NULL, 2, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(337, 16, 'View Purchase Details', 'purchases.details', NULL, 3, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(338, 16, 'Edit Purchase / Add Items', 'purchases.edit_add_items', NULL, 4, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(339, 16, 'Pay Purchase', 'purchases.pay', NULL, 5, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(340, 16, 'Return Purchase To Supplier', 'purchases.return', NULL, 6, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(341, 16, 'Print GRN', 'purchases.print_grn', NULL, 7, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(342, 16, 'Print Purchase Return Note', 'purchases.print_return_note', NULL, 8, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(343, 16, 'Delete Purchase', 'purchases.delete', NULL, 9, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(344, 26, 'View Deals', 'deals.view', NULL, 1, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(345, 26, 'Create Deal', 'deals.create', NULL, 2, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(346, 26, 'Update Deal', 'deals.update', NULL, 3, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(347, 26, 'Delete Deal', 'deals.delete', NULL, 4, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(348, 26, 'Add Deal Follow Up', 'deals.follow_up', NULL, 5, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(349, 26, 'View Own Deals', 'deals.view_own', NULL, 6, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(350, 26, 'View Other Deals', 'deals.view_others', NULL, 7, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(351, 26, 'Transfer Deals', 'deals.transfer', NULL, 8, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(352, 26, 'View Deals Reports', 'deals.reports', NULL, 9, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(353, 27, 'View Call Centre', 'call_centre.view', NULL, 1, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(354, 27, 'Add Call', 'call_centre.create', NULL, 2, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(355, 27, 'Update Call', 'call_centre.update', NULL, 3, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(356, 27, 'Delete Call', 'call_centre.delete', NULL, 4, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(357, 27, 'View Other Calls', 'call_centre.view_others', NULL, 5, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(358, 27, 'View Call Reports', 'call_centre.reports', NULL, 6, 1, '2026-09-15 17:12:01', '2026-09-15 17:12:01'),
(359, 25, 'View Stock Transfers', 'stock_transfers.view', NULL, 900, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(360, 25, 'Create Stock Transfer', 'stock_transfers.create', NULL, 901, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(361, 25, 'View Stock Transfer Details', 'stock_transfers.details', NULL, 902, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(362, 28, 'View Damaged Products', 'damaged_products.view', NULL, 903, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(363, 28, 'Record Damaged Products', 'damaged_products.create', NULL, 904, 1, '2026-09-15 17:37:53', '2026-09-15 17:37:53'),
(364, 9, 'View Audit Trail', 'accounting.audit_trail', NULL, 950, 1, '2026-09-15 18:05:45', '2026-09-15 18:05:45'),
(365, 9, 'View General Ledger', 'accounting.general_ledger', NULL, 951, 1, '2026-09-15 18:05:45', '2026-09-15 18:05:45'),
(366, 9, 'View Trial Balance', 'accounting.trial_balance', NULL, 952, 1, '2026-09-15 18:05:45', '2026-09-15 18:05:45'),
(367, 9, 'View Profit And Loss', 'accounting.profit_loss', NULL, 953, 1, '2026-09-15 18:05:45', '2026-09-15 18:05:45'),
(368, 9, 'View Balance Sheet', 'accounting.balance_sheet', NULL, 954, 1, '2026-09-16 11:59:25', '2026-09-16 11:59:25'),
(369, 13, 'Database Backups', 'settings.backups', NULL, 50, 1, '2026-09-16 12:59:32', '2026-09-16 12:59:32'),
(370, 13, 'Create Database Backup', 'settings.backups_create', NULL, 51, 1, '2026-09-16 12:59:32', '2026-09-16 12:59:32'),
(371, 13, 'Download Database Backup', 'settings.backups_download', NULL, 52, 1, '2026-09-16 12:59:32', '2026-09-16 12:59:32'),
(372, 13, 'Delete Database Backup', 'settings.backups_delete', NULL, 53, 1, '2026-09-16 12:59:32', '2026-09-16 12:59:32'),
(373, 13, 'Update Website Setup', 'settings.website', NULL, 54, 1, '2026-09-21 18:12:42', '2026-09-21 18:12:42'),
(374, 7, 'Manage Meal and Rate Plans', 'accommodation.rate_plans', NULL, 30, 1, '2026-09-21 18:48:16', '2026-09-21 18:48:16'),
(375, 8, 'View Internal Stock Issues', 'inventory.internal_issues_view', NULL, 9, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(376, 8, 'Create Internal Stock Issue', 'inventory.internal_issues_create', NULL, 10, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(377, 8, 'Confirm Internal Stock Receipt', 'inventory.internal_issues_receive', NULL, 11, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(378, 8, 'View Internal Stock Issue Reports', 'inventory.internal_issues_reports', NULL, 12, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(379, 7, 'View Housekeeping Stock', 'accommodation.housekeeping_stock', NULL, 31, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(380, 7, 'Receive Housekeeping Stock', 'accommodation.housekeeping_receive', NULL, 32, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(381, 7, 'Issue Housekeeping Stock To Rooms', 'accommodation.housekeeping_issue_room', NULL, 33, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(382, 7, 'Return Housekeeping Stock', 'accommodation.housekeeping_return', NULL, 34, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(383, 7, 'Record Housekeeping Stock Loss', 'accommodation.housekeeping_loss', NULL, 35, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(384, 7, 'View Housekeeping Stock Reports', 'accommodation.housekeeping_reports', NULL, 36, 1, '2026-09-21 19:57:12', '2026-09-21 19:57:12'),
(385, 7, 'View All Employees Housekeeping Stock', 'accommodation.housekeeping_view_all', NULL, 37, 1, '2026-09-21 20:06:10', '2026-09-21 20:06:10'),
(386, 9, 'View Treasury And Cash Flow', 'accounting.treasury_view', NULL, 50, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(387, 9, 'Record Bank Deposit', 'accounting.bank_deposit', NULL, 51, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(388, 9, 'Record Account Transfer', 'accounting.bank_transfer', NULL, 52, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(389, 9, 'Reverse Treasury Transaction', 'accounting.treasury_reverse', NULL, 53, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(390, 29, 'View Projects', 'projects.view', NULL, 50, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(391, 29, 'Create Project', 'projects.create', NULL, 51, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(392, 29, 'Update Project', 'projects.update', NULL, 52, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(393, 29, 'Manage Project Members', 'projects.members', NULL, 53, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(394, 29, 'Manage Milestones', 'projects.milestones', NULL, 54, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(395, 29, 'Manage Project Tasks', 'projects.tasks', NULL, 55, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(396, 29, 'Post Project Status Update', 'projects.status_updates', NULL, 56, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(397, 29, 'View Project Reports', 'projects.reports', NULL, 57, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(398, 14, 'View Employee Directory', 'human_resource.employees', NULL, 51, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(399, 14, 'Manage Leave Types', 'human_resource.leave_types', NULL, 52, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(400, 14, 'Create Leave Request', 'human_resource.leave_create', NULL, 53, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(401, 14, 'Approve Leave Request', 'human_resource.leave_approve', NULL, 54, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(402, 14, 'Manage Contracts', 'human_resource.contracts', NULL, 55, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(403, 14, 'Manage Performance Reviews', 'human_resource.reviews', NULL, 56, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(404, 14, 'Manage Disciplinary Cases', 'human_resource.discipline', NULL, 57, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(405, 14, 'View HR Reports', 'human_resource.reports', NULL, 58, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(406, 30, 'View Attendance', 'attendance.view', NULL, 50, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(407, 30, 'Manage Biometric Devices', 'attendance.devices', NULL, 51, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(408, 30, 'Map Device Employees', 'attendance.mappings', NULL, 52, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(409, 30, 'Import Or Sync Attendance', 'attendance.sync', NULL, 53, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(410, 30, 'Add Manual Attendance', 'attendance.manual', NULL, 54, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(411, 30, 'Update Attendance Comments', 'attendance.update', NULL, 55, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(412, 30, 'View Attendance Reports', 'attendance.reports', NULL, 56, 1, '2026-09-22 17:15:56', '2026-09-22 17:15:56'),
(413, 14, 'Manage Payroll', 'human_resource.payroll', NULL, 60, 1, '2026-09-22 17:20:32', '2026-09-22 17:20:32'),
(414, 14, 'View Attendance in HR', 'human_resource.attendance', NULL, 70, 1, '2026-09-22 18:44:35', '2026-09-22 18:44:35'),
(415, 14, 'View Leave Records', 'human_resource.leave_view', NULL, 71, 1, '2026-09-22 18:44:35', '2026-09-22 18:44:35'),
(416, 14, 'View Task Performance in HR', 'human_resource.task_performance', NULL, 72, 1, '2026-09-22 18:44:35', '2026-09-22 18:44:35'),
(417, 14, 'Add Employees in HR', 'human_resource.employee_create', NULL, 80, 1, '2026-09-22 19:18:54', '2026-09-22 19:18:54'),
(418, 14, 'Edit Employee and Payroll Details', 'human_resource.employee_update', NULL, 81, 1, '2026-09-22 19:18:54', '2026-09-22 19:18:54'),
(419, 14, 'Manage Payroll Setup', 'human_resource.payroll_setup', NULL, 82, 1, '2026-09-22 19:18:54', '2026-09-22 19:18:54'),
(420, 4, 'Import Products From Excel', 'products.import', NULL, 7, 1, '2026-09-22 21:57:12', '2026-09-22 21:57:12'),
(421, 22, 'Pay Supplier Opening Balance', 'suppliers.pay_opening_balance', 'Record payments against a supplier opening balance.', 50, 1, '2026-09-25 18:42:24', '2026-09-25 18:42:24'),
(422, 2, 'Claim Modem M-Pesa Payment', 'retail_pos.mpesa_claim', NULL, 90, 1, '2026-09-25 21:27:39', '2026-09-25 21:27:39'),
(423, 3, 'Claim Modem M-Pesa Payment', 'wholesale.mpesa_claim', NULL, 90, 1, '2026-09-25 21:27:39', '2026-09-25 21:27:39'),
(424, 15, 'View M-Pesa Transactions', 'sales.mpesa_transactions', NULL, 90, 1, '2026-09-25 21:27:39', '2026-09-25 21:27:39');

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

--
-- Table structure for table `personal_access_tokens`
--

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `token` varchar(64) NOT NULL,
  `abilities` text DEFAULT NULL,
  `last_used_at` timestamp NULL DEFAULT NULL,
  `expires_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 `price_tiers`
--

CREATE TABLE `price_tiers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `is_default` tinyint(1) 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 `products`
--

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `barcode` varchar(255) NOT NULL,
  `product_type` enum('single','combo') NOT NULL DEFAULT 'single',
  `inventory_type` enum('inventory','service') NOT NULL DEFAULT 'inventory',
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `sub_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `uom` varchar(255) DEFAULT NULL,
  `buying_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `retail_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `wholesale_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `website_price` decimal(15,2) DEFAULT NULL,
  `show_on_website` tinyint(1) NOT NULL DEFAULT 1,
  `website_description` text DEFAULT NULL,
  `stock_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `alert_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_of_measure_id` bigint(20) UNSIGNED DEFAULT NULL,
  `track_stock` tinyint(1) NOT NULL DEFAULT 1,
  `vat_method` enum('inclusive','exclusive') NOT NULL DEFAULT 'inclusive',
  `vat_type` enum('standard','zero_rated','exempt','non_vat') NOT NULL DEFAULT 'standard',
  `vat_rate` decimal(5,2) NOT NULL DEFAULT 16.00,
  `tax_rate_id` bigint(20) UNSIGNED DEFAULT NULL,
  `income_account_id` bigint(20) UNSIGNED DEFAULT NULL,
  `expense_account_id` bigint(20) UNSIGNED DEFAULT NULL,
  `asset_account_id` bigint(20) UNSIGNED DEFAULT NULL,
  `image_path` varchar(255) 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;

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

--
-- Table structure for table `product_prices`
--

CREATE TABLE `product_prices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `price_tier_id` bigint(20) UNSIGNED NOT NULL,
  `selling_price` decimal(15,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;

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

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

CREATE TABLE `projects` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `project_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `manager_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'planning',
  `priority` varchar(255) NOT NULL DEFAULT 'medium',
  `health` varchar(255) NOT NULL DEFAULT 'on_track',
  `start_date` date DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `budget` decimal(15,2) NOT NULL DEFAULT 0.00,
  `actual_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `progress` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `description` text DEFAULT NULL,
  `objectives` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED 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 `project_members`
--

CREATE TABLE `project_members` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `project_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `role` varchar(255) DEFAULT NULL,
  `allocation_percent` tinyint(3) UNSIGNED NOT NULL DEFAULT 100,
  `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 `project_milestones`
--

CREATE TABLE `project_milestones` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `project_id` bigint(20) UNSIGNED NOT NULL,
  `owner_id` bigint(20) UNSIGNED DEFAULT NULL,
  `title` varchar(255) NOT NULL,
  `due_date` date DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `completed_at` datetime 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 `project_tasks`
--

CREATE TABLE `project_tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `task_no` varchar(255) NOT NULL,
  `project_id` bigint(20) UNSIGNED NOT NULL,
  `milestone_id` bigint(20) UNSIGNED DEFAULT NULL,
  `assignee_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'backlog',
  `priority` varchar(255) NOT NULL DEFAULT 'medium',
  `start_date` date DEFAULT NULL,
  `due_date` date DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `estimated_hours` decimal(8,2) NOT NULL DEFAULT 0.00,
  `actual_hours` decimal(8,2) NOT NULL DEFAULT 0.00,
  `progress` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `blocker` 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 `project_updates`
--

CREATE TABLE `project_updates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `project_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `update_date` date NOT NULL,
  `health` varchar(255) NOT NULL DEFAULT 'on_track',
  `progress` tinyint(3) UNSIGNED NOT NULL DEFAULT 0,
  `summary` text NOT NULL,
  `accomplishments` text DEFAULT NULL,
  `blockers` text DEFAULT NULL,
  `next_steps` 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 `purchases`
--

CREATE TABLE `purchases` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `shift_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_name` varchar(255) DEFAULT NULL,
  `supplier_invoice_no` varchar(255) DEFAULT NULL,
  `purchase_status` varchar(255) NOT NULL DEFAULT 'received',
  `payment_status` varchar(255) NOT NULL DEFAULT 'unpaid',
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `paid_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `purchase_date` datetime NOT NULL,
  `note` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `delete_reason` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `purchase_items`
--

CREATE TABLE `purchase_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `quantity` decimal(15,2) NOT NULL DEFAULT 1.00,
  `returned_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `line_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `uom` 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 `purchase_payments`
--

CREATE TABLE `purchase_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_id` bigint(20) UNSIGNED NOT NULL,
  `payment_method_id` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `reference_no` varchar(255) DEFAULT NULL,
  `paid_by` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_date` datetime NOT NULL,
  `note` 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 `purchase_returns`
--

CREATE TABLE `purchase_returns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `return_no` varchar(255) NOT NULL,
  `purchase_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `shift_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_name` varchar(255) DEFAULT NULL,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `supplier_note` text DEFAULT NULL,
  `return_date` 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 `purchase_return_items`
--

CREATE TABLE `purchase_return_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_return_id` bigint(20) UNSIGNED NOT NULL,
  `purchase_item_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `line_total` decimal(15,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;

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

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

CREATE TABLE `quotations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `quote_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `converted_sale_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(255) DEFAULT NULL,
  `sale_mode` varchar(255) NOT NULL DEFAULT 'retail',
  `status` varchar(255) NOT NULL DEFAULT 'open',
  `subtotal` decimal(14,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `quote_date` 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 `quotation_items`
--

CREATE TABLE `quotation_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `quotation_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `quantity` decimal(14,2) NOT NULL,
  `unit_price` decimal(14,2) NOT NULL,
  `discount_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(14,2) NOT NULL DEFAULT 0.00,
  `line_total` decimal(14,2) NOT NULL,
  `uom` 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 `restaurant_orders`
--

CREATE TABLE `restaurant_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sale_id` bigint(20) UNSIGNED DEFAULT NULL,
  `restaurant_table_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(255) DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'open',
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `ordered_at` timestamp NULL DEFAULT NULL,
  `billed_at` timestamp NULL DEFAULT NULL,
  `paid_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 `restaurant_order_items`
--

CREATE TABLE `restaurant_order_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `restaurant_order_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `quantity` decimal(15,2) NOT NULL DEFAULT 1.00,
  `unit_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `line_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `note` 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 `restaurant_tables`
--

CREATE TABLE `restaurant_tables` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `area` varchar(255) DEFAULT NULL,
  `seats` int(10) UNSIGNED NOT NULL DEFAULT 4,
  `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 `restaurant_tables`
--

INSERT INTO `restaurant_tables` (`id`, `branch_id`, `name`, `area`, `seats`, `is_active`, `created_at`, `updated_at`) VALUES
(1, NULL, 'table 1', 'main', 4, 1, '2026-09-06 10:30:56', '2026-09-06 10:30:56'),
(2, NULL, 'Table 2', NULL, 4, 1, '2026-09-06 15:40:58', '2026-09-06 15:40:58'),
(3, NULL, 'Table 3', NULL, 4, 1, '2026-09-06 15:41:06', '2026-09-06 15:41:06'),
(4, NULL, 'Table 4', NULL, 4, 1, '2026-09-06 15:41:14', '2026-09-06 15:41:14');

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

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

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` 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 `roles`
--

INSERT INTO `roles` (`id`, `name`, `code`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(45, 'Super Admin', 'SUPER_ADMIN', NULL, 1, '2026-05-19 02:20:01', '2026-05-19 02:20:01'),
(46, 'cashier', 'CASHIER', NULL, 1, '2026-05-19 05:49:48', '2026-05-19 05:49:48');

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

--
-- Table structure for table `role_module_permissions`
--

CREATE TABLE `role_module_permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `module_id` bigint(20) UNSIGNED NOT NULL,
  `can_view` tinyint(1) NOT NULL DEFAULT 0,
  `can_create` tinyint(1) NOT NULL DEFAULT 0,
  `can_edit` tinyint(1) NOT NULL DEFAULT 0,
  `can_delete` tinyint(1) NOT NULL DEFAULT 0,
  `can_approve` tinyint(1) 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;

--
-- Dumping data for table `role_module_permissions`
--

INSERT INTO `role_module_permissions` (`id`, `role_id`, `module_id`, `can_view`, `can_create`, `can_edit`, `can_delete`, `can_approve`, `created_at`, `updated_at`) VALUES
(30, 45, 1, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(31, 45, 2, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(32, 45, 3, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(33, 45, 6, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(34, 45, 7, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(35, 45, 15, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(36, 45, 24, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(37, 45, 21, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(38, 45, 22, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(39, 45, 16, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(40, 45, 17, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(41, 45, 4, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(42, 45, 8, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(43, 45, 5, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(44, 45, 28, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(45, 45, 25, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(46, 45, 10, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(47, 45, 9, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(48, 45, 18, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(49, 45, 11, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(50, 45, 14, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(51, 45, 23, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(52, 45, 26, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(53, 45, 27, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(54, 45, 29, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(55, 45, 30, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(56, 45, 20, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(57, 45, 12, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(58, 45, 13, 1, 0, 0, 0, 0, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(59, 46, 2, 1, 0, 0, 0, 0, '2026-09-22 20:07:06', '2026-09-22 20:07:06');

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

--
-- Table structure for table `role_permissions`
--

CREATE TABLE `role_permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `is_allowed` 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 `role_permissions`
--

INSERT INTO `role_permissions` (`id`, `role_id`, `permission_id`, `is_allowed`, `created_at`, `updated_at`) VALUES
(308, 45, 218, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(309, 45, 200, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(310, 45, 219, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(311, 45, 221, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(312, 45, 224, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(313, 45, 225, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(314, 45, 226, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(315, 45, 228, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(316, 45, 229, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(317, 45, 230, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(318, 45, 231, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(319, 45, 232, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(320, 45, 233, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(321, 45, 234, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(322, 45, 235, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(323, 45, 236, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(324, 45, 237, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(325, 45, 280, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(326, 45, 281, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(327, 45, 282, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(328, 45, 283, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(329, 45, 284, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(330, 45, 285, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(331, 45, 286, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(332, 45, 287, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(333, 45, 288, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(334, 45, 289, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(335, 45, 290, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(336, 45, 291, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(337, 45, 292, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(338, 45, 293, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(339, 45, 294, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(340, 45, 295, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(341, 45, 296, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(342, 45, 297, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(343, 45, 298, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(344, 45, 299, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(345, 45, 374, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(346, 45, 379, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(347, 45, 380, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(348, 45, 381, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(349, 45, 382, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(350, 45, 383, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(351, 45, 384, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(352, 45, 385, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(353, 45, 238, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(354, 45, 239, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(355, 45, 240, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(356, 45, 241, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(357, 45, 242, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(358, 45, 243, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(359, 45, 244, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(360, 45, 245, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(361, 45, 246, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(362, 45, 247, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(363, 45, 248, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(364, 45, 257, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(365, 45, 258, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(366, 45, 259, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(367, 45, 260, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(368, 45, 261, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(369, 45, 249, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(370, 45, 250, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(371, 45, 251, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(372, 45, 252, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(373, 45, 253, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(374, 45, 254, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(375, 45, 255, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(376, 45, 256, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(377, 45, 262, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(378, 45, 263, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(379, 45, 264, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(380, 45, 265, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(381, 45, 335, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(382, 45, 336, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(383, 45, 337, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(384, 45, 338, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(385, 45, 339, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(386, 45, 340, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(387, 45, 341, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(388, 45, 342, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(389, 45, 343, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(390, 45, 271, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(391, 45, 272, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(392, 45, 273, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(393, 45, 162, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(394, 45, 163, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(395, 45, 164, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(396, 45, 165, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(397, 45, 166, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(398, 45, 266, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(399, 45, 300, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(400, 45, 301, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(401, 45, 302, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(402, 45, 303, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(403, 45, 304, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(404, 45, 305, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(405, 45, 306, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(406, 45, 307, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(407, 45, 375, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(408, 45, 376, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(409, 45, 377, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(410, 45, 378, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(411, 45, 167, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(412, 45, 168, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(413, 45, 169, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(414, 45, 170, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(415, 45, 267, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(416, 45, 268, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(417, 45, 269, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(418, 45, 270, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(419, 45, 362, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(420, 45, 363, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(421, 45, 359, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(422, 45, 360, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(423, 45, 361, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(424, 45, 316, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(425, 45, 317, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(426, 45, 318, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(427, 45, 319, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(428, 45, 320, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(429, 45, 321, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(430, 45, 322, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(431, 45, 323, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(432, 45, 324, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(433, 45, 191, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(434, 45, 192, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(435, 45, 193, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(436, 45, 194, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(437, 45, 195, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(438, 45, 196, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(439, 45, 197, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(440, 45, 198, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(441, 45, 199, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(442, 45, 311, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(443, 45, 312, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(444, 45, 313, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(445, 45, 314, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(446, 45, 315, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(447, 45, 364, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(448, 45, 365, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(449, 45, 366, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(450, 45, 367, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(451, 45, 368, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(452, 45, 386, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(453, 45, 387, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(454, 45, 388, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(455, 45, 389, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(456, 45, 182, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(457, 45, 183, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(458, 45, 184, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(459, 45, 185, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(460, 45, 325, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(461, 45, 326, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(462, 45, 327, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(463, 45, 328, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(464, 45, 329, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(465, 45, 181, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(466, 45, 398, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(467, 45, 399, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(468, 45, 400, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(469, 45, 401, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(470, 45, 402, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(471, 45, 403, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(472, 45, 404, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(473, 45, 405, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(474, 45, 413, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(475, 45, 414, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(476, 45, 415, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(477, 45, 416, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(478, 45, 417, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(479, 45, 418, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(480, 45, 419, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(481, 45, 201, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(482, 45, 202, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(483, 45, 203, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(484, 45, 204, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(485, 45, 205, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(486, 45, 206, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(487, 45, 207, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(488, 45, 208, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(489, 45, 209, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(490, 45, 210, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(491, 45, 211, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(492, 45, 212, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(493, 45, 213, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(494, 45, 214, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(495, 45, 215, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(496, 45, 216, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(497, 45, 217, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(498, 45, 344, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(499, 45, 345, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(500, 45, 346, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(501, 45, 347, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(502, 45, 348, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(503, 45, 349, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(504, 45, 350, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(505, 45, 351, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(506, 45, 352, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(507, 45, 353, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(508, 45, 354, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(509, 45, 355, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(510, 45, 356, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(511, 45, 357, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(512, 45, 358, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(513, 45, 390, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(514, 45, 391, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(515, 45, 392, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(516, 45, 393, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(517, 45, 394, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(518, 45, 395, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(519, 45, 396, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(520, 45, 397, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(521, 45, 406, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(522, 45, 407, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(523, 45, 408, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(524, 45, 409, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(525, 45, 410, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(526, 45, 411, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(527, 45, 412, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(528, 45, 274, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(529, 45, 275, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(530, 45, 276, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(531, 45, 277, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(532, 45, 278, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(533, 45, 279, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(534, 45, 171, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(535, 45, 172, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(536, 45, 173, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(537, 45, 174, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(538, 45, 175, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(539, 45, 176, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(540, 45, 177, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(541, 45, 178, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(542, 45, 179, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(543, 45, 180, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(544, 45, 186, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(545, 45, 187, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(546, 45, 188, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(547, 45, 189, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(548, 45, 190, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(549, 45, 330, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(550, 45, 331, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(551, 45, 332, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(552, 45, 333, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(553, 45, 334, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(554, 45, 369, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(555, 45, 370, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(556, 45, 371, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(557, 45, 372, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(558, 45, 373, 1, '2026-09-22 20:05:39', '2026-09-22 20:05:39'),
(559, 46, 200, 1, '2026-09-22 20:07:06', '2026-09-22 20:07:06'),
(560, 46, 219, 1, '2026-09-22 20:07:06', '2026-09-22 20:07:06'),
(561, 46, 221, 1, '2026-09-22 20:07:06', '2026-09-22 20:07:06'),
(562, 46, 224, 1, '2026-09-22 20:07:06', '2026-09-22 20:07:06'),
(563, 46, 225, 1, '2026-09-22 20:07:06', '2026-09-22 20:07:06'),
(564, 46, 226, 1, '2026-09-22 20:07:06', '2026-09-22 20:07:06'),
(565, 45, 420, 1, '2026-09-22 21:57:12', '2026-09-22 21:57:12'),
(566, 45, 421, 1, '2026-09-25 18:42:52', '2026-09-25 18:42:52'),
(567, 46, 421, 0, '2026-09-25 18:42:52', '2026-09-25 18:42:52'),
(568, 45, 422, 1, '2026-09-25 21:27:39', '2026-09-25 21:27:39'),
(569, 45, 423, 1, '2026-09-25 21:27:39', '2026-09-25 21:27:39'),
(570, 45, 424, 1, '2026-09-25 21:27:39', '2026-09-25 21:27:39');

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

--
-- Table structure for table `sales`
--

CREATE TABLE `sales` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `invoice_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `shift_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `sale_mode` varchar(255) NOT NULL DEFAULT 'retail',
  `sale_status` varchar(255) NOT NULL DEFAULT 'completed',
  `payment_status` varchar(255) NOT NULL DEFAULT 'paid',
  `merged_into_sale_id` bigint(20) UNSIGNED DEFAULT NULL,
  `merged_bill_count` int(10) UNSIGNED NOT NULL DEFAULT 1,
  `lpo_no` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `paid_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tendered_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `change_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `sale_date` datetime NOT NULL,
  `note` text DEFAULT NULL,
  `voided_at` datetime DEFAULT NULL,
  `voided_by` bigint(20) UNSIGNED DEFAULT NULL,
  `void_reason` text DEFAULT NULL,
  `room_id` bigint(20) UNSIGNED DEFAULT NULL,
  `guest_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `deleted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `delete_reason` text DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sale_items`
--

CREATE TABLE `sale_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sale_id` bigint(20) UNSIGNED NOT NULL,
  `shift_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `quantity` decimal(15,2) NOT NULL DEFAULT 1.00,
  `unit_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `line_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `uom` 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 `shifts`
--

CREATE TABLE `shifts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `shift_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `opened_at` datetime NOT NULL,
  `closed_at` datetime DEFAULT NULL,
  `opening_cash` decimal(15,2) NOT NULL DEFAULT 0.00,
  `closing_cash` decimal(15,2) DEFAULT NULL,
  `expected_cash` decimal(15,2) NOT NULL DEFAULT 0.00,
  `cash_difference` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` varchar(255) NOT NULL DEFAULT 'open',
  `opening_note` text DEFAULT NULL,
  `closing_note` 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 `shift_stock_counts`
--

CREATE TABLE `shift_stock_counts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `shift_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `opening_stock` decimal(15,2) NOT NULL DEFAULT 0.00,
  `sold_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `sale_return_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `purchased_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `purchase_return_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `expected_closing_stock` decimal(15,2) NOT NULL DEFAULT 0.00,
  `counted_closing_stock` decimal(15,2) DEFAULT NULL,
  `variance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `unit_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `selling_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `counted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `counted_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 `sms_campaigns`
--

CREATE TABLE `sms_campaigns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `campaign_no` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `sms_template_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `recipient_source` varchar(255) NOT NULL DEFAULT 'manual',
  `message` text NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `recipient_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `sent_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `delivered_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `failed_count` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `sms_units` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `estimated_cost` decimal(14,2) NOT NULL DEFAULT 0.00,
  `scheduled_at` timestamp NULL DEFAULT NULL,
  `sent_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 `sms_in`
--

CREATE TABLE `sms_in` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sms_text` text NOT NULL,
  `sender_number` varchar(100) DEFAULT NULL,
  `sent_dt` datetime DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `processing_status` varchar(30) NOT NULL DEFAULT 'pending',
  `processed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Table structure for table `sms_recipients`
--

CREATE TABLE `sms_recipients` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sms_campaign_id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `phone` varchar(255) NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'pending',
  `provider_message_id` varchar(255) DEFAULT NULL,
  `failure_reason` text DEFAULT NULL,
  `sent_at` timestamp NULL DEFAULT NULL,
  `delivered_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 `sms_templates`
--

CREATE TABLE `sms_templates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `message` text NOT 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;

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

--
-- Table structure for table `stock_takings`
--

CREATE TABLE `stock_takings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_take_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'open',
  `started_at` timestamp NULL DEFAULT NULL,
  `closed_at` timestamp NULL DEFAULT NULL,
  `note` 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 `stock_taking_items`
--

CREATE TABLE `stock_taking_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_taking_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `available_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `buying_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `selling_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `actual_quantity` decimal(15,2) DEFAULT NULL,
  `difference_quantity` decimal(15,2) NOT NULL DEFAULT 0.00,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `counted_at` timestamp NULL DEFAULT NULL,
  `adjusted_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 `stock_transfers`
--

CREATE TABLE `stock_transfers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `transfer_no` varchar(255) NOT NULL,
  `from_branch_id` bigint(20) UNSIGNED NOT NULL,
  `to_branch_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `transfer_date` datetime NOT NULL,
  `status` enum('completed','cancelled') NOT NULL DEFAULT 'completed',
  `note` 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 `stock_transfer_items`
--

CREATE TABLE `stock_transfer_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_transfer_id` bigint(20) UNSIGNED NOT NULL,
  `source_product_id` bigint(20) UNSIGNED NOT NULL,
  `destination_product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `product_name` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `quantity` decimal(15,2) NOT NULL,
  `source_stock_before` decimal(15,2) NOT NULL DEFAULT 0.00,
  `source_stock_after` decimal(15,2) NOT NULL DEFAULT 0.00,
  `destination_stock_before` decimal(15,2) NOT NULL DEFAULT 0.00,
  `destination_stock_after` decimal(15,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;

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

--
-- Table structure for table `sub_categories`
--

CREATE TABLE `sub_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `category_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;

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

--
-- Table structure for table `suppliers`
--

CREATE TABLE `suppliers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` varchar(255) DEFAULT NULL,
  `opening_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `opening_balance_date` date 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 `suppliers`
--

INSERT INTO `suppliers` (`id`, `branch_id`, `name`, `phone`, `email`, `address`, `opening_balance`, `opening_balance_date`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 2, 'Default', NULL, NULL, NULL, 0.00, NULL, 1, '2026-09-09 22:03:40', '2026-09-14 18:20:44');

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

--
-- Table structure for table `supplier_opening_balance_payments`
--

CREATE TABLE `supplier_opening_balance_payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_method_id` bigint(20) UNSIGNED NOT NULL,
  `paid_by` bigint(20) UNSIGNED DEFAULT NULL,
  `amount` decimal(15,2) NOT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `payment_date` datetime NOT NULL,
  `note` 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 `system_modules`
--

CREATE TABLE `system_modules` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) NOT NULL,
  `icon` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `is_core` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `sort_order` int(11) 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;

--
-- Dumping data for table `system_modules`
--

INSERT INTO `system_modules` (`id`, `name`, `code`, `icon`, `description`, `is_core`, `is_active`, `sort_order`, `created_at`, `updated_at`) VALUES
(1, 'Dashboard', 'dashboard', 'fas fa-home', NULL, 1, 1, 1, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(2, 'Retail POS', 'retail_pos', 'fas fa-cash-register', NULL, 0, 1, 2, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(3, 'Wholesale', 'wholesale', 'fas fa-boxes', NULL, 0, 1, 3, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(4, 'Products', 'products', 'fas fa-box', NULL, 0, 1, 12, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(5, 'Categories', 'categories', 'fas fa-tags', NULL, 0, 1, 14, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(6, 'Restaurant / Bar', 'restaurant_bar', 'fas fa-utensils', NULL, 0, 1, 4, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(7, 'Accommodation', 'accommodation', 'fas fa-bed', NULL, 0, 1, 5, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(8, 'Inventory', 'inventory', 'fas fa-warehouse', NULL, 0, 1, 13, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(9, 'Accounting', 'accounting', 'fas fa-calculator', NULL, 0, 1, 18, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(10, 'Reports', 'reports', 'fas fa-chart-bar', NULL, 0, 1, 17, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(11, 'Bulk SMS', 'bulk_sms', 'fas fa-sms', NULL, 0, 1, 20, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(12, 'Users', 'users', 'fas fa-users', NULL, 0, 1, 28, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(13, 'Settings', 'settings', 'fas fa-cogs', NULL, 1, 1, 29, '2026-04-15 11:36:10', '2026-09-22 19:55:50'),
(14, 'Human Resource', 'human_resource', 'fas fa-user-tie', NULL, 0, 1, 21, '2026-05-13 04:01:43', '2026-09-22 19:55:50'),
(15, 'Sales', 'sales', 'fas fa-receipt', NULL, 0, 1, 6, '2026-09-05 17:23:34', '2026-09-22 19:55:50'),
(16, 'Purchases', 'purchases', 'fas fa-shopping-cart', 'Record and view stock purchases', 0, 1, 10, '2026-09-08 13:55:26', '2026-09-22 19:55:50'),
(17, 'Expenses', 'expenses', 'fas fa-money-bill-wave', NULL, 0, 1, 11, '2026-09-09 13:33:29', '2026-09-22 19:55:50'),
(18, 'Departments', 'departments', 'fas fa-sitemap', NULL, 0, 1, 19, '2026-09-09 13:55:03', '2026-09-22 19:55:50'),
(20, 'Shift Management', 'shift-management', 'fas fa-clock', NULL, 0, 1, 27, '2026-09-09 15:15:40', '2026-09-22 19:55:50'),
(21, 'Customers', 'customers', 'fas fa-user-friends', NULL, 0, 1, 8, '2026-09-09 21:27:16', '2026-09-22 19:55:50'),
(22, 'Suppliers', 'suppliers', 'fas fa-truck', NULL, 0, 1, 9, '2026-09-09 21:27:17', '2026-09-22 19:55:50'),
(23, 'Task Management', 'task-management', 'fas fa-tasks', 'Assign, track, review, and report staff tasks.', 0, 1, 22, '2026-09-11 17:31:30', '2026-09-22 19:55:50'),
(24, 'Quotations', 'quotations', 'fas fa-file-invoice', 'Create, print, and convert quotations to invoices.', 0, 1, 7, '2026-09-11 20:04:38', '2026-09-22 19:55:50'),
(25, 'Stock Transfers', 'stock-transfers', 'fas fa-exchange-alt', 'Transfer stock from one branch to another.', 0, 1, 16, '2026-09-14 16:07:44', '2026-09-22 19:55:50'),
(26, 'Deals Management', 'deals-management', 'fas fa-handshake', 'Track leads, deals, follow-ups, quotations and customer conversion activity.', 0, 1, 23, '2026-09-14 19:41:58', '2026-09-22 19:55:50'),
(27, 'Call Centre', 'call-centre', 'fas fa-phone-alt', 'Record calls, caller details, support issues, inquiries, complaints and follow-ups.', 0, 1, 24, '2026-09-15 10:21:21', '2026-09-22 19:55:50'),
(28, 'Damaged Products', 'damaged-products', 'fas fa-exclamation-triangle', 'Record damaged stock and reduce inventory quantities.', 0, 1, 15, '2026-09-15 11:11:24', '2026-09-22 19:55:50'),
(29, 'Project Management', 'project-management', 'fas fa-project-diagram', 'Plan projects, milestones, delivery tasks, budgets, and status updates.', 0, 1, 25, '2026-09-22 17:15:56', '2026-09-22 19:55:50'),
(30, 'Biometric Attendance', 'biometric-attendance', 'fas fa-fingerprint', 'Connect attendance devices and reconcile employee clocking.', 0, 1, 26, '2026-09-22 17:15:56', '2026-09-22 19:55:50');

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

--
-- Table structure for table `system_settings`
--

CREATE TABLE `system_settings` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `group` varchar(255) DEFAULT NULL,
  `key` varchar(255) NOT NULL,
  `value` 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 `system_settings`
--

INSERT INTO `system_settings` (`id`, `group`, `key`, `value`, `created_at`, `updated_at`) VALUES
(1, 'system', 'login_mode', 'username_password', '2026-05-19 14:42:32', '2026-09-25 20:49:28'),
(2, 'system', 'pos_mode', 'restaurant', '2026-05-19 14:42:32', '2026-07-08 02:40:25'),
(3, 'tax', 'vat_enabled', 'yes', '2026-05-19 14:42:32', '2026-05-19 14:42:32'),
(4, 'tax', 'vat_rate', '16', '2026-05-19 14:42:32', '2026-05-19 14:42:32'),
(5, 'shift', 'shift_start_time', '00:00', '2026-05-19 14:42:32', '2026-05-19 14:42:32'),
(6, 'shift', 'shift_end_time', '23:59', '2026-05-19 14:42:32', '2026-05-19 14:42:32'),
(7, 'etims', 'etims_enabled', 'no', '2026-05-19 14:42:32', '2026-05-19 14:42:32'),
(8, 'etims', 'hs_code_enabled', 'no', '2026-05-19 14:42:32', '2026-05-19 14:42:32'),
(9, 'invoice', 'auto_logout_after_order', 'yes', '2026-05-19 14:42:32', '2026-09-14 19:05:56'),
(10, 'invoice', 'print_mode', 'receipt_only', '2026-05-19 14:42:32', '2026-09-14 19:05:56'),
(11, 'system', 'default_landing_page', 'retail_pos', '2026-05-25 08:56:54', '2026-09-06 15:22:18'),
(12, 'shift', 'shift_start_day', 'today', '2026-05-25 08:56:54', '2026-05-25 08:56:54'),
(13, 'shift', 'shift_end_day', 'today', '2026-05-25 08:56:54', '2026-09-09 15:52:55'),
(14, 'shift', 'allow_shift_management', 'no', '2026-05-25 08:56:54', '2026-09-22 20:09:14'),
(15, 'invoice', 'receipt_size', '80', '2026-09-05 16:40:49', '2026-09-14 19:05:56'),
(16, 'sales', 'sales_default_entries', '10', '2026-09-05 21:23:20', '2026-09-05 21:23:20'),
(17, 'localization', 'app_timezone', 'Africa/Nairobi', '2026-09-05 21:23:20', '2026-09-05 21:23:20'),
(18, 'localization', 'currency_code', 'KES', '2026-09-05 21:23:20', '2026-09-05 21:35:52'),
(19, 'localization', 'currency_exchange_rate', '1', '2026-09-05 21:23:20', '2026-09-05 21:39:12'),
(20, 'restaurant', 'restaurant_print_mode', 'order_only', '2026-09-06 09:57:28', '2026-09-06 15:20:18'),
(21, 'restaurant', 'restaurant_receipt_printer', '', '2026-09-06 09:57:28', '2026-09-06 09:57:28'),
(22, 'restaurant', 'restaurant_bill_printer', '', '2026-09-06 09:57:28', '2026-09-06 09:57:28'),
(23, 'restaurant', 'restaurant_kitchen_printer', '', '2026-09-06 09:57:28', '2026-09-06 09:57:28'),
(24, 'restaurant', 'restaurant_allow_item_note', '0', '2026-09-06 15:19:48', '2026-09-07 07:20:58'),
(25, 'restaurant', 'restaurant_enable_tables', '0', '2026-09-07 07:18:11', '2026-09-07 07:18:11'),
(26, 'restaurant', 'restaurant_show_customer_name', '0', '2026-09-07 08:07:07', '2026-09-07 08:08:01'),
(27, 'restaurant', 'restaurant_show_keyboard', '0', '2026-09-07 08:07:07', '2026-09-07 08:07:07'),
(28, 'restaurant', 'restaurant_show_numbers', '0', '2026-09-07 08:07:07', '2026-09-07 08:07:07'),
(29, 'accommodation', 'accommodation_hotel_name', 'JL MOTEL', '2026-09-09 22:18:11', '2026-09-09 22:18:11'),
(30, 'accommodation', 'accommodation_hotel_phone', '0712345678', '2026-09-09 22:18:11', '2026-09-09 22:18:11'),
(31, 'accommodation', 'accommodation_hotel_email', 'jl@gmail.com', '2026-09-09 22:18:11', '2026-09-09 22:18:11'),
(32, 'accommodation', 'accommodation_hotel_address', 'Kakamega', '2026-09-09 22:18:11', '2026-09-09 22:18:11'),
(33, 'accommodation', 'accommodation_expected_rooms', '10', '2026-09-09 22:18:11', '2026-09-09 22:18:11'),
(34, 'mpesa', 'mpesa_environment', 'sandbox', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(35, 'mpesa', 'mpesa_shortcode', '7890', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(36, 'mpesa', 'mpesa_shortcode_type', 'paybill', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(37, 'mpesa', 'mpesa_account_reference', '', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(38, 'mpesa', 'mpesa_stk_callback_url', 'http://localhost/jevapos.com/public/mpesa/callbacks/stk', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(39, 'mpesa', 'mpesa_c2b_validation_url', 'http://localhost/jevapos.com/public/mpesa/callbacks/c2b/validation', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(40, 'mpesa', 'mpesa_c2b_confirmation_url', 'http://localhost/jevapos.com/public/mpesa/callbacks/c2b/confirmation', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(41, 'mpesa', 'mpesa_b2c_result_url', 'http://localhost/jevapos.com/public/mpesa/callbacks/b2c/result', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(42, 'mpesa', 'mpesa_b2c_timeout_url', 'http://localhost/jevapos.com/public/mpesa/callbacks/b2c/timeout', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(43, 'mpesa', 'mpesa_stk_enabled', 'no', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(44, 'mpesa', 'mpesa_c2b_enabled', 'no', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(45, 'mpesa', 'mpesa_b2c_enabled', 'no', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(46, 'mpesa', 'mpesa_consumer_key', 'eyJpdiI6Ii8zZUxKQm5DUGFkU0dCbzBzWG1VNEE9PSIsInZhbHVlIjoidGczZzY2a0p3c0lwbndQOGpUKzgvQT09IiwibWFjIjoiNzIwMzMzMTE4OWFjYTk4NTY3NmVhNzdlMzdkNDhmYjVlZjU3N2M4Mjc1OGI2ZTcxZGU0MzgwMzFiYzhiNjY3OCIsInRhZyI6IiJ9', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(47, 'mpesa', 'mpesa_consumer_secret', 'eyJpdiI6Ii9scXptNVJOcG80M3pTalBLeE4zNnc9PSIsInZhbHVlIjoicjdsL3RBcDdBVTVDME1jU01aUHU1Zz09IiwibWFjIjoiMjYzNDRkYmJlZTNlYzVkYjc1OWFiNDU3ZDJjZDc4ZGE4NzM5NDEwNjQ2ZWVlZTYyNWMwNmE1YWVhNGRiNGE5NCIsInRhZyI6IiJ9', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(48, 'mpesa', 'mpesa_passkey', 'eyJpdiI6InpUdGVGU2pJS1FteXBjdVZaRHdYQkE9PSIsInZhbHVlIjoiTUFYSlovWlk5blo4clAzZmMzZU42QT09IiwibWFjIjoiZGMzMGYxOTJiNmJiZWJkMDk5YmY4NzdlODA3Y2MzYjNiZWM1OTcxZGY5OGFiYTJhMmEzM2NjMzg4ZTBhZTY5YyIsInRhZyI6IiJ9', '2026-09-14 10:45:37', '2026-09-14 10:45:37'),
(49, 'invoice', 'invoice_title', 'Receipt / Invoice', '2026-09-14 19:05:56', '2026-09-14 19:05:56'),
(50, 'invoice', 'receipt_footer', 'Thank you.', '2026-09-14 19:05:56', '2026-09-14 19:05:56'),
(51, 'invoice', 'show_branch_details_on_invoice', 'yes', '2026-09-14 19:05:56', '2026-09-14 19:05:56'),
(52, 'invoice', 'show_customer_details_on_invoice', 'yes', '2026-09-14 19:05:56', '2026-09-14 19:05:56'),
(53, 'invoice', 'show_tax_summary_on_invoice', 'yes', '2026-09-14 19:05:56', '2026-09-14 19:05:56'),
(54, 'invoice', 'show_cashier_name_on_invoice', 'yes', '2026-09-14 19:05:56', '2026-09-14 19:05:56'),
(55, 'invoice', 'cash_receipt_template', 'thermal', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(56, 'invoice', 'unpaid_invoice_template', 'a4', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(57, 'invoice', 'kitchen_order_template', 'thermal_no_prices', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(58, 'invoice', 'delivery_note_template', 'a4_no_prices', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(59, 'invoice', 'quotation_template', 'a4', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(60, 'invoice', 'grn_template', 'a4', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(61, 'invoice', 'credit_note_template', 'a4', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(62, 'invoice', 'debit_note_template', 'a4', '2026-09-14 19:30:09', '2026-09-14 19:30:09'),
(63, 'stock', 'allow_overselling', 'no', '2026-09-15 11:11:24', '2026-09-15 11:11:24'),
(64, 'bulk_sms', 'sms_provider', 'africastalking', '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(65, 'bulk_sms', 'sms_environment', 'sandbox', '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(66, 'bulk_sms', 'sms_provider_username', NULL, '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(67, 'bulk_sms', 'sms_provider_api_key', NULL, '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(68, 'bulk_sms', 'sms_sender_id', NULL, '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(69, 'bulk_sms', 'sms_default_country_code', '+254', '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(70, 'bulk_sms', 'sms_estimated_cost_per_unit', '0', '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(71, 'bulk_sms', 'sms_balance', NULL, '2026-09-15 11:16:07', '2026-09-15 11:16:07'),
(72, 'license', 'license_generated_serial', 'JEV-EFDA-MYR2', '2026-09-15 13:11:14', '2026-09-15 13:11:14'),
(73, 'license', 'license_status', 'active', '2026-09-15 13:25:39', '2026-09-15 13:25:39'),
(74, 'license', 'license_key', 'JVL-eyJ2IjoyLCJhY3RpdmF0aW9uX25vIjoiQUNUMDAwNSIsImNsaWVudF9uYW1lIjoiSkVWQVRFQ0giLCJjb21wdXRlcl9zZXJpYWwiOiJTUlYtNjk1NDNCMkJGOUI4OUJGMkI1NjgiLCJpbnN0YWxsYXRpb25faWQiOiJKRVYtRUZEQS1NWVIyIiwiYmluZGluZ190eXBlIjoic2VydmVyIiwiYmluZGluZ192YWx1ZSI6InNydi02OTU0M2IyYmY5Yjg5YmYyYjU2OCIsImV4cGlyZXNfYXQiOm51bGwsImlzc3VlZF9hdCI6IjIwMjYtMDktMjYgMDE6MjY6MTUifQ.WORPv6HV0MUI_jPzjA4gWWqi1cAhotOhraen9E1uwsN1mK3v-1lPtJ_JcajIIQzYEbQJAw_nNy9XioiHbMQ86Roi5v7qbfuzVDtsuLZoMfDOk0M-1PZFJ9SS0Uy0zhcQaPKZFlyYLSeUo2pgKSz4Wgt-2ttDMig_bd2YaALxdEVujq5XXVMPVDVEBxc_knisCuKqw8trTpxIl0baqv18QzpJYc_MFUC7wTFQ7oUZ95zv9MSfl9XhLRvJfveRRDqedpqfuBnHskA3Udh5SQaOYO-14ey1gntS59j6sWLSiQE6lpIG2XR31Qt6SI00Q7KNcr-DPHMgq7JfvSBKZsmCrS1o5KOi76m1le7yXWJgvt6E8JkMEjvfsl1lFjvfjzqb1xtMqiCe8fqUcXzCeFYrBULNEulk7ZUR2_eeXhYRmCDuwAWv32SMu4F1vjYAigsHVz5VEYtrWIdquO8ChcUQLH2HYCdVtWnD3QSkWCVRw_vVM7CahVgRRUfE_g9i5cEk', '2026-09-15 13:25:39', '2026-09-25 22:26:15'),
(75, 'license', 'license_activation_no', 'ACT0005', '2026-09-15 13:25:39', '2026-09-25 22:26:15'),
(76, 'license', 'license_client_name', 'JEVATECH', '2026-09-15 13:25:39', '2026-09-16 11:15:38'),
(77, 'license', 'license_expires_at', NULL, '2026-09-15 13:25:39', '2026-09-16 11:21:31'),
(78, 'license', 'license_contact_person', 'VALENTINE', '2026-09-16 11:15:38', '2026-09-16 11:15:38'),
(79, 'license', 'license_technician_name', 'VALENTINE', '2026-09-16 11:15:38', '2026-09-16 11:15:38'),
(80, 'license', 'license_phone', '0741479897', '2026-09-16 11:15:38', '2026-09-16 11:15:38'),
(81, 'license', 'license_computer_serial', 'SRV-69543B2BF9B89BF2B568', '2026-09-16 11:15:38', '2026-09-25 22:26:15'),
(82, 'backup', 'backup_directory', 'C:\\JEVAPOS_BACKUPS', '2026-09-16 13:05:06', '2026-09-16 13:05:06'),
(83, 'backup', 'mysqldump_path', 'E:\\xampp\\mysql\\bin\\mysqldump.exe', '2026-09-16 13:05:06', '2026-09-16 13:05:06'),
(84, 'backup', 'backup_retention_days', '30', '2026-09-16 13:05:06', '2026-09-16 13:05:06'),
(85, 'website', 'website_integration_key', 'eyJpdiI6InVDZWdHQkR1L2JlNGNyOWU3MkRlRHc9PSIsInZhbHVlIjoidW9WbE9MTWJmM3B5Mmc1V2plcnp4aUlENXJ6b3ZaUUNObkxwS1VOZXowc3FqL0pqUnRWNmxOQnp4WnB6WUhuTEJhVjNjVVdqRGZnbWZHRW9JcGhDeXBEU3pTN2RyRHRHenRoWXllS0hBbHc9IiwibWFjIjoiZjlhNGUxNzQ4NTExMmQzMDEwMzM1YjZmZWExY2ZlOWVmZDUwYjkyMTk0MTk1Mjk0NmI0ZjIxZGY3MmVkOTc0MyIsInRhZyI6IiJ9', '2026-09-21 18:12:27', '2026-09-21 18:12:27'),
(86, 'system', 'default_entries', '10', '2026-09-25 19:38:13', '2026-09-25 19:38:13'),
(87, 'invoice', 'business_tax_pin', '', '2026-09-25 19:39:34', '2026-09-25 19:39:34'),
(88, 'invoice', 'show_customer_pin_on_invoice', 'yes', '2026-09-25 19:39:34', '2026-09-25 19:39:34'),
(89, 'invoice', 'show_discount_on_invoice', 'yes', '2026-09-25 19:39:34', '2026-09-25 19:39:34'),
(90, 'sales', 'pos_duplicate_product_behavior', 'increase_quantity', '2026-09-25 20:49:28', '2026-09-25 20:49:28'),
(91, 'license', 'license_installation_id', 'JEV-EFDA-MYR2', '2026-09-25 22:26:15', '2026-09-25 22:26:15'),
(92, 'license', 'license_binding_type', 'server', '2026-09-25 22:26:15', '2026-09-25 22:26:15'),
(93, 'license', 'license_binding_value', 'srv-69543b2bf9b89bf2b568', '2026-09-25 22:26:15', '2026-09-25 22:26:15');

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

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

CREATE TABLE `tasks` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `task_no` varchar(255) NOT NULL,
  `task_category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `assigned_to_id` bigint(20) UNSIGNED DEFAULT NULL,
  `assigned_by_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supervisor_id` bigint(20) UNSIGNED DEFAULT NULL,
  `task_type` varchar(255) NOT NULL DEFAULT 'specific',
  `subject` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `priority` varchar(255) NOT NULL DEFAULT 'normal',
  `status` varchar(255) NOT NULL DEFAULT 'new',
  `measurement_mode` varchar(255) NOT NULL DEFAULT 'number',
  `target_value` decimal(12,2) DEFAULT NULL,
  `achieved_value` decimal(12,2) NOT NULL DEFAULT 0.00,
  `start_date` datetime DEFAULT NULL,
  `due_date` datetime DEFAULT NULL,
  `sms_action` varchar(255) NOT NULL DEFAULT 'none',
  `completed_at` datetime DEFAULT NULL,
  `verified_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 `task_categories`
--

CREATE TABLE `task_categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `default_measurement_mode` varchar(255) NOT NULL DEFAULT 'number',
  `default_target_value` decimal(12,2) 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 `task_categories`
--

INSERT INTO `task_categories` (`id`, `name`, `description`, `default_measurement_mode`, `default_target_value`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Cold Calls', 'Daily outbound prospecting calls.', 'number', 10.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(2, 'Social Media Posts', 'Facebook, Instagram, TikTok, X and other posts.', 'number', 1.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(3, 'Physical Marketing', 'Field visits and direct marketing.', 'number', 1.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(4, 'Follow Ups', 'Client and prospect follow-up contacts.', 'number', 5.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(5, 'Existing Clients', 'Existing client check-ins and relationship tasks.', 'number', 1.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(6, 'Emails Sent', 'Sales, support or operational emails sent.', 'number', 1.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(7, 'Emails Received', 'Important emails received and handled.', 'number', 1.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(8, 'Support Done', 'Support work completed for clients.', 'number', 1.00, 1, '2026-09-11 17:31:30', '2026-09-11 17:31:30'),
(9, 'Contact Search', 'New business contact research.', 'number', 1.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31'),
(10, 'Images Created', 'Marketing or client image design work.', 'number', 1.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31'),
(12, 'Quotations Sent', 'Quotations prepared and sent.', 'number', 1.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31'),
(13, 'Invoices Sent', 'Invoices prepared and sent.', 'number', 1.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31'),
(14, 'Demos Done', 'Product or service demos completed.', 'number', 1.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31'),
(15, 'Installations', 'Client installations or setup work.', 'number', 1.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31'),
(16, 'Blogs', 'Blog posts written or published.', 'number', 2.00, 1, '2026-09-11 17:31:31', '2026-09-11 17:31:31');

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

--
-- Table structure for table `task_progress_updates`
--

CREATE TABLE `task_progress_updates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `task_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `achieved_value` decimal(12,2) DEFAULT NULL,
  `progress_note` 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 `tax_rates`
--

CREATE TABLE `tax_rates` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `code` varchar(255) DEFAULT NULL,
  `tax_type` enum('standard','zero_rated','exempt','non_taxable','withholding','levy','excise') NOT NULL DEFAULT 'standard',
  `calculation_type` enum('percentage','fixed') NOT NULL DEFAULT 'percentage',
  `rate` decimal(8,2) NOT NULL DEFAULT 0.00,
  `price_method` enum('inclusive','exclusive') NOT NULL DEFAULT 'inclusive',
  `applies_to` enum('sales','purchases','both') NOT NULL DEFAULT 'both',
  `sales_account` varchar(255) DEFAULT NULL,
  `purchase_account` varchar(255) DEFAULT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `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 `tax_rates`
--

INSERT INTO `tax_rates` (`id`, `name`, `code`, `tax_type`, `calculation_type`, `rate`, `price_method`, `applies_to`, `sales_account`, `purchase_account`, `is_default`, `is_active`, `description`, `created_at`, `updated_at`) VALUES
(1, 'VAT 16%', 'VAT16', 'standard', 'percentage', 16.00, 'inclusive', 'both', NULL, NULL, 1, 1, 'Standard Kenyan VAT.', '2026-09-14 16:46:51', '2026-09-14 16:46:51'),
(2, 'Zero Rated', 'ZERO', 'zero_rated', 'percentage', 0.00, 'inclusive', 'both', NULL, NULL, 0, 1, 'Taxable at 0%.', '2026-09-14 16:46:51', '2026-09-14 16:46:51'),
(3, 'Exempt', 'EXEMPT', 'exempt', 'percentage', 0.00, 'inclusive', 'both', NULL, NULL, 0, 1, 'Exempt from VAT.', '2026-09-14 16:46:51', '2026-09-14 16:46:51'),
(4, 'Non Taxable', 'NON', 'non_taxable', 'percentage', 0.00, 'inclusive', 'both', NULL, NULL, 0, 1, 'Outside tax scope.', '2026-09-14 16:46:51', '2026-09-14 16:46:51');

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

--
-- Table structure for table `treasury_transactions`
--

CREATE TABLE `treasury_transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `transaction_no` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `transaction_type` varchar(255) NOT NULL,
  `source_account_id` bigint(20) UNSIGNED NOT NULL,
  `destination_account_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `transaction_date` datetime NOT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'posted',
  `created_by` bigint(20) UNSIGNED NOT NULL,
  `reversed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `reversed_at` datetime DEFAULT NULL,
  `reversal_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 `unit_of_measures`
--

CREATE TABLE `unit_of_measures` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `short_name` 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 `unit_of_measures`
--

INSERT INTO `unit_of_measures` (`id`, `name`, `short_name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Pieces', 'Pcs', NULL, 1, '2026-05-25 10:07:12', '2026-05-25 10:16:50'),
(2, 'Kilogram', 'kg', NULL, 1, '2026-05-25 10:07:24', '2026-05-25 10:07:24');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `department_id` bigint(20) UNSIGNED DEFAULT NULL,
  `payment_method_id` bigint(20) UNSIGNED DEFAULT NULL,
  `first_name` varchar(255) DEFAULT NULL,
  `middle_name` varchar(255) DEFAULT NULL,
  `last_name` varchar(255) DEFAULT NULL,
  `username` varchar(255) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) NOT NULL,
  `pin` varchar(255) DEFAULT NULL,
  `role_id` bigint(20) UNSIGNED DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED DEFAULT NULL,
  `department` varchar(255) DEFAULT NULL,
  `job_title` varchar(255) DEFAULT NULL,
  `employee_number` varchar(255) DEFAULT NULL,
  `hire_date` date DEFAULT NULL,
  `id_number` varchar(255) DEFAULT NULL,
  `kra_pin` varchar(255) DEFAULT NULL,
  `nssf_number` varchar(255) DEFAULT NULL,
  `sha_number` varchar(255) DEFAULT NULL,
  `bank_name` varchar(255) DEFAULT NULL,
  `bank_account_number` varchar(255) DEFAULT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `basic_salary` decimal(15,2) DEFAULT NULL,
  `house_allowance` decimal(15,2) DEFAULT NULL,
  `other_allowance` decimal(15,2) DEFAULT NULL,
  `physical_address` text DEFAULT NULL,
  `next_of_kin` varchar(255) DEFAULT NULL,
  `emergency_contact` varchar(255) DEFAULT NULL,
  `profile_photo` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `last_login_at` timestamp NULL DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `updated_by` bigint(20) UNSIGNED DEFAULT NULL,
  `remember_token` varchar(100) 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 `users`
--

INSERT INTO `users` (`id`, `department_id`, `payment_method_id`, `first_name`, `middle_name`, `last_name`, `username`, `name`, `email`, `phone`, `email_verified_at`, `password`, `pin`, `role_id`, `branch_id`, `department`, `job_title`, `employee_number`, `hire_date`, `id_number`, `kra_pin`, `nssf_number`, `sha_number`, `bank_name`, `bank_account_number`, `payment_method`, `basic_salary`, `house_allowance`, `other_allowance`, `physical_address`, `next_of_kin`, `emergency_contact`, `profile_photo`, `is_active`, `last_login_at`, `created_by`, `updated_by`, `remember_token`, `created_at`, `updated_at`) VALUES
(3, 1, 2, 'JEVATECH', 'JEVA', 'SOLUTIONS', 'user', 'JEVATECH SOLUTIONS', 'user@gmail.com', '254741479897', NULL, '$2y$12$kvrVk6BxKqqjNYBy7RnxruAqp/Dzh/30LcDYJsyS0/T85xu5nXYJ2', NULL, 45, 2, NULL, 'TECHNICIAN', '01', '2025-09-26', '12345', 'A12345L', '12345', '12345', 'KCB', '12345', NULL, 1000.00, NULL, NULL, 'NAIROBI', 'JEVATECH', '25471234', NULL, 1, NULL, NULL, NULL, NULL, '2026-05-19 05:14:46', '2026-09-25 22:06:48');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `accommodation_bookings`
--
ALTER TABLE `accommodation_bookings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `accommodation_bookings_booking_no_unique` (`booking_no`),
  ADD KEY `accommodation_bookings_customer_id_foreign` (`customer_id`),
  ADD KEY `accommodation_bookings_user_id_foreign` (`user_id`),
  ADD KEY `accommodation_bookings_payment_method_id_foreign` (`payment_method_id`),
  ADD KEY `accommodation_bookings_charge_type_id_foreign` (`charge_type_id`),
  ADD KEY `idx_accommodation_bookings_room_id_status` (`room_id`,`status`),
  ADD KEY `idx_accommodation_bookings_check_in_at` (`check_in_at`),
  ADD KEY `idx_accommodation_bookings_expected_check_out_at` (`expected_check_out_at`),
  ADD KEY `idx_accommodation_bookings_status_check_in_at` (`status`,`check_in_at`),
  ADD KEY `accommodation_bookings_rate_plan_id_foreign` (`rate_plan_id`),
  ADD KEY `accommodation_bookings_meal_plan_id_foreign` (`meal_plan_id`),
  ADD KEY `acc_booking_availability_idx` (`room_id`,`status`,`check_in_at`,`expected_check_out_at`),
  ADD KEY `accommodation_bookings_source_status_index` (`source`,`status`);

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

--
-- Indexes for table `accommodation_child_rates`
--
ALTER TABLE `accommodation_child_rates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accommodation_child_rates_rate_plan_id_foreign` (`rate_plan_id`);

--
-- Indexes for table `accommodation_floors`
--
ALTER TABLE `accommodation_floors`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accommodation_floors_hotel_id_foreign` (`hotel_id`);

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

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

--
-- Indexes for table `accommodation_rate_plans`
--
ALTER TABLE `accommodation_rate_plans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `accommodation_rate_plans_code_unique` (`code`),
  ADD KEY `accommodation_rate_plans_hotel_id_foreign` (`hotel_id`),
  ADD KEY `accommodation_rate_plans_meal_plan_id_foreign` (`meal_plan_id`),
  ADD KEY `accommodation_rate_plans_room_type_id_is_active_index` (`room_type_id`,`is_active`);

--
-- Indexes for table `accommodation_rooms`
--
ALTER TABLE `accommodation_rooms`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `accommodation_rooms_room_no_unique` (`room_no`),
  ADD KEY `accommodation_rooms_room_type_id_foreign` (`room_type_id`),
  ADD KEY `accommodation_rooms_floor_id_foreign` (`floor_id`),
  ADD KEY `idx_accommodation_rooms_branch_id_status` (`branch_id`,`status`),
  ADD KEY `idx_accommodation_rooms_hotel_id_floor_id` (`hotel_id`,`floor_id`);

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

--
-- Indexes for table `accommodation_seasonal_rates`
--
ALTER TABLE `accommodation_seasonal_rates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `acc_season_rate_dates_idx` (`rate_plan_id`,`starts_on`,`ends_on`);

--
-- Indexes for table `accounts`
--
ALTER TABLE `accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `accounts_gl_code_unique` (`gl_code`);

--
-- Indexes for table `attendance_days`
--
ALTER TABLE `attendance_days`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `attendance_days_branch_id_user_id_work_date_unique` (`branch_id`,`user_id`,`work_date`),
  ADD KEY `attendance_days_user_id_foreign` (`user_id`),
  ADD KEY `attendance_days_work_date_index` (`work_date`),
  ADD KEY `attendance_days_status_index` (`status`);

--
-- Indexes for table `attendance_sync_logs`
--
ALTER TABLE `attendance_sync_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `attendance_sync_logs_device_id_foreign` (`device_id`);

--
-- Indexes for table `audit_logs`
--
ALTER TABLE `audit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `audit_logs_user_id_index` (`user_id`),
  ADD KEY `audit_logs_branch_id_index` (`branch_id`),
  ADD KEY `audit_logs_module_index` (`module`),
  ADD KEY `audit_logs_action_index` (`action`),
  ADD KEY `audit_logs_auditable_type_index` (`auditable_type`),
  ADD KEY `audit_logs_auditable_id_index` (`auditable_id`),
  ADD KEY `audit_logs_reference_no_index` (`reference_no`),
  ADD KEY `idx_audit_logs_branch_id_created_at` (`branch_id`,`created_at`),
  ADD KEY `idx_audit_logs_user_id_created_at` (`user_id`,`created_at`),
  ADD KEY `idx_audit_logs_module_action_created_at` (`module`,`action`,`created_at`),
  ADD KEY `idx_audit_logs_auditable_type_auditable_id` (`auditable_type`,`auditable_id`);

--
-- Indexes for table `biometric_devices`
--
ALTER TABLE `biometric_devices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `biometric_devices_api_key_hash_unique` (`api_key_hash`),
  ADD KEY `biometric_devices_branch_id_foreign` (`branch_id`),
  ADD KEY `biometric_devices_device_serial_index` (`device_serial`),
  ADD KEY `biometric_devices_status_index` (`status`);

--
-- Indexes for table `biometric_employee_mappings`
--
ALTER TABLE `biometric_employee_mappings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `biometric_employee_mappings_device_id_device_user_id_unique` (`device_id`,`device_user_id`),
  ADD KEY `biometric_employee_mappings_user_id_foreign` (`user_id`),
  ADD KEY `biometric_employee_mappings_device_user_id_index` (`device_user_id`),
  ADD KEY `biometric_employee_mappings_employee_no_index` (`employee_no`);

--
-- Indexes for table `biometric_punches`
--
ALTER TABLE `biometric_punches`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `biometric_punches_external_uid_unique` (`external_uid`),
  ADD KEY `biometric_punches_device_id_foreign` (`device_id`),
  ADD KEY `biometric_punches_user_id_foreign` (`user_id`),
  ADD KEY `punch_branch_user_time_idx` (`branch_id`,`user_id`,`punch_time`),
  ADD KEY `biometric_punches_device_user_id_index` (`device_user_id`),
  ADD KEY `biometric_punches_employee_no_index` (`employee_no`),
  ADD KEY `biometric_punches_punch_time_index` (`punch_time`);

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

--
-- Indexes for table `branch_user`
--
ALTER TABLE `branch_user`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `branch_user_user_id_branch_id_unique` (`user_id`,`branch_id`),
  ADD KEY `branch_user_branch_id_foreign` (`branch_id`);

--
-- Indexes for table `business_modules`
--
ALTER TABLE `business_modules`
  ADD PRIMARY KEY (`id`),
  ADD KEY `business_modules_module_id_foreign` (`module_id`);

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

--
-- Indexes for table `call_records`
--
ALTER TABLE `call_records`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `call_records_call_no_unique` (`call_no`),
  ADD KEY `call_records_customer_id_foreign` (`customer_id`),
  ADD KEY `call_records_receiver_id_foreign` (`receiver_id`),
  ADD KEY `call_records_created_by_foreign` (`created_by`),
  ADD KEY `idx_call_records_branch_id_call_date` (`branch_id`,`call_date`),
  ADD KEY `idx_call_records_branch_id_status` (`branch_id`,`status`);

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `categories_code_unique` (`code`),
  ADD KEY `idx_categories_branch_id_is_active` (`branch_id`,`is_active`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_customers_branch_id_is_active` (`branch_id`,`is_active`),
  ADD KEY `idx_customers_phone` (`phone`),
  ADD KEY `idx_customers_name` (`name`);

--
-- Indexes for table `damaged_products`
--
ALTER TABLE `damaged_products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `damaged_products_damage_no_unique` (`damage_no`),
  ADD KEY `damaged_products_product_id_foreign` (`product_id`),
  ADD KEY `damaged_products_user_id_foreign` (`user_id`),
  ADD KEY `idx_damaged_products_branch_id_damage_date` (`branch_id`,`damage_date`);

--
-- Indexes for table `deals`
--
ALTER TABLE `deals`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `deals_deal_no_unique` (`deal_no`),
  ADD KEY `deals_customer_id_foreign` (`customer_id`),
  ADD KEY `deals_created_by_foreign` (`created_by`),
  ADD KEY `idx_deals_branch_id_status` (`branch_id`,`status`),
  ADD KEY `idx_deals_branch_id_next_follow_up_at` (`branch_id`,`next_follow_up_at`),
  ADD KEY `idx_deals_assigned_to_status` (`assigned_to`,`status`);

--
-- Indexes for table `deal_follow_ups`
--
ALTER TABLE `deal_follow_ups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `deal_follow_ups_deal_id_foreign` (`deal_id`),
  ADD KEY `deal_follow_ups_user_id_foreign` (`user_id`);

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

--
-- Indexes for table `disciplinary_cases`
--
ALTER TABLE `disciplinary_cases`
  ADD PRIMARY KEY (`id`),
  ADD KEY `disciplinary_cases_user_id_foreign` (`user_id`),
  ADD KEY `disciplinary_cases_reported_by_foreign` (`reported_by`),
  ADD KEY `disciplinary_cases_incident_date_index` (`incident_date`),
  ADD KEY `disciplinary_cases_status_index` (`status`);

--
-- Indexes for table `employee_contracts`
--
ALTER TABLE `employee_contracts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_contracts_user_id_foreign` (`user_id`),
  ADD KEY `employee_contracts_start_date_index` (`start_date`),
  ADD KEY `employee_contracts_end_date_index` (`end_date`),
  ADD KEY `employee_contracts_status_index` (`status`);

--
-- Indexes for table `employee_notes`
--
ALTER TABLE `employee_notes`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_notes_employee_id_foreign` (`employee_id`),
  ADD KEY `employee_notes_posted_by_id_foreign` (`posted_by_id`),
  ADD KEY `employee_notes_department_id_foreign` (`department_id`),
  ADD KEY `idx_employee_notes_branch_id_note_date` (`branch_id`,`note_date`);

--
-- Indexes for table `employee_reviews`
--
ALTER TABLE `employee_reviews`
  ADD PRIMARY KEY (`id`),
  ADD KEY `employee_reviews_user_id_foreign` (`user_id`),
  ADD KEY `employee_reviews_reviewer_id_foreign` (`reviewer_id`),
  ADD KEY `employee_reviews_period_start_index` (`period_start`),
  ADD KEY `employee_reviews_period_end_index` (`period_end`),
  ADD KEY `employee_reviews_status_index` (`status`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `expenses_expense_no_unique` (`expense_no`),
  ADD KEY `idx_expenses_branch_id_expense_date` (`branch_id`,`expense_date`),
  ADD KEY `idx_expenses_branch_id_payment_method_id` (`branch_id`,`payment_method_id`),
  ADD KEY `idx_expenses_department_id` (`department_id`),
  ADD KEY `idx_expenses_expense_category_id` (`expense_category_id`),
  ADD KEY `idx_expenses_user_id` (`user_id`),
  ADD KEY `idx_expenses_shift_id` (`shift_id`);

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

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

--
-- Indexes for table `internal_stock_issues`
--
ALTER TABLE `internal_stock_issues`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `internal_stock_issues_issue_no_unique` (`issue_no`),
  ADD KEY `internal_stock_issues_department_id_foreign` (`department_id`),
  ADD KEY `internal_stock_issues_issued_by_foreign` (`issued_by`),
  ADD KEY `internal_stock_issues_received_by_foreign` (`received_by`),
  ADD KEY `isi_branch_date_idx` (`branch_id`,`issue_date`),
  ADD KEY `isi_receiver_status_idx` (`receiver_id`,`status`);

--
-- Indexes for table `internal_stock_issue_items`
--
ALTER TABLE `internal_stock_issue_items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `isi_item_product_unique` (`internal_stock_issue_id`,`product_id`),
  ADD KEY `internal_stock_issue_items_product_id_index` (`product_id`);

--
-- Indexes for table `internal_stock_transactions`
--
ALTER TABLE `internal_stock_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `internal_stock_transactions_internal_stock_issue_item_id_foreign` (`internal_stock_issue_item_id`),
  ADD KEY `internal_stock_transactions_hotel_id_foreign` (`hotel_id`),
  ADD KEY `internal_stock_transactions_booking_id_foreign` (`booking_id`),
  ADD KEY `internal_stock_transactions_user_id_foreign` (`user_id`),
  ADD KEY `ist_type_date_idx` (`transaction_type`,`transaction_date`),
  ADD KEY `ist_room_date_idx` (`room_id`,`transaction_date`);

--
-- Indexes for table `journal_entries`
--
ALTER TABLE `journal_entries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `journal_entries_entry_no_unique` (`entry_no`),
  ADD UNIQUE KEY `journal_source_event_unique` (`source_type`,`source_id`,`event`),
  ADD KEY `journal_entries_branch_id_index` (`branch_id`),
  ADD KEY `journal_entries_user_id_index` (`user_id`),
  ADD KEY `journal_entries_entry_date_index` (`entry_date`),
  ADD KEY `journal_entries_source_type_index` (`source_type`),
  ADD KEY `journal_entries_source_id_index` (`source_id`),
  ADD KEY `journal_entries_event_index` (`event`),
  ADD KEY `journal_entries_reference_no_index` (`reference_no`),
  ADD KEY `journal_entries_status_index` (`status`),
  ADD KEY `journal_entries_reversal_of_id_index` (`reversal_of_id`),
  ADD KEY `idx_journal_entries_branch_id_entry_date` (`branch_id`,`entry_date`),
  ADD KEY `idx_journal_entries_branch_id_status_entry_date` (`branch_id`,`status`,`entry_date`),
  ADD KEY `idx_journal_entries_source_type_source_id` (`source_type`,`source_id`);

--
-- Indexes for table `journal_entry_lines`
--
ALTER TABLE `journal_entry_lines`
  ADD PRIMARY KEY (`id`),
  ADD KEY `journal_entry_lines_account_id_foreign` (`account_id`),
  ADD KEY `journal_entry_lines_account_type_index` (`account_type`),
  ADD KEY `idx_journal_entry_lines_journal_entry_id_account_id` (`journal_entry_id`,`account_id`);

--
-- Indexes for table `leave_requests`
--
ALTER TABLE `leave_requests`
  ADD PRIMARY KEY (`id`),
  ADD KEY `leave_requests_user_id_foreign` (`user_id`),
  ADD KEY `leave_requests_leave_type_id_foreign` (`leave_type_id`),
  ADD KEY `leave_requests_branch_id_foreign` (`branch_id`),
  ADD KEY `leave_requests_reviewed_by_foreign` (`reviewed_by`),
  ADD KEY `leave_requests_start_date_index` (`start_date`),
  ADD KEY `leave_requests_end_date_index` (`end_date`),
  ADD KEY `leave_requests_status_index` (`status`);

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

--
-- Indexes for table `license_activations`
--
ALTER TABLE `license_activations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `license_activations_activation_no_unique` (`activation_no`),
  ADD KEY `license_activations_requested_by_foreign` (`requested_by`),
  ADD KEY `license_activations_activated_by_foreign` (`activated_by`),
  ADD KEY `license_activations_status_created_at_index` (`status`,`created_at`),
  ADD KEY `license_activations_customer_id_index` (`customer_id`),
  ADD KEY `license_activations_computer_serial_index` (`computer_serial`),
  ADD KEY `license_activations_generated_serial_index` (`generated_serial`),
  ADD KEY `license_binding_index` (`binding_type`,`binding_value`);

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

--
-- Indexes for table `mpesa_transactions`
--
ALTER TABLE `mpesa_transactions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `mpesa_transactions_sms_in_id_unique` (`sms_in_id`),
  ADD UNIQUE KEY `mpesa_transaction_code_unique` (`transaction_code`),
  ADD KEY `mpesa_transactions_sale_id_foreign` (`sale_id`),
  ADD KEY `mpesa_transactions_merchant_request_id_index` (`merchant_request_id`),
  ADD KEY `mpesa_transactions_checkout_request_id_index` (`checkout_request_id`),
  ADD KEY `mpesa_transactions_transaction_code_index` (`transaction_code`),
  ADD KEY `mpesa_transactions_account_reference_index` (`account_reference`),
  ADD KEY `mpesa_transactions_branch_id_foreign` (`branch_id`),
  ADD KEY `mpesa_transactions_claimed_by_foreign` (`claimed_by`),
  ADD KEY `mpesa_transactions_source_index` (`source`),
  ADD KEY `mpesa_available_transactions_index` (`source`,`status`,`sale_id`,`branch_id`,`processed_at`);

--
-- Indexes for table `password_reset_tokens`
--
ALTER TABLE `password_reset_tokens`
  ADD PRIMARY KEY (`email`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_payments_sale_id_payment_method_id` (`sale_id`,`payment_method_id`),
  ADD KEY `idx_payments_payment_method_id_payment_date` (`payment_method_id`,`payment_date`),
  ADD KEY `idx_payments_shift_id` (`shift_id`);

--
-- Indexes for table `payment_methods`
--
ALTER TABLE `payment_methods`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_payment_methods_branch_id_is_active` (`branch_id`,`is_active`);

--
-- Indexes for table `payroll_components`
--
ALTER TABLE `payroll_components`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payroll_components_code_unique` (`code`),
  ADD KEY `payroll_components_is_active_index` (`is_active`);

--
-- Indexes for table `payroll_entries`
--
ALTER TABLE `payroll_entries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payroll_entries_payroll_run_id_user_id_unique` (`payroll_run_id`,`user_id`),
  ADD KEY `payroll_entries_user_id_foreign` (`user_id`);

--
-- Indexes for table `payroll_runs`
--
ALTER TABLE `payroll_runs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payroll_runs_payroll_no_unique` (`payroll_no`),
  ADD KEY `payroll_runs_created_by_foreign` (`created_by`),
  ADD KEY `payroll_runs_finalized_by_foreign` (`finalized_by`),
  ADD KEY `payroll_runs_branch_id_period_start_period_end_index` (`branch_id`,`period_start`,`period_end`),
  ADD KEY `payroll_runs_status_index` (`status`);

--
-- Indexes for table `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_code_unique` (`code`),
  ADD KEY `permissions_module_id_foreign` (`module_id`);

--
-- Indexes for table `personal_access_tokens`
--
ALTER TABLE `personal_access_tokens`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  ADD KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`);

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

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `products_barcode_branch_unique` (`barcode`,`branch_id`),
  ADD KEY `products_tax_rate_id_foreign` (`tax_rate_id`),
  ADD KEY `idx_products_branch_id_is_active` (`branch_id`,`is_active`),
  ADD KEY `idx_products_branch_id_category_id` (`branch_id`,`category_id`),
  ADD KEY `idx_products_category_id_sub_category_id` (`category_id`,`sub_category_id`),
  ADD KEY `idx_products_inventory_type_track_stock` (`inventory_type`,`track_stock`),
  ADD KEY `idx_products_stock_quantity_alert_quantity` (`stock_quantity`,`alert_quantity`);

--
-- Indexes for table `product_prices`
--
ALTER TABLE `product_prices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_prices_product_id_price_tier_id_unique` (`product_id`,`price_tier_id`),
  ADD KEY `product_prices_price_tier_id_foreign` (`price_tier_id`);

--
-- Indexes for table `projects`
--
ALTER TABLE `projects`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `projects_project_no_unique` (`project_no`),
  ADD KEY `projects_customer_id_foreign` (`customer_id`),
  ADD KEY `projects_department_id_foreign` (`department_id`),
  ADD KEY `projects_manager_id_foreign` (`manager_id`),
  ADD KEY `projects_created_by_foreign` (`created_by`),
  ADD KEY `projects_branch_id_status_due_date_index` (`branch_id`,`status`,`due_date`),
  ADD KEY `projects_status_index` (`status`),
  ADD KEY `projects_priority_index` (`priority`),
  ADD KEY `projects_health_index` (`health`),
  ADD KEY `projects_due_date_index` (`due_date`);

--
-- Indexes for table `project_members`
--
ALTER TABLE `project_members`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `project_members_project_id_user_id_unique` (`project_id`,`user_id`),
  ADD KEY `project_members_user_id_foreign` (`user_id`);

--
-- Indexes for table `project_milestones`
--
ALTER TABLE `project_milestones`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_milestones_project_id_foreign` (`project_id`),
  ADD KEY `project_milestones_owner_id_foreign` (`owner_id`),
  ADD KEY `project_milestones_due_date_index` (`due_date`),
  ADD KEY `project_milestones_status_index` (`status`);

--
-- Indexes for table `project_tasks`
--
ALTER TABLE `project_tasks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `project_tasks_task_no_unique` (`task_no`),
  ADD KEY `project_tasks_milestone_id_foreign` (`milestone_id`),
  ADD KEY `project_tasks_assignee_id_foreign` (`assignee_id`),
  ADD KEY `project_tasks_created_by_foreign` (`created_by`),
  ADD KEY `project_tasks_project_id_status_assignee_id_index` (`project_id`,`status`,`assignee_id`),
  ADD KEY `project_tasks_status_index` (`status`),
  ADD KEY `project_tasks_priority_index` (`priority`),
  ADD KEY `project_tasks_due_date_index` (`due_date`);

--
-- Indexes for table `project_updates`
--
ALTER TABLE `project_updates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `project_updates_project_id_foreign` (`project_id`),
  ADD KEY `project_updates_user_id_foreign` (`user_id`),
  ADD KEY `project_updates_update_date_index` (`update_date`);

--
-- Indexes for table `purchases`
--
ALTER TABLE `purchases`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchases_purchase_no_unique` (`purchase_no`),
  ADD KEY `idx_purchases_branch_id_purchase_date` (`branch_id`,`purchase_date`),
  ADD KEY `idx_purchases_branch_id_payment_status` (`branch_id`,`payment_status`),
  ADD KEY `idx_purchases_branch_id_user_id` (`branch_id`,`user_id`),
  ADD KEY `idx_purchases_supplier_id` (`supplier_id`),
  ADD KEY `idx_purchases_shift_id` (`shift_id`);

--
-- Indexes for table `purchase_items`
--
ALTER TABLE `purchase_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_purchase_items_purchase_id_product_id` (`purchase_id`,`product_id`),
  ADD KEY `idx_purchase_items_product_id` (`product_id`);

--
-- Indexes for table `purchase_payments`
--
ALTER TABLE `purchase_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_purchase_payments_purchase_id_payment_method_id` (`purchase_id`,`payment_method_id`),
  ADD KEY `idx_purchase_payments_payment_method_id_payment_date` (`payment_method_id`,`payment_date`);

--
-- Indexes for table `purchase_returns`
--
ALTER TABLE `purchase_returns`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchase_returns_return_no_unique` (`return_no`),
  ADD KEY `idx_purchase_returns_purchase_id` (`purchase_id`),
  ADD KEY `idx_purchase_returns_return_date` (`return_date`),
  ADD KEY `idx_purchase_returns_user_id` (`user_id`);

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

--
-- Indexes for table `quotations`
--
ALTER TABLE `quotations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `quotations_quote_no_unique` (`quote_no`),
  ADD KEY `quotations_user_id_foreign` (`user_id`),
  ADD KEY `quotations_customer_id_foreign` (`customer_id`),
  ADD KEY `quotations_converted_sale_id_foreign` (`converted_sale_id`),
  ADD KEY `idx_quotations_branch_id_quote_date` (`branch_id`,`quote_date`),
  ADD KEY `idx_quotations_branch_id_status` (`branch_id`,`status`);

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

--
-- Indexes for table `restaurant_orders`
--
ALTER TABLE `restaurant_orders`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_restaurant_orders_branch_id_status` (`branch_id`,`status`),
  ADD KEY `idx_restaurant_orders_user_id_status` (`user_id`,`status`),
  ADD KEY `idx_restaurant_orders_restaurant_table_id_status` (`restaurant_table_id`,`status`),
  ADD KEY `idx_restaurant_orders_sale_id` (`sale_id`);

--
-- Indexes for table `restaurant_order_items`
--
ALTER TABLE `restaurant_order_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_restaurant_order_items_restaurant_order_id_product_id` (`restaurant_order_id`,`product_id`),
  ADD KEY `idx_restaurant_order_items_product_id` (`product_id`);

--
-- Indexes for table `restaurant_tables`
--
ALTER TABLE `restaurant_tables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_restaurant_tables_branch_id_is_active` (`branch_id`,`is_active`);

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

--
-- Indexes for table `role_module_permissions`
--
ALTER TABLE `role_module_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `role_module_permissions_role_id_module_id_unique` (`role_id`,`module_id`),
  ADD KEY `role_module_permissions_module_id_foreign` (`module_id`);

--
-- Indexes for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `role_permissions_role_id_permission_id_unique` (`role_id`,`permission_id`),
  ADD KEY `role_permissions_permission_id_foreign` (`permission_id`);

--
-- Indexes for table `sales`
--
ALTER TABLE `sales`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sales_invoice_no_unique` (`invoice_no`),
  ADD KEY `idx_sales_branch_id_sale_date` (`branch_id`,`sale_date`),
  ADD KEY `idx_sales_branch_id_payment_status` (`branch_id`,`payment_status`),
  ADD KEY `idx_sales_branch_id_sale_mode` (`branch_id`,`sale_mode`),
  ADD KEY `idx_sales_branch_id_user_id` (`branch_id`,`user_id`),
  ADD KEY `idx_sales_customer_id` (`customer_id`),
  ADD KEY `idx_sales_shift_id` (`shift_id`),
  ADD KEY `idx_sales_merged_into_sale_id` (`merged_into_sale_id`);

--
-- Indexes for table `sale_items`
--
ALTER TABLE `sale_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_sale_items_sale_id_product_id` (`sale_id`,`product_id`),
  ADD KEY `idx_sale_items_product_id_created_at` (`product_id`,`created_at`),
  ADD KEY `idx_sale_items_shift_id` (`shift_id`);

--
-- Indexes for table `shifts`
--
ALTER TABLE `shifts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `shifts_shift_no_unique` (`shift_no`),
  ADD KEY `idx_shifts_branch_id_opened_at` (`branch_id`,`opened_at`),
  ADD KEY `idx_shifts_branch_id_status` (`branch_id`,`status`),
  ADD KEY `idx_shifts_user_id_status` (`user_id`,`status`);

--
-- Indexes for table `shift_stock_counts`
--
ALTER TABLE `shift_stock_counts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `shift_stock_counts_shift_id_product_id_unique` (`shift_id`,`product_id`),
  ADD KEY `shift_stock_counts_shift_id_category_id_index` (`shift_id`,`category_id`);

--
-- Indexes for table `sms_campaigns`
--
ALTER TABLE `sms_campaigns`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sms_campaigns_campaign_no_unique` (`campaign_no`),
  ADD KEY `sms_campaigns_sms_template_id_foreign` (`sms_template_id`),
  ADD KEY `sms_campaigns_user_id_foreign` (`user_id`),
  ADD KEY `idx_sms_campaigns_status_created_at` (`status`,`created_at`);

--
-- Indexes for table `sms_in`
--
ALTER TABLE `sms_in`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sms_in_branch_id_foreign` (`branch_id`),
  ADD KEY `sms_in_sender_number_index` (`sender_number`),
  ADD KEY `sms_in_sent_dt_index` (`sent_dt`),
  ADD KEY `sms_in_processing_status_index` (`processing_status`);

--
-- Indexes for table `sms_recipients`
--
ALTER TABLE `sms_recipients`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sms_recipients_customer_id_foreign` (`customer_id`),
  ADD KEY `idx_sms_recipients_sms_campaign_id_status` (`sms_campaign_id`,`status`);

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

--
-- Indexes for table `stock_takings`
--
ALTER TABLE `stock_takings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_takings_stock_take_no_unique` (`stock_take_no`),
  ADD KEY `stock_takings_user_id_foreign` (`user_id`),
  ADD KEY `idx_stock_takings_branch_id_status` (`branch_id`,`status`),
  ADD KEY `idx_stock_takings_branch_id_started_at` (`branch_id`,`started_at`);

--
-- Indexes for table `stock_taking_items`
--
ALTER TABLE `stock_taking_items`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_taking_items_stock_taking_id_product_id_unique` (`stock_taking_id`,`product_id`),
  ADD KEY `stock_taking_items_product_id_foreign` (`product_id`),
  ADD KEY `stock_taking_items_category_id_foreign` (`category_id`),
  ADD KEY `stock_taking_items_updated_by_foreign` (`updated_by`),
  ADD KEY `idx_stock_taking_items_stock_taking_id_category_id` (`stock_taking_id`,`category_id`);

--
-- Indexes for table `stock_transfers`
--
ALTER TABLE `stock_transfers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_transfers_transfer_no_unique` (`transfer_no`),
  ADD KEY `stock_transfers_user_id_foreign` (`user_id`),
  ADD KEY `idx_stock_transfers_from_branch_id_transfer_date` (`from_branch_id`,`transfer_date`),
  ADD KEY `idx_stock_transfers_to_branch_id_transfer_date` (`to_branch_id`,`transfer_date`),
  ADD KEY `idx_stock_transfers_status_transfer_date` (`status`,`transfer_date`);

--
-- Indexes for table `stock_transfer_items`
--
ALTER TABLE `stock_transfer_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_transfer_items_source_product_id_foreign` (`source_product_id`),
  ADD KEY `stock_transfer_items_destination_product_id_foreign` (`destination_product_id`),
  ADD KEY `idx_stock_transfer_items_stock_transfer_id_source_product_id` (`stock_transfer_id`,`source_product_id`);

--
-- Indexes for table `sub_categories`
--
ALTER TABLE `sub_categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sub_categories_code_unique` (`code`),
  ADD KEY `sub_categories_category_id_foreign` (`category_id`),
  ADD KEY `idx_sub_categories_branch_id_category_id` (`branch_id`,`category_id`),
  ADD KEY `idx_sub_categories_branch_id_is_active` (`branch_id`,`is_active`);

--
-- Indexes for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_suppliers_branch_id_is_active` (`branch_id`,`is_active`),
  ADD KEY `idx_suppliers_phone` (`phone`),
  ADD KEY `idx_suppliers_name` (`name`);

--
-- Indexes for table `supplier_opening_balance_payments`
--
ALTER TABLE `supplier_opening_balance_payments`
  ADD PRIMARY KEY (`id`),
  ADD KEY `supplier_opening_balance_payments_payment_method_id_foreign` (`payment_method_id`),
  ADD KEY `supplier_opening_balance_payments_paid_by_foreign` (`paid_by`),
  ADD KEY `supplier_ob_payments_supplier_date_idx` (`supplier_id`,`payment_date`),
  ADD KEY `supplier_ob_payments_branch_date_idx` (`branch_id`,`payment_date`);

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

--
-- Indexes for table `system_settings`
--
ALTER TABLE `system_settings`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `system_settings_key_unique` (`key`);

--
-- Indexes for table `tasks`
--
ALTER TABLE `tasks`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `tasks_task_no_unique` (`task_no`),
  ADD KEY `tasks_task_category_id_foreign` (`task_category_id`),
  ADD KEY `tasks_department_id_foreign` (`department_id`),
  ADD KEY `tasks_assigned_by_id_foreign` (`assigned_by_id`),
  ADD KEY `tasks_supervisor_id_foreign` (`supervisor_id`),
  ADD KEY `idx_tasks_branch_id_status` (`branch_id`,`status`),
  ADD KEY `idx_tasks_branch_id_due_date` (`branch_id`,`due_date`),
  ADD KEY `idx_tasks_assigned_to_id_status` (`assigned_to_id`,`status`);

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

--
-- Indexes for table `task_progress_updates`
--
ALTER TABLE `task_progress_updates`
  ADD PRIMARY KEY (`id`),
  ADD KEY `task_progress_updates_task_id_foreign` (`task_id`),
  ADD KEY `task_progress_updates_user_id_foreign` (`user_id`);

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

--
-- Indexes for table `treasury_transactions`
--
ALTER TABLE `treasury_transactions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `treasury_transactions_transaction_no_unique` (`transaction_no`),
  ADD KEY `treasury_transactions_source_account_id_foreign` (`source_account_id`),
  ADD KEY `treasury_transactions_destination_account_id_foreign` (`destination_account_id`),
  ADD KEY `treasury_transactions_created_by_foreign` (`created_by`),
  ADD KEY `treasury_transactions_reversed_by_foreign` (`reversed_by`),
  ADD KEY `treasury_branch_date_type_idx` (`branch_id`,`transaction_date`,`transaction_type`),
  ADD KEY `treasury_transactions_transaction_type_index` (`transaction_type`),
  ADD KEY `treasury_transactions_transaction_date_index` (`transaction_date`),
  ADD KEY `treasury_transactions_reference_no_index` (`reference_no`),
  ADD KEY `treasury_transactions_status_index` (`status`);

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

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`),
  ADD UNIQUE KEY `users_username_unique` (`username`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `accommodation_bookings`
--
ALTER TABLE `accommodation_bookings`
  ADD CONSTRAINT `accommodation_bookings_charge_type_id_foreign` FOREIGN KEY (`charge_type_id`) REFERENCES `accommodation_charge_types` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_bookings_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_bookings_meal_plan_id_foreign` FOREIGN KEY (`meal_plan_id`) REFERENCES `accommodation_meal_plans` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_bookings_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_bookings_rate_plan_id_foreign` FOREIGN KEY (`rate_plan_id`) REFERENCES `accommodation_rate_plans` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_bookings_room_id_foreign` FOREIGN KEY (`room_id`) REFERENCES `accommodation_rooms` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `accommodation_bookings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `accommodation_child_rates`
--
ALTER TABLE `accommodation_child_rates`
  ADD CONSTRAINT `accommodation_child_rates_rate_plan_id_foreign` FOREIGN KEY (`rate_plan_id`) REFERENCES `accommodation_rate_plans` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `accommodation_floors`
--
ALTER TABLE `accommodation_floors`
  ADD CONSTRAINT `accommodation_floors_hotel_id_foreign` FOREIGN KEY (`hotel_id`) REFERENCES `accommodation_hotels` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `accommodation_rate_plans`
--
ALTER TABLE `accommodation_rate_plans`
  ADD CONSTRAINT `accommodation_rate_plans_hotel_id_foreign` FOREIGN KEY (`hotel_id`) REFERENCES `accommodation_hotels` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_rate_plans_meal_plan_id_foreign` FOREIGN KEY (`meal_plan_id`) REFERENCES `accommodation_meal_plans` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_rate_plans_room_type_id_foreign` FOREIGN KEY (`room_type_id`) REFERENCES `accommodation_room_types` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `accommodation_rooms`
--
ALTER TABLE `accommodation_rooms`
  ADD CONSTRAINT `accommodation_rooms_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_rooms_floor_id_foreign` FOREIGN KEY (`floor_id`) REFERENCES `accommodation_floors` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_rooms_hotel_id_foreign` FOREIGN KEY (`hotel_id`) REFERENCES `accommodation_hotels` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `accommodation_rooms_room_type_id_foreign` FOREIGN KEY (`room_type_id`) REFERENCES `accommodation_room_types` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `accommodation_seasonal_rates`
--
ALTER TABLE `accommodation_seasonal_rates`
  ADD CONSTRAINT `accommodation_seasonal_rates_rate_plan_id_foreign` FOREIGN KEY (`rate_plan_id`) REFERENCES `accommodation_rate_plans` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `attendance_days`
--
ALTER TABLE `attendance_days`
  ADD CONSTRAINT `attendance_days_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `attendance_days_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `attendance_sync_logs`
--
ALTER TABLE `attendance_sync_logs`
  ADD CONSTRAINT `attendance_sync_logs_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `biometric_devices` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `biometric_devices`
--
ALTER TABLE `biometric_devices`
  ADD CONSTRAINT `biometric_devices_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`);

--
-- Constraints for table `biometric_employee_mappings`
--
ALTER TABLE `biometric_employee_mappings`
  ADD CONSTRAINT `biometric_employee_mappings_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `biometric_devices` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `biometric_employee_mappings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `biometric_punches`
--
ALTER TABLE `biometric_punches`
  ADD CONSTRAINT `biometric_punches_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `biometric_punches_device_id_foreign` FOREIGN KEY (`device_id`) REFERENCES `biometric_devices` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `biometric_punches_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `branch_user`
--
ALTER TABLE `branch_user`
  ADD CONSTRAINT `branch_user_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `branch_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `business_modules`
--
ALTER TABLE `business_modules`
  ADD CONSTRAINT `business_modules_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `system_modules` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `call_records`
--
ALTER TABLE `call_records`
  ADD CONSTRAINT `call_records_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `call_records_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `call_records_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `call_records_receiver_id_foreign` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `customers_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `damaged_products`
--
ALTER TABLE `damaged_products`
  ADD CONSTRAINT `damaged_products_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `damaged_products_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `damaged_products_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `deals`
--
ALTER TABLE `deals`
  ADD CONSTRAINT `deals_assigned_to_foreign` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `deals_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `deals_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `deals_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `deal_follow_ups`
--
ALTER TABLE `deal_follow_ups`
  ADD CONSTRAINT `deal_follow_ups_deal_id_foreign` FOREIGN KEY (`deal_id`) REFERENCES `deals` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `deal_follow_ups_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `disciplinary_cases`
--
ALTER TABLE `disciplinary_cases`
  ADD CONSTRAINT `disciplinary_cases_reported_by_foreign` FOREIGN KEY (`reported_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `disciplinary_cases_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employee_contracts`
--
ALTER TABLE `employee_contracts`
  ADD CONSTRAINT `employee_contracts_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `employee_notes`
--
ALTER TABLE `employee_notes`
  ADD CONSTRAINT `employee_notes_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `employee_notes_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `employee_notes_employee_id_foreign` FOREIGN KEY (`employee_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `employee_notes_posted_by_id_foreign` FOREIGN KEY (`posted_by_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `employee_reviews`
--
ALTER TABLE `employee_reviews`
  ADD CONSTRAINT `employee_reviews_reviewer_id_foreign` FOREIGN KEY (`reviewer_id`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `employee_reviews_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `internal_stock_issues`
--
ALTER TABLE `internal_stock_issues`
  ADD CONSTRAINT `internal_stock_issues_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `internal_stock_issues_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `internal_stock_issues_issued_by_foreign` FOREIGN KEY (`issued_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `internal_stock_issues_received_by_foreign` FOREIGN KEY (`received_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `internal_stock_issues_receiver_id_foreign` FOREIGN KEY (`receiver_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `internal_stock_issue_items`
--
ALTER TABLE `internal_stock_issue_items`
  ADD CONSTRAINT `internal_stock_issue_items_internal_stock_issue_id_foreign` FOREIGN KEY (`internal_stock_issue_id`) REFERENCES `internal_stock_issues` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `internal_stock_issue_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`);

--
-- Constraints for table `internal_stock_transactions`
--
ALTER TABLE `internal_stock_transactions`
  ADD CONSTRAINT `internal_stock_transactions_booking_id_foreign` FOREIGN KEY (`booking_id`) REFERENCES `accommodation_bookings` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `internal_stock_transactions_hotel_id_foreign` FOREIGN KEY (`hotel_id`) REFERENCES `accommodation_hotels` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `internal_stock_transactions_internal_stock_issue_item_id_foreign` FOREIGN KEY (`internal_stock_issue_item_id`) REFERENCES `internal_stock_issue_items` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `internal_stock_transactions_room_id_foreign` FOREIGN KEY (`room_id`) REFERENCES `accommodation_rooms` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `internal_stock_transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `journal_entry_lines`
--
ALTER TABLE `journal_entry_lines`
  ADD CONSTRAINT `journal_entry_lines_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
  ADD CONSTRAINT `journal_entry_lines_journal_entry_id_foreign` FOREIGN KEY (`journal_entry_id`) REFERENCES `journal_entries` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `leave_requests`
--
ALTER TABLE `leave_requests`
  ADD CONSTRAINT `leave_requests_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `leave_requests_leave_type_id_foreign` FOREIGN KEY (`leave_type_id`) REFERENCES `leave_types` (`id`),
  ADD CONSTRAINT `leave_requests_reviewed_by_foreign` FOREIGN KEY (`reviewed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `leave_requests_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `license_activations`
--
ALTER TABLE `license_activations`
  ADD CONSTRAINT `license_activations_activated_by_foreign` FOREIGN KEY (`activated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `license_activations_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `license_activations_requested_by_foreign` FOREIGN KEY (`requested_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `mpesa_transactions`
--
ALTER TABLE `mpesa_transactions`
  ADD CONSTRAINT `mpesa_transactions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `mpesa_transactions_claimed_by_foreign` FOREIGN KEY (`claimed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `mpesa_transactions_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `mpesa_transactions_sms_in_id_foreign` FOREIGN KEY (`sms_in_id`) REFERENCES `sms_in` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `payroll_entries`
--
ALTER TABLE `payroll_entries`
  ADD CONSTRAINT `payroll_entries_payroll_run_id_foreign` FOREIGN KEY (`payroll_run_id`) REFERENCES `payroll_runs` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payroll_entries_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `payroll_runs`
--
ALTER TABLE `payroll_runs`
  ADD CONSTRAINT `payroll_runs_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `payroll_runs_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `payroll_runs_finalized_by_foreign` FOREIGN KEY (`finalized_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `permissions`
--
ALTER TABLE `permissions`
  ADD CONSTRAINT `permissions_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `system_modules` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_tax_rate_id_foreign` FOREIGN KEY (`tax_rate_id`) REFERENCES `tax_rates` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `product_prices`
--
ALTER TABLE `product_prices`
  ADD CONSTRAINT `product_prices_price_tier_id_foreign` FOREIGN KEY (`price_tier_id`) REFERENCES `price_tiers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `projects`
--
ALTER TABLE `projects`
  ADD CONSTRAINT `projects_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `projects_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `projects_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `projects_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `projects_manager_id_foreign` FOREIGN KEY (`manager_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `project_members`
--
ALTER TABLE `project_members`
  ADD CONSTRAINT `project_members_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `project_members_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `project_milestones`
--
ALTER TABLE `project_milestones`
  ADD CONSTRAINT `project_milestones_owner_id_foreign` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `project_milestones_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `project_tasks`
--
ALTER TABLE `project_tasks`
  ADD CONSTRAINT `project_tasks_assignee_id_foreign` FOREIGN KEY (`assignee_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `project_tasks_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `project_tasks_milestone_id_foreign` FOREIGN KEY (`milestone_id`) REFERENCES `project_milestones` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `project_tasks_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `project_updates`
--
ALTER TABLE `project_updates`
  ADD CONSTRAINT `project_updates_project_id_foreign` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `project_updates_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Constraints for table `quotations`
--
ALTER TABLE `quotations`
  ADD CONSTRAINT `quotations_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `quotations_converted_sale_id_foreign` FOREIGN KEY (`converted_sale_id`) REFERENCES `sales` (`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_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`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`) ON DELETE SET NULL,
  ADD CONSTRAINT `quotation_items_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `restaurant_tables`
--
ALTER TABLE `restaurant_tables`
  ADD CONSTRAINT `restaurant_tables_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `role_module_permissions`
--
ALTER TABLE `role_module_permissions`
  ADD CONSTRAINT `role_module_permissions_module_id_foreign` FOREIGN KEY (`module_id`) REFERENCES `system_modules` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_module_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `role_permissions`
--
ALTER TABLE `role_permissions`
  ADD CONSTRAINT `role_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `sms_campaigns`
--
ALTER TABLE `sms_campaigns`
  ADD CONSTRAINT `sms_campaigns_sms_template_id_foreign` FOREIGN KEY (`sms_template_id`) REFERENCES `sms_templates` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `sms_campaigns_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `sms_in`
--
ALTER TABLE `sms_in`
  ADD CONSTRAINT `sms_in_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `sms_recipients`
--
ALTER TABLE `sms_recipients`
  ADD CONSTRAINT `sms_recipients_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `sms_recipients_sms_campaign_id_foreign` FOREIGN KEY (`sms_campaign_id`) REFERENCES `sms_campaigns` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `stock_takings`
--
ALTER TABLE `stock_takings`
  ADD CONSTRAINT `stock_takings_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_takings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stock_taking_items`
--
ALTER TABLE `stock_taking_items`
  ADD CONSTRAINT `stock_taking_items_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_taking_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_taking_items_stock_taking_id_foreign` FOREIGN KEY (`stock_taking_id`) REFERENCES `stock_takings` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_taking_items_updated_by_foreign` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stock_transfers`
--
ALTER TABLE `stock_transfers`
  ADD CONSTRAINT `stock_transfers_from_branch_id_foreign` FOREIGN KEY (`from_branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `stock_transfers_to_branch_id_foreign` FOREIGN KEY (`to_branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `stock_transfers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stock_transfer_items`
--
ALTER TABLE `stock_transfer_items`
  ADD CONSTRAINT `stock_transfer_items_destination_product_id_foreign` FOREIGN KEY (`destination_product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_transfer_items_source_product_id_foreign` FOREIGN KEY (`source_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 `sub_categories`
--
ALTER TABLE `sub_categories`
  ADD CONSTRAINT `sub_categories_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `sub_categories_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD CONSTRAINT `suppliers_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `supplier_opening_balance_payments`
--
ALTER TABLE `supplier_opening_balance_payments`
  ADD CONSTRAINT `supplier_opening_balance_payments_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `supplier_opening_balance_payments_paid_by_foreign` FOREIGN KEY (`paid_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `supplier_opening_balance_payments_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`),
  ADD CONSTRAINT `supplier_opening_balance_payments_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Constraints for table `tasks`
--
ALTER TABLE `tasks`
  ADD CONSTRAINT `tasks_assigned_by_id_foreign` FOREIGN KEY (`assigned_by_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_assigned_to_id_foreign` FOREIGN KEY (`assigned_to_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_department_id_foreign` FOREIGN KEY (`department_id`) REFERENCES `departments` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_supervisor_id_foreign` FOREIGN KEY (`supervisor_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `tasks_task_category_id_foreign` FOREIGN KEY (`task_category_id`) REFERENCES `task_categories` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `task_progress_updates`
--
ALTER TABLE `task_progress_updates`
  ADD CONSTRAINT `task_progress_updates_task_id_foreign` FOREIGN KEY (`task_id`) REFERENCES `tasks` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `task_progress_updates_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `treasury_transactions`
--
ALTER TABLE `treasury_transactions`
  ADD CONSTRAINT `treasury_transactions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`),
  ADD CONSTRAINT `treasury_transactions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `treasury_transactions_destination_account_id_foreign` FOREIGN KEY (`destination_account_id`) REFERENCES `accounts` (`id`),
  ADD CONSTRAINT `treasury_transactions_reversed_by_foreign` FOREIGN KEY (`reversed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `treasury_transactions_source_account_id_foreign` FOREIGN KEY (`source_account_id`) REFERENCES `accounts` (`id`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
