--
-- Host: localhost    Database: aknan
-- ------------------------------------------------------


--
-- Table structure for table `companies`
--

CREATE TABLE `companies` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `company_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `telephone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mobile` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `companies_email_unique` (`email`),
  UNIQUE KEY `companies_telephone_unique` (`telephone`),
  UNIQUE KEY `companies_mobile_unique` (`mobile`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `companies`
--

INSERT INTO `companies` VALUES (1,'شركة ابراهيم الدولية','جدة','ibrahim-company@gmail.com','6300000','050000000',NULL,'customer','2023-03-04 09:13:50','2023-03-04 09:13:50'),(2,'مؤسسة المدهش',NULL,NULL,NULL,NULL,NULL,'customer','2023-03-04 09:18:26','2023-03-04 09:18:26'),(3,'مؤسسة خالد',NULL,NULL,NULL,NULL,NULL,'customer','2023-03-04 09:18:50','2023-03-04 09:18:50'),(4,'مؤسسة سالم',NULL,NULL,NULL,NULL,NULL,'customer','2023-03-04 09:19:01','2023-03-04 09:19:01'),(5,'مطبعة تفنين',NULL,NULL,NULL,NULL,NULL,'supplier','2023-03-04 09:19:47','2023-03-04 09:19:47'),(6,'مركز حياة',NULL,NULL,NULL,NULL,NULL,'supplier','2023-03-04 09:19:58','2023-03-04 09:19:58'),(7,'مطبعة تسنيم',NULL,NULL,NULL,NULL,NULL,'supplier','2023-03-04 09:20:12','2023-03-04 09:20:12'),(8,'عامر ميو','ميوميو','muo@gmail.com','6544','055654',NULL,'customer','2024-06-20 19:38:22','2024-06-20 19:38:22'),(9,'مطبعة أكنان سمارت','جدة',NULL,NULL,NULL,NULL,'supplier','2024-06-20 19:40:25','2024-06-20 19:40:25'),(10,'مطبعة الهندي اوفست','جدة',NULL,NULL,NULL,NULL,'customer','2024-06-20 19:40:50','2024-06-20 19:40:50'),(11,'استيكر لميع',NULL,NULL,NULL,NULL,NULL,'customer','2024-06-20 19:41:30','2024-06-20 19:41:30'),(12,'أختام السلطان','جدة',NULL,NULL,NULL,NULL,'supplier','2024-06-23 10:49:24','2024-06-23 10:49:24'),(13,'أحمد المصري كروت',NULL,NULL,NULL,NULL,NULL,'supplier','2024-06-23 11:10:31','2024-06-23 11:10:47'),(14,'خيالي',NULL,NULL,NULL,NULL,NULL,'customer','2024-06-30 16:46:35','2024-06-30 16:46:35'),(15,'خالد محمد',NULL,NULL,NULL,NULL,NULL,'customer','2024-07-01 07:19:07','2024-07-01 07:19:07'),(16,'ناصر',NULL,NULL,NULL,'2543546334',NULL,'customer','2024-08-24 07:28:07','2024-08-24 07:28:07'),(17,'بصمة حاشي',NULL,NULL,NULL,'0567131163',NULL,'customer','2024-09-11 08:46:26','2024-09-11 08:46:26'),(18,'فيرف - عبدالرحمن','جدة',NULL,NULL,'0555077518',NULL,'customer','2024-09-11 09:03:40','2024-09-11 09:03:40'),(19,'سدرة الوادي',NULL,NULL,NULL,NULL,NULL,'customer','2024-09-12 16:46:59','2024-09-12 16:46:59'),(20,'فاتورة خضروات',NULL,NULL,NULL,NULL,NULL,'customer','2024-09-15 19:00:03','2024-09-15 19:00:03'),(21,'معروف البنقالي',NULL,NULL,NULL,NULL,NULL,'supplier','2024-09-15 19:01:42','2024-09-15 19:01:42'),(22,'شمس العالم',NULL,NULL,NULL,NULL,NULL,'supplier','2024-09-15 19:02:47','2024-09-15 19:02:47'),(23,'كفتيريا نجمة البحر الأحمر',NULL,NULL,NULL,NULL,NULL,'customer','2024-09-19 08:23:24','2024-09-19 08:23:24'),(24,'القوات البحرية السعودية',NULL,NULL,NULL,NULL,NULL,'customer','2024-09-19 08:23:53','2024-09-19 08:23:53');

--
-- Table structure for table `documents`
--

CREATE TABLE `documents` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `file` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `documents_company_id_foreign` (`company_id`),
  CONSTRAINT `documents_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `documents`
--


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

CREATE TABLE `employees` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mobile` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `company_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `employees_email_unique` (`email`),
  UNIQUE KEY `employees_mobile_unique` (`mobile`),
  KEY `employees_company_id_foreign` (`company_id`),
  CONSTRAINT `employees_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


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

CREATE TABLE `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `invoice_product`
--

CREATE TABLE `invoice_product` (
  `invoice_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` bigint unsigned NOT NULL,
  `cost` double(8,2) NOT NULL,
  `sell_price` double(8,2) NOT NULL,
  `vat_rate` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'بدون ضريبة',
  `qty` double(8,2) NOT NULL,
  `discount` double(8,2) NOT NULL,
  `total` double(8,2) NOT NULL,
  `total_vat` double(8,2) NOT NULL,
  `supplier` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`invoice_id`,`product_id`),
  KEY `invoice_product_product_id_foreign` (`product_id`),
  CONSTRAINT `invoice_product_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`),
  CONSTRAINT `invoice_product_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_product`
--

INSERT INTO `invoice_product` VALUES ('IN0001',1,50.00,120.00,'0',1.00,0.00,120.00,120.00,'مطبعة تفنين','طباعة 1000 كرت مسلفن ');

--
-- Table structure for table `invoices`
--

CREATE TABLE `invoices` (
  `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_id` bigint unsigned NOT NULL,
  `emp_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quotation_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `workorder_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` bigint unsigned NOT NULL,
  `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `vat_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'بدون ضريبة',
  `payment_amount` double(8,2) DEFAULT '0.00',
  `total_vat` double(8,2) NOT NULL,
  `total_discount` double(8,2) NOT NULL,
  `total` double(8,2) NOT NULL,
  `total_cost` double(8,2) NOT NULL,
  `profit` double(8,2) NOT NULL,
  `add_vat` double(8,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoices_company_id_foreign` (`company_id`),
  KEY `invoices_quotation_id_foreign` (`quotation_id`),
  KEY `invoices_workorder_id_foreign` (`workorder_id`),
  KEY `invoices_user_id_foreign` (`user_id`),
  CONSTRAINT `invoices_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
  CONSTRAINT `invoices_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`),
  CONSTRAINT `invoices_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`),
  CONSTRAINT `invoices_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `work_orders` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `invoices` VALUES ('IN0001',19,NULL,NULL,'W0017',6,NULL,'بدون ضريبة','نقدية','0',120.00,120.00,0.00,120.00,50.00,70.00,0.00,'2025-01-17 21:11:30','2025-01-17 21:11:30');

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

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

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

INSERT INTO `migrations` VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_19_000000_create_failed_jobs_table',1),(4,'2020_09_12_133530_laratrust_setup_tables',1),(5,'2020_09_13_172956_create_companies_table',1),(6,'2020_09_14_144926_create_employees_table',1),(7,'2020_09_14_153459_create_documents_table',1),(8,'2020_09_19_141205_create_products_table',1),(9,'2020_09_20_135322_create_spendings_table',1),(10,'2020_10_13_150453_create_settings_table',1),(11,'2020_10_14_054730_create_owners_table',1),(12,'2020_10_27_081713_create_quotations_table',1),(13,'2020_10_29_171418_create_work_orders_table',1),(14,'2020_10_30_170126_create_invoices_table',1),(15,'2020_10_31_130917_create_payments_table',1);

--
-- Table structure for table `owners`
--

CREATE TABLE `owners` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name_er` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `title` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `telephone` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `mobile` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `commercial` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `number_vat` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `logo` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `owners`
--

INSERT INTO `owners` VALUES (1,'أكنان للدعاية والاعلان','Aknan Advertising','Trading & Marketing للتجارة والتسويق','جدة - باب مكة','0126301076','0502622135','irb20141@gmail.com','123456789','123456789','1718912813.jpg');

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

CREATE TABLE `payments` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `invoice_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `workorder_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paid` double(8,2) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `payments_invoice_id_foreign` (`invoice_id`),
  KEY `payments_workorder_id_foreign` (`workorder_id`),
  CONSTRAINT `payments_invoice_id_foreign` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`),
  CONSTRAINT `payments_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `work_orders` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `payments` VALUES (3,NULL,'W0016',100.00);

--
-- Table structure for table `permission_role`
--

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

--
-- Dumping data for table `permission_role`
--


--
-- Table structure for table `permission_user`
--

CREATE TABLE `permission_user` (
  `permission_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `user_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`permission_id`,`user_type`),
  KEY `permission_user_permission_id_foreign` (`permission_id`),
  CONSTRAINT `permission_user_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `permission_user`
--


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

CREATE TABLE `permissions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `permissions_name_unique` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `product_company`
--

CREATE TABLE `product_company` (
  `product_id` bigint unsigned NOT NULL,
  `company_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`company_id`,`product_id`),
  KEY `product_company_product_id_foreign` (`product_id`),
  CONSTRAINT `product_company_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
  CONSTRAINT `product_company_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_company`
--

INSERT INTO `product_company` VALUES (1,5),(1,6),(2,5),(2,6),(2,7),(3,5),(3,6),(3,7),(4,5),(4,6),(4,7),(5,5),(5,6),(5,7),(5,9),(7,9),(8,5),(8,7),(8,9),(9,9),(9,12),(10,21),(10,22),(11,6),(12,5),(12,6),(12,7),(12,9),(12,12),(12,13),(12,21),(12,22),(13,9);

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

CREATE TABLE `products` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `cost` double(8,2) DEFAULT NULL,
  `sell_price` double(8,2) NOT NULL,
  `qty` int DEFAULT NULL,
  `sku` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `category` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `unit_number` int DEFAULT NULL,
  `size` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `size_unit` char(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `color` tinyint DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `products` VALUES (1,'كروت شخصية',20.00,50.00,1000,NULL,'دعاية وإعلان','كرتون',2,'5','cm',2,'2023-03-04 09:21:11','2023-03-04 09:21:11'),(2,'بروشورات',5.00,10.00,1200,NULL,'دعاية وإعلان','ورقة',2,'2','cm',2,'2023-03-04 09:21:56','2023-03-04 09:21:56'),(3,'فواتير',10.00,50.00,1000,NULL,'القرطاسية','ورقة',2,'2','cm',2,'2023-03-04 10:01:20','2023-03-04 10:01:20'),(4,'بنر',100.00,200.00,10,NULL,'دعاية وإعلان','ورقة',2,'3','m',2,'2023-03-04 10:02:55','2023-03-04 10:02:55'),(5,'استيكر لميع',7.00,15.00,NULL,NULL,'دعاية وإعلان','متر',1,'1','m',NULL,'2024-06-20 19:44:25','2024-06-20 19:44:25'),(6,'جلدة ختم اتوماتيك',18.00,40.00,NULL,NULL,'دعاية وإعلان','حبة',NULL,NULL,NULL,1,'2024-06-23 10:50:32','2024-06-23 10:51:34'),(7,'ورق خطابات كونتراست ابيض - 100 حبة',NULL,100.00,NULL,NULL,'دعاية وإعلان','ورقة',NULL,NULL,NULL,1,'2024-06-23 11:12:53','2024-06-23 11:12:53'),(8,'بروشور مقاس A4',100.00,1000.00,NULL,NULL,'دعاية وإعلان','حبة',NULL,NULL,NULL,NULL,'2024-09-11 08:55:30','2024-09-11 08:55:30'),(9,'ختم اتمتيك دائري',50.00,150.00,NULL,NULL,'دعاية وإعلان','حبة',NULL,NULL,NULL,NULL,'2024-09-12 17:01:31','2024-09-12 17:01:31'),(10,'فواتير 20 بوك أصل فقط',140.00,250.00,NULL,NULL,'دعاية وإعلان','حبة',NULL,NULL,NULL,NULL,'2024-09-15 19:00:46','2024-09-15 19:00:46'),(11,'ملف كنت اسود كبير ماليزي',6.00,10.00,NULL,NULL,'القرطاسية','حبة',NULL,NULL,NULL,NULL,'2024-09-15 19:11:35','2024-09-15 19:11:35'),(12,'دروع',45.00,80.00,NULL,NULL,'دعاية وإعلان','حبة',1,NULL,NULL,NULL,'2024-09-19 08:31:41','2024-09-19 08:31:41'),(13,'شهادات فاخرة',80.00,40.00,NULL,NULL,'دعاية وإعلان','حبة',NULL,NULL,NULL,NULL,'2024-09-19 08:34:00','2024-09-19 08:34:00');

--
-- Table structure for table `quotation_product`
--

CREATE TABLE `quotation_product` (
  `quotation_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` bigint unsigned NOT NULL,
  `cost` double(8,2) NOT NULL,
  `sell_price` double(8,2) NOT NULL,
  `vat_rate` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'بدون ضريبة',
  `qty` double(8,2) NOT NULL,
  `discount` double(8,2) NOT NULL,
  `total` double(8,2) NOT NULL,
  `total_vat` double(8,2) NOT NULL,
  `supplier` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`quotation_id`,`product_id`),
  KEY `quotation_product_product_id_foreign` (`product_id`),
  CONSTRAINT `quotation_product_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `quotation_product_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `quotation_product`
--


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

CREATE TABLE `quotations` (
  `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_id` bigint unsigned NOT NULL,
  `emp_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` bigint unsigned NOT NULL,
  `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `vat_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'بدون ضريبة',
  `payment_method` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `duration` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `total_vat` double(8,2) NOT NULL,
  `total_discount` double(8,2) NOT NULL,
  `total` double(8,2) NOT NULL,
  `total_cost` double(8,2) NOT NULL,
  `profit` double(8,2) NOT NULL,
  `add_vat` double(8,2) NOT NULL,
  `status` tinyint DEFAULT NULL COMMENT '0 > active , 1 > expired',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `quotations_company_id_foreign` (`company_id`),
  KEY `quotations_user_id_foreign` (`user_id`),
  CONSTRAINT `quotations_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
  CONSTRAINT `quotations_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `quotations` VALUES ('Q0003',24,NULL,4,NULL,'بدون ضريبة','0','50% عند التعميد ، 50% عند التنفيذ','1',160.00,0.00,160.00,80.00,80.00,0.00,0,'2024-09-19 00:00:00','2024-09-19 08:56:16');

--
-- Table structure for table `role_user`
--

CREATE TABLE `role_user` (
  `role_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  `user_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`user_id`,`role_id`,`user_type`),
  KEY `role_user_role_id_foreign` (`role_id`),
  CONSTRAINT `role_user_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `role_user`
--

INSERT INTO `role_user` VALUES (1,1,'App\\User'),(2,4,'App\\User'),(2,5,'App\\User'),(2,6,'App\\User');

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

CREATE TABLE `roles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `display_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `description` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_name_unique` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

INSERT INTO `roles` VALUES (1,'admin','Admin','Can do everything in the app','2022-09-06 17:44:28','2022-09-06 17:44:28'),(2,'user','user','Can do specific tasks in the app','2022-09-06 17:44:28','2022-09-06 17:44:28');

--
-- Table structure for table `settings`
--

CREATE TABLE `settings` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `belongTo` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `settings`
--

INSERT INTO `settings` VALUES (1,'cm','Size'),(2,'m','Size'),(3,'1','Color'),(4,'2','Color'),(5,'4','Color'),(6,'كرتون','Unit'),(7,'قطعة','Unit'),(8,'كرت','Unit'),(9,'ورقة','Unit'),(10,'دعاية وإعلان','Category'),(11,'القرطاسية','Category'),(12,'ايجار','Section'),(13,'رواتب','Section'),(14,'مشتريات','Section'),(15,'50% عند التعميد ، 50% عند التنفيذ','Payment'),(16,'75% عند التعميد ، 25% عند التنفيذ','Payment'),(17,'15','Vat'),(18,'مصروفات','Section'),(19,'متر','Unit'),(20,'حبة','Unit'),(21,'درزن','Unit');

--
-- Table structure for table `spendings`
--

CREATE TABLE `spendings` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `statement` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `section` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` int NOT NULL,
  `file` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` bigint unsigned NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `spendings_user_id_foreign` (`user_id`),
  CONSTRAINT `spendings_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `spendings`
--


--
-- Table structure for table `work_orders`
--

CREATE TABLE `work_orders` (
  `id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `company_id` bigint unsigned NOT NULL,
  `emp_name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `quotation_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_id` bigint unsigned NOT NULL,
  `notes` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `vat_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `rate` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'بدون ضريبة',
  `payment_amount` double(8,2) DEFAULT '0.00',
  `duration` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `total_vat` double(8,2) NOT NULL,
  `total_discount` double(8,2) NOT NULL,
  `total` double(8,2) NOT NULL,
  `total_cost` double(8,2) NOT NULL,
  `profit` double(8,2) NOT NULL,
  `add_vat` double(8,2) NOT NULL,
  `status` tinyint DEFAULT NULL COMMENT '0 > active , 1 Canceled',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `work_orders_company_id_foreign` (`company_id`),
  KEY `work_orders_quotation_id_foreign` (`quotation_id`),
  KEY `work_orders_user_id_foreign` (`user_id`),
  CONSTRAINT `work_orders_company_id_foreign` FOREIGN KEY (`company_id`) REFERENCES `companies` (`id`),
  CONSTRAINT `work_orders_quotation_id_foreign` FOREIGN KEY (`quotation_id`) REFERENCES `quotations` (`id`),
  CONSTRAINT `work_orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `work_orders`
--

INSERT INTO `work_orders` VALUES ('W0008',16,NULL,NULL,1,NULL,'ضريبية','15',0.00,'1',120.00,0.00,104.35,60.00,44.35,15.65,0,'2024-08-24 07:29:36','2024-08-24 07:29:36'),('W0009',17,NULL,NULL,4,'بروشور مقاس A4  عدد 3000 حبة','بدون ضريبة','0',0.00,'2',0.00,0.00,0.00,195.00,75.00,0.00,1,'2024-09-11 08:50:38','2024-09-11 08:59:19'),('W0010',17,NULL,NULL,4,NULL,'بدون ضريبة','0',0.00,'3',900.00,0.00,900.00,650.00,250.00,0.00,0,'2024-09-11 08:58:15','2024-09-11 08:58:15'),('W0011',19,NULL,NULL,4,NULL,'بدون ضريبة','0',560.00,'1',820.00,0.00,820.00,560.00,260.00,0.00,0,'2024-09-12 16:50:43','2024-09-12 16:55:46'),('W0012',20,NULL,NULL,4,NULL,'بدون ضريبة','0',0.00,'1',250.00,0.00,250.00,140.00,110.00,0.00,0,'2024-09-15 19:09:28','2024-09-15 19:09:28'),('W0013',8,NULL,NULL,5,NULL,'بدون ضريبة','0',0.00,'1',150.00,0.00,150.00,50.00,100.00,0.00,0,'2024-09-19 08:18:03','2024-09-19 08:18:03'),('W0014',24,NULL,'Q0003',4,NULL,'بدون ضريبة','0',0.00,'1',160.00,0.00,160.00,80.00,80.00,0.00,0,'2024-09-19 08:57:13','2024-09-19 08:57:13'),('W0015',10,NULL,NULL,1,NULL,'بدون ضريبة','0',0.00,'1',150.00,0.00,150.00,60.00,90.00,0.00,0,'2024-09-30 07:53:40','2024-09-30 07:53:40'),('W0016',17,NULL,NULL,6,NULL,'بدون ضريبة','0',100.00,'3',200.00,0.00,200.00,50.00,150.00,0.00,0,'2025-01-17 21:03:11','2025-01-17 21:03:11'),('W0017',19,NULL,NULL,6,NULL,'بدون ضريبة','0',0.00,'2',120.00,0.00,120.00,50.00,70.00,0.00,0,'2025-01-17 21:05:47','2025-01-17 21:05:47');

--
-- Table structure for table `workorder_product`
--

CREATE TABLE `workorder_product` (
  `workorder_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_id` bigint unsigned NOT NULL,
  `cost` double(8,2) NOT NULL,
  `sell_price` double(8,2) NOT NULL,
  `vat_rate` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT 'بدون ضريبة',
  `qty` double(8,2) NOT NULL,
  `discount` double(8,2) NOT NULL,
  `total` double(8,2) NOT NULL,
  `total_vat` double(8,2) NOT NULL,
  `supplier` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `note` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`workorder_id`,`product_id`),
  KEY `workorder_product_product_id_foreign` (`product_id`),
  CONSTRAINT `workorder_product_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`),
  CONSTRAINT `workorder_product_workorder_id_foreign` FOREIGN KEY (`workorder_id`) REFERENCES `work_orders` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `workorder_product`
--

INSERT INTO `workorder_product` VALUES ('W0012',10,140.00,250.00,'0',1.00,0.00,250.00,250.00,'معروف البنقالي','فواتير '),('W0014',13,40.00,80.00,'0',2.00,0.00,160.00,160.00,'مطبعة أكنان سمارت',NULL),('W0016',5,50.00,200.00,'0',1.00,0.00,200.00,200.00,'مطبعة أكنان سمارت','طباعة استيكر لميع مع السلفان 2 م '),('W0017',1,50.00,120.00,'0',1.00,0.00,120.00,120.00,'مطبعة تفنين','طباعة 1000 كرت مسلفن ');


