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

START TRANSACTION;



--
-- Database: `preez_brands_erp`
--

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

--
-- Table structure for table `audit_logs`
--

CREATE TABLE `audit_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `user_name` varchar(255) DEFAULT NULL,
  `action` varchar(255) NOT NULL,
  `entity_type` varchar(255) NOT NULL,
  `entity_id` bigint(20) UNSIGNED 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,
  `user_agent` text DEFAULT NULL,
  `url` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `audit_logs`
--

INSERT INTO `audit_logs` (`id`, `user_id`, `user_name`, `action`, `entity_type`, `entity_id`, `old_values`, `new_values`, `ip_address`, `user_agent`, `url`, `created_at`, `updated_at`) VALUES
(1, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 14:34:18', '2026-06-20 14:34:18'),
(2, 1, 'System Super Admin', 'settings_updated', 'Setting', NULL, NULL, '{\"business_name\":\"Preez Brands Ltd\",\"business_phone\":\"+256700000000\",\"currency\":\"UGX\",\"vat_rate\":\"18\",\"payment_allocation_rule\":\"fifo\",\"session_timeout\":\"120\",\"low_stock_threshold\":\"10\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings', '2026-06-20 14:39:14', '2026-06-20 14:39:14'),
(3, 1, 'System Super Admin', 'user_created', 'User', 2, NULL, '{\"role_id\":\"4\",\"full_name\":\"Fred Benjamin\",\"username\":\"Benjamin\",\"email\":\"fameofgodstudios@gmail.com\",\"phone\":\"0776913325\",\"employee_code\":\"EMP-002\",\"status\":\"active\",\"updated_at\":\"2026-06-20T17:40:23.000000Z\",\"created_at\":\"2026-06-20T17:40:23.000000Z\",\"id\":2}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/users', '2026-06-20 14:40:23', '2026-06-20 14:40:23'),
(4, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 14:40:39', '2026-06-20 14:40:39'),
(5, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 14:40:43', '2026-06-20 14:40:43'),
(6, 2, 'Fred Benjamin', 'client_created', 'Client', 1, NULL, '{\"full_name\":\"John Mugambe\",\"phone\":\"+256776913325\",\"email\":\"johnmugambe@mail.com\",\"address\":\"Zana-Focus of God House,  Tamale Mirundi Road,  Kampala Uganda.\",\"tin\":null,\"business_name\":\"Fame of God Studios\",\"credit_limit\":\"50000.00\",\"notes\":\"our customer\",\"client_code\":\"CLI-0001\",\"outstanding_balance\":\"0.00\",\"status\":\"active\",\"updated_at\":\"2026-06-20T17:41:39.000000Z\",\"created_at\":\"2026-06-20T17:41:39.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/clients', '2026-06-20 14:41:39', '2026-06-20 14:41:39'),
(7, 2, 'Fred Benjamin', 'logout', 'User', 2, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 14:42:00', '2026-06-20 14:42:00'),
(8, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 14:42:07', '2026-06-20 14:42:07'),
(9, 1, 'System Super Admin', 'category_created', 'Category', 1, NULL, '{\"name\":\"stones\",\"type\":\"product\",\"description\":\"stone slate\",\"updated_at\":\"2026-06-20T17:42:47.000000Z\",\"created_at\":\"2026-06-20T17:42:47.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/categories', '2026-06-20 14:42:47', '2026-06-20 14:42:47'),
(10, 1, 'System Super Admin', 'product_created', 'Product', 1, NULL, '{\"product_code\":\"PRD-0001\",\"product_name\":\"kalangala\",\"category_id\":\"1\",\"tax_type\":\"exempt\",\"base_unit\":\"piece\",\"description\":null,\"status\":\"active\",\"created_by\":1,\"updated_at\":\"2026-06-20T17:44:12.000000Z\",\"created_at\":\"2026-06-20T17:44:12.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/products', '2026-06-20 14:44:12', '2026-06-20 14:44:12'),
(11, 1, 'System Super Admin', 'backup_created', 'Backup', 1, NULL, '{\"filename\":\"backup-2026-06-20-174538.sql\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings/backup', '2026-06-20 14:45:38', '2026-06-20 14:45:38'),
(12, 1, 'System Super Admin', 'supplier_created', 'Supplier', 1, NULL, '{\"company_name\":\"Taply\",\"contact_person\":\"Fred Benjamin\",\"phone\":\"+256776913325\",\"email\":\"fameofgodstudios@gmail.com\",\"address\":\"2a, kamapla\",\"tin\":null,\"supplier_code\":\"SUP-0001\",\"outstanding_balance\":\"0.00\",\"status\":\"active\",\"updated_at\":\"2026-06-20T17:48:02.000000Z\",\"created_at\":\"2026-06-20T17:48:02.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/suppliers', '2026-06-20 14:48:02', '2026-06-20 14:48:02'),
(13, 1, 'System Super Admin', 'stock_adjusted', 'ProductVariant', 1, '{\"stock\":0}', '{\"stock\":3,\"notes\":\"adjustment\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/variants/1/adjust-stock', '2026-06-20 14:52:05', '2026-06-20 14:52:05'),
(14, 1, 'System Super Admin', 'sale_created', 'Sale', 1, NULL, '{\"sale_number\":\"SALE-20260620-0001\",\"invoice_number\":\"INV-20260620-0001\",\"total_amount\":82600,\"amount_paid\":0}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/pos/checkout', '2026-06-20 14:52:42', '2026-06-20 14:52:42'),
(15, 1, 'System Super Admin', 'category_created', 'Category', 2, NULL, '{\"name\":\"cuting\",\"type\":\"service\",\"description\":\"yes\",\"updated_at\":\"2026-06-20T17:57:21.000000Z\",\"created_at\":\"2026-06-20T17:57:21.000000Z\",\"id\":2}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/categories', '2026-06-20 14:57:21', '2026-06-20 14:57:21'),
(16, 1, 'System Super Admin', 'service_created', 'Service', 1, NULL, '{\"service_name\":\"Graphics\",\"category_id\":\"2\",\"default_price\":\"10000.00\",\"service_code\":\"SRV-0001\",\"status\":\"active\",\"updated_at\":\"2026-06-20T17:57:54.000000Z\",\"created_at\":\"2026-06-20T17:57:54.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/services', '2026-06-20 14:57:54', '2026-06-20 14:57:54'),
(17, 1, 'System Super Admin', 'po_created', 'PurchaseOrder', 2, NULL, '{\"po_number\":\"PO-20260620-0001\",\"supplier_id\":1,\"order_date\":\"2026-06-20T00:00:00.000000Z\",\"expected_delivery\":\"2026-06-20T00:00:00.000000Z\",\"status\":\"ordered\",\"created_by\":1,\"updated_at\":\"2026-06-20T17:58:56.000000Z\",\"created_at\":\"2026-06-20T17:58:56.000000Z\",\"id\":2}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/suppliers/1/purchase-orders', '2026-06-20 14:58:56', '2026-06-20 14:58:56'),
(18, 1, 'System Super Admin', 'expense_category_created', 'ExpenseCategory', 1, NULL, '{\"name\":\"Electricity\",\"description\":\"all electricity bills\",\"updated_at\":\"2026-06-20T18:01:30.000000Z\",\"created_at\":\"2026-06-20T18:01:30.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/expenses/categories', '2026-06-20 15:01:30', '2026-06-20 15:01:30'),
(19, 1, 'System Super Admin', 'expense_category_created', 'ExpenseCategory', 2, NULL, '{\"name\":\"rent\",\"description\":\"Rent\",\"updated_at\":\"2026-06-20T18:02:00.000000Z\",\"created_at\":\"2026-06-20T18:02:00.000000Z\",\"id\":2}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/expenses/categories', '2026-06-20 15:02:00', '2026-06-20 15:02:00'),
(20, 1, 'System Super Admin', 'expense_created', 'Expense', 1, NULL, '{\"category_id\":\"1\",\"amount\":\"10000.00\",\"description\":\"nasser Road office\",\"expense_date\":\"2026-06-20T00:00:00.000000Z\",\"expense_number\":\"EXP-20260620-0001\",\"status\":\"pending\",\"created_by\":1,\"updated_at\":\"2026-06-20T18:14:40.000000Z\",\"created_at\":\"2026-06-20T18:14:40.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/expenses', '2026-06-20 15:14:40', '2026-06-20 15:14:40'),
(21, 1, 'System Super Admin', 'expense_approved', 'Expense', 1, '{\"status\":\"pending\"}', '{\"status\":\"approved\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/expenses/1/approve', '2026-06-20 15:23:32', '2026-06-20 15:23:32'),
(22, 1, 'System Super Admin', 'debt_waiver_requested', 'DebtWaiver', 1, NULL, '{\"debt_id\":1,\"client_id\":1,\"waived_amount\":\"82600.00\",\"reason\":\"yes\",\"status\":\"pending\",\"requested_by\":1,\"updated_at\":\"2026-06-20T18:26:00.000000Z\",\"created_at\":\"2026-06-20T18:26:00.000000Z\",\"id\":1}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/debts/waiver', '2026-06-20 15:26:00', '2026-06-20 15:26:00'),
(23, 1, 'System Super Admin', 'po_created', 'PurchaseOrder', 3, NULL, '{\"po_number\":\"PO-20260620-0002\",\"supplier_id\":1,\"order_date\":\"2026-06-20T00:00:00.000000Z\",\"expected_delivery\":\"2026-06-20T00:00:00.000000Z\",\"subtotal\":\"300000.00\",\"total\":\"300000.00\",\"status\":\"ordered\",\"created_by\":1,\"updated_at\":\"2026-06-20T18:31:45.000000Z\",\"created_at\":\"2026-06-20T18:31:45.000000Z\",\"id\":3}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/suppliers/1/purchase-orders', '2026-06-20 15:31:45', '2026-06-20 15:31:45'),
(24, 1, 'System Super Admin', 'po_received', 'PurchaseOrder', 3, NULL, '{\"po\":\"PO-20260620-0002\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/purchase-orders/3/receive', '2026-06-20 15:37:00', '2026-06-20 15:37:00'),
(25, 1, 'System Super Admin', 'payment_recorded', 'Payment', 1, NULL, '{\"amount\":\"50000.00\",\"method\":\"cash\",\"client\":1,\"alloc\":\"fifo\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/clients/1/payments', '2026-06-20 15:39:22', '2026-06-20 15:39:22'),
(26, 1, 'System Super Admin', 'category_created', 'Category', 3, NULL, '{\"name\":\"Machines\",\"type\":\"product\",\"description\":\"All machines\",\"updated_at\":\"2026-06-20T18:50:53.000000Z\",\"created_at\":\"2026-06-20T18:50:53.000000Z\",\"id\":3}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/categories', '2026-06-20 15:50:53', '2026-06-20 15:50:53'),
(27, 1, 'System Super Admin', 'product_created', 'Product', 2, NULL, '{\"product_code\":\"PRD-0002\",\"product_name\":\"Brothers Printers\",\"category_id\":\"3\",\"tax_type\":\"exempt\",\"base_unit\":\"piece\",\"description\":null,\"status\":\"active\",\"created_by\":1,\"updated_at\":\"2026-06-20T18:59:07.000000Z\",\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"id\":2}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/products', '2026-06-20 15:59:07', '2026-06-20 15:59:07'),
(28, 1, 'System Super Admin', 'po_created', 'PurchaseOrder', 4, NULL, '{\"po_number\":\"PO-20260620-0003\",\"supplier_id\":1,\"order_date\":\"2026-06-20T00:00:00.000000Z\",\"expected_delivery\":null,\"subtotal\":\"10000000.00\",\"total\":\"10000000.00\",\"status\":\"ordered\",\"created_by\":1,\"updated_at\":\"2026-06-20T19:00:04.000000Z\",\"created_at\":\"2026-06-20T19:00:04.000000Z\",\"id\":4}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/suppliers/1/purchase-orders', '2026-06-20 16:00:04', '2026-06-20 16:00:04'),
(29, 1, 'System Super Admin', 'po_received', 'PurchaseOrder', 4, NULL, '{\"po\":\"PO-20260620-0003\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/purchase-orders/4/receive', '2026-06-20 16:00:26', '2026-06-20 16:00:26'),
(30, 1, 'System Super Admin', 'product_updated', 'Product', 2, '{\"id\":2,\"product_code\":\"PRD-0002\",\"product_name\":\"Brothers Printers\",\"category_id\":3,\"brand_id\":null,\"description\":null,\"base_unit\":\"piece\",\"tax_type\":\"exempt\",\"product_image\":null,\"has_variants\":false,\"status\":\"active\",\"created_by\":1,\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T18:59:07.000000Z\",\"variants\":[{\"id\":2,\"product_id\":2,\"sku\":\"03\",\"barcode\":null,\"variant_name\":\"Brothers Printers (Default)\",\"buying_price\":\"200000.00\",\"selling_price\":\"350000.00\",\"stock_qty\":50,\"reorder_level\":5,\"track_stock\":true,\"status\":\"active\",\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T19:00:26.000000Z\"}]}', '{\"id\":2,\"product_code\":\"PRD-0002\",\"product_name\":\"Brothers Printers\",\"category_id\":\"3\",\"brand_id\":null,\"description\":null,\"base_unit\":\"piece\",\"tax_type\":\"exempt\",\"product_image\":null,\"has_variants\":false,\"status\":\"active\",\"created_by\":1,\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T18:59:07.000000Z\",\"variants\":[{\"id\":2,\"product_id\":2,\"sku\":\"03\",\"barcode\":null,\"variant_name\":\"Brothers Printers (Default)\",\"buying_price\":\"0.00\",\"selling_price\":\"350000.00\",\"stock_qty\":50,\"reorder_level\":\"5\",\"track_stock\":true,\"status\":\"active\",\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T19:02:15.000000Z\"}]}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/products/2', '2026-06-20 16:02:15', '2026-06-20 16:02:15'),
(31, 1, 'System Super Admin', 'product_updated', 'Product', 2, '{\"id\":2,\"product_code\":\"PRD-0002\",\"product_name\":\"Brothers Printers\",\"category_id\":3,\"brand_id\":null,\"description\":null,\"base_unit\":\"piece\",\"tax_type\":\"exempt\",\"product_image\":null,\"has_variants\":false,\"status\":\"active\",\"created_by\":1,\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T18:59:07.000000Z\",\"variants\":[{\"id\":2,\"product_id\":2,\"sku\":\"03\",\"barcode\":null,\"variant_name\":\"Brothers Printers (Default)\",\"buying_price\":\"0.00\",\"selling_price\":\"350000.00\",\"stock_qty\":50,\"reorder_level\":5,\"track_stock\":true,\"status\":\"active\",\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T19:02:15.000000Z\"}]}', '{\"id\":2,\"product_code\":\"PRD-0002\",\"product_name\":\"Brothers Printers\",\"category_id\":\"3\",\"brand_id\":null,\"description\":null,\"base_unit\":\"piece\",\"tax_type\":\"exempt\",\"product_image\":null,\"has_variants\":false,\"status\":\"active\",\"created_by\":1,\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T18:59:07.000000Z\",\"variants\":[{\"id\":2,\"product_id\":2,\"sku\":\"03\",\"barcode\":null,\"variant_name\":\"Brothers Printers (Default)\",\"buying_price\":\"200000.00\",\"selling_price\":\"350000.00\",\"stock_qty\":50,\"reorder_level\":\"5\",\"track_stock\":true,\"status\":\"active\",\"deleted_at\":null,\"created_at\":\"2026-06-20T18:59:07.000000Z\",\"updated_at\":\"2026-06-20T19:02:42.000000Z\"}]}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/products/2', '2026-06-20 16:02:42', '2026-06-20 16:02:42'),
(32, 1, 'System Super Admin', 'client_created', 'Client', 2, NULL, '{\"full_name\":\"Peter Jousha\",\"phone\":\"+44776913237\",\"email\":\"peterjousha@mail.com\",\"address\":\"Zana-Focus of God House,  Tamale Mirundi Road,  Kampala Uganda.\",\"tin\":null,\"business_name\":\"free lancer\",\"credit_limit\":\"10000.00\",\"notes\":null,\"client_code\":\"CLI-0002\",\"outstanding_balance\":\"0.00\",\"status\":\"active\",\"updated_at\":\"2026-06-20T19:05:04.000000Z\",\"created_at\":\"2026-06-20T19:05:04.000000Z\",\"id\":2}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/clients', '2026-06-20 16:05:04', '2026-06-20 16:05:04'),
(33, 1, 'System Super Admin', 'user_created', 'User', 3, NULL, '{\"role_id\":\"3\",\"full_name\":\"Digital\",\"username\":\"Digital\",\"email\":\"digital@mail.com\",\"phone\":\"776913237\",\"employee_code\":\"EMP-003\",\"status\":\"active\",\"updated_at\":\"2026-06-20T19:05:51.000000Z\",\"created_at\":\"2026-06-20T19:05:51.000000Z\",\"id\":3}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/users', '2026-06-20 16:05:51', '2026-06-20 16:05:51'),
(34, 1, 'System Super Admin', 'user_created', 'User', 4, NULL, '{\"role_id\":\"2\",\"full_name\":\"Dembe\",\"username\":\"Dembe\",\"email\":\"dembe@mail.com\",\"phone\":null,\"employee_code\":\"EMP-004\",\"status\":\"active\",\"updated_at\":\"2026-06-20T19:06:26.000000Z\",\"created_at\":\"2026-06-20T19:06:26.000000Z\",\"id\":4}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/users', '2026-06-20 16:06:26', '2026-06-20 16:06:26'),
(35, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:06:32', '2026-06-20 16:06:32'),
(36, 4, 'Dembe', 'login', 'User', 4, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:06:35', '2026-06-20 16:06:35'),
(37, 4, 'Dembe', 'logout', 'User', 4, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:06:44', '2026-06-20 16:06:44'),
(38, 3, 'Digital', 'login', 'User', 3, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:08:25', '2026-06-20 16:08:25'),
(39, 3, 'Digital', 'logout', 'User', 3, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:08:38', '2026-06-20 16:08:38'),
(40, 3, 'Digital', 'login', 'User', 3, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:08:52', '2026-06-20 16:08:52'),
(41, 3, 'Digital', 'logout', 'User', 3, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:09:05', '2026-06-20 16:09:05'),
(42, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:09:19', '2026-06-20 16:09:19'),
(43, 2, 'Fred Benjamin', 'logout', 'User', 2, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:37:25', '2026-06-20 16:37:25'),
(44, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:37:34', '2026-06-20 16:37:34'),
(45, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:38:35', '2026-06-20 16:38:35'),
(46, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:38:43', '2026-06-20 16:38:43'),
(47, 2, 'Fred Benjamin', 'logout', 'User', 2, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 16:44:02', '2026-06-20 16:44:02'),
(48, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 16:44:08', '2026-06-20 16:44:08'),
(49, 1, 'System Super Admin', 'user_updated', 'User', 1, '{\"id\":1,\"role_id\":1,\"employee_code\":\"EMP-001\",\"full_name\":\"System Super Admin\",\"username\":\"admin\",\"email\":\"admin@preezbrands.com\",\"phone\":\"+256701234567\",\"profile_photo\":null,\"status\":\"active\",\"failed_logins\":0,\"locked_until\":null,\"last_login_at\":\"2026-06-20T19:44:08.000000Z\",\"last_login_ip\":\"::1\",\"email_verified_at\":null,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:21:17.000000Z\",\"updated_at\":\"2026-06-20T19:44:08.000000Z\",\"role\":{\"id\":1,\"name\":\"super_admin\",\"display_name\":\"Super Admin\",\"description\":\"System Owner with unrestricted access.\",\"is_active\":1,\"created_at\":\"2026-06-20T17:21:16.000000Z\",\"updated_at\":\"2026-06-20T17:21:16.000000Z\"}}', '{\"id\":1,\"role_id\":\"1\",\"employee_code\":\"EMP-001\",\"full_name\":\"System Super Admin\",\"username\":\"admin\",\"email\":\"adamin@preezbrands.com\",\"phone\":\"+256701234567\",\"profile_photo\":null,\"status\":\"active\",\"failed_logins\":0,\"locked_until\":null,\"last_login_at\":\"2026-06-20T19:44:08.000000Z\",\"last_login_ip\":\"::1\",\"email_verified_at\":null,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:21:17.000000Z\",\"updated_at\":\"2026-06-20T19:49:37.000000Z\",\"role\":{\"id\":1,\"name\":\"super_admin\",\"display_name\":\"Super Admin\",\"description\":\"System Owner with unrestricted access.\",\"is_active\":1,\"created_at\":\"2026-06-20T17:21:16.000000Z\",\"updated_at\":\"2026-06-20T17:21:16.000000Z\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/users/1', '2026-06-20 16:49:37', '2026-06-20 16:49:37'),
(50, 1, 'System Super Admin', 'user_updated', 'User', 1, '{\"id\":1,\"role_id\":1,\"employee_code\":\"EMP-001\",\"full_name\":\"System Super Admin\",\"username\":\"admin\",\"email\":\"adamin@preezbrands.com\",\"phone\":\"+256701234567\",\"profile_photo\":null,\"status\":\"active\",\"failed_logins\":0,\"locked_until\":null,\"last_login_at\":\"2026-06-20T19:44:08.000000Z\",\"last_login_ip\":\"::1\",\"email_verified_at\":null,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:21:17.000000Z\",\"updated_at\":\"2026-06-20T19:49:37.000000Z\",\"role\":{\"id\":1,\"name\":\"super_admin\",\"display_name\":\"Super Admin\",\"description\":\"System Owner with unrestricted access.\",\"is_active\":1,\"created_at\":\"2026-06-20T17:21:16.000000Z\",\"updated_at\":\"2026-06-20T17:21:16.000000Z\"}}', '{\"id\":1,\"role_id\":\"1\",\"employee_code\":\"EMP-001\",\"full_name\":\"System Super Admin\",\"username\":\"admin\",\"email\":\"adamin@preezbrands.com\",\"phone\":\"+256701234567\",\"profile_photo\":null,\"status\":\"active\",\"failed_logins\":0,\"locked_until\":null,\"last_login_at\":\"2026-06-20T19:44:08.000000Z\",\"last_login_ip\":\"::1\",\"email_verified_at\":null,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:21:17.000000Z\",\"updated_at\":\"2026-06-20T19:49:37.000000Z\",\"role\":{\"id\":1,\"name\":\"super_admin\",\"display_name\":\"Super Admin\",\"description\":\"System Owner with unrestricted access.\",\"is_active\":1,\"created_at\":\"2026-06-20T17:21:16.000000Z\",\"updated_at\":\"2026-06-20T17:21:16.000000Z\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/users/1', '2026-06-20 16:51:53', '2026-06-20 16:51:53'),
(51, 1, 'System Super Admin', 'user_updated', 'User', 1, '{\"id\":1,\"role_id\":1,\"employee_code\":\"EMP-001\",\"full_name\":\"System Super Admin\",\"username\":\"admin\",\"email\":\"admin@preezbrands.com\",\"phone\":\"+256701234567\",\"profile_photo\":null,\"status\":\"active\",\"failed_logins\":0,\"locked_until\":null,\"last_login_at\":\"2026-06-20T19:44:08.000000Z\",\"last_login_ip\":\"::1\",\"email_verified_at\":null,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:21:17.000000Z\",\"updated_at\":\"2026-06-20T19:53:12.000000Z\",\"role\":{\"id\":1,\"name\":\"super_admin\",\"display_name\":\"Super Admin\",\"description\":\"System Owner with unrestricted access.\",\"is_active\":1,\"created_at\":\"2026-06-20T17:21:16.000000Z\",\"updated_at\":\"2026-06-20T17:21:16.000000Z\"}}', '{\"id\":1,\"role_id\":\"1\",\"employee_code\":\"EMP-001\",\"full_name\":\"System Super Admin\",\"username\":\"admin\",\"email\":\"admin@preezbrands.com\",\"phone\":\"+256701234568\",\"profile_photo\":null,\"status\":\"active\",\"failed_logins\":0,\"locked_until\":null,\"last_login_at\":\"2026-06-20T19:44:08.000000Z\",\"last_login_ip\":\"::1\",\"email_verified_at\":null,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:21:17.000000Z\",\"updated_at\":\"2026-06-20T19:54:03.000000Z\",\"role\":{\"id\":1,\"name\":\"super_admin\",\"display_name\":\"Super Admin\",\"description\":\"System Owner with unrestricted access.\",\"is_active\":1,\"created_at\":\"2026-06-20T17:21:16.000000Z\",\"updated_at\":\"2026-06-20T17:21:16.000000Z\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/users/1', '2026-06-20 16:54:03', '2026-06-20 16:54:03'),
(52, 1, 'System Super Admin', 'refund_requested', 'Refund', 1, NULL, '{\"refund_number\":\"REF-20260620-0001\",\"amount\":70000}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/refunds', '2026-06-20 16:56:43', '2026-06-20 16:56:43'),
(53, 1, 'System Super Admin', 'refund_approved', 'Refund', 1, NULL, '{\"refund_number\":\"REF-20260620-0001\",\"amount\":\"70000.00\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/refunds/1/approve', '2026-06-20 16:56:50', '2026-06-20 16:56:50'),
(54, 1, 'System Super Admin', 'settings_updated', 'Setting', NULL, NULL, '{\"business_name\":\"Preez Brands Ltd\",\"business_phone\":\"+256700000000\",\"currency\":\"UGX\",\"vat_rate\":\"0\",\"payment_allocation_rule\":\"fifo\",\"session_timeout\":\"120\",\"low_stock_threshold\":\"10\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings', '2026-06-20 17:50:29', '2026-06-20 17:50:29'),
(55, 1, 'System Super Admin', 'sale_created', 'Sale', 2, NULL, '{\"sale_number\":\"SALE-20260620-0002\",\"invoice_number\":\"INV-20260620-0002\",\"total_amount\":700000,\"amount_paid\":0}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/pos/checkout', '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(56, 1, 'System Super Admin', 'payment_recorded', 'Payment', 2, NULL, '{\"amount\":\"100000.00\",\"method\":\"cash\",\"client\":\"2\",\"alloc\":\"manual\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/pos/checkout', '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
(57, 1, 'System Super Admin', 'sale_created', 'Sale', 3, NULL, '{\"sale_number\":\"SALE-20260620-0003\",\"invoice_number\":\"INV-20260620-0003\",\"total_amount\":210000,\"amount_paid\":100000}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/pos/checkout', '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
(58, 1, 'System Super Admin', 'product_updated', 'Product', 1, '{\"id\":1,\"product_code\":\"PRD-0001\",\"product_name\":\"kalangala\",\"category_id\":1,\"brand_id\":null,\"description\":null,\"base_unit\":\"piece\",\"tax_type\":\"exempt\",\"product_image\":null,\"has_variants\":false,\"status\":\"active\",\"created_by\":1,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:44:12.000000Z\",\"updated_at\":\"2026-06-20T17:44:12.000000Z\",\"variants\":[{\"id\":1,\"product_id\":1,\"sku\":\"01\",\"barcode\":null,\"variant_name\":\"kalangala (Default)\",\"buying_price\":\"10000.00\",\"selling_price\":\"35000.00\",\"stock_qty\":17,\"reorder_level\":5,\"track_stock\":true,\"status\":\"active\",\"deleted_at\":null,\"created_at\":\"2026-06-20T17:44:12.000000Z\",\"updated_at\":\"2026-06-20T20:54:19.000000Z\"}]}', '{\"id\":1,\"product_code\":\"PRD-0001\",\"product_name\":\"kalangala\",\"category_id\":\"1\",\"brand_id\":null,\"description\":null,\"base_unit\":\"sqm\",\"tax_type\":\"exempt\",\"product_image\":null,\"has_variants\":false,\"status\":\"active\",\"created_by\":1,\"deleted_at\":null,\"created_at\":\"2026-06-20T17:44:12.000000Z\",\"updated_at\":\"2026-06-20T20:55:41.000000Z\",\"variants\":[{\"id\":1,\"product_id\":1,\"sku\":\"01\",\"barcode\":null,\"variant_name\":\"kalangala (Default)\",\"buying_price\":\"10000.00\",\"selling_price\":\"35000.00\",\"stock_qty\":17,\"reorder_level\":\"5\",\"track_stock\":true,\"status\":\"active\",\"deleted_at\":null,\"created_at\":\"2026-06-20T17:44:12.000000Z\",\"updated_at\":\"2026-06-20T20:54:19.000000Z\"}]}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/inventory/products/1', '2026-06-20 17:55:41', '2026-06-20 17:55:41'),
(59, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 17:56:03', '2026-06-20 17:56:03'),
(60, 3, 'Digital', 'login', 'User', 3, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 17:56:11', '2026-06-20 17:56:11'),
(61, 3, 'Digital', 'logout', 'User', 3, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 17:56:16', '2026-06-20 17:56:16'),
(62, 4, 'Dembe', 'login', 'User', 4, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 17:56:24', '2026-06-20 17:56:24'),
(63, 4, 'Dembe', 'logout', 'User', 4, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 18:12:46', '2026-06-20 18:12:46'),
(64, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 18:12:54', '2026-06-20 18:12:54'),
(65, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"127.0.0.1\"}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://127.0.0.1:8000/login', '2026-06-20 18:13:44', '2026-06-20 18:13:44'),
(66, 1, 'System Super Admin', 'permissions_matrix_updated', 'Role', NULL, NULL, '{\"cashier\":{\"dashboard.view\":\"0\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"0\",\"quotations.create\":\"1\",\"quotations.convert\":\"0\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"0\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"supervisor\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"0\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"manager\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"1\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"1\",\"debts.waive\":\"0\",\"sales.refund\":\"1\",\"products.create\":\"1\",\"products.edit\":\"1\",\"products.adjust_stock\":\"1\",\"purchase_orders.create\":\"1\",\"expenses.create\":\"1\",\"expenses.approve\":\"1\",\"reports.view\":\"1\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"}}', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://127.0.0.1:8000/settings/permissions', '2026-06-20 18:15:16', '2026-06-20 18:15:16'),
(67, 1, 'System Super Admin', 'permissions_matrix_updated', 'Role', NULL, NULL, '{\"cashier\":{\"dashboard.view\":\"0\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"0\",\"quotations.create\":\"1\",\"quotations.convert\":\"0\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"0\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"supervisor\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"0\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"manager\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"1\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"1\",\"debts.waive\":\"0\",\"sales.refund\":\"1\",\"products.create\":\"1\",\"products.edit\":\"1\",\"products.adjust_stock\":\"1\",\"purchase_orders.create\":\"1\",\"expenses.create\":\"1\",\"expenses.approve\":\"1\",\"reports.view\":\"1\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings/permissions', '2026-06-20 18:20:57', '2026-06-20 18:20:57'),
(68, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 18:21:03', '2026-06-20 18:21:03'),
(69, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 18:21:10', '2026-06-20 18:21:10'),
(70, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 18:35:27', '2026-06-20 18:35:27'),
(71, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 18:36:53', '2026-06-20 18:36:53'),
(72, 1, 'System Super Admin', 'payment_recorded', 'Payment', 3, NULL, '{\"amount\":\"500000.00\",\"method\":\"cash\",\"client\":2,\"alloc\":\"fifo\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/clients/2/payments', '2026-06-20 18:41:29', '2026-06-20 18:41:29'),
(73, 1, 'System Super Admin', 'payment_recorded', 'Payment', 4, NULL, '{\"amount\":\"310000.00\",\"method\":\"cash\",\"client\":2,\"alloc\":\"manual\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/clients/2/payments', '2026-06-20 18:55:02', '2026-06-20 18:55:02'),
(74, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:00:14', '2026-06-20 19:00:14'),
(75, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:01:04', '2026-06-20 19:01:04'),
(76, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:02:01', '2026-06-20 19:02:01'),
(77, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:02:09', '2026-06-20 19:02:09'),
(78, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:03:22', '2026-06-20 19:03:22'),
(79, 2, 'Fred Benjamin', 'login', 'User', 2, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:05:27', '2026-06-20 19:05:27'),
(80, 1, 'System Super Admin', 'permissions_matrix_updated', 'Role', NULL, NULL, '{\"cashier\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"0\",\"quotations.create\":\"1\",\"quotations.convert\":\"0\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"0\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"supervisor\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"0\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"manager\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"1\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"1\",\"debts.waive\":\"0\",\"sales.refund\":\"1\",\"products.create\":\"1\",\"products.edit\":\"1\",\"products.adjust_stock\":\"1\",\"purchase_orders.create\":\"1\",\"expenses.create\":\"1\",\"expenses.approve\":\"1\",\"reports.view\":\"1\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings/permissions', '2026-06-20 19:05:45', '2026-06-20 19:05:45'),
(81, 2, 'Fred Benjamin', 'logout', 'User', 2, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:06:18', '2026-06-20 19:06:18'),
(82, 3, 'Digital', 'login', 'User', 3, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:06:54', '2026-06-20 19:06:54');
INSERT INTO `audit_logs` (`id`, `user_id`, `user_name`, `action`, `entity_type`, `entity_id`, `old_values`, `new_values`, `ip_address`, `user_agent`, `url`, `created_at`, `updated_at`) VALUES
(83, 1, 'System Super Admin', 'permissions_matrix_updated', 'Role', NULL, NULL, '{\"cashier\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"0\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"1\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"supervisor\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"1\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"manager\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"1\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"1\",\"debts.waive\":\"0\",\"sales.refund\":\"1\",\"products.create\":\"1\",\"products.edit\":\"1\",\"products.adjust_stock\":\"1\",\"purchase_orders.create\":\"1\",\"expenses.create\":\"1\",\"expenses.approve\":\"1\",\"reports.view\":\"1\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings/permissions', '2026-06-20 19:08:21', '2026-06-20 19:08:21'),
(84, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:08:52', '2026-06-20 19:08:52'),
(85, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:08:58', '2026-06-20 19:08:58'),
(86, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:09:01', '2026-06-20 19:09:01'),
(87, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:23:45', '2026-06-20 19:23:45'),
(88, 1, 'System Super Admin', 'permissions_matrix_updated', 'Role', NULL, NULL, '{\"cashier\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"0\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"1\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"supervisor\":{\"dashboard.view\":\"1\",\"sales.create\":\"0\",\"sales.edit\":\"0\",\"sales.void\":\"0\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"0\",\"debts.waive\":\"0\",\"sales.refund\":\"0\",\"products.create\":\"0\",\"products.edit\":\"0\",\"products.adjust_stock\":\"0\",\"purchase_orders.create\":\"0\",\"expenses.create\":\"1\",\"expenses.approve\":\"0\",\"reports.view\":\"0\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"},\"manager\":{\"dashboard.view\":\"1\",\"sales.create\":\"1\",\"sales.edit\":\"0\",\"sales.void\":\"1\",\"clients.create\":\"1\",\"clients.edit\":\"1\",\"quotations.create\":\"1\",\"quotations.convert\":\"1\",\"invoices.create\":\"1\",\"payments.create\":\"1\",\"payments.edit\":\"1\",\"debts.waive\":\"0\",\"sales.refund\":\"1\",\"products.create\":\"1\",\"products.edit\":\"1\",\"products.adjust_stock\":\"1\",\"purchase_orders.create\":\"1\",\"expenses.create\":\"1\",\"expenses.approve\":\"1\",\"reports.view\":\"1\",\"users.manage\":\"0\",\"settings.manage\":\"0\",\"backups.manage\":\"0\",\"backups.restore\":\"0\"}}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/settings/permissions', '2026-06-20 19:27:27', '2026-06-20 19:27:27'),
(89, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:50:05', '2026-06-20 19:50:05'),
(90, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:50:19', '2026-06-20 19:50:19'),
(91, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:50:29', '2026-06-20 19:50:29'),
(92, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 19:50:35', '2026-06-20 19:50:35'),
(93, 1, 'System Super Admin', 'debt_waiver_approved', 'DebtWaiver', 1, NULL, '{\"waived_amount\":\"82600.00\",\"invoice\":\"INV-20260620-0001\",\"new_balance\":0}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/debts/waivers/1/approve', '2026-06-20 19:51:08', '2026-06-20 19:51:08'),
(94, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:51:49', '2026-06-20 19:51:49'),
(95, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://127.0.0.1:8000/logout', '2026-06-20 19:52:39', '2026-06-20 19:52:39'),
(96, 3, 'Digital', 'logout', 'User', 3, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 19:54:19', '2026-06-20 19:54:19'),
(97, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 20:01:34', '2026-06-20 20:01:34'),
(98, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 20:03:25', '2026-06-20 20:03:25'),
(99, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 20:03:37', '2026-06-20 20:03:37'),
(100, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 20:03:41', '2026-06-20 20:03:41'),
(101, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 20:03:49', '2026-06-20 20:03:49'),
(102, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 20:05:27', '2026-06-20 20:05:27'),
(103, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 20:09:09', '2026-06-20 20:09:09'),
(104, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 20:09:12', '2026-06-20 20:09:12'),
(105, 1, 'System Super Admin', 'login', 'User', 1, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-20 20:09:37', '2026-06-20 20:09:37'),
(106, 1, 'System Super Admin', 'logout', 'User', 1, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-20 20:09:40', '2026-06-20 20:09:40'),
(107, 3, 'Digital', 'login', 'User', 3, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-21 17:16:34', '2026-06-21 17:16:34'),
(108, 3, 'Digital', 'logout', 'User', 3, NULL, NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/logout', '2026-06-21 17:16:56', '2026-06-21 17:16:56'),
(109, 3, 'Digital', 'login', 'User', 3, NULL, '{\"ip\":\"::1\"}', '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'http://localhost/PREEZ%20BRANDS%20NASSER%20ROAD/public/login', '2026-06-21 17:46:59', '2026-06-21 17:46:59');

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

--
-- Table structure for table `backups`
--

CREATE TABLE `backups` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `filename` varchar(255) NOT NULL,
  `filepath` varchar(255) NOT NULL,
  `file_size` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
  `type` enum('manual','scheduled','pre_restore') NOT NULL,
  `status` enum('pending','completed','failed') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `backups`
--

INSERT INTO `backups` (`id`, `filename`, `filepath`, `file_size`, `type`, `status`, `notes`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 'backup-2026-06-20-174538.sql', 'backups/backup-2026-06-20-174538.sql', 70555, 'manual', 'completed', 'Manual pure-PHP database dump.', 1, '2026-06-20 14:45:38', '2026-06-20 14:45:38');

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

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

CREATE TABLE `brands` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `deleted_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 `categories`
--

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

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

INSERT INTO `categories` (`id`, `name`, `type`, `description`, `is_active`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'stones', 'product', 'stone slate', 1, NULL, '2026-06-20 14:42:47', '2026-06-20 14:42:47'),
(2, 'cuting', 'service', 'yes', 1, NULL, '2026-06-20 14:57:21', '2026-06-20 14:57:21'),
(3, 'Machines', 'product', 'All machines', 1, NULL, '2026-06-20 15:50:53', '2026-06-20 15:50:53');

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

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

CREATE TABLE `clients` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `client_code` varchar(255) NOT NULL,
  `full_name` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `tin` varchar(255) DEFAULT NULL,
  `business_name` varchar(255) DEFAULT NULL,
  `credit_limit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `outstanding_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('active','inactive','blacklisted') NOT NULL DEFAULT 'active',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `clients` (`id`, `client_code`, `full_name`, `phone`, `email`, `address`, `tin`, `business_name`, `credit_limit`, `outstanding_balance`, `status`, `notes`, `created_by`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'CLI-0001', 'John Mugambe', '+256776913325', 'johnmugambe@mail.com', 'Zana-Focus of God House,  Tamale Mirundi Road,  Kampala Uganda.', NULL, 'Fame of God Studios', 50000.00, -120000.00, 'active', 'our customer', NULL, NULL, '2026-06-20 14:41:39', '2026-06-20 19:51:08'),
(2, 'CLI-0002', 'Peter Jousha', '+44776913237', 'peterjousha@mail.com', 'Zana-Focus of God House,  Tamale Mirundi Road,  Kampala Uganda.', NULL, 'free lancer', 10000.00, 0.00, 'active', NULL, NULL, NULL, '2026-06-20 16:05:04', '2026-06-20 18:55:02');

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

--
-- Table structure for table `customer_ledgers`
--

CREATE TABLE `customer_ledgers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `reference` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `credit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `type` varchar(255) NOT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `customer_ledgers`
--

INSERT INTO `customer_ledgers` (`id`, `client_id`, `reference`, `description`, `debit`, `credit`, `balance`, `type`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'INV-20260620-0001', 'Invoice #INV-20260620-0001 issued', 82600.00, 0.00, 82600.00, 'invoice', 1, '2026-06-20 14:52:42', '2026-06-20 14:52:42'),
(2, 1, 'PAY-20260620-0001', 'Payment #PAY-20260620-0001 received', 0.00, 50000.00, 32600.00, 'payment', 1, '2026-06-20 15:39:22', '2026-06-20 15:39:22'),
(3, 1, 'REF-20260620-0001', 'Refund Approved for Invoice #INV-20260620-0001', 0.00, 70000.00, 0.00, 'refund', 1, '2026-06-20 16:56:50', '2026-06-20 16:56:50'),
(4, 2, 'INV-20260620-0002', 'Invoice #INV-20260620-0002 issued', 700000.00, 0.00, 700000.00, 'invoice', 1, '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(5, 2, 'INV-20260620-0003', 'Invoice #INV-20260620-0003 issued', 210000.00, 0.00, 910000.00, 'invoice', 1, '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
(6, 2, 'PAY-20260620-0002', 'Payment #PAY-20260620-0002 received', 0.00, 100000.00, 810000.00, 'payment', 1, '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
(7, 2, 'PAY-20260620-0003', 'Payment #PAY-20260620-0003 received', 0.00, 500000.00, 310000.00, 'payment', 1, '2026-06-20 18:41:29', '2026-06-20 18:41:29'),
(8, 2, 'PAY-20260620-0004', 'Payment #PAY-20260620-0004 received', 0.00, 310000.00, 0.00, 'payment', 1, '2026-06-20 18:55:02', '2026-06-20 18:55:02'),
(9, 1, 'WAIVER-1', 'Debt waiver approved for Invoice #INV-20260620-0001', 0.00, 82600.00, 0.00, 'waiver', 1, '2026-06-20 19:51:08', '2026-06-20 19:51:08');

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

--
-- Table structure for table `debts`
--

CREATE TABLE `debts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL,
  `original_amount` decimal(15,2) NOT NULL,
  `outstanding_balance` decimal(15,2) NOT NULL,
  `due_date` date DEFAULT NULL,
  `days_overdue` int(11) NOT NULL DEFAULT 0,
  `status` enum('active','partially_paid','paid','waived','written_off') NOT NULL DEFAULT 'active',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `debts`
--

INSERT INTO `debts` (`id`, `client_id`, `invoice_id`, `original_amount`, `outstanding_balance`, `due_date`, `days_overdue`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 82600.00, 0.00, '2026-07-20', 0, 'waived', '2026-06-20 14:52:42', '2026-06-20 19:51:08'),
(2, 2, 2, 700000.00, 0.00, '2026-07-20', 0, 'paid', '2026-06-20 17:53:23', '2026-06-20 19:10:39'),
(3, 2, 3, 210000.00, 0.00, '2026-07-20', 0, 'paid', '2026-06-20 17:54:19', '2026-06-20 18:55:02');

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

--
-- Table structure for table `debt_waivers`
--

CREATE TABLE `debt_waivers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `debt_id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `waived_amount` decimal(15,2) NOT NULL,
  `reason` text NOT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `requested_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `debt_waivers`
--

INSERT INTO `debt_waivers` (`id`, `debt_id`, `client_id`, `waived_amount`, `reason`, `status`, `requested_by`, `approved_by`, `approved_at`, `rejection_reason`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 82600.00, 'yes', 'approved', 1, 1, '2026-06-20 19:51:08', NULL, '2026-06-20 15:26:00', '2026-06-20 19:51:08');

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

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

CREATE TABLE `expenses` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `expense_number` varchar(255) NOT NULL,
  `category_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `expense_date` date NOT NULL,
  `description` text NOT NULL,
  `receipt_file` varchar(255) DEFAULT NULL,
  `status` enum('pending','approved','rejected') NOT NULL DEFAULT 'pending',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `expenses` (`id`, `expense_number`, `category_id`, `amount`, `expense_date`, `description`, `receipt_file`, `status`, `created_by`, `approved_by`, `approved_at`, `rejection_reason`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'EXP-20260620-0001', 1, 10000.00, '2026-06-20', 'nasser Road office', NULL, 'approved', 1, 1, '2026-06-20 15:23:32', NULL, NULL, '2026-06-20 15:14:40', '2026-06-20 15:23:32');

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

--
-- 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,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `expense_categories` (`id`, `name`, `description`, `is_active`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'Electricity', 'all electricity bills', 1, NULL, '2026-06-20 15:01:30', '2026-06-20 15:01:30'),
(2, 'rent', 'Rent', 1, NULL, '2026-06-20 15:02:00', '2026-06-20 15:02:00');

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

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

CREATE TABLE `invoices` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `invoice_number` varchar(255) NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `quotation_id` bigint(20) UNSIGNED DEFAULT NULL,
  `invoice_date` date NOT NULL,
  `due_date` date DEFAULT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_rate` decimal(5,2) NOT NULL DEFAULT 18.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `amount_paid` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance_due` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('draft','unpaid','partial','paid','overdue','cancelled','voided') NOT NULL DEFAULT 'draft',
  `payment_method` enum('cash','bank_transfer','mobile_money','cheque','other','mixed') DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `terms` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `voided_by` bigint(20) UNSIGNED DEFAULT NULL,
  `voided_at` timestamp NULL DEFAULT NULL,
  `void_reason` text DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoices`
--

INSERT INTO `invoices` (`id`, `invoice_number`, `client_id`, `quotation_id`, `invoice_date`, `due_date`, `subtotal`, `tax_rate`, `tax_amount`, `discount`, `total_amount`, `amount_paid`, `balance_due`, `status`, `payment_method`, `notes`, `terms`, `created_by`, `voided_by`, `voided_at`, `void_reason`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'INV-20260620-0001', 1, NULL, '2026-06-20', '2026-07-20', 70000.00, 18.00, 12600.00, 0.00, 82600.00, 132600.00, 0.00, 'paid', 'cash', NULL, NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 14:52:42', '2026-06-20 19:51:08'),
(2, 'INV-20260620-0002', 2, NULL, '2026-06-20', '2026-07-20', 700000.00, 0.00, 0.00, 0.00, 700000.00, 700000.00, 0.00, 'paid', 'cash', NULL, NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 17:53:23', '2026-06-20 19:10:39'),
(3, 'INV-20260620-0003', 2, NULL, '2026-06-20', '2026-07-20', 210000.00, 0.00, 0.00, 0.00, 210000.00, 210000.00, 0.00, 'paid', 'cash', NULL, NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 17:54:19', '2026-06-20 18:55:02');

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

--
-- Table structure for table `invoice_items`
--

CREATE TABLE `invoice_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL,
  `item_type` enum('product','service') NOT NULL,
  `item_id` bigint(20) UNSIGNED NOT NULL,
  `item_name` varchar(255) NOT NULL,
  `item_code` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(15,2) NOT NULL,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_price` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_items`
--

INSERT INTO `invoice_items` (`id`, `invoice_id`, `item_type`, `item_id`, `item_name`, `item_code`, `description`, `quantity`, `unit_price`, `discount`, `total_price`, `created_at`, `updated_at`) VALUES
(1, 1, 'product', 1, 'kalangala (Default)', '01', NULL, 2, 35000.00, 0.00, 70000.00, '2026-06-20 14:52:42', '2026-06-20 14:52:42'),
(2, 2, 'product', 2, 'Brothers Printers (Default)', '03', NULL, 1, 350000.00, 0.00, 350000.00, '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(3, 2, 'product', 1, 'kalangala (Default)', '01', NULL, 10, 35000.00, 0.00, 350000.00, '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(4, 3, 'product', 1, 'kalangala (Default)', '01', NULL, 6, 35000.00, 0.00, 210000.00, '2026-06-20 17:54:19', '2026-06-20 17:54:19');

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

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

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

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

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

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

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

--
-- Table structure for table `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, '2024_01_01_000001_create_roles_table', 1),
(2, '2024_01_01_000002_create_users_table', 1),
(3, '2024_01_01_000003_create_settings_and_support_tables', 1),
(4, '2024_01_01_000004_create_clients_table', 1),
(5, '2024_01_01_000005_create_inventory_tables', 1),
(6, '2024_01_01_000006_create_services_suppliers_table', 1),
(7, '2024_01_01_000007_create_purchase_orders_table', 1),
(8, '2024_01_01_000008_create_quotations_invoices_table', 1),
(9, '2024_01_01_000009_create_sales_payments_table', 1),
(10, '2024_01_01_000010_create_debts_expenses_refunds_table', 1),
(11, '2024_01_01_000011_create_audit_notifications_table', 1),
(12, '2026_06_20_184540_add_received_at_to_purchase_orders_table', 2),
(13, '2026_06_21_000000_update_permission_matrix', 3);

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

--
-- Table structure for table `notifications`
--

CREATE TABLE `notifications` (
  `id` char(36) NOT NULL,
  `type` varchar(255) NOT NULL,
  `notifiable_type` varchar(255) NOT NULL,
  `notifiable_id` bigint(20) UNSIGNED NOT NULL,
  `data` text NOT NULL,
  `read_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `notifications`
--

INSERT INTO `notifications` (`id`, `type`, `notifiable_type`, `notifiable_id`, `data`, `read_at`, `created_at`, `updated_at`) VALUES
('25ce94f7-b78b-45de-8ce5-7224f6abf9f4', 'payment_recorded', 'App\\Models\\Role', 2, '{\"message\":\"Payment of 500,000 UGX received from customer Peter Jousha (CLI-0002). Ref: .\",\"payment_id\":3,\"client_id\":2,\"amount\":\"500000.00\"}', NULL, '2026-06-20 18:41:29', '2026-06-20 18:41:29'),
('29bc6249-7511-4233-9005-b4769e12e334', 'payment_recorded', 'App\\Models\\Role', 1, '{\"message\":\"Payment of 310,000 UGX received from customer Peter Jousha (CLI-0002). Ref: .\",\"payment_id\":4,\"client_id\":2,\"amount\":\"310000.00\"}', '2026-06-20 19:49:48', '2026-06-20 18:55:02', '2026-06-20 18:55:02'),
('33e683c1-dcf0-468b-a326-496d9f0cd91a', 'payment_recorded', 'App\\Models\\Role', 1, '{\"message\":\"Payment of 500,000 UGX received from customer Peter Jousha (CLI-0002). Ref: .\",\"payment_id\":3,\"client_id\":2,\"amount\":\"500000.00\"}', '2026-06-20 19:49:48', '2026-06-20 18:41:29', '2026-06-20 18:41:29'),
('5079132f-5deb-4f64-b622-5dc9b3fc3210', 'payment_recorded', 'App\\Models\\Role', 1, '{\"message\":\"Payment of 100,000 UGX received from customer Peter Jousha (CLI-0002). Ref: Invoice #INV-20260620-0003.\",\"payment_id\":2,\"client_id\":2,\"amount\":\"100000.00\"}', '2026-06-20 19:49:48', '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
('71237bec-adbc-47af-915c-60595075012a', 'refund_approved', 'App\\Models\\User', 1, '{\"message\":\"Refund Request #REF-20260620-0001 for 70,000 UGX has been APPROVED.\",\"refund_id\":1,\"amount\":\"70000.00\"}', '2026-06-20 17:52:33', '2026-06-20 16:56:50', '2026-06-20 16:56:50'),
('81733c50-632f-4246-85f2-9c05a19903f1', 'refund_requested', 'App\\Models\\Role', 1, '{\"message\":\"New Refund Request #REF-20260620-0001 for 70,000 UGX has been submitted for approval.\",\"refund_id\":1,\"amount\":70000}', '2026-06-20 17:52:33', '2026-06-20 16:56:43', '2026-06-20 16:56:43'),
('9b3059b5-26b3-4743-874c-221ab5d9fe1a', 'refund_requested', 'App\\Models\\Role', 2, '{\"message\":\"New Refund Request #REF-20260620-0001 for 70,000 UGX has been submitted for approval.\",\"refund_id\":1,\"amount\":70000}', NULL, '2026-06-20 16:56:43', '2026-06-20 16:56:43'),
('ab58892d-8950-4fd6-99b6-92c3b83782e0', 'payment_recorded', 'App\\Models\\Role', 2, '{\"message\":\"Payment of 310,000 UGX received from customer Peter Jousha (CLI-0002). Ref: .\",\"payment_id\":4,\"client_id\":2,\"amount\":\"310000.00\"}', NULL, '2026-06-20 18:55:02', '2026-06-20 18:55:02'),
('c35b187f-a43a-49e7-a5de-3afad0e9b163', 'payment_recorded', 'App\\Models\\Role', 2, '{\"message\":\"Payment of 100,000 UGX received from customer Peter Jousha (CLI-0002). Ref: Invoice #INV-20260620-0003.\",\"payment_id\":2,\"client_id\":2,\"amount\":\"100000.00\"}', NULL, '2026-06-20 17:54:19', '2026-06-20 17:54:19');

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

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

CREATE TABLE `payments` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `payment_number` varchar(255) NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `payment_method` enum('cash','bank_transfer','mobile_money','cheque','other') NOT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `status` enum('active','reversed') NOT NULL DEFAULT 'active',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `reversed_by` bigint(20) UNSIGNED DEFAULT NULL,
  `reversed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `payments` (`id`, `payment_number`, `client_id`, `amount`, `payment_method`, `reference`, `notes`, `status`, `created_by`, `reversed_by`, `reversed_at`, `created_at`, `updated_at`) VALUES
(1, 'PAY-20260620-0001', 1, 50000.00, 'cash', NULL, 'yes', 'active', 1, NULL, NULL, '2026-06-20 15:39:22', '2026-06-20 15:39:22'),
(2, 'PAY-20260620-0002', 2, 100000.00, 'cash', 'Invoice #INV-20260620-0003', 'POS Checkout Payment', 'active', 1, NULL, NULL, '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
(3, 'PAY-20260620-0003', 2, 500000.00, 'cash', NULL, NULL, 'active', 1, NULL, NULL, '2026-06-20 18:41:29', '2026-06-20 18:41:29'),
(4, 'PAY-20260620-0004', 2, 310000.00, 'cash', NULL, NULL, 'active', 1, NULL, NULL, '2026-06-20 18:55:02', '2026-06-20 18:55:02');

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

--
-- Table structure for table `payment_allocations`
--

CREATE TABLE `payment_allocations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `payment_id` bigint(20) UNSIGNED NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL,
  `allocated_amount` decimal(15,2) NOT NULL,
  `allocation_method` enum('fifo','manual','split') 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 `payment_allocations`
--

INSERT INTO `payment_allocations` (`id`, `payment_id`, `invoice_id`, `allocated_amount`, `allocation_method`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 50000.00, 'fifo', '2026-06-20 15:39:22', '2026-06-20 15:39:22'),
(2, 2, 3, 100000.00, 'manual', '2026-06-20 17:54:19', '2026-06-20 17:54:19'),
(3, 3, 2, 500000.00, 'fifo', '2026-06-20 18:41:29', '2026-06-20 18:41:29'),
(4, 4, 3, 110000.00, 'manual', '2026-06-20 18:55:02', '2026-06-20 18:55:02'),
(5, 4, 2, 200000.00, 'manual', '2026-06-20 19:10:39', '2026-06-20 19:10:39');

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

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

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

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

INSERT INTO `permissions` (`id`, `name`, `display_name`, `module`, `description`, `created_at`, `updated_at`) VALUES
(1, 'dashboard.view', 'View Dashboard', 'dashboard', 'Allow viewing dashboard statistics', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(2, 'users.manage', 'Manage Staff/Users', 'users', 'Add, edit, suspend users', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(3, 'roles.manage', 'Manage Roles & Overrides', 'users', 'Modify role permissions or override permissions per staff', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(4, 'clients.manage', 'Manage Clients', 'crm', 'Add and edit clients', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(5, 'clients.ledger', 'View Customer Ledgers', 'crm', 'Access receivable records and customer ledger statements', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(6, 'categories.manage', 'Manage Categories', 'inventory', 'Add and edit product/service categories', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(7, 'products.manage', 'Manage Products & Variants', 'inventory', 'Full CRUD on products, variant SKUs, barcodes and pricing', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(8, 'products.adjust_stock', 'Adjust Stock Levels', 'inventory', 'Manually adjust variant stock quantities', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(9, 'services.manage', 'Manage Services', 'inventory', 'Full CRUD on services sold', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(10, 'suppliers.manage', 'Manage Suppliers', 'purchasing', 'Add and edit suppliers', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(11, 'suppliers.ledger', 'View Supplier Ledgers', 'purchasing', 'Access payable records and supplier ledger statements', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(12, 'purchase_orders.create', 'Create Purchase Orders', 'purchasing', 'Create draft POs to order stock', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(13, 'purchase_orders.approve', 'Approve/Receive PO Stock', 'purchasing', 'Approve POs and receive stock into inventory', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(14, 'quotations.create', 'Create Quotations', 'sales', 'Generate and print customer quotations', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(15, 'quotations.convert', 'Convert Quotations to Invoices', 'sales', 'Convert quotations to official invoices', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(16, 'invoices.create', 'Create Invoices', 'sales', 'Create invoices from sales', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(17, 'sales.create', 'Process Checkout / POS', 'sales', 'Sell products/services at POS and record transactions', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(18, 'sales.void', 'Void Sales Transactions', 'sales', 'Void finalized invoices/sales', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(19, 'sales.refund', 'Refund Sales / Returns', 'sales', 'Execute sales refunds and return product stock', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(20, 'payments.create', 'Record Payments', 'payments', 'Record payment collections against client accounts', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(21, 'payments.edit', 'Edit Payment Records', 'payments', 'Edit or delete payment logs', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(22, 'debts.waive', 'Approve Debt Waivers', 'payments', 'Approve customer outstanding debt forgiveness', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(23, 'expenses.create', 'Submit Expense Requests', 'expenses', 'Log business expenses and upload receipts', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(24, 'expenses.approve', 'Approve Expense Claims', 'expenses', 'Manager approval of staff expense claims', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(25, 'reports.view', 'Access Analytics Reports', 'reports', 'View sales, profit, and debt aging reports', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(26, 'audit_logs.view', 'View System Audit Logs', 'support', 'Inspect immutable user activity trails', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(27, 'settings.manage', 'Manage Settings', 'support', 'Modify business configuration settings', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(28, 'backups.manage', 'Manage Backups', 'support', 'Create and restore system database backups', '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(29, 'sales.edit', 'Edit Finalized Sale', 'sales', 'Modify or edit details of finalized sales', '2026-06-20 18:07:50', '2026-06-20 18:07:50'),
(30, 'clients.create', 'Create Client', 'crm', 'Add new clients to the system', '2026-06-20 18:07:50', '2026-06-20 18:07:50'),
(31, 'clients.edit', 'Edit Client', 'crm', 'Modify client profiles and credentials', '2026-06-20 18:07:50', '2026-06-20 18:07:50'),
(32, 'products.create', 'Add Product', 'inventory', 'Create and register new products/variants', '2026-06-20 18:07:50', '2026-06-20 18:07:50'),
(33, 'products.edit', 'Edit Product', 'inventory', 'Modify existing product/variant information', '2026-06-20 18:07:50', '2026-06-20 18:07:50'),
(34, 'backups.restore', 'Restore Backup', 'support', 'Restore database backups', '2026-06-20 18:07:50', '2026-06-20 18:07:50');

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

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

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_code` varchar(255) NOT NULL,
  `product_name` varchar(255) NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text DEFAULT NULL,
  `base_unit` varchar(255) NOT NULL DEFAULT 'piece',
  `tax_type` enum('vatable','exempt','zero_rated') NOT NULL DEFAULT 'vatable',
  `product_image` varchar(255) DEFAULT NULL,
  `has_variants` tinyint(1) NOT NULL DEFAULT 0,
  `status` enum('active','archived') NOT NULL DEFAULT 'active',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `products` (`id`, `product_code`, `product_name`, `category_id`, `brand_id`, `description`, `base_unit`, `tax_type`, `product_image`, `has_variants`, `status`, `created_by`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'PRD-0001', 'kalangala', 1, NULL, NULL, 'sqm', 'exempt', NULL, 0, 'active', 1, NULL, '2026-06-20 14:44:12', '2026-06-20 17:55:41'),
(2, 'PRD-0002', 'Brothers Printers', 3, NULL, NULL, 'piece', 'exempt', NULL, 0, 'active', 1, NULL, '2026-06-20 15:59:07', '2026-06-20 15:59:07');

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

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

CREATE TABLE `product_variants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `sku` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `variant_name` varchar(255) NOT NULL,
  `buying_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `selling_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `stock_qty` int(11) NOT NULL DEFAULT 0,
  `reorder_level` int(11) NOT NULL DEFAULT 5,
  `track_stock` tinyint(1) NOT NULL DEFAULT 1,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `product_variants` (`id`, `product_id`, `sku`, `barcode`, `variant_name`, `buying_price`, `selling_price`, `stock_qty`, `reorder_level`, `track_stock`, `status`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 1, '01', NULL, 'kalangala (Default)', 10000.00, 35000.00, 17, 5, 1, 'active', NULL, '2026-06-20 14:44:12', '2026-06-20 17:54:19'),
(2, 2, '03', NULL, 'Brothers Printers (Default)', 200000.00, 350000.00, 49, 5, 1, 'active', NULL, '2026-06-20 15:59:07', '2026-06-20 17:53:23');

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

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

CREATE TABLE `purchase_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `po_number` varchar(255) NOT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `order_date` date NOT NULL,
  `expected_delivery` date DEFAULT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('draft','ordered','partial','received','cancelled') NOT NULL DEFAULT 'draft',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `received_at` timestamp NULL DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `purchase_orders` (`id`, `po_number`, `supplier_id`, `order_date`, `expected_delivery`, `subtotal`, `tax_amount`, `discount`, `total`, `status`, `notes`, `created_by`, `approved_by`, `approved_at`, `received_at`, `deleted_at`, `created_at`, `updated_at`) VALUES
(2, 'PO-20260620-0001', 1, '2026-06-20', '2026-06-20', 0.00, 0.00, 0.00, 0.00, 'ordered', NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 14:58:56', '2026-06-20 14:58:56'),
(3, 'PO-20260620-0002', 1, '2026-06-20', '2026-06-20', 300000.00, 0.00, 0.00, 300000.00, 'received', NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 15:31:45', '2026-06-20 15:37:00'),
(4, 'PO-20260620-0003', 1, '2026-06-20', NULL, 10000000.00, 0.00, 0.00, 10000000.00, 'received', NULL, 1, NULL, NULL, '2026-06-20 16:00:26', NULL, '2026-06-20 16:00:04', '2026-06-20 16:00:26');

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

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

CREATE TABLE `purchase_order_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `ordered_qty` int(11) NOT NULL,
  `received_qty` int(11) NOT NULL DEFAULT 0,
  `unit_price` decimal(15,2) NOT NULL,
  `total_price` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `purchase_order_items` (`id`, `purchase_order_id`, `product_variant_id`, `ordered_qty`, `received_qty`, `unit_price`, `total_price`, `created_at`, `updated_at`) VALUES
(1, 2, 1, 30, 0, 10000.00, 300000.00, '2026-06-20 14:58:56', '2026-06-20 14:58:56'),
(2, 3, 1, 30, 0, 10000.00, 300000.00, '2026-06-20 15:31:45', '2026-06-20 15:31:45'),
(3, 4, 2, 50, 0, 200000.00, 10000000.00, '2026-06-20 16:00:04', '2026-06-20 16:00:04');

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

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

CREATE TABLE `quotations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `quotation_number` varchar(255) NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `quotation_date` date NOT NULL,
  `expiry_date` date DEFAULT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_rate` decimal(5,2) NOT NULL DEFAULT 18.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('draft','sent','approved','rejected','expired','converted') NOT NULL DEFAULT 'draft',
  `notes` text DEFAULT NULL,
  `terms` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `converted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `converted_at` timestamp NULL DEFAULT NULL,
  `deleted_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 `quotation_items`
--

CREATE TABLE `quotation_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `quotation_id` bigint(20) UNSIGNED NOT NULL,
  `item_type` enum('product','service') NOT NULL,
  `item_id` bigint(20) UNSIGNED NOT NULL,
  `item_name` varchar(255) NOT NULL,
  `item_code` varchar(255) DEFAULT NULL,
  `description` text DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(15,2) NOT NULL,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_price` decimal(15,2) 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 `refunds`
--

CREATE TABLE `refunds` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `refund_number` varchar(255) NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `refund_amount` decimal(15,2) NOT NULL,
  `refund_type` enum('product_return','service_refund','invoice_reversal','credit_note') NOT NULL,
  `reason` text NOT NULL,
  `status` enum('pending','approved','rejected','completed') NOT NULL DEFAULT 'pending',
  `stock_restored` tinyint(1) NOT NULL DEFAULT 0,
  `ledger_adjusted` tinyint(1) NOT NULL DEFAULT 0,
  `requested_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_by` bigint(20) UNSIGNED DEFAULT NULL,
  `approved_at` timestamp NULL DEFAULT NULL,
  `rejection_reason` text DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `refunds`
--

INSERT INTO `refunds` (`id`, `refund_number`, `invoice_id`, `client_id`, `refund_amount`, `refund_type`, `reason`, `status`, `stock_restored`, `ledger_adjusted`, `requested_by`, `approved_by`, `approved_at`, `rejection_reason`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'REF-20260620-0001', 1, 1, 70000.00, 'invoice_reversal', 'double billing', 'approved', 1, 1, 1, 1, '2026-06-20 16:56:50', NULL, NULL, '2026-06-20 16:56:43', '2026-06-20 16:56:50');

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

--
-- Table structure for table `refund_items`
--

CREATE TABLE `refund_items` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `refund_id` bigint(20) UNSIGNED NOT NULL,
  `item_type` enum('product','service') NOT NULL,
  `item_id` bigint(20) UNSIGNED NOT NULL,
  `item_name` varchar(255) NOT NULL,
  `quantity` int(11) NOT NULL DEFAULT 1,
  `unit_price` decimal(15,2) NOT NULL,
  `total_price` decimal(15,2) NOT NULL,
  `stock_restored` 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 `refund_items`
--

INSERT INTO `refund_items` (`id`, `refund_id`, `item_type`, `item_id`, `item_name`, `quantity`, `unit_price`, `total_price`, `stock_restored`, `created_at`, `updated_at`) VALUES
(1, 1, 'product', 1, 'kalangala (Default)', 2, 35000.00, 70000.00, 1, '2026-06-20 16:56:43', '2026-06-20 16:56:43');

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

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

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

INSERT INTO `roles` (`id`, `name`, `display_name`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'super_admin', 'Super Admin', 'System Owner with unrestricted access.', 1, '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(2, 'manager', 'Manager', 'Business manager handling daily operations, inventory, and finance.', 1, '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(3, 'supervisor', 'Supervisor', 'Shift supervisor overseeing POS checkout and cashiers.', 1, '2026-06-20 14:21:16', '2026-06-20 14:21:16'),
(4, 'cashier', 'Cashier', 'Frontline staff processing sales and payments.', 1, '2026-06-20 14:21:16', '2026-06-20 14:21:16');

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

--
-- 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,
  `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`, `created_at`, `updated_at`) VALUES
(1, 1, 1, NULL, NULL),
(2, 1, 2, NULL, NULL),
(3, 1, 3, NULL, NULL),
(4, 1, 4, NULL, NULL),
(5, 1, 5, NULL, NULL),
(6, 1, 6, NULL, NULL),
(7, 1, 7, NULL, NULL),
(8, 1, 8, NULL, NULL),
(9, 1, 9, NULL, NULL),
(10, 1, 10, NULL, NULL),
(11, 1, 11, NULL, NULL),
(12, 1, 12, NULL, NULL),
(13, 1, 13, NULL, NULL),
(14, 1, 14, NULL, NULL),
(15, 1, 15, NULL, NULL),
(16, 1, 16, NULL, NULL),
(17, 1, 17, NULL, NULL),
(18, 1, 18, NULL, NULL),
(19, 1, 19, NULL, NULL),
(20, 1, 20, NULL, NULL),
(21, 1, 21, NULL, NULL),
(22, 1, 22, NULL, NULL),
(23, 1, 23, NULL, NULL),
(24, 1, 24, NULL, NULL),
(25, 1, 25, NULL, NULL),
(26, 1, 26, NULL, NULL),
(27, 1, 27, NULL, NULL),
(28, 1, 28, NULL, NULL),
(29, 2, 1, NULL, NULL),
(35, 2, 8, NULL, NULL),
(39, 2, 12, NULL, NULL),
(40, 2, 13, NULL, NULL),
(41, 2, 14, NULL, NULL),
(42, 2, 15, NULL, NULL),
(43, 2, 16, NULL, NULL),
(44, 2, 17, NULL, NULL),
(45, 2, 18, NULL, NULL),
(46, 2, 19, NULL, NULL),
(47, 2, 20, NULL, NULL),
(48, 2, 21, NULL, NULL),
(50, 2, 23, NULL, NULL),
(51, 2, 24, NULL, NULL),
(52, 2, 25, NULL, NULL),
(54, 3, 1, NULL, NULL),
(63, 3, 14, NULL, NULL),
(64, 3, 15, NULL, NULL),
(65, 3, 16, NULL, NULL),
(67, 3, 20, NULL, NULL),
(72, 4, 14, NULL, NULL),
(73, 4, 16, NULL, NULL),
(74, 4, 17, NULL, NULL),
(75, 4, 20, NULL, NULL),
(77, 1, 29, NULL, NULL),
(78, 1, 30, NULL, NULL),
(79, 1, 31, NULL, NULL),
(80, 1, 32, NULL, NULL),
(81, 1, 33, NULL, NULL),
(82, 1, 34, NULL, NULL),
(83, 2, 30, NULL, NULL),
(84, 2, 31, NULL, NULL),
(85, 2, 32, NULL, NULL),
(86, 2, 33, NULL, NULL),
(87, 3, 30, NULL, NULL),
(88, 3, 31, NULL, NULL),
(89, 4, 30, NULL, NULL),
(90, 2, 5, NULL, NULL),
(91, 2, 6, NULL, NULL),
(92, 2, 9, NULL, NULL),
(93, 2, 10, NULL, NULL),
(94, 2, 11, NULL, NULL),
(95, 3, 5, NULL, NULL),
(96, 4, 5, NULL, NULL),
(97, 4, 1, NULL, NULL),
(98, 3, 23, NULL, NULL),
(99, 4, 15, NULL, NULL),
(100, 4, 23, NULL, NULL);

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

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

CREATE TABLE `sales` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sale_number` varchar(255) NOT NULL,
  `invoice_id` bigint(20) UNSIGNED NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `total_amount` decimal(15,2) NOT NULL,
  `amount_paid` decimal(15,2) NOT NULL DEFAULT 0.00,
  `change_given` decimal(15,2) NOT NULL DEFAULT 0.00,
  `payment_method` enum('cash','bank_transfer','mobile_money','cheque','other','mixed','credit') NOT NULL,
  `status` enum('completed','voided','refunded','partial_refund') NOT NULL DEFAULT 'completed',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `voided_by` bigint(20) UNSIGNED DEFAULT NULL,
  `voided_at` timestamp NULL DEFAULT NULL,
  `void_reason` text DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `sales` (`id`, `sale_number`, `invoice_id`, `client_id`, `total_amount`, `amount_paid`, `change_given`, `payment_method`, `status`, `notes`, `created_by`, `voided_by`, `voided_at`, `void_reason`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'SALE-20260620-0001', 1, 1, 82600.00, 0.00, 0.00, 'cash', 'completed', NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 14:52:42', '2026-06-20 14:52:42'),
(2, 'SALE-20260620-0002', 2, 2, 700000.00, 0.00, 0.00, 'cash', 'completed', NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(3, 'SALE-20260620-0003', 3, 2, 210000.00, 100000.00, 0.00, 'cash', 'completed', NULL, 1, NULL, NULL, NULL, NULL, '2026-06-20 17:54:19', '2026-06-20 17:54:19');

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

--
-- Table structure for table `services`
--

CREATE TABLE `services` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `service_code` varchar(255) NOT NULL,
  `service_name` varchar(255) NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `default_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `description` text DEFAULT NULL,
  `tax_type` enum('vatable','exempt','zero_rated') NOT NULL DEFAULT 'vatable',
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `services`
--

INSERT INTO `services` (`id`, `service_code`, `service_name`, `category_id`, `default_price`, `description`, `tax_type`, `status`, `created_by`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'SRV-0001', 'Graphics', 2, 10000.00, NULL, 'vatable', 'active', NULL, NULL, '2026-06-20 14:57:54', '2026-06-20 14:57:54');

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

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

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

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

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('7BIVYE1SN5xea0FDMPyCixH4rVsmZZ02VyoNQpYz', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiVWJ0U2U4QUJ6ZjlmQ3RzUnVIZUgwQ3RBMjR5ZWZOamxSSFA3MTQ0QSI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjA6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fX0=', 1781996981),
('fQkmSlvgOamQ4bcKwaAmYyXqKSlwk2JmNkxlFZtQ', 2, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiSzNUR2RzOW5JQUhHUXIySUhQRXk0bWJBbFJVT01mcVducTBBMjJNMCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjQ6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9kYXNoYm9hcmQiO3M6NToicm91dGUiO3M6OToiZGFzaGJvYXJkIjt9czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6MjtzOjE4OiJsYXN0X2FjdGl2aXR5X3RpbWUiO2k6MTc4MTk5MTI3MTt9', 1781991272),
('lpa8pQ96110L9JxqlrL8sfMsXYPYxzXwePzznCqF', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiTU5Mek51NmMySHp0S2pPT1ZMNHRQTjFlekxsVWFiSXdKUEJPUU1DMCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjA6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fX0=', 1781993178),
('Occ2dxL119crSKwo4NVRCXBvS4dCGxjLxkUSCF9G', 3, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiUjc1MXNJMEZFVE5sclVURHVpVTF6UlhSM2YybzlSekUxd3ExVGtVYyI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjQ6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9kYXNoYm9hcmQiO3M6NToicm91dGUiO3M6OToiZGFzaGJvYXJkIjt9czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6MztzOjE4OiJsYXN0X2FjdGl2aXR5X3RpbWUiO2k6MTc4MjA3NDgxOTt9', 1782074819),
('PYF76dkvJUI3d85imi9j9GRJoOffff4585RpBqIq', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiazZiVkdUWGRrUnNSeE05b215cXdlMTJ5WVZjSDNsSmxPWldRNWxpQiI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjA6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fX0=', 1781996059),
('QADo8NLqsGwIg5SDu5wHs3j4siFUNArWsjHLZR4m', 2, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiRklVR0x1bnk4aFdLY2pZZHE1WXp5bFRWeUtCclNMekljTFd5b1p5SyI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjA6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjI7czoxODoibGFzdF9hY3Rpdml0eV90aW1lIjtpOjE3ODE5OTMwMTI7fQ==', 1781993012),
('t8CqAxyPQ8GkJPh8tb0oO32BYUU0yvcwAzyHbOge', 2, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Avast/148.0.0.0', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiQm1qQkNCYUhkczFhQzBZMmdzTUpTSFNJM2J0WFo5SnQyUkFVUjB3MiI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjQ6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9kYXNoYm9hcmQiO3M6NToicm91dGUiO3M6OToiZGFzaGJvYXJkIjt9czo1MDoibG9naW5fd2ViXzU5YmEzNmFkZGMyYjJmOTQwMTU4MGYwMTRjN2Y1OGVhNGUzMDk4OWQiO2k6MjtzOjE4OiJsYXN0X2FjdGl2aXR5X3RpbWUiO2k6MTc4MTk5MjkyOTt9', 1781992929),
('tGpMQbxdyxOMnf4qmHT207L1JPmHDKkGjYYFtgaR', NULL, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiYjFtT0ZrYUZiOFdoTHhORGZEU25FblppOFBBUkptamxFZEE1Um9DMiI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NjA6Imh0dHA6Ly9sb2NhbGhvc3QvUFJFRVolMjBCUkFORFMlMjBOQVNTRVIlMjBST0FEL3B1YmxpYy9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fX0=', 1781992815),
('Ys8bmwgg2e4Q8vVzAADGGZhshG8QB89ZtLfAbXI3', NULL, '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiblZUTWJtWXR0djdRdndWNnZ2SXBlRXlacTZITDY3VWhJek5UY2hNdCI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6Mjc6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9sb2dpbiI7czo1OiJyb3V0ZSI7czo1OiJsb2dpbiI7fX0=', 1781995960);

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

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

CREATE TABLE `stock_movements` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('purchase','sale','return','adjustment_in','adjustment_out','transfer_in','transfer_out') NOT NULL,
  `quantity` int(11) NOT NULL,
  `stock_before` int(11) NOT NULL,
  `stock_after` int(11) NOT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `stock_movements` (`id`, `product_variant_id`, `type`, `quantity`, `stock_before`, `stock_after`, `reference`, `notes`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'adjustment_in', 3, 0, 3, NULL, 'adjustment', 1, '2026-06-20 14:52:05', '2026-06-20 14:52:05'),
(2, 1, 'sale', 2, 3, 1, 'INV-20260620-0001', 'POS Checkout Sale', 1, '2026-06-20 14:52:42', '2026-06-20 14:52:42'),
(3, 1, 'purchase', 30, 1, 31, 'PO-20260620-0002', 'PO stock delivery received', 1, '2026-06-20 15:37:00', '2026-06-20 15:37:00'),
(4, 2, 'purchase', 50, 0, 50, 'PO-20260620-0003', 'PO stock delivery received', 1, '2026-06-20 16:00:26', '2026-06-20 16:00:26'),
(5, 1, 'return', 2, 31, 33, 'REF-20260620-0001', 'Stock returned from Refund #REF-20260620-0001', 1, '2026-06-20 16:56:50', '2026-06-20 16:56:50'),
(6, 2, 'sale', 1, 50, 49, 'INV-20260620-0002', 'POS Checkout Sale', 1, '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(7, 1, 'sale', 10, 33, 23, 'INV-20260620-0002', 'POS Checkout Sale', 1, '2026-06-20 17:53:23', '2026-06-20 17:53:23'),
(8, 1, 'sale', 6, 23, 17, 'INV-20260620-0003', 'POS Checkout Sale', 1, '2026-06-20 17:54:19', '2026-06-20 17:54:19');

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

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

CREATE TABLE `suppliers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `supplier_code` varchar(255) NOT NULL,
  `company_name` varchar(255) NOT NULL,
  `contact_person` varchar(255) DEFAULT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `tin` varchar(255) DEFAULT NULL,
  `outstanding_balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('active','inactive') NOT NULL DEFAULT 'active',
  `notes` text DEFAULT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `deleted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `suppliers`
--

INSERT INTO `suppliers` (`id`, `supplier_code`, `company_name`, `contact_person`, `phone`, `email`, `address`, `tin`, `outstanding_balance`, `status`, `notes`, `created_by`, `deleted_at`, `created_at`, `updated_at`) VALUES
(1, 'SUP-0001', 'Taply', 'Fred Benjamin', '+256776913325', 'fameofgodstudios@gmail.com', '2a, kamapla', NULL, 10300000.00, 'active', NULL, NULL, NULL, '2026-06-20 14:48:02', '2026-06-20 16:00:26');

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

--
-- Table structure for table `supplier_ledgers`
--

CREATE TABLE `supplier_ledgers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `reference` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `credit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `balance` decimal(15,2) NOT NULL DEFAULT 0.00,
  `type` varchar(255) NOT NULL,
  `created_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `supplier_ledgers`
--

INSERT INTO `supplier_ledgers` (`id`, `supplier_id`, `reference`, `description`, `debit`, `credit`, `balance`, `type`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'PO-20260620-0002', 'Purchase Order #PO-20260620-0002 stock received', 0.00, 300000.00, 300000.00, 'purchase', 1, '2026-06-20 15:37:00', '2026-06-20 15:37:00'),
(2, 1, 'PO-20260620-0003', 'Purchase Order #PO-20260620-0003 stock received', 0.00, 10000000.00, 10300000.00, 'purchase', 1, '2026-06-20 16:00:26', '2026-06-20 16:00:26');

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

--
-- Table structure for table `user_permissions`
--

CREATE TABLE `user_permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `granted` tinyint(1) NOT NULL DEFAULT 1,
  `granted_by` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `audit_logs`
--
ALTER TABLE `audit_logs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `audit_logs_entity_type_entity_id_index` (`entity_type`,`entity_id`),
  ADD KEY `audit_logs_user_id_created_at_index` (`user_id`,`created_at`),
  ADD KEY `audit_logs_action_index` (`action`);

--
-- Indexes for table `backups`
--
ALTER TABLE `backups`
  ADD PRIMARY KEY (`id`),
  ADD KEY `backups_created_by_foreign` (`created_by`);

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

--
-- Indexes for table `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `categories_name_type_unique` (`name`,`type`);

--
-- Indexes for table `clients`
--
ALTER TABLE `clients`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `clients_client_code_unique` (`client_code`),
  ADD KEY `clients_created_by_foreign` (`created_by`),
  ADD KEY `clients_phone_index` (`phone`),
  ADD KEY `clients_status_index` (`status`);

--
-- Indexes for table `customer_ledgers`
--
ALTER TABLE `customer_ledgers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_ledgers_created_by_foreign` (`created_by`),
  ADD KEY `customer_ledgers_client_id_created_at_index` (`client_id`,`created_at`);

--
-- Indexes for table `debts`
--
ALTER TABLE `debts`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debts_invoice_id_foreign` (`invoice_id`),
  ADD KEY `debts_client_id_status_index` (`client_id`,`status`),
  ADD KEY `debts_status_due_date_index` (`status`,`due_date`);

--
-- Indexes for table `debt_waivers`
--
ALTER TABLE `debt_waivers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `debt_waivers_debt_id_foreign` (`debt_id`),
  ADD KEY `debt_waivers_client_id_foreign` (`client_id`),
  ADD KEY `debt_waivers_requested_by_foreign` (`requested_by`),
  ADD KEY `debt_waivers_approved_by_foreign` (`approved_by`);

--
-- Indexes for table `expenses`
--
ALTER TABLE `expenses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `expenses_expense_number_unique` (`expense_number`),
  ADD KEY `expenses_category_id_foreign` (`category_id`),
  ADD KEY `expenses_created_by_foreign` (`created_by`),
  ADD KEY `expenses_approved_by_foreign` (`approved_by`),
  ADD KEY `expenses_status_expense_date_index` (`status`,`expense_date`);

--
-- 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 `invoices`
--
ALTER TABLE `invoices`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `invoices_invoice_number_unique` (`invoice_number`),
  ADD KEY `invoices_quotation_id_foreign` (`quotation_id`),
  ADD KEY `invoices_created_by_foreign` (`created_by`),
  ADD KEY `invoices_voided_by_foreign` (`voided_by`),
  ADD KEY `invoices_client_id_status_index` (`client_id`,`status`),
  ADD KEY `invoices_status_due_date_index` (`status`,`due_date`);

--
-- Indexes for table `invoice_items`
--
ALTER TABLE `invoice_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `invoice_items_invoice_id_foreign` (`invoice_id`);

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

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

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

--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
  ADD PRIMARY KEY (`id`),
  ADD KEY `notifications_notifiable_type_notifiable_id_index` (`notifiable_type`,`notifiable_id`);

--
-- Indexes for table `payments`
--
ALTER TABLE `payments`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `payments_payment_number_unique` (`payment_number`),
  ADD KEY `payments_created_by_foreign` (`created_by`),
  ADD KEY `payments_reversed_by_foreign` (`reversed_by`),
  ADD KEY `payments_client_id_status_index` (`client_id`,`status`);

--
-- Indexes for table `payment_allocations`
--
ALTER TABLE `payment_allocations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `payment_allocations_invoice_id_foreign` (`invoice_id`),
  ADD KEY `payment_allocations_payment_id_invoice_id_index` (`payment_id`,`invoice_id`);

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

--
-- Indexes for table `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `products_product_code_unique` (`product_code`),
  ADD KEY `products_category_id_foreign` (`category_id`),
  ADD KEY `products_brand_id_foreign` (`brand_id`),
  ADD KEY `products_created_by_foreign` (`created_by`),
  ADD KEY `products_status_category_id_index` (`status`,`category_id`);

--
-- Indexes for table `product_variants`
--
ALTER TABLE `product_variants`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_variants_sku_unique` (`sku`),
  ADD UNIQUE KEY `product_variants_barcode_unique` (`barcode`),
  ADD KEY `product_variants_product_id_status_index` (`product_id`,`status`),
  ADD KEY `product_variants_barcode_index` (`barcode`);

--
-- Indexes for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchase_orders_po_number_unique` (`po_number`),
  ADD KEY `purchase_orders_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchase_orders_created_by_foreign` (`created_by`),
  ADD KEY `purchase_orders_approved_by_foreign` (`approved_by`),
  ADD KEY `purchase_orders_status_supplier_id_index` (`status`,`supplier_id`);

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

--
-- Indexes for table `quotations`
--
ALTER TABLE `quotations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `quotations_quotation_number_unique` (`quotation_number`),
  ADD KEY `quotations_created_by_foreign` (`created_by`),
  ADD KEY `quotations_converted_by_foreign` (`converted_by`),
  ADD KEY `quotations_client_id_status_index` (`client_id`,`status`);

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

--
-- Indexes for table `refunds`
--
ALTER TABLE `refunds`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `refunds_refund_number_unique` (`refund_number`),
  ADD KEY `refunds_invoice_id_foreign` (`invoice_id`),
  ADD KEY `refunds_requested_by_foreign` (`requested_by`),
  ADD KEY `refunds_approved_by_foreign` (`approved_by`),
  ADD KEY `refunds_client_id_status_index` (`client_id`,`status`);

--
-- Indexes for table `refund_items`
--
ALTER TABLE `refund_items`
  ADD PRIMARY KEY (`id`),
  ADD KEY `refund_items_refund_id_foreign` (`refund_id`);

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

--
-- 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_sale_number_unique` (`sale_number`),
  ADD KEY `sales_invoice_id_foreign` (`invoice_id`),
  ADD KEY `sales_created_by_foreign` (`created_by`),
  ADD KEY `sales_voided_by_foreign` (`voided_by`),
  ADD KEY `sales_client_id_status_index` (`client_id`,`status`),
  ADD KEY `sales_created_at_index` (`created_at`);

--
-- Indexes for table `services`
--
ALTER TABLE `services`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `services_service_code_unique` (`service_code`),
  ADD KEY `services_category_id_foreign` (`category_id`),
  ADD KEY `services_created_by_foreign` (`created_by`);

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

--
-- Indexes for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_movements_created_by_foreign` (`created_by`),
  ADD KEY `stock_movements_product_variant_id_created_at_index` (`product_variant_id`,`created_at`);

--
-- Indexes for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `suppliers_supplier_code_unique` (`supplier_code`),
  ADD KEY `suppliers_created_by_foreign` (`created_by`);

--
-- Indexes for table `supplier_ledgers`
--
ALTER TABLE `supplier_ledgers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `supplier_ledgers_created_by_foreign` (`created_by`),
  ADD KEY `supplier_ledgers_supplier_id_created_at_index` (`supplier_id`,`created_at`);

--
-- Indexes for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `user_permissions_user_id_permission_id_unique` (`user_id`,`permission_id`),
  ADD KEY `user_permissions_permission_id_foreign` (`permission_id`),
  ADD KEY `user_permissions_granted_by_foreign` (`granted_by`);

--
-- AUTO_INCREMENT for dumped tables
--

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

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

--
-- AUTO_INCREMENT for table `brands`
--
ALTER TABLE `brands`
  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=4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- 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_ledgers`
--
ALTER TABLE `supplier_ledgers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

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

--
-- Constraints for dumped tables
--

--
-- Constraints for table `audit_logs`
--
ALTER TABLE `audit_logs`
  ADD CONSTRAINT `audit_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `backups`
--
ALTER TABLE `backups`
  ADD CONSTRAINT `backups_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `clients`
--
ALTER TABLE `clients`
  ADD CONSTRAINT `clients_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `customer_ledgers`
--
ALTER TABLE `customer_ledgers`
  ADD CONSTRAINT `customer_ledgers_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `customer_ledgers_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `debts`
--
ALTER TABLE `debts`
  ADD CONSTRAINT `debts_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `debts_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`);

--
-- Constraints for table `debt_waivers`
--
ALTER TABLE `debt_waivers`
  ADD CONSTRAINT `debt_waivers_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `debt_waivers_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `debt_waivers_debt_id_foreign` FOREIGN KEY (`debt_id`) REFERENCES `debts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `debt_waivers_requested_by_foreign` FOREIGN KEY (`requested_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `expenses`
--
ALTER TABLE `expenses`
  ADD CONSTRAINT `expenses_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `expenses_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `expense_categories` (`id`),
  ADD CONSTRAINT `expenses_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `invoices`
--
ALTER TABLE `invoices`
  ADD CONSTRAINT `invoices_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `invoices_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `invoices_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `invoices_voided_by_foreign` FOREIGN KEY (`voided_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `invoice_items`
--
ALTER TABLE `invoice_items`
  ADD CONSTRAINT `invoice_items_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `payments`
--
ALTER TABLE `payments`
  ADD CONSTRAINT `payments_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `payments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `payments_reversed_by_foreign` FOREIGN KEY (`reversed_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `payment_allocations`
--
ALTER TABLE `payment_allocations`
  ADD CONSTRAINT `payment_allocations_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `payment_allocations_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payments` (`id`) ON DELETE CASCADE;

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

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

--
-- Constraints for table `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD CONSTRAINT `purchase_orders_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_orders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_orders_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

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

--
-- Constraints for table `quotations`
--
ALTER TABLE `quotations`
  ADD CONSTRAINT `quotations_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `quotations_converted_by_foreign` FOREIGN KEY (`converted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `quotations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

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

--
-- Constraints for table `refunds`
--
ALTER TABLE `refunds`
  ADD CONSTRAINT `refunds_approved_by_foreign` FOREIGN KEY (`approved_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `refunds_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `refunds_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`),
  ADD CONSTRAINT `refunds_requested_by_foreign` FOREIGN KEY (`requested_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `refund_items`
--
ALTER TABLE `refund_items`
  ADD CONSTRAINT `refund_items_refund_id_foreign` FOREIGN KEY (`refund_id`) REFERENCES `refunds` (`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 `sales`
--
ALTER TABLE `sales`
  ADD CONSTRAINT `sales_client_id_foreign` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`),
  ADD CONSTRAINT `sales_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `sales_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`),
  ADD CONSTRAINT `sales_voided_by_foreign` FOREIGN KEY (`voided_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `services`
--
ALTER TABLE `services`
  ADD CONSTRAINT `services_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `services_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD CONSTRAINT `stock_movements_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `stock_movements_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `suppliers`
--
ALTER TABLE `suppliers`
  ADD CONSTRAINT `suppliers_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Constraints for table `supplier_ledgers`
--
ALTER TABLE `supplier_ledgers`
  ADD CONSTRAINT `supplier_ledgers_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `supplier_ledgers_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE;

--
-- Constraints for table `user_permissions`
--
ALTER TABLE `user_permissions`
  ADD CONSTRAINT `user_permissions_granted_by_foreign` FOREIGN KEY (`granted_by`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `user_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `user_permissions_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;

