diff --git a/complete_schema.sql b/complete_schema.sql new file mode 100644 index 0000000..5d94d0a --- /dev/null +++ b/complete_schema.sql @@ -0,0 +1,1651 @@ +/*M!999999\- enable the sandbox mode */ +-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64) +-- +-- Host: 127.0.0.1 Database: app_38471 +-- ------------------------------------------------------ +-- Server version 10.11.14-MariaDB-0+deb12u2 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `acc_accounts` +-- + +DROP TABLE IF EXISTS `acc_accounts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `acc_accounts` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(20) NOT NULL, + `name_en` varchar(100) NOT NULL, + `name_ar` varchar(100) NOT NULL, + `type` enum('asset','liability','equity','revenue','expense') NOT NULL, + `parent_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`), + KEY `parent_id` (`parent_id`), + CONSTRAINT `acc_accounts_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `acc_accounts` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `acc_accounts` +-- + +LOCK TABLES `acc_accounts` WRITE; +/*!40000 ALTER TABLE `acc_accounts` DISABLE KEYS */; +INSERT INTO `acc_accounts` VALUES +(1,'1000','Assets','الأصول','asset',NULL), +(2,'1100','Cash on Hand','النقدية','asset',1), +(3,'1200','Bank Account','حساب البنك','asset',1), +(4,'1300','Accounts Receivable','حسابات العملاء','asset',1), +(5,'1400','Inventory','المخزون','asset',1), +(6,'2000','Liabilities','الالتزامات','liability',NULL), +(7,'2100','Accounts Payable','حسابات الموردين','liability',6), +(8,'3000','Equity','حقوق الملكية','equity',NULL), +(9,'4000','Revenue','الإيرادات','revenue',NULL), +(10,'4100','Sales Revenue','إيرادات المبيعات','revenue',9), +(11,'5000','Expenses','المصروفات','expense',NULL), +(12,'5100','Cost of Goods Sold','تكلفة البضاعة المباعة','expense',11), +(13,'5200','Operating Expenses','مصاريف تشغيلية','expense',11), +(14,'1500','VAT Input','ضريبة القيمة المضافة - مدخلات','asset',1), +(15,'2300','VAT Payable','ضريبة القيمة المضافة - مستحقة','liability',6); +/*!40000 ALTER TABLE `acc_accounts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `acc_journal_entries` +-- + +DROP TABLE IF EXISTS `acc_journal_entries`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `acc_journal_entries` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `entry_date` date NOT NULL, + `description` text DEFAULT NULL, + `reference` varchar(100) DEFAULT NULL, + `source_type` varchar(50) DEFAULT NULL, + `source_id` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `acc_journal_entries` +-- + +LOCK TABLES `acc_journal_entries` WRITE; +/*!40000 ALTER TABLE `acc_journal_entries` DISABLE KEYS */; +INSERT INTO `acc_journal_entries` VALUES +(46,'2026-02-16','Sale Invoice #1','INV-1','invoice',1,'2026-02-18 02:04:43'), +(47,'2026-02-16','Sale Invoice #2','INV-2','invoice',2,'2026-02-18 02:04:44'), +(48,'2026-02-16','Sale Invoice #3','INV-3','invoice',3,'2026-02-18 02:04:44'), +(49,'2026-02-16','Sale Invoice #4','INV-4','invoice',4,'2026-02-18 02:04:44'), +(50,'2026-02-16','Sale Invoice #5','INV-5','invoice',5,'2026-02-18 02:04:44'), +(51,'2026-02-16','Purchase Invoice #6','PINV-6','invoice',6,'2026-02-18 02:04:45'), +(52,'2026-02-16','Sale Invoice #12','INV-12','invoice',12,'2026-02-18 02:04:45'), +(53,'2026-02-16','Sale Invoice #14','INV-14','invoice',14,'2026-02-18 02:04:45'), +(54,'2026-02-16','Sale Invoice #15','INV-15','invoice',15,'2026-02-18 02:04:45'), +(55,'2026-02-16','Sale Invoice #16','INV-16','invoice',16,'2026-02-18 02:04:45'), +(56,'2026-02-16','Sale Invoice #17','INV-17','invoice',17,'2026-02-18 02:04:45'), +(57,'2026-02-16','Sale Invoice #18','INV-18','invoice',18,'2026-02-18 02:04:45'), +(58,'2026-02-16','Sale Invoice #19','INV-19','invoice',19,'2026-02-18 02:04:45'), +(59,'2026-02-16','Sale Invoice #20','INV-20','invoice',20,'2026-02-18 02:04:45'), +(60,'2026-02-16','Sale Invoice #21','INV-21','invoice',21,'2026-02-18 02:04:46'), +(61,'2026-02-16','Sale Invoice #22','INV-22','invoice',22,'2026-02-18 02:04:46'), +(62,'2026-02-16','Sale Invoice #23','INV-23','invoice',23,'2026-02-18 02:04:46'), +(63,'2026-02-16','Sale Invoice #24','INV-24','invoice',24,'2026-02-18 02:04:46'), +(64,'2026-02-16','Sale Invoice #25','INV-25','invoice',25,'2026-02-18 02:04:46'), +(65,'2026-02-16','Sale Invoice #26','INV-26','invoice',26,'2026-02-18 02:04:46'), +(66,'2026-02-17','Sale Invoice #27','INV-27','invoice',27,'2026-02-18 02:04:46'), +(67,'2026-02-17','Sale Invoice #28','INV-28','invoice',28,'2026-02-18 02:04:46'), +(68,'2026-02-17','Sale Invoice #29','INV-29','invoice',29,'2026-02-18 02:04:47'), +(69,'2026-02-16','Payment Received #1','PAY-1','payment',1,'2026-02-18 02:04:47'), +(70,'2026-02-16','Payment Received #2','PAY-2','payment',2,'2026-02-18 02:04:47'), +(71,'2026-02-16','Payment Received #3','PAY-3','payment',3,'2026-02-18 02:04:47'), +(72,'2026-02-16','Payment Received #4','PAY-4','payment',4,'2026-02-18 02:04:47'), +(73,'2026-02-16','Payment Received #5','PAY-5','payment',5,'2026-02-18 02:04:47'), +(74,'2026-02-16','Payment Received #6','PAY-6','payment',6,'2026-02-18 02:04:47'), +(75,'2026-02-16','Payment Made #7','PAY-7','payment',7,'2026-02-18 02:04:47'), +(76,'2026-02-16','Payment Made #8','PAY-8','payment',8,'2026-02-18 02:04:47'), +(77,'2026-02-16','Payment Received #9','PAY-9','payment',9,'2026-02-18 02:04:47'), +(78,'2026-02-16','Payment Received #10','PAY-10','payment',10,'2026-02-18 02:04:47'), +(79,'2026-02-16','Payment Received #11','PAY-11','payment',11,'2026-02-18 02:04:47'), +(80,'2026-02-16','Payment Received #12','PAY-12','payment',12,'2026-02-18 02:04:48'), +(81,'2026-02-16','Payment Received #13','PAY-13','payment',13,'2026-02-18 02:04:48'), +(82,'2026-02-16','Payment Received #14','PAY-14','payment',14,'2026-02-18 02:04:48'), +(83,'2026-02-16','Payment Received #15','PAY-15','payment',15,'2026-02-18 02:04:48'), +(84,'2026-02-16','Payment Received #16','PAY-16','payment',16,'2026-02-18 02:04:48'), +(85,'2026-02-16','Payment Received #17','PAY-17','payment',17,'2026-02-18 02:04:48'), +(86,'2026-02-17','Payment Received #18','PAY-18','payment',18,'2026-02-18 02:04:48'), +(87,'2026-02-17','Payment Received #19','PAY-19','payment',19,'2026-02-18 02:04:48'), +(88,'2026-02-17','Expense: Electricity & Water','EXP-1','expense',1,'2026-02-18 02:04:48'), +(89,'2026-02-17','Sales Return #1','SRET-1','sales_return',1,'2026-02-18 02:04:48'), +(90,'2026-02-17','Purchase Return #1','PRET-1','purchase_return',1,'2026-02-18 02:04:48'); +/*!40000 ALTER TABLE `acc_journal_entries` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `acc_ledger` +-- + +DROP TABLE IF EXISTS `acc_ledger`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `acc_ledger` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `journal_entry_id` int(11) NOT NULL, + `account_id` int(11) NOT NULL, + `debit` decimal(15,3) DEFAULT 0.000, + `credit` decimal(15,3) DEFAULT 0.000, + PRIMARY KEY (`id`), + KEY `journal_entry_id` (`journal_entry_id`), + KEY `account_id` (`account_id`), + CONSTRAINT `acc_ledger_ibfk_1` FOREIGN KEY (`journal_entry_id`) REFERENCES `acc_journal_entries` (`id`) ON DELETE CASCADE, + CONSTRAINT `acc_ledger_ibfk_2` FOREIGN KEY (`account_id`) REFERENCES `acc_accounts` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=273 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `acc_ledger` +-- + +LOCK TABLES `acc_ledger` WRITE; +/*!40000 ALTER TABLE `acc_ledger` DISABLE KEYS */; +INSERT INTO `acc_ledger` VALUES +(137,46,4,0.225,0.000), +(138,46,10,0.000,0.225), +(139,46,12,0.200,0.000), +(140,46,5,0.000,0.200), +(141,47,4,2.250,0.000), +(142,47,10,0.000,2.250), +(143,47,12,2.000,0.000), +(144,47,5,0.000,2.000), +(145,48,4,4.950,0.000), +(146,48,10,0.000,4.950), +(147,48,12,4.400,0.000), +(148,48,5,0.000,4.400), +(149,49,4,4.500,0.000), +(150,49,10,0.000,4.500), +(151,49,12,4.000,0.000), +(152,49,5,0.000,4.000), +(153,50,4,0.450,0.000), +(154,50,10,0.000,0.450), +(155,50,12,0.400,0.000), +(156,50,5,0.000,0.400), +(157,51,5,40.000,0.000), +(158,51,7,0.000,40.000), +(159,52,4,1.350,0.000), +(160,52,10,0.000,1.350), +(161,52,12,1.200,0.000), +(162,52,5,0.000,1.200), +(163,53,4,0.900,0.000), +(164,53,10,0.000,0.900), +(165,53,12,0.800,0.000), +(166,53,5,0.000,0.800), +(167,54,4,0.450,0.000), +(168,54,10,0.000,0.450), +(169,54,12,0.400,0.000), +(170,54,5,0.000,0.400), +(171,55,4,0.450,0.000), +(172,55,10,0.000,0.450), +(173,55,12,0.400,0.000), +(174,55,5,0.000,0.400), +(175,56,4,0.900,0.000), +(176,56,10,0.000,0.900), +(177,56,12,0.800,0.000), +(178,56,5,0.000,0.800), +(179,57,4,0.450,0.000), +(180,57,10,0.000,0.450), +(181,57,12,0.400,0.000), +(182,57,5,0.000,0.400), +(183,58,4,0.450,0.000), +(184,58,10,0.000,0.450), +(185,58,12,0.400,0.000), +(186,58,5,0.000,0.400), +(187,59,4,0.450,0.000), +(188,59,10,0.000,0.450), +(189,59,12,0.400,0.000), +(190,59,5,0.000,0.400), +(191,60,4,0.900,0.000), +(192,60,10,0.000,0.900), +(193,60,12,0.800,0.000), +(194,60,5,0.000,0.800), +(195,61,4,0.450,0.000), +(196,61,10,0.000,0.450), +(197,61,12,0.400,0.000), +(198,61,5,0.000,0.400), +(199,62,4,0.900,0.000), +(200,62,10,0.000,0.900), +(201,62,12,0.800,0.000), +(202,62,5,0.000,0.800), +(203,63,4,0.900,0.000), +(204,63,10,0.000,0.900), +(205,63,12,0.800,0.000), +(206,63,5,0.000,0.800), +(207,64,4,0.900,0.000), +(208,64,10,0.000,0.900), +(209,64,12,0.800,0.000), +(210,64,5,0.000,0.800), +(211,65,4,2.700,0.000), +(212,65,10,0.000,2.700), +(213,65,12,2.400,0.000), +(214,65,5,0.000,2.400), +(215,66,4,4.500,0.000), +(216,66,10,0.000,4.500), +(217,66,12,4.000,0.000), +(218,66,5,0.000,4.000), +(219,67,4,0.713,0.000), +(220,67,10,0.000,0.700), +(221,67,15,0.000,0.013), +(222,67,12,0.550,0.000), +(223,67,5,0.000,0.550), +(224,68,4,0.788,0.000), +(225,68,10,0.000,0.750), +(226,68,15,0.000,0.038), +(227,68,12,0.450,0.000), +(228,68,5,0.000,0.450), +(229,69,2,2.250,0.000), +(230,69,4,0.000,2.250), +(231,70,2,2.250,0.000), +(232,70,4,0.000,2.250), +(233,71,2,2.000,0.000), +(234,71,4,0.000,2.000), +(235,72,2,2.500,0.000), +(236,72,4,0.000,2.500), +(237,73,2,0.225,0.000), +(238,73,4,0.000,0.225), +(239,74,2,0.450,0.000), +(240,74,4,0.000,0.450), +(241,75,7,20.000,0.000), +(242,75,2,0.000,20.000), +(243,76,7,20.000,0.000), +(244,76,2,0.000,20.000), +(245,77,2,1.350,0.000), +(246,77,4,0.000,1.350), +(247,78,2,0.900,0.000), +(248,78,4,0.000,0.900), +(249,79,2,5.000,0.000), +(250,79,4,0.000,5.000), +(251,80,2,0.450,0.000), +(252,80,4,0.000,0.450), +(253,81,2,0.900,0.000), +(254,81,4,0.000,0.900), +(255,82,2,0.900,0.000), +(256,82,4,0.000,0.900), +(257,83,2,0.450,0.000), +(258,83,4,0.000,0.450), +(259,84,2,0.900,0.000), +(260,84,4,0.000,0.900), +(261,85,2,0.900,0.000), +(262,85,4,0.000,0.900), +(263,86,2,0.713,0.000), +(264,86,4,0.000,0.713), +(265,87,2,0.788,0.000), +(266,87,4,0.000,0.788), +(267,88,13,75.000,0.000), +(268,88,2,0.000,75.000), +(269,89,10,0.500,0.000), +(270,89,4,0.000,0.500), +(271,90,7,20.000,0.000), +(272,90,5,0.000,20.000); +/*!40000 ALTER TABLE `acc_ledger` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `cash_registers` +-- + +DROP TABLE IF EXISTS `cash_registers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `cash_registers` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL, + `status` enum('active','inactive') DEFAULT 'active', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `cash_registers` +-- + +LOCK TABLES `cash_registers` WRITE; +/*!40000 ALTER TABLE `cash_registers` DISABLE KEYS */; +INSERT INTO `cash_registers` VALUES +(1,'Counter 1','active','2026-02-18 11:33:57'), +(2,'Counter 2','active','2026-02-18 11:34:15'); +/*!40000 ALTER TABLE `cash_registers` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `customers` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `email` varchar(255) DEFAULT NULL, + `phone` varchar(50) DEFAULT NULL, + `tax_id` varchar(50) DEFAULT NULL, + `balance` decimal(15,3) DEFAULT 0.000, + `credit_limit` decimal(15,3) DEFAULT 0.000, + `created_at` timestamp NULL DEFAULT current_timestamp(), + `type` enum('customer','supplier') DEFAULT 'customer', + `loyalty_points` decimal(15,3) DEFAULT 0.000, + `loyalty_tier` enum('bronze','silver','gold') DEFAULT 'bronze', + `total_spent` decimal(15,3) DEFAULT 0.000, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `customers` +-- + +LOCK TABLES `customers` WRITE; +/*!40000 ALTER TABLE `customers` DISABLE KEYS */; +INSERT INTO `customers` VALUES +(1,'Moosa Ali Al-Abri','aalabry@gmail.com','99359472',NULL,-2.650,0.000,'2026-02-16 08:11:42','customer',1.000,'bronze',10.688), +(2,'Cash','cash@cash.com','',NULL,0.000,0.000,'2026-02-16 08:12:03','customer',0.000,'bronze',0.450), +(4,'ahmed moosa','','',NULL,-1.350,0.000,'2026-02-16 08:26:36','customer',0.000,'bronze',15.788), +(5,'CASH','','',NULL,0.000,0.000,'2026-02-16 08:26:55','supplier',0.000,'bronze',0.000), +(6,'شركة المراعي','','',NULL,20.000,0.000,'2026-02-16 08:27:07','supplier',0.000,'bronze',0.000); +/*!40000 ALTER TABLE `customers` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `discount_codes` +-- + +DROP TABLE IF EXISTS `discount_codes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `discount_codes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(50) NOT NULL, + `type` enum('percentage','fixed') NOT NULL DEFAULT 'percentage', + `value` decimal(15,3) NOT NULL, + `min_purchase` decimal(15,3) DEFAULT 0.000, + `expiry_date` date DEFAULT NULL, + `status` enum('active','inactive') DEFAULT 'active', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `code` (`code`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `discount_codes` +-- + +LOCK TABLES `discount_codes` WRITE; +/*!40000 ALTER TABLE `discount_codes` DISABLE KEYS */; +INSERT INTO `discount_codes` VALUES +(1,'WELCOME10','percentage',10.000,0.000,NULL,'active','2026-02-16 12:12:09'), +(2,'SAVE5','fixed',5.000,50.000,NULL,'active','2026-02-16 12:12:09'); +/*!40000 ALTER TABLE `discount_codes` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `expense_categories` +-- + +DROP TABLE IF EXISTS `expense_categories`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `expense_categories` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name_en` varchar(255) NOT NULL, + `name_ar` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `expense_categories` +-- + +LOCK TABLES `expense_categories` WRITE; +/*!40000 ALTER TABLE `expense_categories` DISABLE KEYS */; +INSERT INTO `expense_categories` VALUES +(1,'Salary','رواتب','2026-02-17 09:03:22'), +(2,'Electricity & Water','كهرباء وماء','2026-02-17 09:03:56'); +/*!40000 ALTER TABLE `expense_categories` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `expenses` +-- + +DROP TABLE IF EXISTS `expenses`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `expenses` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `category_id` int(11) NOT NULL, + `amount` decimal(10,3) NOT NULL, + `expense_date` date NOT NULL, + `description` text DEFAULT NULL, + `reference_no` varchar(50) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `category_id` (`category_id`), + CONSTRAINT `expenses_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `expense_categories` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `expenses` +-- + +LOCK TABLES `expenses` WRITE; +/*!40000 ALTER TABLE `expenses` DISABLE KEYS */; +INSERT INTO `expenses` VALUES +(1,2,75.000,'2026-02-17','','3655','2026-02-17 09:04:33'); +/*!40000 ALTER TABLE `expenses` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hr_attendance` +-- + +DROP TABLE IF EXISTS `hr_attendance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `hr_attendance` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `employee_id` int(11) NOT NULL, + `attendance_date` date NOT NULL, + `clock_in` time DEFAULT NULL, + `clock_out` time DEFAULT NULL, + `status` enum('present','absent','on_leave') DEFAULT 'present', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `employee_id` (`employee_id`,`attendance_date`), + CONSTRAINT `hr_attendance_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `hr_employees` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `hr_attendance` +-- + +LOCK TABLES `hr_attendance` WRITE; +/*!40000 ALTER TABLE `hr_attendance` DISABLE KEYS */; +/*!40000 ALTER TABLE `hr_attendance` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hr_biometric_devices` +-- + +DROP TABLE IF EXISTS `hr_biometric_devices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `hr_biometric_devices` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `device_name` varchar(100) NOT NULL, + `ip_address` varchar(50) NOT NULL, + `port` int(11) DEFAULT 4370, + `io_address` varchar(100) DEFAULT NULL, + `serial_number` varchar(100) DEFAULT NULL, + `status` enum('active','inactive') DEFAULT 'active', + `last_sync` timestamp NULL DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `hr_biometric_devices` +-- + +LOCK TABLES `hr_biometric_devices` WRITE; +/*!40000 ALTER TABLE `hr_biometric_devices` DISABLE KEYS */; +/*!40000 ALTER TABLE `hr_biometric_devices` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hr_biometric_logs` +-- + +DROP TABLE IF EXISTS `hr_biometric_logs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `hr_biometric_logs` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `biometric_id` varchar(50) NOT NULL, + `device_id` int(11) DEFAULT NULL, + `employee_id` int(11) DEFAULT NULL, + `timestamp` datetime NOT NULL, + `type` enum('check_in','check_out','unknown') DEFAULT 'unknown', + `processed` tinyint(1) DEFAULT 0, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `employee_id` (`employee_id`), + KEY `device_id` (`device_id`), + CONSTRAINT `hr_biometric_logs_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `hr_employees` (`id`) ON DELETE SET NULL, + CONSTRAINT `hr_biometric_logs_ibfk_2` FOREIGN KEY (`device_id`) REFERENCES `hr_biometric_devices` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `hr_biometric_logs` +-- + +LOCK TABLES `hr_biometric_logs` WRITE; +/*!40000 ALTER TABLE `hr_biometric_logs` DISABLE KEYS */; +INSERT INTO `hr_biometric_logs` VALUES +(1,'999',NULL,NULL,'2026-02-17 08:30:00','check_in',0,'2026-02-17 17:26:09'); +/*!40000 ALTER TABLE `hr_biometric_logs` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hr_departments` +-- + +DROP TABLE IF EXISTS `hr_departments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `hr_departments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `hr_departments` +-- + +LOCK TABLES `hr_departments` WRITE; +/*!40000 ALTER TABLE `hr_departments` DISABLE KEYS */; +INSERT INTO `hr_departments` VALUES +(1,'purchase','2026-02-17 17:10:46'); +/*!40000 ALTER TABLE `hr_departments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hr_employees` +-- + +DROP TABLE IF EXISTS `hr_employees`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `hr_employees` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `department_id` int(11) DEFAULT NULL, + `biometric_id` varchar(50) DEFAULT NULL, + `name` varchar(255) NOT NULL, + `email` varchar(255) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `position` varchar(100) DEFAULT NULL, + `salary` decimal(15,3) DEFAULT 0.000, + `joining_date` date DEFAULT NULL, + `status` enum('active','inactive') DEFAULT 'active', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `biometric_id` (`biometric_id`), + KEY `department_id` (`department_id`), + CONSTRAINT `hr_employees_ibfk_1` FOREIGN KEY (`department_id`) REFERENCES `hr_departments` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `hr_employees` +-- + +LOCK TABLES `hr_employees` WRITE; +/*!40000 ALTER TABLE `hr_employees` DISABLE KEYS */; +/*!40000 ALTER TABLE `hr_employees` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `hr_payroll` +-- + +DROP TABLE IF EXISTS `hr_payroll`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `hr_payroll` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `employee_id` int(11) NOT NULL, + `payroll_month` int(11) NOT NULL, + `payroll_year` int(11) NOT NULL, + `basic_salary` decimal(15,3) DEFAULT 0.000, + `bonus` decimal(15,3) DEFAULT 0.000, + `deductions` decimal(15,3) DEFAULT 0.000, + `net_salary` decimal(15,3) DEFAULT 0.000, + `payment_date` date DEFAULT NULL, + `status` enum('pending','paid') DEFAULT 'pending', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `employee_month_year` (`employee_id`,`payroll_month`,`payroll_year`), + CONSTRAINT `hr_payroll_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `hr_employees` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `hr_payroll` +-- + +LOCK TABLES `hr_payroll` WRITE; +/*!40000 ALTER TABLE `hr_payroll` DISABLE KEYS */; +/*!40000 ALTER TABLE `hr_payroll` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `invoice_items` +-- + +DROP TABLE IF EXISTS `invoice_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `invoice_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL, + `quantity` decimal(15,2) NOT NULL, + `unit_price` decimal(15,3) DEFAULT 0.000, + `total_price` decimal(15,3) DEFAULT 0.000, + PRIMARY KEY (`id`), + KEY `invoice_id` (`invoice_id`), + KEY `item_id` (`item_id`), + CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE, + CONSTRAINT `invoice_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `stock_items` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `invoice_items` +-- + +LOCK TABLES `invoice_items` WRITE; +/*!40000 ALTER TABLE `invoice_items` DISABLE KEYS */; +INSERT INTO `invoice_items` VALUES +(5,3,1,11.00,0.450,4.950), +(6,2,1,5.00,0.450,2.250), +(7,1,1,0.50,0.450,0.225), +(8,4,1,10.00,0.450,4.500), +(9,5,1,1.00,0.450,0.450), +(10,6,1,100.00,0.400,40.000), +(11,12,1,3.00,0.450,1.350), +(12,14,1,2.00,0.450,0.900), +(13,15,1,1.00,0.450,0.450), +(14,16,1,1.00,0.450,0.450), +(15,17,1,2.00,0.450,0.900), +(16,18,1,1.00,0.450,0.450), +(17,19,1,1.00,0.450,0.450), +(18,20,1,1.00,0.450,0.450), +(19,21,1,2.00,0.450,0.900), +(20,22,1,1.00,0.450,0.450), +(21,23,1,2.00,0.450,0.900), +(22,24,1,2.00,0.450,0.900), +(23,25,1,2.00,0.450,0.900), +(24,26,1,6.00,0.450,2.700), +(25,27,1,10.00,0.450,4.500), +(26,28,1,1.00,0.450,0.450), +(27,28,2,1.00,0.250,0.250), +(29,29,2,3.00,0.250,0.750); +/*!40000 ALTER TABLE `invoice_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `invoices` +-- + +DROP TABLE IF EXISTS `invoices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `invoices` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) DEFAULT NULL, + `invoice_date` date NOT NULL, + `type` enum('sale','purchase') NOT NULL, + `payment_type` varchar(100) DEFAULT NULL, + `total_amount` decimal(15,3) DEFAULT 0.000, + `created_at` timestamp NULL DEFAULT current_timestamp(), + `vat_amount` decimal(15,3) DEFAULT 0.000, + `total_with_vat` decimal(15,3) DEFAULT 0.000, + `terms_conditions` text DEFAULT NULL, + `paid_amount` decimal(15,3) DEFAULT 0.000, + `status` enum('paid','unpaid','partially_paid') DEFAULT 'unpaid', + `register_session_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `customer_id` (`customer_id`), + CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `invoices` +-- + +LOCK TABLES `invoices` WRITE; +/*!40000 ALTER TABLE `invoices` DISABLE KEYS */; +INSERT INTO `invoices` VALUES +(1,4,'2026-02-16','sale','cash',0.225,'2026-02-16 09:03:24',0.000,0.225,NULL,0.225,'paid',NULL), +(2,1,'2026-02-16','sale','credit',2.250,'2026-02-16 09:12:02',0.000,2.250,NULL,4.500,'paid',NULL), +(3,4,'2026-02-16','sale','cash',4.950,'2026-02-16 09:53:11',0.000,4.950,NULL,0.000,'paid',NULL), +(4,1,'2026-02-16','sale','credit',4.500,'2026-02-16 10:58:38',0.000,4.500,NULL,4.500,'paid',NULL), +(5,2,'2026-02-16','sale','cash',0.450,'2026-02-16 11:20:39',0.000,0.450,NULL,0.450,'paid',NULL), +(6,6,'2026-02-16','purchase','credit',40.000,'2026-02-16 11:21:59',0.000,40.000,NULL,40.000,'paid',NULL), +(12,NULL,'2026-02-16','sale','cash',0.000,'2026-02-16 12:22:22',0.000,1.350,NULL,1.350,'paid',NULL), +(14,NULL,'2026-02-16','sale','cash',0.000,'2026-02-16 12:31:20',0.000,0.900,NULL,0.900,'paid',NULL), +(15,NULL,'2026-02-16','sale',NULL,0.000,'2026-02-16 12:57:53',0.000,0.450,NULL,0.450,'paid',NULL), +(16,4,'2026-02-16','sale',NULL,0.000,'2026-02-16 13:00:02',0.000,0.450,NULL,0.450,'paid',NULL), +(17,NULL,'2026-02-16','sale',NULL,0.000,'2026-02-16 13:04:16',0.000,0.900,NULL,0.900,'paid',NULL), +(18,4,'2026-02-16','sale','credit',0.450,'2026-02-16 13:34:29',0.000,0.450,NULL,0.000,'unpaid',NULL), +(19,4,'2026-02-16','sale','credit',0.450,'2026-02-16 13:37:35',0.000,0.450,NULL,0.000,'unpaid',NULL), +(20,4,'2026-02-16','sale','credit',0.450,'2026-02-16 13:46:45',0.000,0.450,NULL,0.000,'unpaid',NULL), +(21,4,'2026-02-16','sale',NULL,0.000,'2026-02-16 14:12:31',0.000,0.900,NULL,0.900,'paid',NULL), +(22,1,'2026-02-16','sale',NULL,0.000,'2026-02-16 14:46:12',0.000,0.450,NULL,0.450,'paid',NULL), +(23,1,'2026-02-16','sale',NULL,0.000,'2026-02-16 14:47:25',0.000,0.900,NULL,0.900,'paid',NULL), +(24,1,'2026-02-16','sale',NULL,0.000,'2026-02-16 14:49:19',0.000,0.900,NULL,0.900,'paid',NULL), +(25,1,'2026-02-16','sale','credit',0.000,'2026-02-16 14:53:43',0.000,0.900,NULL,0.000,'unpaid',NULL), +(26,4,'2026-02-16','sale','cash',2.700,'2026-02-16 14:56:40',0.000,2.700,NULL,0.000,'unpaid',NULL), +(27,4,'2026-02-17','sale',NULL,4.500,'2026-02-17 02:19:50',0.000,4.500,NULL,0.000,'unpaid',NULL), +(28,4,'2026-02-17','sale','cash',0.700,'2026-02-17 07:43:25',0.013,0.713,NULL,0.713,'paid',NULL), +(29,1,'2026-02-17','sale','cash',0.750,'2026-02-17 15:07:01',0.038,0.788,NULL,0.788,'paid',NULL); +/*!40000 ALTER TABLE `invoices` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `loyalty_transactions` +-- + +DROP TABLE IF EXISTS `loyalty_transactions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `loyalty_transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) NOT NULL, + `transaction_id` int(11) DEFAULT NULL, + `points_change` decimal(15,3) NOT NULL, + `transaction_type` enum('earned','redeemed','adjustment') NOT NULL, + `description` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `customer_id` (`customer_id`), + CONSTRAINT `loyalty_transactions_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `loyalty_transactions` +-- + +LOCK TABLES `loyalty_transactions` WRITE; +/*!40000 ALTER TABLE `loyalty_transactions` DISABLE KEYS */; +INSERT INTO `loyalty_transactions` VALUES +(1,1,14,1.000,'earned','Earned from POS order #POS-177142159441','2026-02-18 13:33:15'); +/*!40000 ALTER TABLE `loyalty_transactions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `lpo_items` +-- + +DROP TABLE IF EXISTS `lpo_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `lpo_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `lpo_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL, + `quantity` decimal(15,3) NOT NULL, + `unit_price` decimal(15,3) NOT NULL, + `vat_percentage` decimal(5,2) DEFAULT 0.00, + `vat_amount` decimal(15,3) DEFAULT 0.000, + `total_amount` decimal(15,3) DEFAULT 0.000, + PRIMARY KEY (`id`), + KEY `lpo_id` (`lpo_id`), + KEY `item_id` (`item_id`), + CONSTRAINT `lpo_items_ibfk_1` FOREIGN KEY (`lpo_id`) REFERENCES `lpos` (`id`) ON DELETE CASCADE, + CONSTRAINT `lpo_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `stock_items` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `lpo_items` +-- + +LOCK TABLES `lpo_items` WRITE; +/*!40000 ALTER TABLE `lpo_items` DISABLE KEYS */; +/*!40000 ALTER TABLE `lpo_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `lpos` +-- + +DROP TABLE IF EXISTS `lpos`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `lpos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `supplier_id` int(11) NOT NULL, + `lpo_date` date NOT NULL, + `delivery_date` date DEFAULT NULL, + `status` enum('pending','converted','cancelled') DEFAULT 'pending', + `total_amount` decimal(15,3) DEFAULT 0.000, + `vat_amount` decimal(15,3) DEFAULT 0.000, + `total_with_vat` decimal(15,3) DEFAULT 0.000, + `terms_conditions` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `supplier_id` (`supplier_id`), + CONSTRAINT `lpos_ibfk_1` FOREIGN KEY (`supplier_id`) REFERENCES `customers` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `lpos` +-- + +LOCK TABLES `lpos` WRITE; +/*!40000 ALTER TABLE `lpos` DISABLE KEYS */; +/*!40000 ALTER TABLE `lpos` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `payment_methods` +-- + +DROP TABLE IF EXISTS `payment_methods`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `payment_methods` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name_en` varchar(255) DEFAULT NULL, + `name_ar` varchar(255) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `payment_methods` +-- + +LOCK TABLES `payment_methods` WRITE; +/*!40000 ALTER TABLE `payment_methods` DISABLE KEYS */; +INSERT INTO `payment_methods` VALUES +(1,'Cash','كاش','2026-02-16 08:33:31'), +(2,'Credit Card','بطاقة بنكية','2026-02-16 08:33:53'), +(3,'Bank Transfer','تحويل بنكي','2026-02-16 08:34:17'); +/*!40000 ALTER TABLE `payment_methods` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `payments` +-- + +DROP TABLE IF EXISTS `payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `payments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `payment_date` date NOT NULL, + `amount` decimal(15,3) DEFAULT 0.000, + `payment_method` varchar(50) DEFAULT 'Cash', + `notes` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `invoice_id` (`invoice_id`), + CONSTRAINT `payments_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `payments` +-- + +LOCK TABLES `payments` WRITE; +/*!40000 ALTER TABLE `payments` DISABLE KEYS */; +INSERT INTO `payments` VALUES +(1,2,'2026-02-16',2.250,'Cash','','2026-02-16 10:42:56'), +(2,2,'2026-02-16',2.250,'Cash','','2026-02-16 10:43:33'), +(3,4,'2026-02-16',2.000,'Cash','','2026-02-16 10:58:51'), +(4,4,'2026-02-16',2.500,'Cash','','2026-02-16 11:06:09'), +(5,1,'2026-02-16',0.225,'Cash','Initial payment','2026-02-16 11:08:23'), +(6,5,'2026-02-16',0.450,'Cash','Initial payment','2026-02-16 11:20:39'), +(7,6,'2026-02-16',20.000,'Cash','','2026-02-16 11:22:38'), +(8,6,'2026-02-16',20.000,'Cash','','2026-02-16 11:22:52'), +(9,12,'2026-02-16',1.350,'cash','POS Transaction','2026-02-16 12:22:22'), +(10,14,'2026-02-16',0.900,'cash','POS Transaction','2026-02-16 12:31:21'), +(11,15,'2026-02-16',5.000,'cash','POS Transaction','2026-02-16 12:57:53'), +(12,16,'2026-02-16',0.450,'credit','POS Transaction','2026-02-16 13:00:02'), +(13,17,'2026-02-16',0.900,'cash','POS Transaction','2026-02-16 13:04:16'), +(14,21,'2026-02-16',0.900,'credit','POS Transaction','2026-02-16 14:12:31'), +(15,22,'2026-02-16',0.450,'credit','POS Transaction','2026-02-16 14:46:12'), +(16,23,'2026-02-16',0.900,'credit','POS Transaction','2026-02-16 14:47:25'), +(17,24,'2026-02-16',0.900,'credit','POS Transaction','2026-02-16 14:49:19'), +(18,28,'2026-02-17',0.713,'Cash','Initial payment','2026-02-17 07:43:25'), +(19,29,'2026-02-17',0.788,'Cash','Payment via edit','2026-02-17 15:07:28'); +/*!40000 ALTER TABLE `payments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pos_devices` +-- + +DROP TABLE IF EXISTS `pos_devices`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `pos_devices` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `device_name` varchar(100) NOT NULL, + `device_type` enum('scale','printer','display') DEFAULT 'scale', + `connection_type` enum('usb','network','serial') DEFAULT 'usb', + `ip_address` varchar(50) DEFAULT NULL, + `port` int(11) DEFAULT NULL, + `baud_rate` int(11) DEFAULT NULL, + `status` enum('active','inactive') DEFAULT 'active', + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pos_devices` +-- + +LOCK TABLES `pos_devices` WRITE; +/*!40000 ALTER TABLE `pos_devices` DISABLE KEYS */; +/*!40000 ALTER TABLE `pos_devices` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pos_held_carts` +-- + +DROP TABLE IF EXISTS `pos_held_carts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `pos_held_carts` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `cart_name` varchar(100) NOT NULL, + `items_json` text NOT NULL, + `customer_id` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `customer_id` (`customer_id`), + CONSTRAINT `pos_held_carts_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pos_held_carts` +-- + +LOCK TABLES `pos_held_carts` WRITE; +/*!40000 ALTER TABLE `pos_held_carts` DISABLE KEYS */; +/*!40000 ALTER TABLE `pos_held_carts` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pos_items` +-- + +DROP TABLE IF EXISTS `pos_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `pos_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `transaction_id` int(11) NOT NULL, + `product_id` int(11) NOT NULL, + `quantity` decimal(15,3) NOT NULL, + `unit_price` decimal(15,3) NOT NULL, + `subtotal` decimal(15,3) NOT NULL, + PRIMARY KEY (`id`), + KEY `transaction_id` (`transaction_id`), + CONSTRAINT `pos_items_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pos_transactions` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pos_items` +-- + +LOCK TABLES `pos_items` WRITE; +/*!40000 ALTER TABLE `pos_items` DISABLE KEYS */; +INSERT INTO `pos_items` VALUES +(1,4,1,3.000,0.450,1.350), +(2,5,1,2.000,0.450,0.900), +(3,6,1,1.000,0.450,0.450), +(4,7,1,1.000,0.450,0.450), +(5,8,1,2.000,0.450,0.900), +(6,9,1,2.000,0.450,0.900), +(7,10,1,1.000,0.450,0.450), +(8,11,1,2.000,0.450,0.900), +(9,12,1,2.000,0.450,0.900), +(10,13,1,2.000,0.450,0.900), +(11,14,1,2.000,0.383,0.765), +(12,14,2,2.000,0.213,0.425), +(13,15,1,1.000,0.383,0.383), +(14,15,2,1.000,0.213,0.213), +(15,16,1,1.000,0.383,0.383), +(16,17,2,1.000,0.213,0.213), +(17,17,1,1.000,0.383,0.383); +/*!40000 ALTER TABLE `pos_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pos_payments` +-- + +DROP TABLE IF EXISTS `pos_payments`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `pos_payments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `transaction_id` int(11) NOT NULL, + `payment_method` varchar(50) NOT NULL, + `amount` decimal(15,3) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `transaction_id` (`transaction_id`), + CONSTRAINT `pos_payments_ibfk_1` FOREIGN KEY (`transaction_id`) REFERENCES `pos_transactions` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pos_payments` +-- + +LOCK TABLES `pos_payments` WRITE; +/*!40000 ALTER TABLE `pos_payments` DISABLE KEYS */; +INSERT INTO `pos_payments` VALUES +(1,4,'cash',1.350,'2026-02-18 12:07:43'), +(2,5,'cash',0.900,'2026-02-18 12:07:43'), +(3,6,'cash',0.450,'2026-02-18 12:07:43'), +(4,7,'credit',0.450,'2026-02-18 12:07:43'), +(5,8,'cash',0.900,'2026-02-18 12:07:43'), +(6,9,'credit',0.900,'2026-02-18 12:07:43'), +(7,10,'credit',0.450,'2026-02-18 12:07:43'), +(8,11,'credit',0.900,'2026-02-18 12:07:43'), +(9,12,'credit',0.900,'2026-02-18 12:07:43'), +(10,13,'credit',0.900,'2026-02-18 12:07:43'), +(16,14,'credit',1.190,'2026-02-18 13:33:15'), +(17,15,'cash',0.595,'2026-02-18 15:32:30'), +(18,16,'cash',0.383,'2026-02-18 18:09:25'), +(19,17,'cash',0.595,'2026-02-18 18:09:44'); +/*!40000 ALTER TABLE `pos_payments` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pos_transactions` +-- + +DROP TABLE IF EXISTS `pos_transactions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `pos_transactions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `transaction_no` varchar(50) NOT NULL, + `customer_id` int(11) DEFAULT NULL, + `total_amount` decimal(15,3) NOT NULL, + `tax_amount` decimal(15,3) DEFAULT 0.000, + `discount_code_id` int(11) DEFAULT NULL, + `discount_amount` decimal(15,3) DEFAULT 0.000, + `loyalty_points_earned` decimal(15,3) DEFAULT 0.000, + `loyalty_points_redeemed` decimal(15,3) DEFAULT 0.000, + `net_amount` decimal(15,3) NOT NULL DEFAULT 0.000, + `payment_method` varchar(100) DEFAULT NULL, + `status` enum('completed','refunded','cancelled') DEFAULT 'completed', + `created_at` timestamp NULL DEFAULT current_timestamp(), + `created_by` int(11) DEFAULT NULL, + `register_session_id` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `transaction_no` (`transaction_no`) +) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pos_transactions` +-- + +LOCK TABLES `pos_transactions` WRITE; +/*!40000 ALTER TABLE `pos_transactions` DISABLE KEYS */; +INSERT INTO `pos_transactions` VALUES +(4,'POS-1771244542359',NULL,1.350,0.000,NULL,0.000,1.000,0.000,1.350,'cash','completed','2026-02-16 12:22:22',NULL,NULL), +(5,'POS-1771245080116',NULL,0.900,0.000,NULL,0.000,0.000,0.000,0.900,'cash','completed','2026-02-16 12:31:20',NULL,NULL), +(6,'POS-1771246673214',NULL,0.450,0.000,NULL,0.000,0.000,0.000,0.450,'cash','completed','2026-02-16 12:57:53',NULL,NULL), +(7,'POS-1771246802602',4,0.450,0.000,NULL,0.000,0.000,0.000,0.450,'credit','completed','2026-02-16 13:00:02',NULL,NULL), +(8,'POS-1771247056481',NULL,0.900,0.000,NULL,0.000,0.000,0.000,0.900,'cash','completed','2026-02-16 13:04:16',NULL,NULL), +(9,'POS-1771251151407',4,0.900,0.000,NULL,0.000,0.000,0.000,0.900,'credit','completed','2026-02-16 14:12:31',NULL,NULL), +(10,'POS-1771253172485',1,0.450,0.000,NULL,0.000,0.000,0.000,0.450,'credit','completed','2026-02-16 14:46:12',NULL,NULL), +(11,'POS-1771253245896',1,0.900,0.000,NULL,0.000,0.000,0.000,0.900,'credit','completed','2026-02-16 14:47:25',NULL,NULL), +(12,'POS-1771253359500',1,0.900,0.000,NULL,0.000,0.000,0.000,0.900,'credit','completed','2026-02-16 14:49:19',NULL,NULL), +(13,'POS-1771253623949',1,0.900,0.000,NULL,0.000,0.000,0.000,0.900,'credit','completed','2026-02-16 14:53:43',NULL,NULL), +(14,'POS-177142159441',1,1.190,0.000,NULL,0.000,1.000,0.000,1.190,NULL,'completed','2026-02-18 13:33:14',1,NULL), +(15,'POS-177142875034',NULL,0.595,0.000,NULL,0.000,0.000,0.000,0.595,NULL,'completed','2026-02-18 15:32:30',1,NULL), +(16,'POS-177143816521',NULL,0.383,0.000,NULL,0.000,0.000,0.000,0.383,NULL,'completed','2026-02-18 18:09:25',1,2), +(17,'POS-177143818439',NULL,0.595,0.000,NULL,0.000,0.000,0.000,0.595,NULL,'completed','2026-02-18 18:09:44',1,2); +/*!40000 ALTER TABLE `pos_transactions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `purchase_return_items` +-- + +DROP TABLE IF EXISTS `purchase_return_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `purchase_return_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `return_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL, + `quantity` decimal(15,2) NOT NULL, + `unit_price` decimal(15,3) NOT NULL, + `total_price` decimal(15,3) NOT NULL, + PRIMARY KEY (`id`), + KEY `return_id` (`return_id`), + KEY `item_id` (`item_id`), + CONSTRAINT `purchase_return_items_ibfk_1` FOREIGN KEY (`return_id`) REFERENCES `purchase_returns` (`id`) ON DELETE CASCADE, + CONSTRAINT `purchase_return_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `stock_items` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `purchase_return_items` +-- + +LOCK TABLES `purchase_return_items` WRITE; +/*!40000 ALTER TABLE `purchase_return_items` DISABLE KEYS */; +INSERT INTO `purchase_return_items` VALUES +(1,1,1,50.00,0.400,20.000); +/*!40000 ALTER TABLE `purchase_return_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `purchase_returns` +-- + +DROP TABLE IF EXISTS `purchase_returns`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `purchase_returns` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `supplier_id` int(11) DEFAULT NULL, + `return_date` date NOT NULL, + `total_amount` decimal(15,3) NOT NULL DEFAULT 0.000, + `notes` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `invoice_id` (`invoice_id`), + KEY `supplier_id` (`supplier_id`), + CONSTRAINT `purchase_returns_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE, + CONSTRAINT `purchase_returns_ibfk_2` FOREIGN KEY (`supplier_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `purchase_returns` +-- + +LOCK TABLES `purchase_returns` WRITE; +/*!40000 ALTER TABLE `purchase_returns` DISABLE KEYS */; +INSERT INTO `purchase_returns` VALUES +(1,6,6,'2026-02-17',20.000,'','2026-02-17 16:52:23'); +/*!40000 ALTER TABLE `purchase_returns` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quotation_items` +-- + +DROP TABLE IF EXISTS `quotation_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `quotation_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `quotation_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL, + `quantity` decimal(15,2) NOT NULL, + `unit_price` decimal(15,3) DEFAULT 0.000, + `total_price` decimal(15,3) DEFAULT 0.000, + PRIMARY KEY (`id`), + KEY `quotation_id` (`quotation_id`), + KEY `item_id` (`item_id`), + CONSTRAINT `quotation_items_ibfk_1` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`) ON DELETE CASCADE, + CONSTRAINT `quotation_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `stock_items` (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quotation_items` +-- + +LOCK TABLES `quotation_items` WRITE; +/*!40000 ALTER TABLE `quotation_items` DISABLE KEYS */; +INSERT INTO `quotation_items` VALUES +(1,1,1,10.00,0.450,4.500), +(2,2,2,10.00,0.250,2.500); +/*!40000 ALTER TABLE `quotation_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `quotations` +-- + +DROP TABLE IF EXISTS `quotations`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `quotations` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `customer_id` int(11) DEFAULT NULL, + `quotation_date` date NOT NULL, + `valid_until` date DEFAULT NULL, + `status` enum('pending','converted','expired','cancelled') DEFAULT 'pending', + `total_amount` decimal(15,3) DEFAULT 0.000, + `vat_amount` decimal(15,3) DEFAULT 0.000, + `total_with_vat` decimal(15,3) DEFAULT 0.000, + `terms_conditions` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `customer_id` (`customer_id`), + CONSTRAINT `quotations_ibfk_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `quotations` +-- + +LOCK TABLES `quotations` WRITE; +/*!40000 ALTER TABLE `quotations` DISABLE KEYS */; +INSERT INTO `quotations` VALUES +(1,4,'2026-02-16','2026-02-20','converted',4.500,0.000,4.500,NULL,'2026-02-16 17:08:34'), +(2,4,'2026-02-17','2026-02-20','pending',2.500,0.125,2.625,NULL,'2026-02-17 07:44:12'); +/*!40000 ALTER TABLE `quotations` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `register_sessions` +-- + +DROP TABLE IF EXISTS `register_sessions`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `register_sessions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `register_id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `opening_balance` decimal(15,3) NOT NULL, + `closing_balance` decimal(15,3) DEFAULT NULL, + `cash_in_hand` decimal(15,3) DEFAULT NULL, + `opened_at` timestamp NULL DEFAULT current_timestamp(), + `closed_at` timestamp NULL DEFAULT NULL, + `status` enum('open','closed') DEFAULT 'open', + `notes` text DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `register_sessions` +-- + +LOCK TABLES `register_sessions` WRITE; +/*!40000 ALTER TABLE `register_sessions` DISABLE KEYS */; +INSERT INTO `register_sessions` VALUES +(1,1,1,0.000,0.000,0.000,'2026-02-18 11:43:14','2026-02-18 12:01:49','closed',''), +(2,1,1,0.000,0.978,5.000,'2026-02-18 18:09:07','2026-02-18 18:10:17','closed',''); +/*!40000 ALTER TABLE `register_sessions` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `role_groups` +-- + +DROP TABLE IF EXISTS `role_groups`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `role_groups` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) NOT NULL, + `permissions` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `role_groups` +-- + +LOCK TABLES `role_groups` WRITE; +/*!40000 ALTER TABLE `role_groups` DISABLE KEYS */; +INSERT INTO `role_groups` VALUES +(1,'Administrator','all','2026-02-18 05:30:12'), +(4,'Cashier','[\"pos_view\",\"pos_add\",\"items_view\",\"items_add\"]','2026-02-18 09:32:14'), +(5,'Admin','[\"pos_view\",\"pos_add\",\"pos_edit\",\"quotations_view\",\"quotations_add\",\"quotations_edit\",\"customers_view\",\"customers_add\",\"customers_edit\",\"suppliers_view\",\"suppliers_add\",\"suppliers_edit\",\"sales_view\",\"sales_add\",\"sales_edit\",\"purchases_view\",\"purchases_add\",\"purchases_edit\",\"hr_view\",\"hr_add\",\"hr_edit\",\"hr_delete\",\"users_view\"]','2026-02-18 09:33:29'), +(6,'Accountant','[\"accounting_view\",\"accounting_add\",\"accounting_edit\"]','2026-02-18 09:34:03'); +/*!40000 ALTER TABLE `role_groups` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sales_return_items` +-- + +DROP TABLE IF EXISTS `sales_return_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `sales_return_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `return_id` int(11) NOT NULL, + `item_id` int(11) NOT NULL, + `quantity` decimal(15,2) NOT NULL, + `unit_price` decimal(15,3) NOT NULL, + `total_price` decimal(15,3) NOT NULL, + PRIMARY KEY (`id`), + KEY `return_id` (`return_id`), + KEY `item_id` (`item_id`), + CONSTRAINT `sales_return_items_ibfk_1` FOREIGN KEY (`return_id`) REFERENCES `sales_returns` (`id`) ON DELETE CASCADE, + CONSTRAINT `sales_return_items_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `stock_items` (`id`) ON DELETE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sales_return_items` +-- + +LOCK TABLES `sales_return_items` WRITE; +/*!40000 ALTER TABLE `sales_return_items` DISABLE KEYS */; +INSERT INTO `sales_return_items` VALUES +(1,1,2,2.00,0.250,0.500); +/*!40000 ALTER TABLE `sales_return_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `sales_returns` +-- + +DROP TABLE IF EXISTS `sales_returns`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `sales_returns` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `invoice_id` int(11) NOT NULL, + `customer_id` int(11) DEFAULT NULL, + `return_date` date NOT NULL, + `total_amount` decimal(15,3) NOT NULL DEFAULT 0.000, + `notes` text DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + KEY `invoice_id` (`invoice_id`), + KEY `customer_id` (`customer_id`), + CONSTRAINT `sales_returns_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE, + CONSTRAINT `sales_returns_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `sales_returns` +-- + +LOCK TABLES `sales_returns` WRITE; +/*!40000 ALTER TABLE `sales_returns` DISABLE KEYS */; +INSERT INTO `sales_returns` VALUES +(1,29,1,'2026-02-17',0.500,'','2026-02-17 16:30:50'); +/*!40000 ALTER TABLE `sales_returns` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `settings` +-- + +DROP TABLE IF EXISTS `settings`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `settings` ( + `key` varchar(50) NOT NULL, + `value` text DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `settings` +-- + +LOCK TABLES `settings` WRITE; +/*!40000 ALTER TABLE `settings` DISABLE KEYS */; +INSERT INTO `settings` VALUES +('allow_zero_stock_sell','1','2026-02-18 05:23:57'), +('bank_name','','2026-02-16 09:49:27'), +('company_address','AL Hamra\r\nOman','2026-02-16 10:05:55'), +('company_email','aalabry@gmail.com','2026-02-16 09:49:27'), +('company_iban','','2026-02-16 09:49:27'), +('company_logo','uploads/logo.png','2026-02-16 09:49:48'), +('company_name','Bahjet Al-Safa Trading','2026-02-16 09:49:26'), +('company_phone','99359472','2026-02-16 09:49:26'), +('company_website','','2026-02-16 09:49:27'), +('cr_number','','2026-02-16 09:18:20'), +('customer_display_greeting_text','أهلا وسهلاً بكــم','2026-02-18 17:02:02'), +('customer_display_greeting_title','Welcome','2026-02-18 17:02:02'), +('default_vat_rate','5','2026-02-16 09:49:27'), +('favicon','uploads/favicon.png','2026-02-16 10:09:59'), +('invoice_footer','','2026-02-16 09:49:27'), +('loyalty_enabled','0','2026-02-18 05:06:52'), +('loyalty_points_per_unit','1','2026-02-18 05:06:52'), +('loyalty_redeem_points_per_unit','100','2026-02-18 05:06:52'), +('manager_name','','2026-02-16 09:49:27'), +('registration_no','','2026-02-16 10:05:55'), +('vat_enabled','1','2026-02-16 09:18:20'), +('vat_number','OM25418','2026-02-16 09:49:27'); +/*!40000 ALTER TABLE `settings` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `stock_categories` +-- + +DROP TABLE IF EXISTS `stock_categories`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `stock_categories` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name_en` varchar(255) NOT NULL, + `name_ar` varchar(255) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `stock_categories` +-- + +LOCK TABLES `stock_categories` WRITE; +/*!40000 ALTER TABLE `stock_categories` DISABLE KEYS */; +INSERT INTO `stock_categories` VALUES +(1,'Spices','بهارات','2026-02-16 08:00:02'), +(2,'Food Stuff','مواد غذائية','2026-02-16 08:00:36'); +/*!40000 ALTER TABLE `stock_categories` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `stock_items` +-- + +DROP TABLE IF EXISTS `stock_items`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `stock_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `category_id` int(11) DEFAULT NULL, + `unit_id` int(11) DEFAULT NULL, + `supplier_id` int(11) DEFAULT NULL, + `name_en` varchar(255) NOT NULL, + `name_ar` varchar(255) NOT NULL, + `sku` varchar(100) DEFAULT NULL, + `purchase_price` decimal(15,3) DEFAULT 0.000, + `sale_price` decimal(15,3) DEFAULT 0.000, + `stock_quantity` decimal(15,2) DEFAULT 0.00, + `min_stock_level` decimal(15,2) DEFAULT 0.00, + `expiry_date` date DEFAULT NULL, + `image_path` varchar(255) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + `vat_rate` decimal(5,2) DEFAULT 0.00, + `is_promotion` tinyint(1) DEFAULT 0, + `promotion_start` date DEFAULT NULL, + `promotion_end` date DEFAULT NULL, + `promotion_percent` decimal(5,2) DEFAULT 0.00, + PRIMARY KEY (`id`), + UNIQUE KEY `sku` (`sku`), + KEY `category_id` (`category_id`), + KEY `unit_id` (`unit_id`), + KEY `fk_stock_items_supplier` (`supplier_id`), + CONSTRAINT `fk_stock_items_supplier` FOREIGN KEY (`supplier_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL, + CONSTRAINT `stock_items_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `stock_categories` (`id`) ON DELETE SET NULL, + CONSTRAINT `stock_items_ibfk_2` FOREIGN KEY (`unit_id`) REFERENCES `stock_units` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `stock_items` +-- + +LOCK TABLES `stock_items` WRITE; +/*!40000 ALTER TABLE `stock_items` DISABLE KEYS */; +INSERT INTO `stock_items` VALUES +(1,2,3,NULL,'Tomato','طماطم','1234567',0.400,0.450,-20.50,0.00,NULL,'uploads/items/item_6992d1c375bb8.jfif','2026-02-16 08:13:55',0.00,1,'2026-02-18','2026-02-19',15.00), +(2,2,3,6,'onion','بصل','123456',0.150,0.250,24.00,20.00,NULL,'uploads/items/item_699421bad9019.jfif','2026-02-17 04:22:48',5.00,1,'2026-02-18','2026-02-19',15.00); +/*!40000 ALTER TABLE `stock_items` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `stock_units` +-- + +DROP TABLE IF EXISTS `stock_units`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `stock_units` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name_en` varchar(255) NOT NULL, + `name_ar` varchar(255) NOT NULL, + `short_name_en` varchar(50) NOT NULL, + `short_name_ar` varchar(50) NOT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `stock_units` +-- + +LOCK TABLES `stock_units` WRITE; +/*!40000 ALTER TABLE `stock_units` DISABLE KEYS */; +INSERT INTO `stock_units` VALUES +(1,'piece','حبة','pcs','حبة','2026-02-16 08:01:29'), +(2,'Box','صندوق','Box','صندوق','2026-02-16 08:01:55'), +(3,'Kilogram','كيلوجرام','Kg','ك.ج','2026-02-16 08:02:53'); +/*!40000 ALTER TABLE `stock_units` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `system_license` +-- + +DROP TABLE IF EXISTS `system_license`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `system_license` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `license_key` varchar(255) NOT NULL, + `activation_token` text DEFAULT NULL, + `fingerprint` varchar(255) DEFAULT NULL, + `status` enum('pending','active','expired','suspended') DEFAULT 'pending', + `activated_at` datetime DEFAULT NULL, + `last_checked_at` datetime DEFAULT NULL, + `created_at` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `system_license` +-- + +LOCK TABLES `system_license` WRITE; +/*!40000 ALTER TABLE `system_license` DISABLE KEYS */; +INSERT INTO `system_license` VALUES +(1,'FLAT-8822-1192-3301','60952c06f50b36017a6626afe5196de6b08b49692db26716ebd90f25f791c0ca','e43ab74edcde18e3edea26e701d07c17cfdddf5e33a8e0f64bf56ff50e2c34bb','active','2026-02-18 10:48:04',NULL,'2026-02-18 10:48:04'); +/*!40000 ALTER TABLE `system_license` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `group_id` int(11) DEFAULT NULL, + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `email` varchar(255) DEFAULT NULL, + `phone` varchar(20) DEFAULT NULL, + `profile_pic` varchar(255) DEFAULT NULL, + `status` enum('active','inactive') DEFAULT 'active', + `created_at` timestamp NULL DEFAULT current_timestamp(), + `theme` varchar(50) DEFAULT 'default', + PRIMARY KEY (`id`), + UNIQUE KEY `username` (`username`), + KEY `group_id` (`group_id`), + CONSTRAINT `users_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `role_groups` (`id`) ON DELETE SET NULL +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES +(1,1,'admin','$2y$10$uLxB5VJa9nZ3nGhukx7jOeBotQ/PtumL3ndbzTZ.TjrAr9yJH/hIq','admin@example.com',NULL,'uploads/profile_1_1771401598.png','active','2026-02-18 05:30:12','default'), +(2,1,'admin2','$2y$10$A299UOd8VZWXyuKcbcLwWewIg.7V2ti3oomGaKH9qhMm4vdG6a/xi',NULL,NULL,NULL,'active','2026-02-18 06:44:10','default'), +(5,1,'moosa','$2y$10$Ho5NrFTAb6HUH4VvCd4NZuCsKGMl4v1pvWiesEuC29fDDu6Pkg7AS','aalabry@gmail.com',NULL,NULL,'active','2026-02-18 09:30:38','default'); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2026-02-19 4:47:13