-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             12.1.0.6537
-- --------------------------------------------------------


-- Dumping structure for table order_toko.ar_lists
CREATE TABLE IF NOT EXISTS `ar_lists` (
  `id` int NOT NULL AUTO_INCREMENT,
  `no_order` varchar(50) NOT NULL,
  `accountnum` varchar(50) NOT NULL,
  `store_name` varchar(100) NOT NULL,
  `invoice` varchar(50) NOT NULL,
  `points_used` decimal(11,2) NOT NULL,
  `amount` decimal(11,2) NOT NULL,
  `fixed_amount` decimal(11,2) NOT NULL,
  `due_date` datetime NOT NULL,
  `real_due_date` datetime NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.ar_lists: ~0 rows (approximately)

-- Dumping structure for table order_toko.ar_open
CREATE TABLE IF NOT EXISTS `ar_open` (
  `id` int NOT NULL AUTO_INCREMENT,
  `accountnum` varchar(50) NOT NULL,
  `store_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `amount` decimal(11,2) NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.ar_open: ~0 rows (approximately)

-- Dumping structure for table order_toko.carts
CREATE TABLE IF NOT EXISTS `carts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_mobile_id` int NOT NULL,
  `store_id` int NOT NULL,
  `item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `brand` varchar(50) NOT NULL,
  `group_item` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `product_division` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name_description` varchar(255) NOT NULL,
  `salesprice_incl` decimal(10,2) NOT NULL,
  `qty_box` decimal(10,2) NOT NULL,
  `mtp` decimal(10,2) NOT NULL,
  `qty` decimal(10,2) NOT NULL,
  `discount` decimal(5,2) NOT NULL,
  `sub_total` decimal(10,2) NOT NULL,
  `is_hkn` tinyint NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK__user_mobiles` (`user_mobile_id`),
  KEY `FK_carts_stores` (`store_id`),
  CONSTRAINT `FK__user_mobiles` FOREIGN KEY (`user_mobile_id`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_carts_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.carts: ~0 rows (approximately)

-- Dumping structure for table order_toko.cart_overviews
CREATE TABLE IF NOT EXISTS `cart_overviews` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_mobile_id` int NOT NULL,
  `store_id` int NOT NULL,
  `item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `brand` varchar(50) NOT NULL,
  `group_item` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `product_division` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `salesprice_incl` decimal(10,2) NOT NULL,
  `qty_box` decimal(10,2) NOT NULL,
  `mtp` decimal(10,2) NOT NULL,
  `qty` decimal(10,2) NOT NULL,
  `discount` decimal(5,2) NOT NULL,
  `sub_total` decimal(10,2) NOT NULL,
  `is_hkn` tinyint NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `FK__stores` (`store_id`) USING BTREE,
  KEY `FK__user_mobiles` (`user_mobile_id`) USING BTREE,
  CONSTRAINT `cart_overviews_ibfk_2` FOREIGN KEY (`user_mobile_id`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_cart_overviews_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- Dumping data for table order_toko.cart_overviews: ~0 rows (approximately)

-- Dumping structure for table order_toko.delivery_assignments
CREATE TABLE IF NOT EXISTS `delivery_assignments` (
  `id` int NOT NULL AUTO_INCREMENT,
  `order_id` bigint NOT NULL,
  `assigned_to` int NOT NULL,
  `ps_number` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `status_delivery` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_delivery_assignments_orders` (`order_id`),
  KEY `FK_delivery_assignments_user_mobiles` (`assigned_to`),
  CONSTRAINT `FK_delivery_assignments_orders` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_delivery_assignments_user_mobiles` FOREIGN KEY (`assigned_to`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.delivery_assignments: ~0 rows (approximately)

-- Dumping structure for table order_toko.detail_ar_lists
CREATE TABLE IF NOT EXISTS `detail_ar_lists` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `invoice` varchar(50) NOT NULL,
  `no_order` varchar(50) NOT NULL,
  `item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `brand` varchar(50) NOT NULL,
  `group_item` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `product_division` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `salesprice_incl` decimal(10,2) NOT NULL,
  `qty` decimal(10,2) NOT NULL,
  `discount` decimal(5,2) NOT NULL,
  `sub_total` decimal(10,2) NOT NULL,
  `is_hkn` tinyint NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- Dumping data for table order_toko.detail_ar_lists: ~0 rows (approximately)

-- Dumping structure for table order_toko.discounts
CREATE TABLE IF NOT EXISTS `discounts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_at` datetime DEFAULT NULL,
  `updated_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.discounts: ~4 rows (approximately)
INSERT INTO `discounts` (`id`, `name`, `created_at`, `updated_at`) VALUES
	(1, 'Basic Discount', '2025-10-20 14:10:24', '2025-10-20 14:10:25'),
	(2, 'D2', '2025-10-20 14:10:30', '2025-10-20 14:10:31'),
	(3, 'D3', '2025-10-20 14:10:42', '2025-10-20 14:10:42'),
	(4, 'D4', '2025-10-20 14:10:46', '2025-10-20 14:10:47');

-- Dumping structure for table order_toko.failed_jobs
CREATE TABLE IF NOT EXISTS `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `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`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table order_toko.failed_jobs: ~0 rows (approximately)

-- Dumping structure for table order_toko.hkn
CREATE TABLE IF NOT EXISTS `hkn` (
  `id` int NOT NULL AUTO_INCREMENT,
  `store_id` int NOT NULL,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `hkn_price` decimal(11,2) NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `FK_store_discounts_users` (`created_by`) USING BTREE,
  KEY `FK_store_discounts_users_2` (`modified_by`) USING BTREE,
  KEY `FK_store_discounts_stores` (`store_id`) USING BTREE,
  CONSTRAINT `hkn_ibfk_2` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `hkn_ibfk_3` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `hkn_ibfk_4` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- Dumping data for table order_toko.hkn: ~0 rows (approximately)
INSERT INTO `hkn` (`id`, `store_id`, `namelevel5`, `item_id`, `hkn_price`, `start_date`, `end_date`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 2, 'DISC PAD', '06435-K97-N01', 19000.00, '2025-10-20 14:48:37', '2025-12-20 14:48:37', 1, NULL, '2025-10-20 14:49:22', '2025-10-20 14:49:23'),
	(2, 1, 'GS. GASKET', '061A1-GN8-001', 42000.00, '2025-10-20 14:52:17', '2025-12-20 14:52:18', 1, NULL, '2025-10-20 14:52:27', '2025-10-20 14:52:30');

-- Dumping structure for table order_toko.image_categories
CREATE TABLE IF NOT EXISTS `image_categories` (
  `id` int NOT NULL AUTO_INCREMENT,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `image` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.image_categories: ~0 rows (approximately)

-- Dumping structure for table order_toko.item_masters
CREATE TABLE IF NOT EXISTS `item_masters` (
  `id` int NOT NULL AUTO_INCREMENT,
  `item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `brand` varchar(50) NOT NULL,
  `group_item` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `product_division` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `salesprice` decimal(10,2) NOT NULL,
  `salesprice_incl` decimal(10,2) NOT NULL,
  `mtp` decimal(10,2) NOT NULL,
  `qty_box` decimal(10,2) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `modified_by` int DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `FK_item_master_user_mobiles` (`modified_by`),
  CONSTRAINT `FK_item_master_user_mobiles` FOREIGN KEY (`modified_by`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- Dumping data for table order_toko.item_masters: ~15 rows (approximately)
INSERT INTO `item_masters` (`id`, `item_id`, `brand`, `group_item`, `product_division`, `namelevel3`, `namelevel4`, `namelevel5`, `name_description`, `salesprice`, `salesprice_incl`, `mtp`, `qty_box`, `created_at`, `updated_at`, `modified_by`) VALUES
	(1, '06141-GN5-505', 'HONDA', 'R2', 'IP', 'INDOPART', 'CHAINGEAR', 'CAM CHAIN KIT', 'HND : SUPRA,PRIMA,GRAND,ASTREA,WIN,C800', 23423.00, 26000.00, 20.00, 160.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(2, '06141-KRS-505', 'HONDA', 'R2', 'IP', 'INDOPART', 'CHAINGEAR', 'CAM CHAIN KIT', 'HND : SUPRAFIT,LEGENDA', 24324.00, 27000.00, 20.00, 160.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(3, '06141-KWB-505', 'HONDA', 'R2', 'IP', 'INDOPART', 'CHAINGEAR', 'CAM CHAIN KIT', 'HND : BLADE, ABS REVO', 24775.00, 27500.00, 20.00, 160.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(4, '061A1-GN8-001', 'HONDA', 'R2', 'IP', 'INDOPART', 'GASKET', 'GS. GASKET', 'HND : ASTREA STAR', 36036.00, 40000.00, 5.00, 100.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(5, '061A1-K03-001', 'HONDA', 'R2', 'IP', 'INDOPART', 'GASKET', 'GS. GASKET', 'HND : BLADE FI, REVO FI', 31532.00, 35000.00, 5.00, 100.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(6, '061A1-K15-001', 'HONDA', 'R2', 'IP', 'INDOPART', 'GASKET', 'GS. GASKET', 'HND : CB150, CB150R', 45045.00, 50000.00, 5.00, 100.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(7, '06435-K97-N01', 'HONDA', 'R2', 'IP', 'INDOPART', 'BRAKE', 'DISC PAD', 'HND:PCX150K97,ADV150 (RR)', 18018.00, 20000.00, 25.00, 100.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(8, '06435-KRE-G31', 'HONDA', 'R2', 'IP', 'INDOPART', 'BRAKE', 'DISC PAD', 'HND:CB150R STREEET FORE K15,CBR150R K45,CBR150R CBU,MEGAPRO,CRF150LK84,SONIC150RK56,SUPRAGTRK56 (RR)', 19820.00, 22000.00, 25.00, 100.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(9, '06435-KSP-B01', 'HONDA', 'R2', 'IP', 'INDOPART', 'BRAKE', 'DISC PAD', 'HND:NEW MEGAPRO (RR)', 20721.00, 23000.00, 25.00, 100.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(10, '12760-09J00-000', 'SUZUKI', 'R2', 'IP', 'INDOPART', 'CHAINGEAR', 'CAM CHAIN', 'SZK:NEX110,LET S110', 55856.00, 62000.00, 10.00, 50.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(11, '12760-12F50-000', 'SUZUKI', 'R2', 'IP', 'INDOPART', 'CHAINGEAR', 'CAM CHAIN', 'SZK:THUNDER125', 72072.00, 80000.00, 10.00, 50.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(12, '12760-20G00-000', 'SUZUKI', 'R2', 'IP', 'INDOPART', 'CHAINGEAR', 'CAM CHAIN', 'SZK:SKYDRIVE,SKYWAVE,SPIN,SHOGUN125', 56306.00, 62500.00, 10.00, 50.00, '2024-05-31 09:44:26', '2024-05-31 09:44:26', NULL),
	(13, '21066-1097', 'KAWASAKI', 'R2', 'IP', 'INDOPART', 'ELECTRIC', 'CDI/FLASH/RECT', 'KWK:KAZE/R', 54054.00, 60000.00, 5.00, 50.00, '2024-05-31 09:44:27', '2024-05-31 09:44:27', NULL),
	(14, '21066-1132', 'KAWASAKI', 'R2', 'IP', 'INDOPART', 'ELECTRIC', 'CDI/FLASH/RECT', 'KWK:BLITZ/R', 54054.00, 60000.00, 5.00, 50.00, '2024-05-31 09:44:27', '2024-05-31 09:44:27', NULL),
	(15, '21119-0064', 'KAWASAKI', 'R2', 'IP', 'INDOPART', 'ELECTRIC', 'CDI/FLASH/RECT', 'KWK:ATHLETE,KAZE125, HND:KIRANA', 199099.00, 221000.00, 5.00, 50.00, '2024-05-31 09:44:27', '2024-05-31 09:44:27', NULL);

-- Dumping structure for table order_toko.migrations
CREATE TABLE IF NOT EXISTS `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Dumping data for table order_toko.migrations: ~0 rows (approximately)
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
	(1, '2014_10_12_100000_create_password_resets_table', 1),
	(2, '2019_08_19_000000_create_failed_jobs_table', 1),
	(3, '2019_12_14_000001_create_personal_access_tokens_table', 1);

-- Dumping structure for table order_toko.notes
CREATE TABLE IF NOT EXISTS `notes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `notified_to` int NOT NULL,
  `no_invoice` varchar(50) NOT NULL,
  `amount` decimal(11,2) NOT NULL,
  `payment_status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `description` text NOT NULL,
  `status` int NOT NULL DEFAULT '1',
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_notes_user_mobiles` (`notified_to`),
  CONSTRAINT `FK_notes_user_mobiles` FOREIGN KEY (`notified_to`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.notes: ~0 rows (approximately)

-- Dumping structure for table order_toko.orders
CREATE TABLE IF NOT EXISTS `orders` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `no_order` varchar(50) NOT NULL,
  `store_id` int NOT NULL,
  `order_by` int NOT NULL,
  `user_sales` int NOT NULL,
  `total_price` decimal(11,2) NOT NULL,
  `status` varchar(50) NOT NULL,
  `download_status` tinyint NOT NULL,
  `is_approved` tinyint NOT NULL,
  `store_payment_id` int NOT NULL,
  `payment_terms` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `payment_terms_code` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_orders_stores` (`store_id`),
  KEY `FK_orders_user_mobiles` (`order_by`),
  KEY `FK_orders_user_mobiles_2` (`user_sales`),
  CONSTRAINT `FK_orders_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_orders_user_mobiles` FOREIGN KEY (`order_by`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_orders_user_mobiles_2` FOREIGN KEY (`user_sales`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.orders: ~0 rows (approximately)

-- Dumping structure for table order_toko.order_lists
CREATE TABLE IF NOT EXISTS `order_lists` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `order_id` bigint NOT NULL,
  `item_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `group_item` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `product_division` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel4` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `namelevel5` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `name_description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `salesprice_incl` decimal(10,2) NOT NULL,
  `qty_box` decimal(10,2) NOT NULL,
  `mtp` decimal(10,2) NOT NULL,
  `qty` decimal(10,2) NOT NULL,
  `discount` decimal(5,2) NOT NULL,
  `sub_total` decimal(10,2) NOT NULL,
  `is_hkn` tinyint NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `FK__user_mobiles` (`order_id`) USING BTREE,
  CONSTRAINT `FK_order_lists_orders` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- Dumping data for table order_toko.order_lists: ~0 rows (approximately)

-- Dumping structure for table order_toko.owners
CREATE TABLE IF NOT EXISTS `owners` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `no_identity` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `identity_picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `no_telp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_owners_users` (`created_by`),
  KEY `FK_owners_users_2` (`modified_by`),
  CONSTRAINT `FK_owners_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_owners_users_2` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.owners: ~2 rows (approximately)
INSERT INTO `owners` (`id`, `name`, `no_identity`, `identity_picture`, `no_telp`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 'Fenquini', '1234561234122', 'owners/identity/xkP0IE7VEgFde8TEMbdFAYgTzuUKECBCfsKXFJMB.png', '08190928019', 1, 1, '2025-10-20 13:56:06', '2025-10-21 00:06:57'),
	(2, 'Guilles', '12345612345612', '', '081284849102', 1, 1, '2025-10-20 13:56:06', '2025-10-21 00:02:20');

-- Dumping data for table order_toko.password_resets: ~0 rows (approximately)

-- Dumping structure for table order_toko.payment_terms
CREATE TABLE IF NOT EXISTS `payment_terms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.payment_terms: ~0 rows (approximately)
INSERT INTO `payment_terms` (`id`, `name`, `created_at`, `updated_at`) VALUES
	(1, 'Cash Before Delivery', '2025-10-20 14:04:22', '2025-10-20 14:04:22'),
	(2, 'TOP', '2025-10-20 14:04:29', '2025-10-20 14:04:29');

-- Dumping data for table order_toko.personal_access_tokens: ~0 rows (approximately)

-- Dumping structure for table order_toko.points
CREATE TABLE IF NOT EXISTS `points` (
  `id` int NOT NULL AUTO_INCREMENT,
  `store_id` int NOT NULL,
  `order_id` bigint NOT NULL,
  `total_points` decimal(11,2) NOT NULL,
  `trans_date` datetime NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_points_stores` (`store_id`),
  KEY `FK_points_orders` (`order_id`),
  CONSTRAINT `FK_points_orders` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_points_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.points: ~0 rows (approximately)

-- Dumping structure for table order_toko.programs
CREATE TABLE IF NOT EXISTS `programs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `target_transaction` decimal(12,2) NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_programs_users` (`created_by`),
  KEY `FK_programs_users_2` (`modified_by`),
  CONSTRAINT `FK_programs_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_programs_users_2` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.programs: ~1 rows (approximately)
INSERT INTO `programs` (`id`, `name`, `description`, `target_transaction`, `start_date`, `end_date`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 'Tour China', 'Ini tour China', 300000000.00, '2025-10-20 14:38:54', '2026-04-20 14:38:59', 1, NULL, '2025-10-20 14:39:19', '2025-10-20 14:39:21');

-- Dumping structure for table order_toko.promos
CREATE TABLE IF NOT EXISTS `promos` (
  `id` int NOT NULL AUTO_INCREMENT,
  `store_id` int NOT NULL,
  `namelevel5` varchar(50) NOT NULL,
  `item_id` varchar(50) DEFAULT NULL,
  `min_qty` int DEFAULT NULL,
  `discount` decimal(5,2) NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_promos_users` (`created_by`),
  KEY `FK_promos_users_2` (`modified_by`),
  KEY `FK_promos_stores` (`store_id`),
  CONSTRAINT `FK_promos_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_promos_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_promos_users_2` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.promos: ~3 rows (approximately)
INSERT INTO `promos` (`id`, `store_id`, `namelevel5`, `item_id`, `min_qty`, `discount`, `start_date`, `end_date`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 1, 'CAM CHAIN KIT', NULL, 10, 10.00, '2025-10-20 14:08:10', NULL, 1, NULL, '2025-10-20 14:08:14', '2025-10-20 14:08:16'),
	(2, 1, 'CDI/FLASH/RECT', '21066-1097', 4, 7.00, '2025-10-20 14:09:04', NULL, 1, NULL, '2025-10-20 14:09:15', '2025-10-20 14:09:18'),
	(3, 2, 'CAM CHAIN KIT', NULL, 10, 12.00, '2025-10-20 14:08:10', NULL, 1, NULL, '2025-10-20 14:08:14', '2025-10-20 14:08:16');

-- Dumping structure for table order_toko.roles
CREATE TABLE IF NOT EXISTS `roles` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.roles: ~3 rows (approximately)
INSERT INTO `roles` (`id`, `name`, `created_at`) VALUES
	(1, 'Administrator', '2025-10-17 13:43:14'),
	(2, 'Finance', '2025-10-17 13:43:14'),
	(3, 'Warehouse', '2025-10-17 13:43:14');

-- Dumping structure for table order_toko.sliders
CREATE TABLE IF NOT EXISTS `sliders` (
  `id` int NOT NULL AUTO_INCREMENT,
  `store_id` int DEFAULT NULL,
  `title` varchar(100) NOT NULL,
  `image` varchar(255) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_sliders_stores` (`store_id`),
  CONSTRAINT `FK_sliders_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.sliders: ~0 rows (approximately)

-- Dumping structure for table order_toko.stores
CREATE TABLE IF NOT EXISTS `stores` (
  `id` int NOT NULL AUTO_INCREMENT,
  `store_category_id` int NOT NULL,
  `user_sales` int NOT NULL,
  `owner_id` int NOT NULL,
  `accountnum` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `store_name` varchar(100) DEFAULT NULL,
  `store_picture` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
  `address` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
  `latitude` decimal(10,8) DEFAULT NULL,
  `longitude` decimal(11,8) DEFAULT NULL,
  `default_order_status` tinyint NOT NULL,
  `override_order_status` tinyint NOT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_stores_user_mobiles` (`user_sales`),
  KEY `FK_stores_owners` (`owner_id`),
  KEY `FK_stores_users` (`modified_by`),
  KEY `FK_stores_users_2` (`created_by`),
  KEY `FK_stores_store_categories` (`store_category_id`) USING BTREE,
  CONSTRAINT `FK_stores_owners` FOREIGN KEY (`owner_id`) REFERENCES `owners` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_stores_store_categories` FOREIGN KEY (`store_category_id`) REFERENCES `store_categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_stores_user_mobiles` FOREIGN KEY (`user_sales`) REFERENCES `user_mobiles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_stores_users` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_stores_users_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.stores: ~0 rows (approximately)
INSERT INTO `stores` (`id`, `store_category_id`, `user_sales`, `owner_id`, `accountnum`, `store_name`, `store_picture`, `address`, `latitude`, `longitude`, `default_order_status`, `override_order_status`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 3, 1, 1, '072133', 'MAJU MOTOR - TGR', NULL, 'tangerang', NULL, NULL, 1, 0, 1, NULL, '2025-10-20 14:03:10', '2025-10-20 14:03:13'),
	(2, 2, 1, 2, '071927', 'DINARTO MOTOR', NULL, 'tangerang', NULL, NULL, 0, 0, 1, NULL, '2025-10-20 14:03:10', '2025-10-20 14:03:13');

-- Dumping structure for table order_toko.store_categories
CREATE TABLE IF NOT EXISTS `store_categories` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `color` varchar(50) NOT NULL,
  `min_transaction` decimal(12,2) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.store_categories: ~3 rows (approximately)
INSERT INTO `store_categories` (`id`, `name`, `color`, `min_transaction`, `created_at`, `updated_at`) VALUES
	(1, 'Gold', '#FFD700', 100000000.00, '2025-10-20 13:50:57', '2025-10-20 13:50:57'),
	(2, 'Silver', '#C0C0C0', 75000000.00, '2025-10-20 13:50:57', '2025-10-20 13:50:57'),
	(3, 'Bronze', '#CD7F32', 50000000.00, '2025-10-20 13:51:07', '2025-10-20 13:51:08');

-- Dumping structure for table order_toko.store_discounts
CREATE TABLE IF NOT EXISTS `store_discounts` (
  `id` int NOT NULL AUTO_INCREMENT,
  `discount_id` int NOT NULL,
  `store_id` int NOT NULL,
  `namelevel5` varchar(50) NOT NULL,
  `item_id` varchar(50) DEFAULT NULL,
  `discount` decimal(5,2) NOT NULL,
  `status` enum('HET','HKN') NOT NULL,
  `start_date` datetime NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_store_discounts_users` (`created_by`),
  KEY `FK_store_discounts_users_2` (`modified_by`),
  KEY `FK_store_discounts_discounts` (`discount_id`),
  KEY `FK_store_discounts_stores` (`store_id`),
  CONSTRAINT `FK_store_discounts_discounts` FOREIGN KEY (`discount_id`) REFERENCES `discounts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_discounts_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_discounts_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_discounts_users_2` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.store_discounts: ~9 rows (approximately)
INSERT INTO `store_discounts` (`id`, `discount_id`, `store_id`, `namelevel5`, `item_id`, `discount`, `status`, `start_date`, `end_date`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 1, 1, 'CAM CHAIN KIT', NULL, 25.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(2, 2, 1, 'CAM CHAIN KIT', NULL, 5.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(3, 1, 1, 'CDI/FLASH/RECT', NULL, 25.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(4, 2, 1, 'CDI/FLASH/RECT', '21066-1097', 3.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(5, 1, 2, 'CAM CHAIN KIT', NULL, 25.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(6, 1, 2, 'CAM CHAIN KIT', NULL, 7.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(7, 1, 2, 'DISC PAD', NULL, 10.00, 'HKN', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(8, 1, 1, 'GS. GASKET', NULL, 10.00, 'HET', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04'),
	(9, 1, 1, 'GS. GASKET', NULL, 5.00, 'HKN', '2025-10-20 14:11:56', NULL, 1, NULL, '2025-10-20 14:12:02', '2025-10-20 14:12:04');

-- Dumping structure for table order_toko.store_payment_terms
CREATE TABLE IF NOT EXISTS `store_payment_terms` (
  `id` int NOT NULL AUTO_INCREMENT,
  `payment_terms_id` int NOT NULL,
  `store_id` int NOT NULL,
  `day` int NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `modified_by` int DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_store_payment_terms_payment_terms` (`payment_terms_id`),
  KEY `FK_store_payment_terms_stores` (`store_id`),
  KEY `FK_store_payment_terms_users` (`modified_by`),
  CONSTRAINT `FK_store_payment_terms_payment_terms` FOREIGN KEY (`payment_terms_id`) REFERENCES `payment_terms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_payment_terms_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_payment_terms_users` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.store_payment_terms: ~0 rows (approximately)
INSERT INTO `store_payment_terms` (`id`, `payment_terms_id`, `store_id`, `day`, `created_at`, `updated_at`, `modified_by`) VALUES
	(1, 1, 1, 7, '2025-10-20 14:04:47', '2025-10-20 14:04:49', NULL),
	(2, 2, 1, 14, '2025-10-20 14:05:09', '2025-10-20 14:05:09', NULL),
	(3, 1, 2, 7, '2025-10-20 14:05:09', '2025-10-20 14:05:09', NULL);

-- Dumping structure for table order_toko.store_programs
CREATE TABLE IF NOT EXISTS `store_programs` (
  `id` int NOT NULL AUTO_INCREMENT,
  `program_id` int NOT NULL,
  `store_id` int NOT NULL,
  `created_by` int NOT NULL,
  `modified_by` int DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK_store_programs_programs` (`program_id`),
  KEY `FK_store_programs_users` (`created_by`),
  KEY `FK_store_programs_users_2` (`modified_by`),
  KEY `FK_store_programs_stores` (`store_id`),
  CONSTRAINT `FK_store_programs_programs` FOREIGN KEY (`program_id`) REFERENCES `programs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_programs_stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_programs_users` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_store_programs_users_2` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- Dumping data for table order_toko.store_programs: ~2 rows (approximately)
INSERT INTO `store_programs` (`id`, `program_id`, `store_id`, `created_by`, `modified_by`, `created_at`, `updated_at`) VALUES
	(1, 1, 1, 1, NULL, '2025-10-20 14:41:05', '2025-10-20 14:41:06'),
	(2, 1, 2, 1, NULL, '2025-10-20 14:41:17', '2025-10-20 14:41:18');

-- Dumping structure for table order_toko.transaction_points
CREATE TABLE IF NOT EXISTS `transaction_points` (
  `id` bigint NOT NULL,
  `store_id` int NOT NULL,
  `order_id` bigint NOT NULL,
  `program_id` int NOT NULL,
  `total_points` decimal(11,2) NOT NULL,
  `trans_date` datetime NOT NULL,
  `status` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
  `created_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `FK__stores` (`store_id`),
  KEY `FK__orders` (`order_id`),
  KEY `FK_transaction_points_programs` (`program_id`),
  CONSTRAINT `FK__orders` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK__stores` FOREIGN KEY (`store_id`) REFERENCES `stores` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `FK_transaction_points_programs` FOREIGN KEY (`program_id`) REFERENCES `programs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

