--
-- Host: 127.0.0.1    Database: alhilkkw_soug_hanana
-- ------------------------------------------------------


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

CREATE TABLE `business_settings` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `business_name` varchar(255) DEFAULT NULL,
  `business_address` text DEFAULT NULL,
  `business_phone` varchar(20) DEFAULT NULL,
  `business_email` varchar(255) DEFAULT NULL,
  `business_website` varchar(255) DEFAULT NULL,
  `business_logo` varchar(255) DEFAULT NULL,
  `invoice_prefix` varchar(10) NOT NULL DEFAULT 'INV',
  `invoice_number_start` int(11) NOT NULL DEFAULT 1000,
  `current_invoice_number` int(11) NOT NULL DEFAULT 1000,
  `receipt_prefix` varchar(10) NOT NULL DEFAULT 'RCP',
  `receipt_number_start` int(11) NOT NULL DEFAULT 1000,
  `current_receipt_number` int(11) NOT NULL DEFAULT 1000,
  `default_tax_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_label` varchar(50) NOT NULL DEFAULT 'Tax',
  `currency_symbol` varchar(10) NOT NULL DEFAULT 'CFA',
  `currency_code` varchar(3) NOT NULL DEFAULT 'XOF',
  `business_registration_number` varchar(255) DEFAULT NULL,
  `tax_identification_number` varchar(255) DEFAULT NULL,
  `invoice_footer_note` text DEFAULT NULL,
  `receipt_footer_note` text DEFAULT NULL,
  `show_logo_on_invoice` tinyint(1) NOT NULL DEFAULT 1,
  `show_logo_on_receipt` tinyint(1) NOT NULL DEFAULT 1,
  `date_format` varchar(20) NOT NULL DEFAULT 'd/m/Y',
  `time_format` varchar(20) NOT NULL DEFAULT 'H:i:s',
  `starting_year` int(11) NOT NULL DEFAULT 2026,
  `active_fiscal_year_id` bigint(20) unsigned DEFAULT NULL,
  `view_fiscal_year_id` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `business_settings`
--

INSERT INTO `business_settings` VALUES
(1,'DST','N`djamena - Tchad','66 95 66 48','soug.hanana@gmail.com',NULL,'business-logos/1762199025_690905f10ff02.png','DST',0,257,'RCP',1000,1000,0.00,'Tax','CFA','XOF',NULL,NULL,NULL,NULL,1,1,'d/m/Y','H:i:s',2026,NULL,NULL,'2025-10-31 16:14:31','2026-03-24 15:36:31');

--
-- Table structure for table `cache`
--

CREATE TABLE `cache` (
  `key` varchar(255) NOT NULL,
  `value` mediumtext NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cache`
--

INSERT INTO `cache` VALUES
('soug-hanana-cache-8cc3311539df046b0bdc1e1c6f489220','i:1;',1775558368),
('soug-hanana-cache-8cc3311539df046b0bdc1e1c6f489220:timer','i:1775558368;',1775558368),
('soug-hanana-cache-market_config_127.0.0.1','N;',1775561999),
('soug-hanana-cache-spatie.permission.cache','a:3:{s:5:\"alias\";a:4:{s:1:\"a\";s:2:\"id\";s:1:\"b\";s:4:\"name\";s:1:\"c\";s:10:\"guard_name\";s:1:\"r\";s:5:\"roles\";}s:11:\"permissions\";a:60:{i:0;a:4:{s:1:\"a\";i:1;s:1:\"b\";s:14:\"view dashboard\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:4;}}i:1;a:4:{s:1:\"a\";i:2;s:1:\"b\";s:17:\"refresh dashboard\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:2;a:4:{s:1:\"a\";i:3;s:1:\"b\";s:20:\"view dashboard stats\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:3;a:4:{s:1:\"a\";i:4;s:1:\"b\";s:10:\"view users\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:4;a:4:{s:1:\"a\";i:5;s:1:\"b\";s:12:\"create users\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:5;a:4:{s:1:\"a\";i:6;s:1:\"b\";s:10:\"edit users\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:6;a:4:{s:1:\"a\";i:7;s:1:\"b\";s:12:\"delete users\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:7;a:4:{s:1:\"a\";i:8;s:1:\"b\";s:12:\"assign roles\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:8;a:4:{s:1:\"a\";i:9;s:1:\"b\";s:10:\"view roles\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:9;a:4:{s:1:\"a\";i:10;s:1:\"b\";s:12:\"create roles\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:10;a:4:{s:1:\"a\";i:11;s:1:\"b\";s:10:\"edit roles\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:11;a:4:{s:1:\"a\";i:12;s:1:\"b\";s:12:\"delete roles\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:12;a:4:{s:1:\"a\";i:13;s:1:\"b\";s:15:\"view categories\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:13;a:4:{s:1:\"a\";i:14;s:1:\"b\";s:17:\"create categories\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:14;a:4:{s:1:\"a\";i:15;s:1:\"b\";s:15:\"edit categories\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:15;a:4:{s:1:\"a\";i:16;s:1:\"b\";s:17:\"delete categories\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:16;a:4:{s:1:\"a\";i:17;s:1:\"b\";s:22:\"toggle category status\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:17;a:4:{s:1:\"a\";i:18;s:1:\"b\";s:13:\"view products\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:18;a:4:{s:1:\"a\";i:19;s:1:\"b\";s:15:\"create products\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:19;a:4:{s:1:\"a\";i:20;s:1:\"b\";s:13:\"edit products\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:20;a:4:{s:1:\"a\";i:21;s:1:\"b\";s:15:\"delete products\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:21;a:4:{s:1:\"a\";i:22;s:1:\"b\";s:20:\"manage product stock\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:22;a:4:{s:1:\"a\";i:23;s:1:\"b\";s:22:\"view product analytics\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:23;a:4:{s:1:\"a\";i:24;s:1:\"b\";s:10:\"access pos\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:24;a:4:{s:1:\"a\";i:25;s:1:\"b\";s:13:\"process sales\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:25;a:4:{s:1:\"a\";i:26;s:1:\"b\";s:12:\"cancel sales\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:26;a:4:{s:1:\"a\";i:27;s:1:\"b\";s:18:\"view sales history\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:27;a:4:{s:1:\"a\";i:28;s:1:\"b\";s:17:\"view sale details\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:28;a:4:{s:1:\"a\";i:29;s:1:\"b\";s:10:\"edit sales\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:29;a:4:{s:1:\"a\";i:30;s:1:\"b\";s:14:\"print receipts\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:30;a:4:{s:1:\"a\";i:31;s:1:\"b\";s:12:\"export sales\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:31;a:4:{s:1:\"a\";i:32;s:1:\"b\";s:17:\"view sale history\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:32;a:4:{s:1:\"a\";i:33;s:1:\"b\";s:12:\"view reports\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:4;}}i:33;a:4:{s:1:\"a\";i:34;s:1:\"b\";s:14:\"export reports\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:34;a:4:{s:1:\"a\";i:35;s:1:\"b\";s:25:\"generate advanced reports\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:35;a:4:{s:1:\"a\";i:36;s:1:\"b\";s:22:\"view business settings\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:36;a:4:{s:1:\"a\";i:37;s:1:\"b\";s:22:\"edit business settings\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:37;a:4:{s:1:\"a\";i:38;s:1:\"b\";s:13:\"view expenses\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:38;a:4:{s:1:\"a\";i:39;s:1:\"b\";s:15:\"create expenses\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:39;a:4:{s:1:\"a\";i:40;s:1:\"b\";s:13:\"edit expenses\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:40;a:4:{s:1:\"a\";i:41;s:1:\"b\";s:15:\"delete expenses\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:41;a:4:{s:1:\"a\";i:42;s:1:\"b\";s:16:\"approve expenses\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:42;a:4:{s:1:\"a\";i:43;s:1:\"b\";s:10:\"view loans\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:43;a:4:{s:1:\"a\";i:44;s:1:\"b\";s:20:\"manage loan payments\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:44;a:4:{s:1:\"a\";i:45;s:1:\"b\";s:15:\"mark loans paid\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:45;a:4:{s:1:\"a\";i:46;s:1:\"b\";s:14:\"view proformas\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:46;a:4:{s:1:\"a\";i:47;s:1:\"b\";s:16:\"create proformas\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:47;a:4:{s:1:\"a\";i:48;s:1:\"b\";s:14:\"edit proformas\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:48;a:4:{s:1:\"a\";i:49;s:1:\"b\";s:16:\"delete proformas\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:49;a:4:{s:1:\"a\";i:50;s:1:\"b\";s:17:\"confirm proformas\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:3;i:2;i:4;}}i:50;a:4:{s:1:\"a\";i:51;s:1:\"b\";s:16:\"cancel proformas\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:3;i:2;i:4;}}i:51;a:4:{s:1:\"a\";i:52;s:1:\"b\";s:12:\"view cashier\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:52;a:4:{s:1:\"a\";i:53;s:1:\"b\";s:19:\"process withdrawals\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:53;a:4:{s:1:\"a\";i:54;s:1:\"b\";s:20:\"view cashier history\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:54;a:4:{s:1:\"a\";i:55;s:1:\"b\";s:22:\"export cashier reports\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}i:55;a:4:{s:1:\"a\";i:56;s:1:\"b\";s:20:\"view cashier balance\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:56;a:4:{s:1:\"a\";i:57;s:1:\"b\";s:18:\"view expense types\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}}i:57;a:4:{s:1:\"a\";i:58;s:1:\"b\";s:20:\"create expense types\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:58;a:4:{s:1:\"a\";i:59;s:1:\"b\";s:18:\"edit expense types\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:3:{i:0;i:1;i:1;i:2;i:2;i:3;}}i:59;a:4:{s:1:\"a\";i:60;s:1:\"b\";s:20:\"delete expense types\";s:1:\"c\";s:3:\"web\";s:1:\"r\";a:2:{i:0;i:1;i:1;i:2;}}}s:5:\"roles\";a:4:{i:0;a:3:{s:1:\"a\";i:1;s:1:\"b\";s:11:\"Super Admin\";s:1:\"c\";s:3:\"web\";}i:1;a:3:{s:1:\"a\";i:2;s:1:\"b\";s:5:\"Admin\";s:1:\"c\";s:3:\"web\";}i:2;a:3:{s:1:\"a\";i:4;s:1:\"b\";s:6:\"Seller\";s:1:\"c\";s:3:\"web\";}i:3;a:3:{s:1:\"a\";i:3;s:1:\"b\";s:7:\"Manager\";s:1:\"c\";s:3:\"web\";}}}',1775644708);

--
-- Table structure for table `cache_locks`
--

CREATE TABLE `cache_locks` (
  `key` varchar(255) NOT NULL,
  `owner` varchar(255) NOT NULL,
  `expiration` int(11) NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cache_locks`
--


--
-- Table structure for table `cashier_balances`
--

CREATE TABLE `cashier_balances` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `current_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_sales` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_withdrawals` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_expenses` decimal(15,2) NOT NULL DEFAULT 0.00,
  `last_updated_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cashier_balances_user_id_unique` (`user_id`),
  KEY `cashier_balances_user_id_index` (`user_id`),
  CONSTRAINT `cashier_balances_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cashier_balances`
--


--
-- Table structure for table `cashier_transactions`
--

CREATE TABLE `cashier_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `type` enum('sale','sale_edit','sale_cancel','withdrawal','expense') NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `direction` enum('credit','debit') NOT NULL,
  `description` text NOT NULL,
  `reference_id` bigint(20) unsigned DEFAULT NULL,
  `reference_type` varchar(255) DEFAULT NULL,
  `balance_before` decimal(15,2) NOT NULL,
  `balance_after` decimal(15,2) NOT NULL,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `transaction_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cashier_transactions_user_id_transaction_date_index` (`user_id`,`transaction_date`),
  KEY `cashier_transactions_type_transaction_date_index` (`type`,`transaction_date`),
  KEY `cashier_transactions_reference_id_reference_type_index` (`reference_id`,`reference_type`),
  CONSTRAINT `cashier_transactions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cashier_transactions`
--


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

CREATE TABLE `categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `categories_is_active_index` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `categories` VALUES
(1,'Systems',NULL,NULL,1,'2026-04-03 13:31:07','2026-04-03 13:31:07');

--
-- Table structure for table `clients`
--

CREATE TABLE `clients` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `phone` varchar(30) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `clients_phone_unique` (`phone`),
  KEY `clients_name_index` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `clients`
--


--
-- Table structure for table `expense_types`
--

CREATE TABLE `expense_types` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `color` varchar(7) NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `expense_types_name_unique` (`name`),
  UNIQUE KEY `expense_types_color_unique` (`color`),
  KEY `expense_types_is_active_name_index` (`is_active`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `expense_types`
--


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

CREATE TABLE `expenses` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `expense_type_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `description` text DEFAULT NULL,
  `expense_date` date NOT NULL,
  `receipt_number` varchar(255) DEFAULT NULL,
  `payment_method` varchar(255) NOT NULL DEFAULT 'cash',
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `expenses_expense_date_status_index` (`expense_date`,`status`),
  KEY `expenses_expense_type_id_status_index` (`expense_type_id`,`status`),
  KEY `expenses_user_id_expense_date_index` (`user_id`,`expense_date`),
  CONSTRAINT `expenses_expense_type_id_foreign` FOREIGN KEY (`expense_type_id`) REFERENCES `expense_types` (`id`),
  CONSTRAINT `expenses_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


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

CREATE TABLE `failed_jobs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `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(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `failed_jobs`
--


--
-- Table structure for table `fiscal_years`
--

CREATE TABLE `fiscal_years` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `start_date` date NOT NULL,
  `end_date` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 0,
  `is_closed` tinyint(1) NOT NULL DEFAULT 0,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `fiscal_years`
--


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

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

--
-- Dumping data for table `job_batches`
--


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

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

--
-- Dumping data for table `jobs`
--


--
-- Table structure for table `loan_histories`
--

CREATE TABLE `loan_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `action` enum('created','payment_made','fully_paid','edited','cancelled') NOT NULL,
  `old_amount` decimal(15,2) DEFAULT NULL,
  `new_amount` decimal(15,2) DEFAULT NULL,
  `payment_amount` decimal(15,2) DEFAULT NULL,
  `reason` varchar(255) DEFAULT NULL,
  `metadata` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`metadata`)),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `loan_histories_sale_id_foreign` (`sale_id`),
  KEY `loan_histories_user_id_foreign` (`user_id`),
  CONSTRAINT `loan_histories_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loan_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `loan_histories`
--


--
-- Table structure for table `loan_payments`
--

CREATE TABLE `loan_payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `payment_method` enum('cash','card','mobile_payment') NOT NULL,
  `notes` text DEFAULT NULL,
  `balance_before` decimal(15,2) NOT NULL,
  `balance_after` decimal(15,2) NOT NULL,
  `payment_date` datetime NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `loan_payments_sale_id_foreign` (`sale_id`),
  KEY `loan_payments_user_id_foreign` (`user_id`),
  CONSTRAINT `loan_payments_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `loan_payments_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `loan_payments`
--


--
-- Table structure for table `market_audit_logs`
--

CREATE TABLE `market_audit_logs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `market_id` bigint(20) unsigned NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `action` varchar(50) NOT NULL,
  `description` 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`)),
  `ip_address` varchar(45) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `market_audit_logs_market_id_foreign` (`market_id`),
  CONSTRAINT `market_audit_logs_market_id_foreign` FOREIGN KEY (`market_id`) REFERENCES `markets` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `market_audit_logs`
--

INSERT INTO `market_audit_logs` VALUES
(1,13,2,'backup','Database backup created: alhilkkw_business_soug_hanana-2026-04-11_09-28-56.sql',NULL,NULL,'143.105.161.156','2026-04-11 06:29:00'),
(2,3,2,'backup','Database backup created: alhilkkw_yeski-2026-04-20_07-09-44.sql',NULL,NULL,'154.73.113.132','2026-04-20 04:09:49'),
(3,13,2,'backup','Database backup created: alhilkkw_business_soug_hanana-2026-04-23_08-52-23.sql',NULL,NULL,'154.73.161.120','2026-04-23 05:52:27'),
(4,13,2,'backup','Database backup created: alhilkkw_business_soug_hanana-2026-04-23_08-53-09.sql',NULL,NULL,'154.73.161.120','2026-04-23 05:53:09'),
(5,12,2,'backup','Database backup created: alhilkkw_hilal_shop-2026-04-23_08-53-21.sql',NULL,NULL,'154.73.161.120','2026-04-23 05:53:21'),
(6,11,2,'backup','Database backup created: alhilkkw_hilali_shop-2026-04-23_08-53-25.sql',NULL,NULL,'154.73.161.120','2026-04-23 05:53:28');

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

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

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

INSERT INTO `migrations` VALUES
(1,'0001_01_01_000000_create_users_table',1),
(2,'0001_01_01_000001_create_cache_table',1),
(3,'0001_01_01_000002_create_jobs_table',1),
(4,'2024_01_01_000008_create_categories_table',1),
(5,'2025_08_20_204847_add_two_factor_columns_to_users_table',1),
(6,'2025_08_20_204856_create_personal_access_tokens_table',1),
(7,'2025_08_21_174432_create_products_table',1),
(8,'2025_08_21_174528_create_product_inventories_table',1),
(9,'2025_08_21_174637_create_product_histories_table',1),
(10,'2025_08_21_174721_create_sales_table',1),
(11,'2025_08_21_174757_create_sale_items_table',1),
(12,'2025_08_21_174838_create_product_variants_table',1),
(13,'2025_08_26_161417_create_sale_histories_table',1),
(14,'2025_09_03_142120_create_proformas_table',1),
(15,'2025_09_03_142121_create_proforma_items_table',1),
(16,'2025_09_07_121232_create_expense_types_table',1),
(17,'2025_09_07_121233_create_expenses_table',1),
(18,'2025_09_07_153315_create_cashier_balances_table',1),
(19,'2025_09_10_093456_add_loan_fields_to_sales_table',1),
(20,'2025_09_10_093456_create_loan_histories_table',1),
(21,'2025_09_10_093456_create_loan_payments_table',1),
(22,'2025_09_12_181425_create_business_settings_table',1),
(23,'2025_09_27_194618_create_permission_tables',1),
(24,'2025_10_31_164515_create_markets_table',1),
(25,'2025_11_27_135818_create_push_subscriptions_table',2),
(26,'2026_04_05_000001_add_starting_year_to_business_settings',2),
(27,'2026_04_05_220918_create_fiscal_years_table',2),
(28,'2026_04_07_071928_add_endpoint_hash_to_push_subscriptions',2),
(29,'2026_04_11_000001_add_extra_fields_to_markets_table',3),
(30,'2026_04_11_000002_create_market_audit_logs_table',3);

--
-- Table structure for table `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_permissions`
--


--
-- Table structure for table `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) unsigned NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`),
  CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `model_has_roles`
--

INSERT INTO `model_has_roles` VALUES
(1,'App\\Models\\User',2);

--
-- 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,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `password_reset_tokens`
--


--
-- Table structure for table `permissions`
--

CREATE TABLE `permissions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permissions`
--

INSERT INTO `permissions` VALUES
(1,'view dashboard','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(2,'refresh dashboard','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(3,'view dashboard stats','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(4,'view users','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(5,'create users','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(6,'edit users','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(7,'delete users','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(8,'assign roles','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(9,'view roles','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(10,'create roles','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(11,'edit roles','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(12,'delete roles','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(13,'view categories','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(14,'create categories','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(15,'edit categories','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(16,'delete categories','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(17,'toggle category status','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(18,'view products','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(19,'create products','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(20,'edit products','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(21,'delete products','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(22,'manage product stock','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(23,'view product analytics','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(24,'access pos','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(25,'process sales','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(26,'cancel sales','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(27,'view sales history','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(28,'view sale details','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(29,'edit sales','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(30,'print receipts','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(31,'export sales','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(32,'view sale history','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(33,'view reports','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(34,'export reports','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(35,'generate advanced reports','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(36,'view business settings','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(37,'edit business settings','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(38,'view expenses','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(39,'create expenses','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(40,'edit expenses','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(41,'delete expenses','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(42,'approve expenses','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(43,'view loans','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(44,'manage loan payments','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(45,'mark loans paid','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(46,'view proformas','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(47,'create proformas','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(48,'edit proformas','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(49,'delete proformas','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(50,'confirm proformas','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(51,'cancel proformas','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(52,'view cashier','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(53,'process withdrawals','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(54,'view cashier history','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(55,'export cashier reports','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(56,'view cashier balance','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(57,'view expense types','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(58,'create expense types','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(59,'edit expense types','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(60,'delete expense types','web','2025-10-31 16:14:24','2025-10-31 16:14:24');

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

CREATE TABLE `personal_access_tokens` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `tokenable_type` varchar(255) NOT NULL,
  `tokenable_id` bigint(20) unsigned NOT NULL,
  `name` text 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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `personal_access_tokens_token_unique` (`token`),
  KEY `personal_access_tokens_tokenable_type_tokenable_id_index` (`tokenable_type`,`tokenable_id`),
  KEY `personal_access_tokens_expires_at_index` (`expires_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `personal_access_tokens`
--


--
-- Table structure for table `product_histories`
--

CREATE TABLE `product_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `action` varchar(50) NOT NULL,
  `description` text NOT NULL,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`data`)),
  `ip_address` varchar(45) DEFAULT NULL,
  `user_agent` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_histories_product_id_created_at_index` (`product_id`,`created_at`),
  KEY `product_histories_action_index` (`action`),
  KEY `product_histories_user_id_index` (`user_id`),
  CONSTRAINT `product_histories_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `product_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_histories`
--

INSERT INTO `product_histories` VALUES
(1,1,'created','Product created',2,'{\"name\":\"Transfer MNG\",\"description\":null,\"barcode\":\"PRD759347\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"cost_price\":\"50000.00\",\"selling_price\":\"350000.00\",\"image\":\"products\\/1775234034_Jl9CGF196k.jpg\",\"expiry_date\":null,\"is_active\":true,\"alert_quantity\":5,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"updated_at\":\"2026-04-03T16:33:54.000000Z\",\"created_at\":\"2026-04-03T16:33:54.000000Z\",\"id\":1}','154.73.166.152','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-03 13:33:54','2026-04-03 13:33:54'),
(2,1,'stock_added','Added 100 units - Initial stock',2,'{\"quantity\":100,\"reason\":\"Initial stock\",\"previous_stock\":0,\"new_stock\":100,\"notes\":\"Product creation\"}','154.73.166.152','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-03 13:33:54','2026-04-03 13:33:54'),
(3,2,'created','Product created',2,'{\"name\":\"Market MNG\",\"description\":null,\"barcode\":\"PRD003104\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"cost_price\":\"50000.00\",\"selling_price\":\"500000.00\",\"image\":\"products\\/1775234174_EflQdczVS5.png\",\"expiry_date\":null,\"is_active\":true,\"alert_quantity\":5,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"updated_at\":\"2026-04-03T16:36:14.000000Z\",\"created_at\":\"2026-04-03T16:36:14.000000Z\",\"id\":2}','154.73.166.152','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-03 13:36:14','2026-04-03 13:36:14'),
(4,2,'stock_added','Added 100 units - Initial stock',2,'{\"quantity\":100,\"reason\":\"Initial stock\",\"previous_stock\":0,\"new_stock\":100,\"notes\":\"Product creation\"}','154.73.166.152','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-03 13:36:14','2026-04-03 13:36:14'),
(5,3,'created','Product created',2,'{\"name\":\"Cargo MNG\",\"description\":null,\"barcode\":\"PRD098707\",\"category_id\":\"1\",\"product_type\":\"market\",\"unit\":\"pcs\",\"cost_price\":\"50000.00\",\"selling_price\":\"900000.00\",\"image\":\"products\\/1775234292_eIsatMnPTR.webp\",\"expiry_date\":null,\"is_active\":true,\"alert_quantity\":5,\"weight\":null,\"length\":null,\"width\":null,\"height\":null,\"updated_at\":\"2026-04-03T16:38:12.000000Z\",\"created_at\":\"2026-04-03T16:38:12.000000Z\",\"id\":3}','154.73.166.152','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-03 13:38:12','2026-04-03 13:38:12'),
(6,3,'stock_added','Added 100 units - Initial stock',2,'{\"quantity\":100,\"reason\":\"Initial stock\",\"previous_stock\":0,\"new_stock\":100,\"notes\":\"Product creation\"}','154.73.166.152','Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36','2026-04-03 13:38:12','2026-04-03 13:38:12'),
(7,3,'updated','Product updated',2,'{\"image\":{\"old\":\"products\\/1775234292_eIsatMnPTR.webp\",\"new\":\"products\\/1775563907_FUg73qYdoZ.jpg\"}}','143.105.161.192','Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36','2026-04-07 09:11:47','2026-04-07 09:11:47');

--
-- Table structure for table `product_inventories`
--

CREATE TABLE `product_inventories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `current_stock` int(11) NOT NULL DEFAULT 0,
  `reserved_stock` int(11) NOT NULL DEFAULT 0,
  `available_stock` int(11) NOT NULL DEFAULT 0,
  `last_stock_update` timestamp NULL DEFAULT NULL,
  `last_updated_by` bigint(20) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `product_inventories_last_updated_by_foreign` (`last_updated_by`),
  KEY `product_inventories_product_id_index` (`product_id`),
  KEY `product_inventories_available_stock_index` (`available_stock`),
  CONSTRAINT `product_inventories_last_updated_by_foreign` FOREIGN KEY (`last_updated_by`) REFERENCES `users` (`id`),
  CONSTRAINT `product_inventories_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_inventories`
--

INSERT INTO `product_inventories` VALUES
(1,1,100,0,100,'2026-04-03 13:33:54',2,'2026-04-03 13:33:54','2026-04-03 13:33:54'),
(2,2,100,0,100,'2026-04-03 13:36:14',2,'2026-04-03 13:36:14','2026-04-03 13:36:14'),
(3,3,100,0,100,'2026-04-03 13:38:12',2,'2026-04-03 13:38:12','2026-04-03 13:38:12');

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

CREATE TABLE `product_variants` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint(20) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `value` varchar(255) NOT NULL,
  `sku` varchar(255) NOT NULL,
  `price_adjustment` decimal(8,2) NOT NULL DEFAULT 0.00,
  `stock_quantity` 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,
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_variants_sku_unique` (`sku`),
  KEY `product_variants_product_id_is_active_index` (`product_id`,`is_active`),
  CONSTRAINT `product_variants_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


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

CREATE TABLE `products` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `category_id` bigint(20) unsigned NOT NULL,
  `product_type` enum('market','store') NOT NULL,
  `unit` varchar(50) NOT NULL,
  `alert_quantity` int(11) NOT NULL DEFAULT 1,
  `cost_price` decimal(10,2) NOT NULL,
  `selling_price` decimal(10,2) NOT NULL,
  `discount_price` decimal(10,2) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `weight` decimal(8,3) DEFAULT NULL,
  `length` decimal(8,2) DEFAULT NULL,
  `width` decimal(8,2) DEFAULT NULL,
  `height` decimal(8,2) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_barcode_unique` (`barcode`),
  KEY `products_product_type_is_active_index` (`product_type`,`is_active`),
  KEY `products_category_id_is_active_index` (`category_id`,`is_active`),
  KEY `products_barcode_index` (`barcode`),
  KEY `products_is_active_index` (`is_active`),
  KEY `products_expiry_date_index` (`expiry_date`),
  KEY `products_product_type_index` (`product_type`),
  CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `products` VALUES
(1,'Transfer MNG',NULL,'PRD759347',1,'market','pcs',5,50000.00,350000.00,NULL,'products/1775234034_Jl9CGF196k.jpg',NULL,1,NULL,NULL,NULL,NULL,'2026-04-03 13:33:54','2026-04-03 13:33:54',NULL),
(2,'Market MNG',NULL,'PRD003104',1,'market','pcs',5,50000.00,500000.00,NULL,'products/1775234174_EflQdczVS5.png',NULL,1,NULL,NULL,NULL,NULL,'2026-04-03 13:36:14','2026-04-03 13:36:14',NULL),
(3,'Cargo MNG',NULL,'PRD098707',1,'market','pcs',5,50000.00,900000.00,NULL,'products/1775563907_FUg73qYdoZ.jpg',NULL,1,NULL,NULL,NULL,NULL,'2026-04-03 13:38:12','2026-04-07 09:11:47',NULL);

--
-- Table structure for table `proforma_items`
--

CREATE TABLE `proforma_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `proforma_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_barcode` varchar(255) DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `tax_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `proforma_items_proforma_id_index` (`proforma_id`),
  KEY `proforma_items_product_id_index` (`product_id`),
  CONSTRAINT `proforma_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `proforma_items_proforma_id_foreign` FOREIGN KEY (`proforma_id`) REFERENCES `proformas` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `proforma_items`
--


--
-- Table structure for table `proformas`
--

CREATE TABLE `proformas` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `proforma_number` varchar(255) NOT NULL,
  `proforma_type` enum('market','store') NOT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(20) DEFAULT NULL,
  `customer_email` varchar(255) DEFAULT NULL,
  `subtotal` decimal(10,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `status` enum('draft','sent','confirmed','expired','cancelled') NOT NULL DEFAULT 'draft',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) unsigned NOT NULL,
  `confirmed_by` bigint(20) unsigned DEFAULT NULL,
  `confirmed_at` timestamp NULL DEFAULT NULL,
  `sale_id` bigint(20) unsigned DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `proformas_proforma_number_unique` (`proforma_number`),
  KEY `proformas_confirmed_by_foreign` (`confirmed_by`),
  KEY `proformas_sale_id_foreign` (`sale_id`),
  KEY `proformas_proforma_type_status_index` (`proforma_type`,`status`),
  KEY `proformas_created_at_index` (`created_at`),
  KEY `proformas_status_index` (`status`),
  KEY `proformas_created_by_index` (`created_by`),
  KEY `proformas_expires_at_index` (`expires_at`),
  CONSTRAINT `proformas_confirmed_by_foreign` FOREIGN KEY (`confirmed_by`) REFERENCES `users` (`id`),
  CONSTRAINT `proformas_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  CONSTRAINT `proformas_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `proformas`
--


--
-- Table structure for table `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) unsigned NOT NULL,
  `role_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`permission_id`,`role_id`),
  KEY `role_has_permissions_role_id_foreign` (`role_id`),
  CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_has_permissions`
--

INSERT INTO `role_has_permissions` VALUES
(1,1),
(1,2),
(1,4),
(2,1),
(2,2),
(3,1),
(3,2),
(4,1),
(4,2),
(5,1),
(5,2),
(6,1),
(6,2),
(7,1),
(7,2),
(8,1),
(8,2),
(9,1),
(9,2),
(10,1),
(10,2),
(11,1),
(11,2),
(12,1),
(12,2),
(13,1),
(13,2),
(13,3),
(13,4),
(14,1),
(14,2),
(14,3),
(15,1),
(15,2),
(15,3),
(16,1),
(16,2),
(17,1),
(17,2),
(17,3),
(18,1),
(18,2),
(18,3),
(18,4),
(19,1),
(19,2),
(19,3),
(20,1),
(20,2),
(20,3),
(21,1),
(21,2),
(22,1),
(22,2),
(22,3),
(22,4),
(23,1),
(23,2),
(23,3),
(24,1),
(24,2),
(24,3),
(24,4),
(25,1),
(25,2),
(25,3),
(25,4),
(26,1),
(26,2),
(26,3),
(27,1),
(27,2),
(27,3),
(27,4),
(28,1),
(28,2),
(28,3),
(28,4),
(29,1),
(29,2),
(29,3),
(30,1),
(30,2),
(30,3),
(30,4),
(31,1),
(31,2),
(31,3),
(32,1),
(32,2),
(32,3),
(33,1),
(33,2),
(33,4),
(34,1),
(34,2),
(35,1),
(35,2),
(36,1),
(36,2),
(36,3),
(37,1),
(37,2),
(37,3),
(38,1),
(38,2),
(38,3),
(39,1),
(39,2),
(39,3),
(40,1),
(40,2),
(40,3),
(41,1),
(41,2),
(42,1),
(42,2),
(43,1),
(43,2),
(43,3),
(43,4),
(44,1),
(44,2),
(44,3),
(44,4),
(45,1),
(45,2),
(45,3),
(46,1),
(46,2),
(46,3),
(46,4),
(47,1),
(47,2),
(47,3),
(47,4),
(48,1),
(48,2),
(48,3),
(48,4),
(49,1),
(49,2),
(49,3),
(49,4),
(50,1),
(50,3),
(50,4),
(51,1),
(51,3),
(51,4),
(52,1),
(52,2),
(52,3),
(52,4),
(53,1),
(53,2),
(53,3),
(53,4),
(54,1),
(54,2),
(54,3),
(55,1),
(55,2),
(56,1),
(56,2),
(56,3),
(56,4),
(57,1),
(57,2),
(57,3),
(57,4),
(58,1),
(58,2),
(58,3),
(59,1),
(59,2),
(59,3),
(60,1),
(60,2);

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

CREATE TABLE `roles` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `roles` VALUES
(1,'Super Admin','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(2,'Admin','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(3,'Manager','web','2025-10-31 16:14:24','2025-10-31 16:14:24'),
(4,'Seller','web','2025-10-31 16:14:24','2025-10-31 16:14:24');

--
-- Table structure for table `sale_histories`
--

CREATE TABLE `sale_histories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `action` varchar(255) NOT NULL,
  `changes` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`changes`)),
  `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,
  `user_id` bigint(20) unsigned DEFAULT NULL,
  `user_name` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_histories_sale_id_created_at_index` (`sale_id`,`created_at`),
  KEY `sale_histories_action_index` (`action`),
  KEY `sale_histories_user_id_foreign` (`user_id`),
  CONSTRAINT `sale_histories_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE,
  CONSTRAINT `sale_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_histories`
--


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

CREATE TABLE `sale_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `product_id` bigint(20) unsigned NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `product_barcode` varchar(255) DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(10,2) NOT NULL,
  `tax_rate` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_items_sale_id_index` (`sale_id`),
  KEY `sale_items_product_id_index` (`product_id`),
  CONSTRAINT `sale_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `sale_items_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sale_items`
--


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

CREATE TABLE `sales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_number` varchar(255) NOT NULL,
  `sale_type` enum('market','store') NOT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `customer_phone` varchar(20) DEFAULT NULL,
  `customer_email` varchar(255) DEFAULT NULL,
  `subtotal` decimal(10,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(10,2) NOT NULL,
  `loan_amount` decimal(15,2) DEFAULT NULL,
  `collected_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `is_loan` tinyint(1) NOT NULL DEFAULT 0,
  `paid_amount` decimal(10,2) NOT NULL,
  `change_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
  `payment_method` enum('cash','card','mobile_payment') NOT NULL,
  `payment_status` enum('paid','partial','unpaid','refunded') NOT NULL DEFAULT 'paid',
  `sale_status` enum('completed','pending','cancelled','refunded') NOT NULL DEFAULT 'completed',
  `notes` text DEFAULT NULL,
  `cashier_id` bigint(20) unsigned NOT NULL,
  `client_id` bigint(20) unsigned DEFAULT NULL,
  `sale_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sales_sale_number_unique` (`sale_number`),
  KEY `sales_sale_type_sale_status_index` (`sale_type`,`sale_status`),
  KEY `sales_sale_date_index` (`sale_date`),
  KEY `sales_payment_status_index` (`payment_status`),
  KEY `sales_cashier_id_index` (`cashier_id`),
  KEY `sales_client_id_foreign` (`client_id`),
  CONSTRAINT `sales_cashier_id_foreign` FOREIGN KEY (`cashier_id`) REFERENCES `users` (`id`),
  CONSTRAINT `sales_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `sales`
--


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

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

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

INSERT INTO `sessions` VALUES
('94OffZERfHyUGPm5OolNt7Ny3BjrOgxh5TshTUuQ',2,'127.0.0.1','Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:148.0) Gecko/20100101 Firefox/148.0','YTo2OntzOjY6Il90b2tlbiI7czo0MDoiNnlkU0JEcFVsUDV0VG9qcDQ0dVpuOTFUbUJCMXYydFdySkJZQ3ZoViI7czo2OiJsb2NhbGUiO3M6MjoiZW4iO3M6MzoidXJsIjthOjA6e31zOjk6Il9wcmV2aW91cyI7YToxOntzOjM6InVybCI7czozNToiaHR0cDovLzEyNy4wLjAuMTo4MDAwL2FkbWluL21hcmtldHMiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToyO30=',1775558399);

--
-- Table structure for table `withdrawals`
--

CREATE TABLE `withdrawals` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `reason` text DEFAULT NULL,
  `status` enum('completed','cancelled') NOT NULL DEFAULT 'completed',
  `balance_before` decimal(15,2) NOT NULL,
  `balance_after` decimal(15,2) NOT NULL,
  `withdrawal_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `withdrawals_user_id_withdrawal_date_index` (`user_id`,`withdrawal_date`),
  KEY `withdrawals_status_withdrawal_date_index` (`status`,`withdrawal_date`),
  CONSTRAINT `withdrawals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `withdrawals`
--



