-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 26 Jan 2026 pada 23.26
-- Versi server: 10.4.32-MariaDB
-- Versi PHP: 8.2.12

START TRANSACTION;



--
-- Database: `umi-cell`
--

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

--
-- Struktur dari tabel `branches`
--

CREATE TABLE `branches` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `address` text DEFAULT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT 1,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `branches`
--

INSERT INTO `branches` (`id`, `name`, `address`, `phone`, `is_active`, `created_at`, `updated_at`) VALUES
(1, 'Cabang Pusat', 'Jl. Raya Utama No. 123, Kaliwungu', '0831-2369-0224', 1, '2026-01-24 00:54:55', '2026-01-24 00:54:55'),
(2, 'Cabang Mijen', 'Jl. Mijen Raya No. 456, Mijen', '0838-3828-2729', 1, '2026-01-24 00:54:55', '2026-01-24 00:54:55');

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

--
-- Struktur dari tabel `brands`
--

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

--
-- Dumping data untuk tabel `brands`
--

INSERT INTO `brands` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Redmi', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(2, 'Lenovo', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(3, 'Universal', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(4, 'Tecno', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(5, 'Infinix', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(6, 'Realme', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(7, 'Vivo', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(8, 'Oppo', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(9, 'Xiaomi', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(10, 'iPhone', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(11, 'Samsung', '2026-01-24 00:57:35', '2026-01-24 00:57:35'),
(12, 'ASUS', '2026-01-24 08:48:03', '2026-01-24 08:48:03'),
(13, 'OG', '2026-01-24 10:56:10', '2026-01-24 10:56:10');

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

--
-- Struktur dari tabel `categories`
--

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

--
-- Dumping data untuk tabel `categories`
--

INSERT INTO `categories` (`id`, `name`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Laptop', 'Produk laptop baru dan bekas', '2026-01-24 00:56:12', '2026-01-24 00:56:12'),
(2, 'Pulsa & Paket Data', 'Produk digital pulsa dan paket data', '2026-01-24 00:56:12', '2026-01-24 00:56:12'),
(3, 'Sparepart', 'Sparepart handphone', '2026-01-24 00:56:12', '2026-01-24 00:56:12'),
(4, 'Aksesoris HP', 'Aksesoris handphone seperti case, charger, dll', '2026-01-24 00:56:12', '2026-01-24 00:56:12'),
(5, 'Handphone', 'Produk handphone baru dan bekas', '2026-01-24 00:56:12', '2026-01-24 00:56:12'),
(6, 'LCD', 'LCD', '2026-01-24 10:55:58', '2026-01-24 10:55:58');

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

--
-- Struktur dari tabel `customers`
--

CREATE TABLE `customers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `customers`
--

INSERT INTO `customers` (`id`, `name`, `phone`, `address`, `email`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 'Rama', '081234567890', 'Boja', 'customer1@example.com', 2, '2026-01-24 00:59:25', '2026-01-24 00:59:25'),
(2, 'Dzul', '081234567891', 'Demak', 'customer2@example.com', 3, '2026-01-24 00:59:25', '2026-01-24 00:59:25');

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

--
-- Struktur dari tabel `failed_jobs`
--

CREATE TABLE `failed_jobs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `uuid` varchar(255) NOT NULL,
  `connection` text NOT NULL,
  `queue` text NOT NULL,
  `payload` longtext NOT NULL,
  `exception` longtext NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `jobs`
--

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

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

--
-- Struktur dari tabel `job_batches`
--

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

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

--
-- Struktur dari tabel `migrations`
--

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) NOT NULL,
  `batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `migrations`
--

INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '0001_01_01_000000_create_users_table', 1),
(2, '0001_01_01_000001_create_cache_table', 1),
(3, '0001_01_01_000002_create_jobs_table', 1),
(4, '2025_12_07_033020_create_permission_tables', 1),
(5, '2025_12_07_221610_create_branches_table', 1),
(6, '2025_12_07_221832_create_categories_table', 1),
(7, '2025_12_07_221844_create_brands_table', 1),
(8, '2025_12_07_221854_create_suppliers_table', 1),
(9, '2025_12_07_221900_create_customers_table', 1),
(10, '2025_12_07_221905_create_products_table', 1),
(11, '2025_12_07_221912_create_product_stocks_table', 1),
(12, '2025_12_07_221918_create_product_prices_table', 1),
(13, '2025_12_07_221923_create_stock_movements_table', 1),
(14, '2025_12_07_221929_create_purchases_table', 1),
(15, '2025_12_07_221934_create_purchase_details_table', 1),
(16, '2025_12_07_221939_create_sales_table', 1),
(17, '2025_12_07_221944_create_sale_details_table', 1),
(18, '2025_12_07_221951_create_stock_opnames_table', 1),
(19, '2025_12_07_221957_create_stock_opname_details_table', 1),
(20, '2025_12_31_170645_create_services_table', 1),
(21, '2025_12_31_170930_create_service_details_table', 1),
(22, '2025_12_31_171008_create_service_status_histories_table', 1),
(23, '2026_01_03_005021_add_user_id_to_customers_table', 1),
(24, '2026_01_03_020258_add_barcode_to_purchases_table', 1),
(25, '2026_01_03_062019_add_barcode_to_sales_table', 1),
(26, '2026_01_03_065544_add_barcode_to_services_table', 1),
(27, '2026_01_11_040606_add_guest_and_tracking_fields_to_services_table', 1),
(28, '2026_01_11_042511_make_customer_id_nullable_in_services_table', 1),
(29, '2026_01_11_060000_add_recipient_id_to_services_table', 1),
(30, '2026_01_16_074634_create_ms_nota_services_table', 1),
(31, '2026_01_17_000001_add_global_stock_to_products', 1),
(32, '2026_01_17_000002_add_new_product_fields_to_purchase_details', 1),
(33, '2026_01_17_000003_remove_branch_id_from_stock_movements', 1),
(34, '2026_01_17_000004_drop_product_stocks_and_prices', 1),
(35, '2026_01_17_105434_add_products_edit_permission', 1),
(36, '2026_01_24_000000_add_guest_columns_to_sales_table', 2),
(37, '2026_01_24_104337_add_discount_and_tax_to_purchases_table', 3),
(38, '2026_01_24_104348_add_discount_and_tax_to_services_table', 3),
(39, '2026_01_24_185739_add_menunggu_antrian_to_services_table', 4),
(40, '2026_01_24_210326_add_service_fields_to_sales_table', 5),
(41, '2026_01_25_054516_make_product_id_nullable_on_sale_details_table', 6),
(42, '2026_01_25_131332_create_ms_nota_purchases_table', 7),
(43, '2026_01_25_131340_create_ms_nota_sales_table', 7),
(44, '2026_01_25_131401_create_ms_dashboard_informations_table', 7),
(45, '2026_01_25_165040_add_return_column_to_products_table', 8);

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

--
-- Struktur dari tabel `model_has_permissions`
--

CREATE TABLE `model_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `model_has_roles`
--

CREATE TABLE `model_has_roles` (
  `role_id` bigint(20) UNSIGNED NOT NULL,
  `model_type` varchar(255) NOT NULL,
  `model_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `model_has_roles`
--

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

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

--
-- Struktur dari tabel `ms_dashboard_informations`
--

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

--
-- Dumping data untuk tabel `ms_dashboard_informations`
--

INSERT INTO `ms_dashboard_informations` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'besok libur,,,setelah libur ada promo setiap pemebelian lcd dpt topi', '2026-01-25 07:30:38', '2026-01-25 07:30:38'),
(2, 'beli 1 gratis 1', '2026-01-25 07:32:42', '2026-01-25 07:32:42');

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

--
-- Struktur dari tabel `ms_nota_purchases`
--

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

--
-- Dumping data untuk tabel `ms_nota_purchases`
--

INSERT INTO `ms_nota_purchases` (`id`, `name`, `created_at`, `updated_at`) VALUES
(2, '1', '2026-01-25 07:15:54', '2026-01-25 07:15:54'),
(3, '2', '2026-01-25 07:15:57', '2026-01-25 07:15:57');

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

--
-- Struktur dari tabel `ms_nota_sales`
--

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

--
-- Dumping data untuk tabel `ms_nota_sales`
--

INSERT INTO `ms_nota_sales` (`id`, `name`, `created_at`, `updated_at`) VALUES
(2, '1', '2026-01-25 07:04:00', '2026-01-25 07:04:00'),
(3, '2', '2026-01-25 07:04:05', '2026-01-25 07:04:05'),
(4, '3', '2026-01-25 07:04:09', '2026-01-25 07:04:09');

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

--
-- Struktur dari tabel `ms_nota_services`
--

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

--
-- Dumping data untuk tabel `ms_nota_services`
--

INSERT INTO `ms_nota_services` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, '1', '2026-01-24 00:59:36', '2026-01-24 00:59:36'),
(2, '2', '2026-01-24 00:59:41', '2026-01-24 00:59:41');

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

--
-- Struktur dari tabel `permissions`
--

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

--
-- Dumping data untuk tabel `permissions`
--

INSERT INTO `permissions` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(2, 'permissions.index', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(3, 'roles.index', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(4, 'roles.create', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(5, 'roles.edit', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(6, 'roles.delete', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(7, 'users.index', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(8, 'users.create', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(9, 'users.edit', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(10, 'users.delete', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(11, 'branches.index', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(12, 'branches.create', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(13, 'branches.edit', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(14, 'branches.delete', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(15, 'categories.index', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(16, 'categories.create', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(17, 'categories.edit', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(18, 'categories.delete', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(19, 'brands.index', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(20, 'brands.create', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(21, 'brands.edit', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(22, 'brands.delete', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(23, 'suppliers.index', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(24, 'suppliers.create', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(25, 'suppliers.edit', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(26, 'suppliers.delete', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(27, 'customers.index', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(28, 'customers.create', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(29, 'customers.edit', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(30, 'customers.delete', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(31, 'ms_nota_services.index', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(32, 'ms_nota_services.create', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(33, 'ms_nota_services.edit', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(34, 'ms_nota_services.delete', 'web', '2026-01-24 00:45:00', '2026-01-24 00:45:00'),
(35, 'products.index', 'web', '2026-01-24 01:00:13', '2026-01-24 01:00:13'),
(36, 'purchases.index', 'web', '2026-01-24 01:00:13', '2026-01-24 01:00:13'),
(37, 'purchases.create', 'web', '2026-01-24 01:00:13', '2026-01-24 01:00:13'),
(38, 'purchases.edit', 'web', '2026-01-24 01:00:13', '2026-01-24 01:00:13'),
(39, 'purchases.delete', 'web', '2026-01-24 01:00:13', '2026-01-24 01:00:13'),
(40, 'sales.index', 'web', '2026-01-24 01:12:20', '2026-01-24 01:12:20'),
(41, 'sales.create', 'web', '2026-01-24 01:12:20', '2026-01-24 01:12:20'),
(42, 'sales.edit', 'web', '2026-01-24 01:12:20', '2026-01-24 01:12:20'),
(43, 'sales.delete', 'web', '2026-01-24 01:12:20', '2026-01-24 01:12:20'),
(44, 'services.index', 'web', '2026-01-24 01:26:08', '2026-01-24 01:26:08'),
(45, 'services.create', 'web', '2026-01-24 01:26:08', '2026-01-24 01:26:08'),
(46, 'services.edit', 'web', '2026-01-24 01:26:08', '2026-01-24 01:26:08'),
(47, 'services.delete', 'web', '2026-01-24 01:26:08', '2026-01-24 01:26:08'),
(48, 'stock-movements.index', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(49, 'stock-opnames.index', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(50, 'stock-opnames.create', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(51, 'stock-opnames.edit', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(52, 'stock-opnames.delete', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(53, 'profit.index', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(54, 'item.index', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(55, 'service-reports.index', 'web', '2026-01-24 02:38:49', '2026-01-24 02:38:49'),
(56, 'products.edit', 'web', '2026-01-24 03:35:10', '2026-01-24 03:35:10'),
(57, 'ms_nota_purchases.index', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(58, 'ms_nota_purchases.create', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(59, 'ms_nota_purchases.edit', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(60, 'ms_nota_purchases.delete', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(61, 'ms_nota_sales.index', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(62, 'ms_nota_sales.create', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(63, 'ms_nota_sales.edit', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(64, 'ms_nota_sales.delete', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(65, 'ms_dashboard_informations.index', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(66, 'ms_dashboard_informations.create', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(67, 'ms_dashboard_informations.edit', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08'),
(68, 'ms_dashboard_informations.delete', 'web', '2026-01-25 06:59:08', '2026-01-25 06:59:08');

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

--
-- Struktur dari tabel `products`
--

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `category_id` bigint(20) UNSIGNED NOT NULL,
  `brand_id` bigint(20) UNSIGNED NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `unit` varchar(20) NOT NULL DEFAULT 'pcs',
  `stock` int(11) NOT NULL DEFAULT 0,
  `return` bigint(20) NOT NULL DEFAULT 0,
  `purchase_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `selling_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `min_stock` int(11) NOT NULL DEFAULT 0,
  `description` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `products`
--

INSERT INTO `products` (`id`, `name`, `category_id`, `brand_id`, `barcode`, `unit`, `stock`, `return`, `purchase_price`, `selling_price`, `min_stock`, `description`, `created_at`, `updated_at`) VALUES
(1, 'IPHONE 7', 5, 10, 'PRD260124uARLhLOCdUvi4U7qHxrusTdEfqexqWhw5S66WOTJQu8s4XVp0Th26BxBpaXFrzy5fNchUnBguEkQX43rhcndA1Pbh4mwgLWTbSkb', 'PCS', 2, 0, 2000000.00, 3000000.00, 0, NULL, '2026-01-24 01:08:27', '2026-01-25 09:42:00'),
(2, 'IPHONE 7', 5, 10, 'PRD260124TPugre4rF31pARIqpQCe5VbPw8GuK2zGT2aGXSVhBCX7a4X1v53eTQBIZBqeLMJGKw1BWhbMqjek6RMoTaGf8f0P4mfALzr4DoGY', 'PCS', 7, 0, 2000000.00, 3000000.00, 1, NULL, '2026-01-24 01:09:17', '2026-01-25 02:47:48'),
(3, 'IPHONE 7', 5, 10, 'PRD260124XGc2YJfCDy3I5PISxOd0DxddtlvcZYjq8xXwCN53rczmj73RHo2cKCiqHYXzExdB4DcJN6iBQ8WwukAVw1u5CPSvkz9ay0IDEAc3', 'PCS', 2, 0, 4000000.00, 3000000.00, 0, NULL, '2026-01-24 01:09:36', '2026-01-25 09:44:13'),
(4, 'IPHONE 7', 5, 10, 'PRD2601248oY23r1VUlgpqr1dMzR0mDPcqwNBS6JzJht10e66ACh8Xe55ofs5kxrkILjjaNdL3o3Mvncxd1HTy2Dw0WFX1kNJSoaZUKjOGe54', 'PCS', 8, 0, 2000000.00, 3000000.00, 0, NULL, '2026-01-24 01:09:52', '2026-01-24 01:51:56'),
(5, 'SAMSUNG', 5, 11, 'PRD260124f6G1Iy3a1YxlL2kE6mPRyody8ERf2yQ5hYZTzvGgaT3AHFgQKJyj5NiJvXrkFNkRXyMSYlboQBPkKrU5VSsjhGN8xFfPoUnmQCLU', 'PCS', 9, 0, 4000000.00, 5000000.00, 0, NULL, '2026-01-24 01:10:12', '2026-01-24 23:45:15'),
(6, 'LCD SAMSUNG', 3, 11, 'PRD260124fnkLA0iF84r5iQkcvKdKb0HNaoHovOYwe1ch1SaWXkmxLsVQzQu0Wedd6tC9ff8vGI3vh5U4PL9veW4yZGH3KzVGuulXJbdElArK', 'pcs', 12, 0, 200000.00, 300000.00, 0, NULL, '2026-01-24 01:30:40', '2026-01-25 05:53:49'),
(7, 'LENOVO IDEAPAD', 1, 2, 'PRD260124TFCohq6IiWoHdKpnV9aL5pCCO4XmjjZi7znM5QLzLe7HTvjGBIP8EWBc59hnLoyov0jHypVP3eNCgkU4UXc6C2PCvqD30HIqsEUz', 'pcs', 8, 0, 18000000.00, 19000000.00, 0, NULL, '2026-01-24 04:01:09', '2026-01-25 09:38:05'),
(8, 'ASUS', 1, 12, 'PRD2601242SBbVKCH5e03VQ43IDtxl9IiGgJle8EvIFGjiOlVJDkoSe2UHM3Z450IJoRIG4JCx4WctZJrDlo6zpgQDfLQKwhlyhGTdGtV08pM', 'pcs', 17, 1, 20000000.00, 21000000.00, 20, NULL, '2026-01-24 08:49:10', '2026-01-26 15:12:52'),
(9, 'ADVAN', 5, 5, 'PRD260124yKzOpTcjNfijxpqh1v9A9HJ5hizKnu9CcOWMpB0aBlvgWRANIkqTx9UJnJNQqxhQI8euT3M0kigfeWl4BCRoLJbuxE4LmZJXRgtv', 'pcs', 13, 0, 2000000.00, 3000000.00, 0, NULL, '2026-01-24 10:28:55', '2026-01-25 02:20:41'),
(10, 'LCD OPPO A36', 6, 13, 'PRD2601246Aajl5aIFz4nuHXc8NHSso2vEzXcA24BaUrkZDM5ET3V9u84cZHBYdB8M82DX2B7Vs2kF2Glg73oS6dExyj0nnvsdSFulD1qJxqm', 'PCS', 10, 0, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:29', '2026-01-24 10:56:29'),
(11, 'LCD OPPO A37', 6, 13, 'PRD260124X0qbgzJK6Y1hoRFHtS36t4Qdb9PIc3moqJ3O4pIksSN4VUQRsIkmihry3KQ6qmJZ6ziR1735XM3M90cthyeksDGhcTRVS5lNztRZ', 'PCS', 10, 0, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:29', '2026-01-24 10:56:29'),
(12, 'LCD OPPO A38', 6, 13, 'PRD260124fsszorNrdWr90zVmy8wUo3xUymwhXYZ9lRwiOCKsCV2MrXNFH0bIj14HFGSlt41EbrqMfev4Tz5OWKO7jV2nr6SHIDXGx11kBEsm', 'PCS', 10, 0, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(13, 'LCD OPPO A39', 6, 13, 'PRD260124rag3qowLZEQH0MJXvNmwY7WXsokyrKn3PryDeANKacBpW2t9k7AHs79J6CEGBMfMLqT8cHvUzcDVLDG2C9fjADbwO1LiCHOdDOuN', 'PCS', 10, 0, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:30', '2026-01-25 02:47:45'),
(14, 'LCD OPPO A40', 6, 13, 'PRD260124cldQY4t94gQUjCfdryFGqHSwNXaK1aVVwsbHxBAYrxXDwkH5jOTJ4cTJx40Ic00O9BJRaf9Us5DQMNe7ee7CHFd3lTfEFe16Jleg', 'PCS', 10, 0, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(15, 'LCD OPPO A41 EDIT', 6, 13, 'PRD260124xRlvBszzG9jHuy03BU7V4fUEE9L5WlNaAZ3n3tEA35wpTIPAXH1d53zYgRN9PwvfmcAb8t8y4xVZl7KwimOKtNcvq54CdSK7w8CR', 'PCS', 9, 1, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:30', '2026-01-25 11:28:16'),
(16, 'LCD OPPO A42 EDIT', 6, 13, 'PRD26012479s9cKanYtyI78041boPW7uXko7nlDkixcZGKHKkz6t8yessj7ONJyz6ftkXRkcM2a9pRh1VCvoQPEe6jV53W47Qzma2NAOCj57z', 'PCS', 3, 0, 10000.00, 15000.00, 0, NULL, '2026-01-24 10:56:30', '2026-01-25 10:53:54');

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

--
-- Struktur dari tabel `purchases`
--

CREATE TABLE `purchases` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_number` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `purchase_date` date NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'pending',
  `notes` text DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `purchases`
--

INSERT INTO `purchases` (`id`, `purchase_number`, `barcode`, `supplier_id`, `branch_id`, `purchase_date`, `subtotal`, `discount`, `tax`, `total_amount`, `status`, `notes`, `user_id`, `created_at`, `updated_at`) VALUES
(3, 'PO202601240001', 'PUR260124,:i)Itj:^u0ht@l=)7%:*{6nm%gotl.=A5{5zh@6!AM$V[2jlhAxy%:[g,va4MW?$>2{(&pr<?VAXfKuKC[cZ-ugTJAUOTb[lpS:', 2, 2, '2026-01-24', 0.00, 0.00, 0.00, 10000000.00, 'completed', 'Import Excel (Import Excel)', 1, '2026-01-24 01:08:27', '2026-01-24 01:08:27'),
(4, 'PO202601240002', 'PUR260124OsRG(dKAzI0KB$+q]#BeR0pz0!lD3g4vXl-GS@6KWZ;oVA8<EJM4EHY7H98&ifRgGM&JID[PD&6mH=91FwxWAOmkwtM:7u%hTk+I', 2, 1, '2026-01-24', 0.00, 0.00, 0.00, 12000000.00, 'completed', 'Import Excel (Import Excel)', 1, '2026-01-24 01:09:16', '2026-01-24 01:09:16'),
(6, 'PO202601240004', 'PUR260124|$bCVGr#0sMk(O#y4g%jdPk^MU9^)I_^8;CZ4]Ot<{:6$p%g_tQ.DL5ac?hIEx?0>@10Fn(}Q6{17*,I#ue69.-awpG[jYg-(cDJ', 1, 1, '2026-01-25', 0.00, 0.00, 0.00, 16000000.00, 'completed', 'Import Excel (Import Excel)', 1, '2026-01-24 01:09:52', '2026-01-24 01:09:52'),
(7, 'PO202601240005', 'PUR260124>q;SzWv(vlxrb+s}-bA6qo=4R@Dz-Qb5itlFC{#JVoe_jf]K-evBiozYW3{ziLy.^c_T*p$bX<6*vKgLFU,_.QE<,0i;bP|MOAFF', 2, 1, '2026-01-26', 0.00, 0.00, 0.00, 18000000.00, 'completed', 'Import Excel (Import Excel)', 1, '2026-01-24 01:10:12', '2026-01-24 01:10:12'),
(8, 'PO202601240006', 'PUR260124k[^wjTI:]EZT5E*&,zwqt#IE.BqAZcl$^R!hyWwWTM(m32cq)pz#ewcDc=hB$!j{]wMoCq-od(Bm=Y.{?rb&lrk;p2Rsk3d2-m>4', 1, 1, '2026-01-24', 0.00, 0.00, 0.00, 3000000.00, 'completed', NULL, 1, '2026-01-24 01:30:40', '2026-01-24 01:30:40'),
(9, 'PO202601240007', 'PUR260124&s=U_j}.p@wc0B3z57vI^;wQNQ,)l%F=0:BLG(?t*489yz|jX)sBAm{kDA6f5o&dDFf7,lSI?{SOQmN:t6G.S-yosU<|5.ozZJjr', 1, 2, '2026-01-24', 180000000.00, 1000000.00, 500000.00, 179500000.00, 'completed', NULL, 1, '2026-01-24 04:01:07', '2026-01-24 04:01:07'),
(10, 'PO202601240008', 'PUR260124rY}m5c^%%8xC7jK?5n*rqS=.D|m0-9iV,2<6r}3v,5@f#N#sLT{L*u<|8:m^Y^pr)vkika3;:7]-4m?$gThf}[t;s0DQ6hD@IkR-', 1, 2, '2026-01-24', 4000000.00, 0.00, 0.00, 4000000.00, 'completed', NULL, 1, '2026-01-24 08:16:09', '2026-01-24 08:16:09'),
(11, 'PO202601240009', 'PUR260124_#-Tn+I5kx]}x79P3[J%BoPqdqN|a&l?v&E)5D$!u_13u9{@B,i6D$DXC7usm1gC}p9#q%g4)(g(hFb}8,2&N9uF43|%7xA-|b+R', 1, 2, '2026-01-24', 210000000.00, 0.00, 0.00, 210000000.00, 'completed', NULL, 1, '2026-01-24 08:49:10', '2026-01-24 08:49:10'),
(12, 'PO202601240010', 'PUR260124D{-oSi{][:)kPB5U}yhgp!v!Ba8ZtGE}$xhE,X&Bqm}Nz?3auz5mLgGxm:Yp&kDya%PIlYTPsM>Y%v2<b5V&^L*pOIh1_Bz<5ufR', 1, 2, '2026-01-24', 100000000.00, 0.00, 0.00, 100000000.00, 'completed', NULL, 1, '2026-01-24 08:54:44', '2026-01-24 08:54:44'),
(13, 'PO202601240011', 'PUR260124qg&S}O7jQ%QuI}!f3U<KH]#D?CGDp922Mv^|)pa0,_n@x<RcM@Q;,JkaTWaIOyDUnX<+O6]%?NP}5H,%bcW#=vrJ+2|Ag?9:-Nq*', 2, 1, '2026-01-24', 32000000.00, 0.00, 0.00, 32000000.00, 'completed', NULL, 1, '2026-01-24 10:28:55', '2026-01-24 10:28:55'),
(14, 'PO202601240012', 'PUR260124S#sEs2%8UfG-lFk,>{{30jTx-k4dnE+orV=r[gUNs}F|5xrS&.X60=f]jc!)*Dxpc,Vk=js?bmBU6]98:6B8ZM.W>.SPuz*C,r,P', 1, 1, '2026-01-24', 700000.00, 0.00, 0.00, 700000.00, 'completed', 'Catatan pembelian (opsional) (Import Excel)', 1, '2026-01-24 10:56:29', '2026-01-24 10:56:29');

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

--
-- Struktur dari tabel `purchase_details`
--

CREATE TABLE `purchase_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `is_new_product` tinyint(1) NOT NULL DEFAULT 0,
  `product_barcode` varchar(255) DEFAULT NULL,
  `product_name` varchar(255) DEFAULT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `brand_id` bigint(20) UNSIGNED DEFAULT NULL,
  `unit` varchar(20) DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `purchase_price` decimal(15,2) NOT NULL,
  `selling_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `subtotal` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `purchase_details`
--

INSERT INTO `purchase_details` (`id`, `purchase_id`, `product_id`, `is_new_product`, `product_barcode`, `product_name`, `category_id`, `brand_id`, `unit`, `quantity`, `purchase_price`, `selling_price`, `subtotal`, `created_at`, `updated_at`) VALUES
(1, 3, 1, 1, 'PRD260124uARLhLOCdUvi4U7qHxrusTdEfqexqWhw5S66WOTJQu8s4XVp0Th26BxBpaXFrzy5fNchUnBguEkQX43rhcndA1Pbh4mwgLWTbSkb', 'IPHONE 7', 5, 10, 'PCS', 5, 2000000.00, 3000000.00, 10000000.00, '2026-01-24 01:08:27', '2026-01-24 01:08:27'),
(2, 4, 2, 1, 'PRD260124TPugre4rF31pARIqpQCe5VbPw8GuK2zGT2aGXSVhBCX7a4X1v53eTQBIZBqeLMJGKw1BWhbMqjek6RMoTaGf8f0P4mfALzr4DoGY', 'IPHONE 7', 5, 10, 'PCS', 6, 2000000.00, 3000000.00, 12000000.00, '2026-01-24 01:09:17', '2026-01-24 01:09:17'),
(4, 6, 4, 1, 'PRD2601248oY23r1VUlgpqr1dMzR0mDPcqwNBS6JzJht10e66ACh8Xe55ofs5kxrkILjjaNdL3o3Mvncxd1HTy2Dw0WFX1kNJSoaZUKjOGe54', 'IPHONE 7', 5, 10, 'PCS', 8, 2000000.00, 3000000.00, 16000000.00, '2026-01-24 01:09:52', '2026-01-24 01:09:52'),
(5, 7, 5, 1, 'PRD260124f6G1Iy3a1YxlL2kE6mPRyody8ERf2yQ5hYZTzvGgaT3AHFgQKJyj5NiJvXrkFNkRXyMSYlboQBPkKrU5VSsjhGN8xFfPoUnmQCLU', 'SAMSUNG', 5, 11, 'PCS', 9, 2000000.00, 3000000.00, 18000000.00, '2026-01-24 01:10:12', '2026-01-24 01:10:12'),
(6, 8, 6, 1, 'PRD260124fnkLA0iF84r5iQkcvKdKb0HNaoHovOYwe1ch1SaWXkmxLsVQzQu0Wedd6tC9ff8vGI3vh5U4PL9veW4yZGH3KzVGuulXJbdElArK', 'LCD SAMSUNG', 3, 11, 'pcs', 15, 200000.00, 300000.00, 3000000.00, '2026-01-24 01:30:40', '2026-01-24 01:30:40'),
(7, 9, 7, 1, 'PRD260124TFCohq6IiWoHdKpnV9aL5pCCO4XmjjZi7znM5QLzLe7HTvjGBIP8EWBc59hnLoyov0jHypVP3eNCgkU4UXc6C2PCvqD30HIqsEUz', 'LENOVO IDEAPAD', 1, 2, 'pcs', 10, 18000000.00, 19000000.00, 180000000.00, '2026-01-24 04:01:09', '2026-01-24 04:01:09'),
(8, 10, 3, 0, 'PRD260124XGc2YJfCDy3I5PISxOd0DxddtlvcZYjq8xXwCN53rczmj73RHo2cKCiqHYXzExdB4DcJN6iBQ8WwukAVw1u5CPSvkz9ay0IDEAc3', 'IPHONE 7', 5, 10, 'PCS', 1, 4000000.00, 3000000.00, 4000000.00, '2026-01-24 08:16:11', '2026-01-24 08:16:11'),
(9, 11, 8, 1, 'PRD2601242SBbVKCH5e03VQ43IDtxl9IiGgJle8EvIFGjiOlVJDkoSe2UHM3Z450IJoRIG4JCx4WctZJrDlo6zpgQDfLQKwhlyhGTdGtV08pM', 'ASUS', 1, 12, 'pcs', 15, 14000000.00, 15000000.00, 210000000.00, '2026-01-24 08:49:10', '2026-01-24 08:49:10'),
(10, 12, 8, 0, 'PRD2601242SBbVKCH5e03VQ43IDtxl9IiGgJle8EvIFGjiOlVJDkoSe2UHM3Z450IJoRIG4JCx4WctZJrDlo6zpgQDfLQKwhlyhGTdGtV08pM', 'ASUS', 1, 12, 'pcs', 5, 20000000.00, 21000000.00, 100000000.00, '2026-01-24 08:54:44', '2026-01-24 08:54:44'),
(11, 13, 2, 0, 'PRD260124TPugre4rF31pARIqpQCe5VbPw8GuK2zGT2aGXSVhBCX7a4X1v53eTQBIZBqeLMJGKw1BWhbMqjek6RMoTaGf8f0P4mfALzr4DoGY', 'IPHONE 7', 5, 10, 'PCS', 1, 2000000.00, 3000000.00, 2000000.00, '2026-01-24 10:28:55', '2026-01-24 10:28:55'),
(12, 13, 5, 0, 'PRD260124f6G1Iy3a1YxlL2kE6mPRyody8ERf2yQ5hYZTzvGgaT3AHFgQKJyj5NiJvXrkFNkRXyMSYlboQBPkKrU5VSsjhGN8xFfPoUnmQCLU', 'SAMSUNG', 5, 11, 'PCS', 1, 4000000.00, 5000000.00, 4000000.00, '2026-01-24 10:28:55', '2026-01-24 10:28:55'),
(13, 13, 9, 1, 'PRD260124yKzOpTcjNfijxpqh1v9A9HJ5hizKnu9CcOWMpB0aBlvgWRANIkqTx9UJnJNQqxhQI8euT3M0kigfeWl4BCRoLJbuxE4LmZJXRgtv', 'ADVAN', 5, 5, 'pcs', 13, 2000000.00, 3000000.00, 26000000.00, '2026-01-24 10:28:55', '2026-01-24 10:28:55'),
(14, 14, 10, 1, 'PRD2601246Aajl5aIFz4nuHXc8NHSso2vEzXcA24BaUrkZDM5ET3V9u84cZHBYdB8M82DX2B7Vs2kF2Glg73oS6dExyj0nnvsdSFulD1qJxqm', 'LCD OPPO A36', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:29', '2026-01-24 10:56:29'),
(15, 14, 11, 1, 'PRD260124X0qbgzJK6Y1hoRFHtS36t4Qdb9PIc3moqJ3O4pIksSN4VUQRsIkmihry3KQ6qmJZ6ziR1735XM3M90cthyeksDGhcTRVS5lNztRZ', 'LCD OPPO A37', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(16, 14, 12, 1, 'PRD260124fsszorNrdWr90zVmy8wUo3xUymwhXYZ9lRwiOCKsCV2MrXNFH0bIj14HFGSlt41EbrqMfev4Tz5OWKO7jV2nr6SHIDXGx11kBEsm', 'LCD OPPO A38', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(17, 14, 13, 1, 'PRD260124rag3qowLZEQH0MJXvNmwY7WXsokyrKn3PryDeANKacBpW2t9k7AHs79J6CEGBMfMLqT8cHvUzcDVLDG2C9fjADbwO1LiCHOdDOuN', 'LCD OPPO A39', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(18, 14, 14, 1, 'PRD260124cldQY4t94gQUjCfdryFGqHSwNXaK1aVVwsbHxBAYrxXDwkH5jOTJ4cTJx40Ic00O9BJRaf9Us5DQMNe7ee7CHFd3lTfEFe16Jleg', 'LCD OPPO A40', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(19, 14, 15, 1, 'PRD260124xRlvBszzG9jHuy03BU7V4fUEE9L5WlNaAZ3n3tEA35wpTIPAXH1d53zYgRN9PwvfmcAb8t8y4xVZl7KwimOKtNcvq54CdSK7w8CR', 'LCD OPPO A41', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:30', '2026-01-24 10:56:30'),
(20, 14, 16, 1, 'PRD26012479s9cKanYtyI78041boPW7uXko7nlDkixcZGKHKkz6t8yessj7ONJyz6ftkXRkcM2a9pRh1VCvoQPEe6jV53W47Qzma2NAOCj57z', 'LCD OPPO A42', 6, 13, 'PCS', 10, 10000.00, 15000.00, 100000.00, '2026-01-24 10:56:30', '2026-01-24 10:56:30');

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

--
-- Struktur dari tabel `roles`
--

CREATE TABLE `roles` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `guard_name` varchar(255) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `roles`
--

INSERT INTO `roles` (`id`, `name`, `guard_name`, `created_at`, `updated_at`) VALUES
(1, 'admin', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(2, 'customer', 'web', '2026-01-24 00:41:18', '2026-01-24 00:41:18'),
(3, 'admin mijen', 'web', '2026-01-25 10:33:18', '2026-01-25 11:01:29');

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

--
-- Struktur dari tabel `role_has_permissions`
--

CREATE TABLE `role_has_permissions` (
  `permission_id` bigint(20) UNSIGNED NOT NULL,
  `role_id` bigint(20) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `role_has_permissions`
--

INSERT INTO `role_has_permissions` (`permission_id`, `role_id`) VALUES
(2, 1),
(3, 1),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1),
(10, 1),
(11, 1),
(12, 1),
(13, 1),
(14, 1),
(15, 1),
(16, 1),
(17, 1),
(18, 1),
(19, 1),
(20, 1),
(21, 1),
(22, 1),
(23, 1),
(24, 1),
(25, 1),
(26, 1),
(27, 1),
(28, 1),
(29, 1),
(30, 1),
(31, 1),
(32, 1),
(33, 1),
(34, 1),
(35, 1),
(36, 1),
(37, 1),
(38, 1),
(39, 1),
(40, 1),
(40, 3),
(41, 1),
(41, 3),
(42, 1),
(42, 3),
(43, 1),
(43, 3),
(44, 1),
(44, 3),
(45, 1),
(45, 3),
(46, 1),
(46, 3),
(47, 1),
(47, 3),
(48, 1),
(49, 1),
(50, 1),
(51, 1),
(52, 1),
(53, 1),
(54, 1),
(54, 3),
(55, 1),
(56, 1),
(57, 1),
(58, 1),
(59, 1),
(60, 1),
(61, 1),
(62, 1),
(63, 1),
(64, 1),
(65, 1),
(66, 1),
(67, 1),
(68, 1);

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

--
-- Struktur dari tabel `sales`
--

CREATE TABLE `sales` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sale_number` varchar(255) NOT NULL,
  `service_id` bigint(20) UNSIGNED DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `guest_name` varchar(255) DEFAULT NULL,
  `guest_phone` varchar(255) DEFAULT NULL,
  `guest_address` text DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `cashier_id` bigint(20) UNSIGNED NOT NULL,
  `sale_date` date NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `service_fee` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `payment_method` enum('cash','transfer','credit') NOT NULL DEFAULT 'cash',
  `status` enum('pending','completed','cancelled') NOT NULL DEFAULT 'completed',
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `sales`
--

INSERT INTO `sales` (`id`, `sale_number`, `service_id`, `barcode`, `customer_id`, `guest_name`, `guest_phone`, `guest_address`, `branch_id`, `cashier_id`, `sale_date`, `subtotal`, `service_fee`, `discount`, `tax`, `total_amount`, `payment_method`, `status`, `notes`, `created_at`, `updated_at`) VALUES
(31, 'SO202601250001', NULL, 'SAL260125u66beVl#s@Rd>6e*$pgp@y0H}rGI=)tur|%q1y(PuN<%P{EhB10<bo%}P[FOd.DXdR}IE$Xh?a*kk)^x^uGk03@*0#af91O5Vn?^', 2, NULL, NULL, NULL, 1, 1, '2026-01-25', 8400000.00, 0.00, 100000.00, 50000.00, 8350000.00, 'cash', 'completed', NULL, '2026-01-24 23:45:15', '2026-01-24 23:45:15'),
(34, 'SO202601250003', NULL, 'SAL260125BqZf{ZV-csZel8yV@+eF;<lfI|6^[K-3*7KmbiCf_EBzUnL97#$_P*GD{4cIX&vkB_]]97XqhUlLAHEhngg1mgUnb#2^%1JYY7E$', 2, NULL, NULL, NULL, 2, 1, '2026-01-25', 10000000.00, 0.00, 0.00, 0.00, 10000000.00, 'cash', 'completed', NULL, '2026-01-24 23:51:12', '2026-01-24 23:51:12'),
(35, 'SO202601250004', NULL, 'SAL260125THI,P:=I5$$G<3>Q6?th9hFN=$@4K[Sr]k2#HiX)QOeUvy=g[;Lbh;mzxBR+2}UT2;:Tp@_P_7upNFO,9_3(hK#9%O}]GO7;o(8O', 2, NULL, NULL, NULL, 2, 1, '2026-01-25', 22000000.00, 0.00, 50000.00, 10000.00, 21960000.00, 'transfer', 'completed', NULL, '2026-01-24 23:52:38', '2026-01-25 06:42:57'),
(41, 'SO202601250005', 25, '4wImSRmtQqP4Ew62ICo6NV6FEQWKqgHsLfSwRTrd5iAK2Ln42C2HhMbmYWdq1gUW00o47fn3MPDOg2CLXu4xHpBgEhN1jq1dFLLQ', NULL, 'SAIPUL', '081234567890', 'JATINGALEH', 2, 1, '2026-01-25', 300000.00, 250000.00, 50000.00, 10000.00, 510000.00, 'cash', 'completed', 'Auto-generated from Service #SRV-20260125-0001', '2026-01-25 05:53:49', '2026-01-25 05:53:49'),
(42, 'SO202601250006', 26, 'P89cEygZUkVtrTb8gpJCJ4RF4AEYuOS9aVU5qnPcz3rkp56r63hXXYBm3riP7GxQtx8fDiv73CzKlmpJWgR6WtYYAzIoj5FVQEPy', NULL, 'HENDRA', '085211494202', 'MERANGGEN', 2, 1, '2026-01-25', 0.00, 100000.00, 0.00, 0.00, 100000.00, 'cash', 'completed', 'Auto-generated from Service #SRV-20260125-0002', '2026-01-25 05:54:52', '2026-01-25 05:54:52'),
(43, 'SO202601250007', 27, 'MSYJppQzelTu7EeWvhOz6h3FAI1GqToKmZilZMmvQbZbYDyhGavfhWSFUHkTJTpkgqBeFbPBCCnntpsHxaolq261vuAi3GP8o9hu', NULL, 'SAIPUL', '081234567890', 'JATINGALEH', 2, 1, '2026-01-25', 0.00, 150000.00, 0.00, 10000.00, 160000.00, 'cash', 'completed', 'Auto-generated from Service #SRV-20260125-0003', '2026-01-25 05:55:55', '2026-01-25 05:55:55'),
(44, 'SO202601250008', 28, 'qXkpOCY9J4VOl66fPzCen2khe13AFtZD5fR8qRVoV9IUcLsLWC2K29hRswqFMBvhg87A8zHisQIdKtVyjrezZae5KhWkWAO6QhDY', 2, NULL, NULL, NULL, 1, 1, '2026-01-25', 0.00, 145000.00, 0.00, 0.00, 145000.00, 'cash', 'completed', 'Auto-generated from Service #SRV-20260125-0004', '2026-01-25 08:18:13', '2026-01-25 08:18:13');

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

--
-- Struktur dari tabel `sale_details`
--

CREATE TABLE `sale_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sale_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED DEFAULT NULL,
  `quantity` int(11) NOT NULL,
  `selling_price` decimal(15,2) NOT NULL,
  `purchase_price` decimal(15,2) NOT NULL,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `subtotal` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `sale_details`
--

INSERT INTO `sale_details` (`id`, `sale_id`, `product_id`, `quantity`, `selling_price`, `purchase_price`, `discount`, `subtotal`, `created_at`, `updated_at`) VALUES
(35, 31, 2, 1, 3000000.00, 2000000.00, 0.00, 3000000.00, '2026-01-24 23:45:15', '2026-01-24 23:45:15'),
(36, 31, 5, 1, 5000000.00, 4000000.00, 0.00, 5000000.00, '2026-01-24 23:45:15', '2026-01-24 23:45:15'),
(37, 31, 6, 1, 400000.00, 200000.00, 0.00, 400000.00, '2026-01-24 23:45:15', '2026-01-24 23:45:15'),
(40, 34, 7, 1, 10000000.00, 18000000.00, 0.00, 10000000.00, '2026-01-24 23:51:12', '2026-01-24 23:51:12'),
(58, 41, 6, 1, 300000.00, 200000.00, 0.00, 300000.00, '2026-01-25 05:53:49', '2026-01-25 05:53:49'),
(59, 42, NULL, 1, 0.00, 0.00, 0.00, 0.00, '2026-01-25 05:54:52', '2026-01-25 05:54:52'),
(60, 43, NULL, 1, 0.00, 0.00, 0.00, 0.00, '2026-01-25 05:55:55', '2026-01-25 05:55:55'),
(61, 35, 1, 1, 3000000.00, 0.00, 0.00, 3000000.00, '2026-01-25 06:42:57', '2026-01-25 06:42:57'),
(62, 35, 7, 1, 19000000.00, 0.00, 0.00, 19000000.00, '2026-01-25 06:42:57', '2026-01-25 06:42:57'),
(63, 44, NULL, 1, 0.00, 0.00, 0.00, 0.00, '2026-01-25 08:18:13', '2026-01-25 08:18:13');

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

--
-- Struktur dari tabel `services`
--

CREATE TABLE `services` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `service_number` varchar(255) NOT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `unique_code` varchar(20) DEFAULT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `guest_name` varchar(255) DEFAULT NULL,
  `guest_phone` varchar(255) DEFAULT NULL,
  `guest_address` text DEFAULT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `technician_id` bigint(20) UNSIGNED DEFAULT NULL,
  `recipient_id` bigint(20) UNSIGNED DEFAULT NULL,
  `service_date` date NOT NULL,
  `device_type` varchar(255) NOT NULL,
  `device_brand` varchar(255) NOT NULL,
  `device_model` varchar(255) NOT NULL,
  `imei` varchar(255) DEFAULT NULL,
  `complaint` text NOT NULL,
  `diagnosis` text DEFAULT NULL,
  `estimated_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `service_fee` decimal(15,2) NOT NULL DEFAULT 0.00,
  `parts_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(15,2) NOT NULL DEFAULT 0.00,
  `total_cost` decimal(15,2) NOT NULL DEFAULT 0.00,
  `down_payment` decimal(15,2) NOT NULL DEFAULT 0.00,
  `remaining_payment` decimal(15,2) NOT NULL DEFAULT 0.00,
  `status` enum('menunggu diagnosa','menunggu antrian','sedang diagnosa','menunggu persetujuan','menunggu spare part','dalam pengerjaan','quality control','siap diambil','selesai','dibatalkan') DEFAULT 'menunggu diagnosa',
  `priority` enum('normal','urgent','very urgent') NOT NULL DEFAULT 'normal',
  `estimated_completion` datetime DEFAULT NULL,
  `completed_at` datetime DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `services`
--

INSERT INTO `services` (`id`, `service_number`, `barcode`, `unique_code`, `customer_id`, `guest_name`, `guest_phone`, `guest_address`, `branch_id`, `technician_id`, `recipient_id`, `service_date`, `device_type`, `device_brand`, `device_model`, `imei`, `complaint`, `diagnosis`, `estimated_cost`, `service_fee`, `parts_cost`, `discount`, `tax`, `total_cost`, `down_payment`, `remaining_payment`, `status`, `priority`, `estimated_completion`, `completed_at`, `notes`, `created_at`, `updated_at`) VALUES
(25, 'SRV-20260125-0001', 'SRV2601256PSGDBDQJC7RADEZ16HH5DE1CDXBKPN9JL9DYMNNI5UW5QB7UGYHERP8J5ITK9MO28JDVIW3TKYVM6EO6E4H5I6D77BKAN0GBT9R', 'TRK-MGLC0ECHOE', NULL, 'SAIPUL', '081234567890', 'JATINGALEH', 2, 1, 1, '2026-01-25', 'Handphone', 'SAMSUNG', 'S23', '0987654321', 'LCD PECAH', 'GANTI LCD', 550000.00, 250000.00, 300000.00, 50000.00, 10000.00, 510000.00, 50000.00, 460000.00, 'menunggu diagnosa', 'normal', '2026-01-28 12:53:00', NULL, NULL, '2026-01-25 05:53:48', '2026-01-25 05:53:49'),
(26, 'SRV-20260125-0002', 'SRV260125YU6QKC2AV5MXQZHPBJGQBY5ORWMO3XYLGTJZ1HC8KG16PYMIO35F9F9G0O565EQBTTQV9O1POAURRCWMHWX3REN1POONE2KX03LX', 'TRK-XW24Y17IFR', NULL, 'HENDRA', '085211494202', 'MERANGGEN', 2, 1, 1, '2026-01-25', 'Laptop', 'LENOVO', 'LENOVO IDEPAD I7', '0987654321', 'KEYBOARD NGETIK SENDIRI', NULL, 100000.00, 100000.00, 0.00, 0.00, 0.00, 100000.00, 0.00, 100000.00, 'menunggu diagnosa', 'normal', NULL, NULL, NULL, '2026-01-25 05:54:52', '2026-01-25 05:54:52'),
(27, 'SRV-20260125-0003', 'SRV2601256T3SORASDKOA2TPKVWSBE2AAO0ZNL2VOTLU0GMEYN6VFJCN53PA2XOT5U2QNAX833OJXCECQBXAKCHZP1IMCM6X9VLO4XM0PXGN8', 'TRK-7470RN064X', NULL, 'SAIPUL', '081234567890', 'JATINGALEH', 2, 1, 1, '2026-01-25', 'Tablet', 'ADVAN', 'A9', '0987654321', 'LAYAR TERKUNCI', NULL, 150000.00, 150000.00, 0.00, 0.00, 10000.00, 160000.00, 20000.00, 140000.00, 'menunggu diagnosa', 'normal', NULL, NULL, NULL, '2026-01-25 05:55:54', '2026-01-25 05:55:54'),
(28, 'SRV-20260125-0004', 'SRV2601255HWIDFI1U08M1HAQ0K9P72HIT2HNT6UDBJ62LGAV6QEKMUQB0OG1FZZ3DMKWX64U907H41XOR3A7CQ0Q1XKJSV29GG3I2ZARC8M2', 'TRK-B3XUDC3P8U', 2, NULL, NULL, NULL, 1, 1, 1, '2026-01-25', 'Laptop', 'LENOVO', 'LENOVO IDEPAD I7', '0987654321', 'INSTALL ULANG WINDOWS', NULL, 145000.00, 145000.00, 0.00, 0.00, 0.00, 145000.00, 0.00, 145000.00, 'menunggu diagnosa', 'normal', NULL, NULL, NULL, '2026-01-25 08:18:13', '2026-01-25 08:18:13');

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

--
-- Struktur dari tabel `service_details`
--

CREATE TABLE `service_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `service_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` int(11) NOT NULL,
  `unit_price` decimal(15,2) NOT NULL,
  `subtotal` decimal(15,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `service_details`
--

INSERT INTO `service_details` (`id`, `service_id`, `product_id`, `quantity`, `unit_price`, `subtotal`, `created_at`, `updated_at`) VALUES
(18, 25, 6, 1, 300000.00, 300000.00, '2026-01-25 05:53:49', '2026-01-25 05:53:49');

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

--
-- Struktur dari tabel `service_status_histories`
--

CREATE TABLE `service_status_histories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `service_id` bigint(20) UNSIGNED NOT NULL,
  `status` varchar(255) NOT NULL,
  `notes` text DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `service_status_histories`
--

INSERT INTO `service_status_histories` (`id`, `service_id`, `status`, `notes`, `user_id`, `created_at`, `updated_at`) VALUES
(34, 25, 'menunggu diagnosa', 'Service baru dibuat', 1, '2026-01-25 05:53:49', '2026-01-25 05:53:49'),
(35, 26, 'menunggu diagnosa', 'Service baru dibuat', 1, '2026-01-25 05:54:52', '2026-01-25 05:54:52'),
(36, 27, 'menunggu diagnosa', 'Service baru dibuat', 1, '2026-01-25 05:55:54', '2026-01-25 05:55:54'),
(37, 28, 'menunggu diagnosa', 'Service baru dibuat', 1, '2026-01-25 08:18:13', '2026-01-25 08:18:13');

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

--
-- Struktur dari tabel `sessions`
--

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

--
-- Dumping data untuk tabel `sessions`
--

INSERT INTO `sessions` (`id`, `user_id`, `ip_address`, `user_agent`, `payload`, `last_activity`) VALUES
('DhI4U2FOr5OX5LP1s86DtYViUSn6HLisWeAwXnUf', 1, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiSW05M2hXaGcyMHlsaUlualFOYVk1Q1hXZ01LTEJManNrMUE1a2JJbCI7czozOiJ1cmwiO2E6MTp7czo4OiJpbnRlbmRlZCI7czo0MToiaHR0cDovL2xvY2FsaG9zdDo4MDgyL3VtaS1jZWxsL2FkbWluL3JvbGUiO31zOjk6Il9wcmV2aW91cyI7YToyOntzOjM6InVybCI7czo0MToiaHR0cDovL2xvY2FsaG9zdDo4MDgyL3VtaS1jZWxsL2FkbWluL2hvbWUiO3M6NToicm91dGUiO3M6NDoiaG9tZSI7fXM6NjoiX2ZsYXNoIjthOjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fXM6NTA6ImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjtpOjE7fQ==', 1769466367),
('pLSb5OseB63R81vbpIT6ZVz3AgiQVfgL8lVbvGYD', 1, '::1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiazhOMk5QaGVrOVlhT3dRRUNJa0RYSkxWcXRNWGp2R0o0TzJCemZBQiI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NDE6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4Mi91bWktY2VsbC9hZG1pbi9yb2xlIjtzOjU6InJvdXRlIjtzOjQ6InJvbGUiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToxO30=', 1769440411);

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

--
-- Struktur dari tabel `stock_movements`
--

CREATE TABLE `stock_movements` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `type` enum('in','out','transfer','adjustment') NOT NULL,
  `quantity` int(11) NOT NULL,
  `reference_type` varchar(255) DEFAULT NULL,
  `reference_id` bigint(20) UNSIGNED DEFAULT NULL,
  `notes` text DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `stock_movements`
--

INSERT INTO `stock_movements` (`id`, `product_id`, `type`, `quantity`, `reference_type`, `reference_id`, `notes`, `user_id`, `created_at`) VALUES
(1, 1, 'in', 5, 'purchase', 3, 'Pembelian #PO202601240001 (Import Excel)', 1, '2026-01-24 01:08:27'),
(2, 2, 'in', 6, 'purchase', 4, 'Pembelian #PO202601240002 (Import Excel)', 1, '2026-01-24 01:09:17'),
(3, 3, 'in', 7, 'purchase', 5, 'Pembelian #PO202601240003 (Import Excel)', 1, '2026-01-24 01:09:36'),
(4, 4, 'in', 8, 'purchase', 6, 'Pembelian #PO202601240004 (Import Excel)', 1, '2026-01-24 01:09:52'),
(5, 5, 'in', 9, 'purchase', 7, 'Pembelian #PO202601240005 (Import Excel)', 1, '2026-01-24 01:10:12'),
(6, 6, 'in', 15, 'App\\Models\\Purchase', 8, 'Pembelian #PO202601240006', 1, '2026-01-24 01:30:40'),
(19, 7, 'in', 10, 'App\\Models\\Purchase', 9, 'Pembelian #PO202601240007', 1, '2026-01-24 04:01:09'),
(21, 3, 'in', 1, 'App\\Models\\Purchase', 10, 'Pembelian #PO202601240008', 1, '2026-01-24 08:16:11'),
(22, 8, 'in', 15, 'App\\Models\\Purchase', 11, 'Pembelian #PO202601240009', 1, '2026-01-24 08:49:10'),
(23, 8, 'in', 5, 'App\\Models\\Purchase', 12, 'Pembelian #PO202601240010', 1, '2026-01-24 08:54:44'),
(24, 1, 'adjustment', 1, 'App\\Models\\StockOpname', 1, 'Stock Opname #OP202601240001 (-1)', 1, '2026-01-24 09:00:39'),
(25, 2, 'adjustment', 1, 'App\\Models\\StockOpname', 1, 'Stock Opname #OP202601240001 (+1)', 1, '2026-01-24 09:00:39'),
(26, 1, 'adjustment', 1, 'App\\Models\\StockOpname', 2, 'Stock Opname #OP202601240002 (-1)', 1, '2026-01-24 09:36:14'),
(27, 3, 'adjustment', 1, 'App\\Models\\StockOpname', 2, 'Stock Opname #OP202601240002 (+1)', 1, '2026-01-24 09:36:14'),
(28, 6, 'adjustment', 1, 'App\\Models\\StockOpname', 3, 'Stock Opname #OP202601240001 (-1)', 1, '2026-01-24 09:53:54'),
(29, 2, 'in', 1, 'App\\Models\\Purchase', 13, 'Pembelian #PO202601240011', 1, '2026-01-24 10:28:55'),
(30, 5, 'in', 1, 'App\\Models\\Purchase', 13, 'Pembelian #PO202601240011', 1, '2026-01-24 10:28:55'),
(31, 9, 'in', 13, 'App\\Models\\Purchase', 13, 'Pembelian #PO202601240011', 1, '2026-01-24 10:28:55'),
(32, 10, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:29'),
(33, 11, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:30'),
(34, 12, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:30'),
(35, 13, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:30'),
(36, 14, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:30'),
(37, 15, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:30'),
(38, 16, 'in', 10, 'purchase', 14, 'Pembelian #PO202601240012 (Import Excel)', 1, '2026-01-24 10:56:30'),
(55, 2, 'out', 1, 'App\\Models\\Sale', 31, 'Penjualan #SO202601250001', 1, '2026-01-24 23:45:15'),
(56, 5, 'out', 1, 'App\\Models\\Sale', 31, 'Penjualan #SO202601250001', 1, '2026-01-24 23:45:15'),
(57, 6, 'out', 1, 'App\\Models\\Sale', 31, 'Penjualan #SO202601250001', 1, '2026-01-24 23:45:15'),
(58, 7, 'out', 1, 'App\\Models\\Sale', 34, 'Penjualan #SO202601250003', 1, '2026-01-24 23:51:12'),
(92, 6, 'out', -1, 'service', 25, 'Used in Service #SRV-20260125-0001', 1, '2026-01-25 05:53:49'),
(93, 1, 'out', 1, 'App\\Models\\Sale', 35, 'Update Penjualan #SO202601250004', 1, '2026-01-25 06:42:57'),
(94, 7, 'out', 1, 'App\\Models\\Sale', 35, 'Update Penjualan #SO202601250004', 1, '2026-01-25 06:42:57'),
(112, 16, 'adjustment', 1, 'App\\Models\\StockOpname', 4, 'Stock Opname #OP202601250001 (-1)', 1, '2026-01-25 10:14:52'),
(113, 16, 'adjustment', 1, 'App\\Models\\StockOpname', 5, 'Stock Opname #OP202601250002 (-1)', 1, '2026-01-25 10:15:53'),
(114, 16, 'adjustment', 2, 'App\\Models\\StockOpname', 6, 'Stock Opname #OP202601250003 (-2)', 1, '2026-01-25 10:16:57'),
(115, 15, 'adjustment', 1, 'App\\Models\\StockOpname', 7, 'Stock Opname #OP202601250004 (-1)', 1, '2026-01-25 11:28:16'),
(116, 8, 'adjustment', 1, 'App\\Models\\StockOpname', 8, 'Stock Opname #OP202601260001 (-1)', 1, '2026-01-26 15:07:51'),
(117, 8, 'adjustment', 1, 'App\\Models\\StockOpname', 9, 'Stock Opname #OP202601260002 (-1)', 1, '2026-01-26 15:12:52');

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

--
-- Struktur dari tabel `stock_opnames`
--

CREATE TABLE `stock_opnames` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `opname_number` varchar(255) NOT NULL,
  `branch_id` bigint(20) UNSIGNED NOT NULL,
  `opname_date` date NOT NULL,
  `status` enum('draft','completed') NOT NULL DEFAULT 'draft',
  `notes` text DEFAULT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `stock_opnames`
--

INSERT INTO `stock_opnames` (`id`, `opname_number`, `branch_id`, `opname_date`, `status`, `notes`, `user_id`, `created_at`, `updated_at`) VALUES
(3, 'OP202601240001', 1, '2026-01-24', 'completed', NULL, 1, '2026-01-24 09:53:54', '2026-01-24 09:53:54'),
(4, 'OP202601250001', 1, '2026-01-25', 'completed', NULL, 1, '2026-01-25 10:14:52', '2026-01-25 10:14:52'),
(5, 'OP202601250002', 1, '2026-01-25', 'completed', NULL, 1, '2026-01-25 10:15:53', '2026-01-25 10:15:53'),
(6, 'OP202601250003', 1, '2026-01-25', 'completed', NULL, 1, '2026-01-25 10:16:57', '2026-01-25 10:16:57'),
(7, 'OP202601250004', 1, '2026-01-25', 'completed', NULL, 1, '2026-01-25 11:28:16', '2026-01-25 11:28:16'),
(8, 'OP202601260001', 2, '2026-01-26', 'completed', NULL, 1, '2026-01-26 15:07:51', '2026-01-26 15:07:51'),
(9, 'OP202601260002', 2, '2026-01-26', 'completed', NULL, 1, '2026-01-26 15:12:52', '2026-01-26 15:12:52');

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

--
-- Struktur dari tabel `stock_opname_details`
--

CREATE TABLE `stock_opname_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `stock_opname_id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `system_stock` int(11) NOT NULL,
  `physical_stock` int(11) NOT NULL,
  `difference` int(11) NOT NULL,
  `notes` text DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `stock_opname_details`
--

INSERT INTO `stock_opname_details` (`id`, `stock_opname_id`, `product_id`, `system_stock`, `physical_stock`, `difference`, `notes`, `created_at`, `updated_at`) VALUES
(5, 3, 6, 15, 14, -1, NULL, '2026-01-24 09:53:54', '2026-01-24 09:53:54'),
(6, 4, 16, 9, 8, -1, 'HILANG', '2026-01-25 10:14:52', '2026-01-25 10:14:52'),
(7, 5, 16, 7, 6, -1, 'HILANG', '2026-01-25 10:15:53', '2026-01-25 10:15:53'),
(8, 6, 16, 5, 3, -2, NULL, '2026-01-25 10:16:57', '2026-01-25 10:16:57'),
(9, 7, 15, 10, 9, -1, NULL, '2026-01-25 11:28:16', '2026-01-25 11:28:16'),
(10, 8, 8, 19, 18, -1, 'hilang', '2026-01-26 15:07:51', '2026-01-26 15:07:51'),
(11, 9, 8, 17, 16, -1, 'hilang', '2026-01-26 15:12:52', '2026-01-26 15:12:52');

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

--
-- Struktur dari tabel `suppliers`
--

CREATE TABLE `suppliers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(20) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `suppliers`
--

INSERT INTO `suppliers` (`id`, `name`, `phone`, `address`, `email`, `created_at`, `updated_at`) VALUES
(1, 'CV Aksesoris Mobile', '081234567890', 'Jl. Contoh No. 123, Jakarta', 'supplier1@example.com', '2026-01-24 00:58:22', '2026-01-24 00:58:22'),
(2, 'PT Distributor Handphone Jaya', '081234567891', 'Jl. Contoh No. 456, Bandung', 'supplier2@example.com', '2026-01-24 00:58:22', '2026-01-24 00:58:22');

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `branches`
--
ALTER TABLE `branches`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `brands`
--
ALTER TABLE `brands`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `categories`
--
ALTER TABLE `categories`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customers_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `failed_jobs`
--
ALTER TABLE `failed_jobs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);

--
-- Indeks untuk tabel `jobs`
--
ALTER TABLE `jobs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `jobs_queue_index` (`queue`);

--
-- Indeks untuk tabel `job_batches`
--
ALTER TABLE `job_batches`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `migrations`
--
ALTER TABLE `migrations`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`model_id`,`model_type`),
  ADD KEY `model_has_permissions_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indeks untuk tabel `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD PRIMARY KEY (`role_id`,`model_id`,`model_type`),
  ADD KEY `model_has_roles_model_id_model_type_index` (`model_id`,`model_type`);

--
-- Indeks untuk tabel `ms_dashboard_informations`
--
ALTER TABLE `ms_dashboard_informations`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `ms_nota_purchases`
--
ALTER TABLE `ms_nota_purchases`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `ms_nota_sales`
--
ALTER TABLE `ms_nota_sales`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `ms_nota_services`
--
ALTER TABLE `ms_nota_services`
  ADD PRIMARY KEY (`id`);

--
-- Indeks untuk tabel `permissions`
--
ALTER TABLE `permissions`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `permissions_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indeks untuk tabel `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `products_barcode_unique` (`barcode`),
  ADD KEY `products_category_id_foreign` (`category_id`),
  ADD KEY `products_brand_id_foreign` (`brand_id`);

--
-- Indeks untuk tabel `purchases`
--
ALTER TABLE `purchases`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchases_purchase_number_unique` (`purchase_number`),
  ADD UNIQUE KEY `purchases_barcode_unique` (`barcode`),
  ADD KEY `purchases_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchases_branch_id_foreign` (`branch_id`),
  ADD KEY `purchases_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `purchase_details`
--
ALTER TABLE `purchase_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_details_purchase_id_foreign` (`purchase_id`),
  ADD KEY `purchase_details_product_id_foreign` (`product_id`),
  ADD KEY `purchase_details_category_id_foreign` (`category_id`),
  ADD KEY `purchase_details_brand_id_foreign` (`brand_id`);

--
-- Indeks untuk tabel `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `roles_name_guard_name_unique` (`name`,`guard_name`);

--
-- Indeks untuk tabel `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD PRIMARY KEY (`permission_id`,`role_id`),
  ADD KEY `role_has_permissions_role_id_foreign` (`role_id`);

--
-- Indeks untuk tabel `sales`
--
ALTER TABLE `sales`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sales_sale_number_unique` (`sale_number`),
  ADD UNIQUE KEY `sales_barcode_unique` (`barcode`),
  ADD KEY `sales_customer_id_foreign` (`customer_id`),
  ADD KEY `sales_branch_id_foreign` (`branch_id`),
  ADD KEY `sales_cashier_id_foreign` (`cashier_id`),
  ADD KEY `sales_service_id_foreign` (`service_id`);

--
-- Indeks untuk tabel `sale_details`
--
ALTER TABLE `sale_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sale_details_sale_id_foreign` (`sale_id`),
  ADD KEY `sale_details_product_id_foreign` (`product_id`);

--
-- Indeks untuk tabel `services`
--
ALTER TABLE `services`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `services_service_number_unique` (`service_number`),
  ADD UNIQUE KEY `services_barcode_unique` (`barcode`),
  ADD UNIQUE KEY `services_unique_code_unique` (`unique_code`),
  ADD KEY `services_customer_id_foreign` (`customer_id`),
  ADD KEY `services_branch_id_foreign` (`branch_id`),
  ADD KEY `services_technician_id_foreign` (`technician_id`),
  ADD KEY `services_recipient_id_foreign` (`recipient_id`);

--
-- Indeks untuk tabel `service_details`
--
ALTER TABLE `service_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_details_service_id_foreign` (`service_id`),
  ADD KEY `service_details_product_id_foreign` (`product_id`);

--
-- Indeks untuk tabel `service_status_histories`
--
ALTER TABLE `service_status_histories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `service_status_histories_service_id_foreign` (`service_id`),
  ADD KEY `service_status_histories_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `sessions`
--
ALTER TABLE `sessions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sessions_user_id_index` (`user_id`),
  ADD KEY `sessions_last_activity_index` (`last_activity`);

--
-- Indeks untuk tabel `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_movements_product_id_foreign` (`product_id`),
  ADD KEY `stock_movements_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `stock_opnames`
--
ALTER TABLE `stock_opnames`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `stock_opnames_opname_number_unique` (`opname_number`),
  ADD KEY `stock_opnames_branch_id_foreign` (`branch_id`),
  ADD KEY `stock_opnames_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `stock_opname_details`
--
ALTER TABLE `stock_opname_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_opname_details_stock_opname_id_foreign` (`stock_opname_id`),
  ADD KEY `stock_opname_details_product_id_foreign` (`product_id`);

--
-- Indeks untuk tabel `suppliers`
--
ALTER TABLE `suppliers`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

--
-- AUTO_INCREMENT untuk tabel `branches`
--
ALTER TABLE `branches`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT untuk tabel `brands`
--
ALTER TABLE `brands`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT untuk tabel `categories`
--
ALTER TABLE `categories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT untuk tabel `customers`
--
ALTER TABLE `customers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

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

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

--
-- AUTO_INCREMENT untuk tabel `migrations`
--
ALTER TABLE `migrations`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;

--
-- AUTO_INCREMENT untuk tabel `ms_dashboard_informations`
--
ALTER TABLE `ms_dashboard_informations`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT untuk tabel `ms_nota_purchases`
--
ALTER TABLE `ms_nota_purchases`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT untuk tabel `ms_nota_sales`
--
ALTER TABLE `ms_nota_sales`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT untuk tabel `ms_nota_services`
--
ALTER TABLE `ms_nota_services`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT untuk tabel `permissions`
--
ALTER TABLE `permissions`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=69;

--
-- AUTO_INCREMENT untuk tabel `products`
--
ALTER TABLE `products`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;

--
-- AUTO_INCREMENT untuk tabel `purchases`
--
ALTER TABLE `purchases`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=27;

--
-- AUTO_INCREMENT untuk tabel `purchase_details`
--
ALTER TABLE `purchase_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=53;

--
-- AUTO_INCREMENT untuk tabel `roles`
--
ALTER TABLE `roles`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT untuk tabel `sales`
--
ALTER TABLE `sales`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=46;

--
-- AUTO_INCREMENT untuk tabel `sale_details`
--
ALTER TABLE `sale_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=67;

--
-- AUTO_INCREMENT untuk tabel `services`
--
ALTER TABLE `services`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;

--
-- AUTO_INCREMENT untuk tabel `service_details`
--
ALTER TABLE `service_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;

--
-- AUTO_INCREMENT untuk tabel `service_status_histories`
--
ALTER TABLE `service_status_histories`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=38;

--
-- AUTO_INCREMENT untuk tabel `stock_movements`
--
ALTER TABLE `stock_movements`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=118;

--
-- AUTO_INCREMENT untuk tabel `stock_opnames`
--
ALTER TABLE `stock_opnames`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT untuk tabel `stock_opname_details`
--
ALTER TABLE `stock_opname_details`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT untuk tabel `suppliers`
--
ALTER TABLE `suppliers`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--

--
-- Ketidakleluasaan untuk tabel `customers`
--
ALTER TABLE `customers`
  ADD CONSTRAINT `customers_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `model_has_permissions`
--
ALTER TABLE `model_has_permissions`
  ADD CONSTRAINT `model_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `model_has_roles`
--
ALTER TABLE `model_has_roles`
  ADD CONSTRAINT `model_has_roles_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `purchases`
--
ALTER TABLE `purchases`
  ADD CONSTRAINT `purchases_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchases_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchases_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `purchase_details`
--
ALTER TABLE `purchase_details`
  ADD CONSTRAINT `purchase_details_brand_id_foreign` FOREIGN KEY (`brand_id`) REFERENCES `brands` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_details_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_details_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_details_purchase_id_foreign` FOREIGN KEY (`purchase_id`) REFERENCES `purchases` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `role_has_permissions`
--
ALTER TABLE `role_has_permissions`
  ADD CONSTRAINT `role_has_permissions_permission_id_foreign` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `role_has_permissions_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `sales`
--
ALTER TABLE `sales`
  ADD CONSTRAINT `sales_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sales_cashier_id_foreign` FOREIGN KEY (`cashier_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sales_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `sales_service_id_foreign` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `sale_details`
--
ALTER TABLE `sale_details`
  ADD CONSTRAINT `sale_details_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sale_details_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `services`
--
ALTER TABLE `services`
  ADD CONSTRAINT `services_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `services_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `services_recipient_id_foreign` FOREIGN KEY (`recipient_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `services_technician_id_foreign` FOREIGN KEY (`technician_id`) REFERENCES `users` (`id`) ON DELETE SET NULL;

--
-- Ketidakleluasaan untuk tabel `service_details`
--
ALTER TABLE `service_details`
  ADD CONSTRAINT `service_details_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `service_details_service_id_foreign` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `service_status_histories`
--
ALTER TABLE `service_status_histories`
  ADD CONSTRAINT `service_status_histories_service_id_foreign` FOREIGN KEY (`service_id`) REFERENCES `services` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `service_status_histories_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stock_movements`
--
ALTER TABLE `stock_movements`
  ADD CONSTRAINT `stock_movements_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_movements_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stock_opnames`
--
ALTER TABLE `stock_opnames`
  ADD CONSTRAINT `stock_opnames_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_opnames_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stock_opname_details`
--
ALTER TABLE `stock_opname_details`
  ADD CONSTRAINT `stock_opname_details_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `stock_opname_details_stock_opname_id_foreign` FOREIGN KEY (`stock_opname_id`) REFERENCES `stock_opnames` (`id`) ON DELETE CASCADE;
COMMIT;

