--
-- Host: localhost    Database: safarid6_acc
-- ------------------------------------------------------


--
-- Current Database: `safarid6_acc`
--


--
-- Table structure for table `admin_details`
--

CREATE TABLE `admin_details` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `first_name` varchar(191) DEFAULT NULL,
  `last_name` varchar(191) DEFAULT NULL,
  `picture` varchar(191) DEFAULT NULL,
  `mobile` varchar(191) DEFAULT NULL,
  `tel` varchar(191) DEFAULT NULL,
  `description` varchar(191) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `admin_details`
--

INSERT INTO `admin_details` (`id`, `user_id`, `first_name`, `last_name`, `picture`, `mobile`, `tel`, `description`) VALUES (1,1,'مدیر','برنامه',NULL,NULL,NULL,NULL);

--
-- Table structure for table `bank_transactions`
--

CREATE TABLE `bank_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `bank_id` bigint(20) unsigned NOT NULL,
  `person_id` bigint(20) unsigned NOT NULL,
  `amount` varchar(191) NOT NULL,
  `invoice_number` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `bank_transactions_bank_id_foreign` (`bank_id`),
  KEY `bank_transactions_person_id_foreign` (`person_id`),
  CONSTRAINT `bank_transactions_bank_id_foreign` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `bank_transactions_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `people` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bank_transactions`
--


--
-- Table structure for table `bill_items`
--

CREATE TABLE `bill_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `bill_id` int(11) NOT NULL,
  `item_name` varchar(191) NOT NULL,
  `order_item_quantity` varchar(191) NOT NULL,
  `order_item_price` varchar(191) NOT NULL,
  `order_item_final_amount` varchar(191) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `bill_items`
--


--
-- Table structure for table `billing_invoices`
--

CREATE TABLE `billing_invoices` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(11) NOT NULL,
  `title` varchar(191) NOT NULL,
  `discount` bigint(20) NOT NULL,
  `discount_percent` int(10) unsigned DEFAULT NULL,
  `discount_type` enum('fixed','percent') NOT NULL DEFAULT 'fixed',
  `tax` bigint(20) NOT NULL,
  `total_amount_1` bigint(20) NOT NULL,
  `total_amount_2` bigint(20) NOT NULL,
  `bill_date` date NOT NULL,
  `description` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `billing_invoices`
--


--
-- Table structure for table `cash_transactions`
--

CREATE TABLE `cash_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `cash_id` bigint(20) unsigned NOT NULL,
  `person_id` bigint(20) unsigned NOT NULL,
  `amount` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cash_transactions_cash_id_foreign` (`cash_id`),
  KEY `cash_transactions_person_id_foreign` (`person_id`),
  CONSTRAINT `cash_transactions_cash_id_foreign` FOREIGN KEY (`cash_id`) REFERENCES `cashes` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `cash_transactions_person_id_foreign` FOREIGN KEY (`person_id`) REFERENCES `people` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cash_transactions`
--


--
-- Table structure for table `cashes`
--

CREATE TABLE `cashes` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(191) NOT NULL,
  `balance` varchar(191) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `cashes`
--

INSERT INTO `cashes` (`id`, `title`, `balance`, `is_active`, `description`, `created_at`, `updated_at`) VALUES (1,'صندوق سفری دیگر','0',1,NULL,'2023-03-04 16:20:29','2023-03-04 16:20:29');

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

CREATE TABLE `companies` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(191) NOT NULL,
  `title` varchar(191) NOT NULL,
  `reg_number` bigint(20) DEFAULT NULL,
  `description` varchar(191) DEFAULT NULL,
  `logo` varchar(191) DEFAULT NULL,
  `country` varchar(191) DEFAULT NULL,
  `state` varchar(191) DEFAULT NULL,
  `city` varchar(191) DEFAULT NULL,
  `address` varchar(191) DEFAULT NULL,
  `zip_code` varchar(191) DEFAULT NULL,
  `tel` varchar(191) DEFAULT NULL,
  `fax` varchar(191) DEFAULT NULL,
  `email` varchar(191) DEFAULT NULL,
  `website` varchar(191) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


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

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

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


--
-- Table structure for table `income__costs`
--

CREATE TABLE `income__costs` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(191) NOT NULL,
  `description` varchar(191) NOT NULL,
  `amount` bigint(20) NOT NULL,
  `type` enum('1','2') NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `income__costs`
--

INSERT INTO `income__costs` (`id`, `title`, `description`, `amount`, `type`, `date`) VALUES (1,'موجودی حساب','مانده حساب',1237861564,'1','2023-03-04'),(2,'دریافتی از بهنام','دریافتی بابت لپ تاپ',400000000,'1','2023-03-04'),(3,'تمدید هاست','تمدید هاست',2305350,'2','2023-03-04');

--
-- Table structure for table `invoice_payments`
--

CREATE TABLE `invoice_payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint(20) unsigned NOT NULL,
  `payment_type` varchar(191) NOT NULL,
  `payment_id` bigint(20) unsigned NOT NULL,
  `status` enum('pending','succeed') NOT NULL DEFAULT 'succeed',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_payments_sale_id_foreign` (`sale_id`),
  CONSTRAINT `invoice_payments_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `invoice_payments`
--


--
-- Table structure for table `legacy_transactions`
--

CREATE TABLE `legacy_transactions` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `amount` varchar(191) NOT NULL,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `legacy_transactions`
--


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

CREATE TABLE `license_activations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(191) DEFAULT NULL,
  `orderid` varchar(191) DEFAULT NULL,
  `status` enum('0','1') NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `license_activations`
--

INSERT INTO `license_activations` (`id`, `username`, `orderid`, `status`, `created_at`, `updated_at`) VALUES (1,'aminbabazadeh','96516567797','1','2023-03-04 16:17:46','2023-03-04 16:18:59');

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

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

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

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (1,'2014_10_12_000000_create_users_table',1),(2,'2014_10_12_100000_create_password_resets_table',1),(3,'2019_08_19_000000_create_failed_jobs_table',1),(4,'2020_12_08_213535_create_people_table',1),(5,'2020_12_08_213651_create_persons_categories_table',1),(6,'2020_12_08_213736_create_persons_infos_table',1),(7,'2020_12_12_101726_create_product_categories_table',1),(8,'2020_12_12_103717_create_products_table',1),(9,'2020_12_14_155556_create_sales_table',1),(10,'2020_12_14_164122_create_salesmen_table',1),(11,'2020_12_28_112115_create_sale_items_table',1),(12,'2020_12_30_102543_create_companies_table',1),(13,'2021_01_02_124354_create_admin_details_table',1),(14,'2021_01_03_122405_create_income__costs_table',1),(15,'2021_01_04_120744_create_received_checks_table',1),(16,'2021_01_04_120805_create_paid_checks_table',1),(17,'2021_01_05_092759_create_permission_tables',1),(18,'2021_01_07_182531_create_payments_table',1),(19,'2021_01_18_142923_create_billing_invoices_table',1),(20,'2021_02_03_150757_create_license_activations_table',1),(21,'2021_10_06_200538_create_bill_items_table',1),(22,'2022_05_25_135509_add_discount_percent_columns_to_sales_table',1),(23,'2022_05_25_171038_add_discount_percent_columns_to_billing_invoices_table',1),(24,'2022_06_23_202725_create_cashes_table',1),(25,'2022_06_23_202735_create_banks_table',1),(26,'2022_06_23_202839_create_invoice_payments_table',1),(27,'2022_06_23_214629_create_cash_transactions_table',1),(28,'2022_06_23_214639_create_bank_transactions_table',1),(29,'2022_07_05_231820_create_legacy_transactions_table',1);

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

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

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


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

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

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

INSERT INTO `model_has_roles` (`role_id`, `model_type`, `model_id`) VALUES (1,'App\\Models\\User',1);

--
-- Table structure for table `paid_checks`
--

CREATE TABLE `paid_checks` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(11) NOT NULL,
  `amount` bigint(20) NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `bank` varchar(191) NOT NULL,
  `branch` varchar(191) NOT NULL,
  `status` enum('0','1','2') NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `paid_checks`
--


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

CREATE TABLE `payments` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `transactionId` varchar(191) NOT NULL,
  `ref_id` varchar(191) DEFAULT NULL,
  `sale_id` int(11) NOT NULL,
  `person_id` int(11) NOT NULL,
  `amount` bigint(20) NOT NULL,
  `status` enum('0','1') NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `people`
--

CREATE TABLE `people` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `company_name` varchar(191) DEFAULT NULL,
  `title` varchar(191) DEFAULT NULL,
  `first_name` varchar(191) DEFAULT NULL,
  `last_name` varchar(191) DEFAULT NULL,
  `alias` varchar(191) NOT NULL,
  `category` int(11) NOT NULL,
  `picture` varchar(191) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `people_id_unique` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `people`
--

INSERT INTO `people` (`id`, `company_name`, `title`, `first_name`, `last_name`, `alias`, `category`, `picture`, `created_at`, `updated_at`) VALUES (1,'سفری دیگر باستان','آقای','امین','بابازاده','بابازاده',1,'/storage/person-images/640370fcd895f1677947132.png','2023-03-04 16:23:46','2023-03-04 16:25:32');

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

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

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

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES (1,'Persons','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(2,'Companies','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(3,'Salesman','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(4,'Products','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(5,'Sales','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(6,'Income_Cost','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(7,'Warehouse','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(8,'Accounting','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(9,'Users','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(10,'Setting','web','2023-03-04 16:15:52','2023-03-04 16:15:52'),(11,'Reports','web','2023-03-04 16:15:52','2023-03-04 16:15:52');

--
-- Table structure for table `persons_categories`
--

CREATE TABLE `persons_categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `cat_name` varchar(191) NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `persons_categories`
--

INSERT INTO `persons_categories` (`id`, `cat_name`, `description`, `created_at`, `updated_at`) VALUES (1,'سفری دیگر',NULL,'2023-03-04 16:23:08','2023-03-04 16:23:08');

--
-- Table structure for table `persons_infos`
--

CREATE TABLE `persons_infos` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(11) NOT NULL,
  `national_id` bigint(20) DEFAULT NULL,
  `economic_code` bigint(20) DEFAULT NULL,
  `reg_number` bigint(20) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `address` varchar(191) DEFAULT NULL,
  `country` varchar(191) DEFAULT NULL,
  `state` varchar(191) DEFAULT NULL,
  `city` varchar(191) DEFAULT NULL,
  `zip_code` varchar(191) DEFAULT NULL,
  `tel` varchar(191) DEFAULT NULL,
  `mobile` varchar(191) DEFAULT NULL,
  `fax` varchar(191) DEFAULT NULL,
  `email` varchar(191) DEFAULT NULL,
  `website` varchar(191) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `persons_infos`
--

INSERT INTO `persons_infos` (`id`, `person_id`, `national_id`, `economic_code`, `reg_number`, `description`, `address`, `country`, `state`, `city`, `zip_code`, `tel`, `mobile`, `fax`, `email`, `website`, `created_at`, `updated_at`) VALUES (1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2023-03-04 16:23:46','2023-03-04 16:25:32');

--
-- Table structure for table `product_categories`
--

CREATE TABLE `product_categories` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `cat_name` varchar(191) NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `product_categories`
--

INSERT INTO `product_categories` (`id`, `cat_name`, `description`, `created_at`, `updated_at`) VALUES (1,'خدمات ویزا',NULL,'2023-03-05 06:05:46','2023-03-05 06:05:46');

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

CREATE TABLE `products` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `p_code` varchar(191) DEFAULT NULL,
  `name` varchar(191) NOT NULL,
  `p_category` int(11) NOT NULL,
  `buy_price` bigint(20) NOT NULL,
  `sell_price` bigint(20) NOT NULL,
  `count` int(11) DEFAULT 0,
  `image` varchar(191) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `status` enum('0','1') NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_id_unique` (`id`),
  UNIQUE KEY `products_p_code_unique` (`p_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `received_checks`
--

CREATE TABLE `received_checks` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(11) NOT NULL,
  `amount` bigint(20) NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `bank` varchar(191) NOT NULL,
  `branch` varchar(191) NOT NULL,
  `status` enum('0','1','2','3') NOT NULL,
  `image` varchar(191) DEFAULT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `received_checks`
--


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

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

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

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1),(11,1);

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

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

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

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES (1,'super-admin','web','2023-03-04 16:15:52','2023-03-04 16:15:52');

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

CREATE TABLE `sale_items` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` int(11) NOT NULL,
  `item_name` varchar(191) NOT NULL,
  `order_item_quantity` varchar(191) NOT NULL,
  `order_item_price` varchar(191) NOT NULL,
  `order_item_final_amount` varchar(191) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


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

CREATE TABLE `sales` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `person_id` int(11) NOT NULL,
  `salesman_id` int(11) NOT NULL,
  `company_id` int(11) NOT NULL,
  `title` varchar(191) NOT NULL,
  `discount` bigint(20) NOT NULL,
  `discount_percent` int(10) unsigned DEFAULT NULL,
  `discount_type` enum('fixed','percent') NOT NULL DEFAULT 'fixed',
  `tax` bigint(20) NOT NULL,
  `total_amount_1` bigint(20) NOT NULL,
  `total_amount_2` bigint(20) NOT NULL,
  `sale_date` date NOT NULL,
  `remaining_date` date NOT NULL,
  `status` enum('0','1') NOT NULL,
  `description` text DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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


--
-- Table structure for table `salesmen`
--

CREATE TABLE `salesmen` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(191) NOT NULL,
  `first_name` varchar(191) NOT NULL,
  `last_name` varchar(191) NOT NULL,
  `picture` varchar(191) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),
  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `salesmen_id_unique` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data for table `salesmen`
--


--
-- Dumping events for database 'safarid6_acc'
--

--
-- Dumping routines for database 'safarid6_acc'
--


