-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 22 Nov 2025 pada 04.39
-- Versi server: 11.4.9-MariaDB
-- Versi PHP: 8.4.14

START TRANSACTION;



--
-- Database: `mukulink_demoposit`
--

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

--
-- Struktur dari tabel `accounts`
--

CREATE TABLE `accounts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `account_number` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `type` enum('Aset Lancar','Aset Tetap','Liabilitas','Ekuitas','Pendapatan','HPP','Biaya Operasional') NOT NULL,
  `normal_balance` enum('Debit','Kredit') NOT NULL,
  `description` text 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 `accounts`
--

INSERT INTO `accounts` (`id`, `account_number`, `name`, `type`, `normal_balance`, `description`, `is_active`, `created_at`, `updated_at`) VALUES
(1, '1101', 'Kas', 'Aset Lancar', 'Debit', NULL, 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(2, '1102', 'Bank BCA', 'Aset Lancar', 'Debit', NULL, 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(3, '1103', 'Piutang Usaha', 'Aset Lancar', 'Debit', 'Akun piutang dari penjualan kredit', 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(4, '1104', 'Persediaan Barang Dagang', 'Aset Lancar', 'Debit', 'Nilai HPP dari stok di gudang', 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(5, '1105', 'PPN Masukan', 'Aset Lancar', 'Debit', 'Pajak yang kita bayar saat pembelian', 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(6, '1201', 'Peralatan Apotek', 'Aset Tetap', 'Debit', NULL, 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(7, '1202', 'Akum. Penyusutan - Peralatan', 'Aset Tetap', 'Kredit', 'Akun Kontra-Aset', 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(8, '2101', 'Utang Usaha', 'Liabilitas', 'Kredit', 'Akun utang ke supplier', 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(9, '2102', 'PPN Keluaran', 'Liabilitas', 'Kredit', 'Pajak yang kita pungut dari pelanggan', 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(10, '2103', 'Utang Gaji', 'Liabilitas', 'Kredit', NULL, 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(11, '3101', 'Modal Pemilik', 'Ekuitas', 'Kredit', NULL, 1, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(12, '3102', 'Prive - Pemilik', 'Ekuitas', 'Debit', 'Penarikan pribadi (Kontra-Ekuitas)', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(13, '4101', 'Pendapatan Penjualan', 'Pendapatan', 'Kredit', 'Total penjualan (DPP)', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(14, '4201', 'Retur Penjualan', 'Pendapatan', 'Debit', 'Pengurang pendapatan (Kontra-Pendapatan)', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(15, '5101', 'HPP (Harga Pokok Penjualan)', 'HPP', 'Debit', 'Total HPP barang terjual', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(16, '5201', 'Retur Pembelian', 'HPP', 'Kredit', 'Pengurang HPP (Kontra-HPP)', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(17, '5202', 'Diskon Pembelian', 'HPP', 'Kredit', 'Pengurang HPP (Kontra-HPP)', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(18, '6101', 'Biaya Gaji', 'Biaya Operasional', 'Debit', NULL, 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(19, '6102', 'Biaya Listrik & Air', 'Biaya Operasional', 'Debit', NULL, 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(20, '6103', 'Biaya Sewa', 'Biaya Operasional', 'Debit', NULL, 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(21, '6104', 'Diskon Penjualan', 'Biaya Operasional', 'Debit', 'Diskon item & faktur saat penjualan', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52'),
(22, '6999', 'Biaya Lain-lain (Default)', 'Biaya Operasional', 'Debit', 'Default untuk biaya operasional', 1, '2025-11-14 18:35:52', '2025-11-14 18:35:52');

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

--
-- Struktur dari tabel `accounts_payables`
--

CREATE TABLE `accounts_payables` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `goods_receipt_id` bigint(20) UNSIGNED NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_type` varchar(255) NOT NULL DEFAULT 'fixed',
  `grand_total` decimal(15,2) NOT NULL,
  `amount_paid` decimal(15,2) NOT NULL DEFAULT 0.00,
  `due_date` date NOT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'Unpaid',
  `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 `accounts_payables`
--

INSERT INTO `accounts_payables` (`id`, `supplier_id`, `goods_receipt_id`, `subtotal`, `tax_amount`, `discount_amount`, `discount_type`, `grand_total`, `amount_paid`, `due_date`, `status`, `created_at`, `updated_at`) VALUES
(1, 1, 2, 350000.00, 38500.00, 0.00, 'fixed', 388500.00, 0.00, '2025-11-26', 'Unpaid', '2025-11-21 14:07:42', '2025-11-21 14:07:42'),
(2, 1, 3, 1750000.00, 192500.00, 0.00, 'fixed', 1942500.00, 0.00, '2025-11-30', 'Unpaid', '2025-11-22 21:07:05', '2025-11-22 21:07:05');

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

--
-- Struktur dari tabel `accounts_receivables`
--

CREATE TABLE `accounts_receivables` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `sales_order_id` bigint(20) UNSIGNED NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `grand_total` decimal(15,2) NOT NULL,
  `amount_paid` decimal(15,2) NOT NULL DEFAULT 0.00,
  `due_date` date DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'Unpaid',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `activity_logs`
--

CREATE TABLE `activity_logs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `action` varchar(255) NOT NULL,
  `module` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `subject_type` varchar(255) DEFAULT NULL,
  `subject_id` bigint(20) UNSIGNED DEFAULT NULL,
  `ip_address` varchar(45) 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 `activity_logs`
--

INSERT INTO `activity_logs` (`id`, `user_id`, `action`, `module`, `description`, `subject_type`, `subject_id`, `ip_address`, `created_at`, `updated_at`) VALUES
(1, 2, 'create', 'POS', 'Penjualan: INV-1763690910', 'App\\Models\\SalesOrder', 1, '140.213.16.68', '2025-11-21 14:08:30', '2025-11-21 14:08:30'),
(2, 2, 'login', 'Auth', 'User admin toko berhasil login.', NULL, NULL, '140.213.103.38', '2025-11-21 18:43:34', '2025-11-21 18:43:34'),
(3, 2, 'login', 'Auth', 'User admin toko berhasil login.', NULL, NULL, '140.213.254.186', '2025-11-22 12:27:31', '2025-11-22 12:27:31'),
(4, 2, 'login', 'Auth', 'User admin toko berhasil login.', NULL, NULL, '103.147.8.9', '2025-11-22 21:01:51', '2025-11-22 21:01:51'),
(5, 3, 'login', 'Auth', 'User demo toko berhasil login.', NULL, NULL, '103.147.8.9', '2025-11-22 21:20:19', '2025-11-22 21:20:19'),
(6, 2, 'login', 'Auth', 'User admin toko berhasil login.', NULL, NULL, '103.147.8.9', '2025-11-22 21:20:39', '2025-11-22 21:20:39');

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

--
-- Struktur dari tabel `cash_transactions`
--

CREATE TABLE `cash_transactions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `transaction_date` timestamp NOT NULL,
  `description` varchar(255) NOT NULL,
  `amount_in` decimal(15,2) NOT NULL DEFAULT 0.00,
  `amount_out` decimal(15,2) NOT NULL DEFAULT 0.00,
  `reference_type` varchar(255) DEFAULT NULL,
  `reference_id` bigint(20) UNSIGNED DEFAULT NULL,
  `created_by` 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 `cash_transactions`
--

INSERT INTO `cash_transactions` (`id`, `transaction_date`, `description`, `amount_in`, `amount_out`, `reference_type`, `reference_id`, `created_by`, `created_at`, `updated_at`) VALUES
(1, '2025-11-21 14:08:30', 'Penjualan Cash (INV: INV-1763690910)', 36630.00, 0.00, 'App\\Models\\GeneralJournal', 2, 2, '2025-11-21 14:08:30', '2025-11-21 14:08:30');

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

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

CREATE TABLE `categories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `parent_id` bigint(20) UNSIGNED DEFAULT 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`, `parent_id`, `description`, `created_at`, `updated_at`) VALUES
(1, 'Obat Bebas', NULL, NULL, NULL, NULL),
(2, 'Obat Keras', NULL, NULL, NULL, NULL),
(3, 'Suplemen & Vitamin', NULL, NULL, NULL, NULL),
(4, 'Alat Kesehatan', NULL, NULL, NULL, NULL),
(5, 'Obat Herbal', NULL, NULL, NULL, NULL);

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

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

CREATE TABLE `customers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `phone` varchar(255) DEFAULT NULL,
  `address` text DEFAULT NULL,
  `customer_type` varchar(255) NOT NULL DEFAULT 'Retail',
  `membership_level` varchar(255) DEFAULT NULL,
  `credit_limit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `point_balance` bigint(20) NOT NULL DEFAULT 0,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `deleted_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`, `customer_type`, `membership_level`, `credit_limit`, `point_balance`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'Pelanggan Umum', NULL, NULL, 'Retail', NULL, 0.00, 0, '2025-11-21 14:07:49', '2025-11-21 14:07:49', NULL);

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

--
-- Struktur dari tabel `customer_point_histories`
--

CREATE TABLE `customer_point_histories` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED NOT NULL,
  `points_change` int(11) NOT NULL,
  `description` 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;

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

--
-- 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 `general_journals`
--

CREATE TABLE `general_journals` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `journal_date` date NOT NULL,
  `description` text NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `reference_type` varchar(255) DEFAULT NULL,
  `reference_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 `general_journals`
--

INSERT INTO `general_journals` (`id`, `journal_date`, `description`, `user_id`, `reference_type`, `reference_id`, `created_at`, `updated_at`) VALUES
(1, '2025-11-21', 'Pembelian (GR/Faktur: dfggfg) dari PT. Kimia Farma (PBF)', 2, NULL, NULL, '2025-11-21 14:07:42', '2025-11-21 14:07:42'),
(2, '2025-11-21', 'Penjualan (INV: INV-1763690910)', 2, 'App\\Models\\SalesOrder', 1, '2025-11-21 14:08:30', '2025-11-21 14:08:30'),
(3, '2025-11-22', 'Pembelian (GR/Faktur: sdfd) dari PT. Kimia Farma (PBF)', 2, NULL, NULL, '2025-11-22 21:07:05', '2025-11-22 21:07:05');

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

--
-- Struktur dari tabel `general_journal_details`
--

CREATE TABLE `general_journal_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `general_journal_id` bigint(20) UNSIGNED NOT NULL,
  `account_id` bigint(20) UNSIGNED NOT NULL,
  `debit` decimal(15,2) NOT NULL DEFAULT 0.00,
  `credit` decimal(15,2) NOT NULL DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Dumping data untuk tabel `general_journal_details`
--

INSERT INTO `general_journal_details` (`id`, `general_journal_id`, `account_id`, `debit`, `credit`) VALUES
(1, 1, 4, 350000.00, 0.00),
(2, 1, 5, 38500.00, 0.00),
(3, 1, 8, 0.00, 388500.00),
(4, 2, 1, 36630.00, 0.00),
(5, 2, 15, 17000.00, 0.00),
(6, 2, 13, 0.00, 33000.00),
(7, 2, 9, 0.00, 3630.00),
(8, 2, 4, 0.00, 17000.00),
(9, 3, 4, 1750000.00, 0.00),
(10, 3, 5, 192500.00, 0.00),
(11, 3, 8, 0.00, 1942500.00);

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

--
-- Struktur dari tabel `goods_receipts`
--

CREATE TABLE `goods_receipts` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `receipt_number` varchar(255) NOT NULL,
  `receipt_date` datetime NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_type` varchar(255) NOT NULL DEFAULT 'fixed',
  `grand_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `payment_method` varchar(255) NOT NULL DEFAULT 'Credit',
  `notes` text DEFAULT NULL,
  `created_by` 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 `goods_receipts`
--

INSERT INTO `goods_receipts` (`id`, `purchase_order_id`, `supplier_id`, `receipt_number`, `receipt_date`, `subtotal`, `tax_amount`, `discount_amount`, `discount_type`, `grand_total`, `payment_method`, `notes`, `created_by`, `created_at`, `updated_at`) VALUES
(2, 1, 1, 'dfggfg', '2025-11-21 09:04:00', 350000.00, 38500.00, 0.00, 'fixed', 388500.00, 'Credit', 'dfgfg', 2, '2025-11-21 14:07:42', '2025-11-21 14:07:42'),
(3, 2, 1, 'sdfd', '2025-11-22 16:06:00', 1750000.00, 192500.00, 0.00, 'fixed', 1942500.00, 'Credit', '', 2, '2025-11-22 21:07:05', '2025-11-22 21:07:05');

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

--
-- Struktur dari tabel `goods_receipt_details`
--

CREATE TABLE `goods_receipt_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `goods_receipt_id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `unit_id` bigint(20) UNSIGNED NOT NULL,
  `quantity_received` decimal(15,2) NOT NULL,
  `batch_number` varchar(255) NOT NULL,
  `expired_date` date NOT NULL,
  `purchase_price` 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 `goods_receipt_details`
--

INSERT INTO `goods_receipt_details` (`id`, `goods_receipt_id`, `product_variant_id`, `unit_id`, `quantity_received`, `batch_number`, `expired_date`, `purchase_price`, `created_at`, `updated_at`) VALUES
(3, 2, 1, 1, 1000.00, 'dfgfdgf4', '2025-11-29', 200.00, NULL, NULL),
(4, 2, 8, 1, 1000.00, 'fdvfdg2', '2025-11-29', 150.00, NULL, NULL),
(5, 3, 8, 1, 1000.00, 'sdfdf', '2025-12-26', 150.00, NULL, NULL),
(6, 3, 4, 1, 1000.00, 'were', '2025-12-26', 100.00, NULL, NULL),
(7, 3, 6, 7, 1000.00, 'ddg', '2025-12-25', 1500.00, NULL, NULL);

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

--
-- 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_11_07_162619_create_suppliers_table', 1),
(5, '2025_11_07_162620_create_categories_table', 1),
(6, '2025_11_07_162621_create_units_table', 1),
(7, '2025_11_07_162622_create_products_table', 1),
(8, '2025_11_07_162623_create_product_variants_table', 1),
(9, '2025_11_07_162624_create_product_units_table', 1),
(10, '2025_11_07_162627_create_stock_batches_table', 1),
(11, '2025_11_07_162638_create_purchase_orders_table', 1),
(12, '2025_11_07_162639_create_purchase_order_details_table', 1),
(13, '2025_11_07_162640_create_goods_receipts_table', 1),
(14, '2025_11_07_162643_create_goods_receipt_details_table', 1),
(15, '2025_11_07_162700_create_customers_table', 1),
(16, '2025_11_07_162701_create_sales_orders_table', 1),
(17, '2025_11_07_162702_create_sales_order_details_table', 1),
(18, '2025_11_07_162704_create_stock_mutations_table', 1),
(19, '2025_11_07_162716_create_accounts_payables_table', 1),
(20, '2025_11_07_162717_create_accounts_receivables_table', 1),
(21, '2025_11_07_162718_create_cash_transactions_table', 1),
(22, '2025_11_07_162720_create_operational_costs_table', 1),
(23, '2025_11_08_140446_create_sales_returns_table', 1),
(24, '2025_11_08_140450_create_sales_return_details_table', 1),
(25, '2025_11_08_160257_create_purchase_returns_table', 1),
(26, '2025_11_08_160300_create_purchase_return_details_table', 1),
(27, '2025_11_08_161946_add_tax_to_purchase_order_details_table', 1),
(28, '2025_11_08_161948_add_tax_to_sales_order_details_table', 1),
(29, '2025_11_08_161949_add_tax_to_accounts_payables_table', 1),
(30, '2025_11_08_161953_add_tax_to_accounts_receivables_table', 1),
(31, '2025_11_09_050904_add_crm_fields_to_customers_table', 1),
(32, '2025_11_09_050906_create_customer_point_histories_table', 1),
(33, '2025_11_09_050912_create_vouchers_table', 1),
(34, '2025_11_09_090803_add_tax_to_sales_returns_table', 1),
(35, '2025_11_09_090805_add_tax_to_purchase_returns_table', 1),
(36, '2025_11_09_100336_modify_purchase_orders_for_discounts_table', 1),
(37, '2025_11_09_100337_add_discount_to_purchase_order_details_table', 1),
(38, '2025_11_09_100339_modify_goods_receipts_for_discounts_table', 1),
(39, '2025_11_09_100343_add_discount_to_accounts_payables_table', 1),
(40, '2025_11_09_113416_add_discount_type_to_purchase_orders_table', 1),
(41, '2025_11_09_113418_add_discount_type_to_purchase_order_details_table', 1),
(42, '2025_11_09_113420_add_discount_type_to_goods_receipts_table', 1),
(43, '2025_11_09_113425_add_discount_type_to_accounts_payables_table', 1),
(44, '2025_11_09_120008_rename_discount_columns_in_purchase_orders_table', 1),
(45, '2025_11_09_131939_modify_discount_columns_in_purchase_order_details_table', 1),
(46, '2025_11_10_044116_add_tax_percent_to_purchase_orders_table', 1),
(47, '2025_11_10_053947_add_discount_fields_to_sales_order_details_table', 1),
(48, '2025_11_10_064029_add_discount_to_accounts_receivables_table', 1),
(49, '2025_11_11_022223_add_barcode_to_product_variants_table', 1),
(50, '2025_11_11_044030_add_tax_percent_to_sales_orders_table', 1),
(51, '2025_11_11_070611_add_payment_method_to_goods_receipts_table', 1),
(52, '2025_11_11_081508_create_accounts_table', 1),
(53, '2025_11_11_082732_create_general_journals_table', 1),
(54, '2025_11_11_082804_create_general_journal_details_table', 1),
(55, '2025_11_11_101215_create_account_settings_table', 1),
(56, '2025_11_12_010641_create_settings_table', 1),
(57, '2025_11_12_051539_create_roles_and_permissions_tables', 1),
(58, '2025_11_12_082015_create_activity_logs_table', 1),
(59, '2025_11_13_171336_change_date_columns_to_datetime', 1),
(60, '2025_11_13_194016_add_reference_columns_to_general_journals_table', 1);

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

--
-- Struktur dari tabel `operational_costs`
--

CREATE TABLE `operational_costs` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `cost_date` date NOT NULL,
  `category` varchar(255) NOT NULL,
  `description` varchar(255) NOT NULL,
  `amount` decimal(15,2) NOT NULL,
  `created_by` 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;

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

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

CREATE TABLE `permissions` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `group_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`, `group_name`, `created_at`, `updated_at`) VALUES
(1, 'view_dashboard', 'Dashboard', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(2, 'access_pos', 'Penjualan (POS)', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(3, 'create_sales_return', 'Penjualan (POS)', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(4, 'manage_inventory', 'Inventori', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(5, 'adjust_stock', 'Inventori', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(6, 'view_stock_card', 'Inventori', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(7, 'manage_purchasing', 'Pembelian', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(8, 'manage_finances', 'Keuangan', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(9, 'view_profit_loss', 'Keuangan', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(10, 'manage_settings', 'Pengaturan', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(11, 'manage_users', 'Pengaturan', '2025-11-14 18:35:51', '2025-11-14 18:35:51');

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

--
-- Struktur dari tabel `permission_role`
--

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

--
-- Dumping data untuk tabel `permission_role`
--

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

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

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

CREATE TABLE `products` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `category_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_id` bigint(20) UNSIGNED DEFAULT NULL,
  `description` text DEFAULT NULL,
  `image_url` 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 `products`
--

INSERT INTO `products` (`id`, `name`, `category_id`, `supplier_id`, `description`, `image_url`, `created_at`, `updated_at`) VALUES
(1, 'Paracetamol', 1, 1, 'Obat penurun panas dan pereda nyeri.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(2, 'Amoxicillin Sirup Kering', 2, 1, 'Antibiotik sirup kering.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(3, 'Ibuprofen', 2, 1, 'Obat anti-inflamasi nonsteroid.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(4, 'Vitamin C IPI', 3, 1, 'Suplemen Vitamin C 50mg.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(5, 'Promag', 1, 1, 'Obat maag kunyah.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(6, 'Komix OBH', 1, 1, 'Obat batuk sachet.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(7, 'Betadine Antiseptic Ointment', 1, 1, 'Salep antiseptik untuk luka.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(8, 'Amlodipine Besilate', 2, 1, 'Obat hipertensi.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(9, 'Metformin HCl', 2, 1, 'Obat diabetes.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(10, 'Vicks Formula 44', 1, 1, 'Obat batuk kering sirup.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(11, 'Hansaplast', 4, 1, 'Plester luka.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(12, 'Omeprazole', 2, 1, 'Obat asam lambung.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(13, 'Antimo', 1, 1, 'Obat anti mabok perjalanan.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(14, 'Minyak Kayu Putih Cap Lang', 5, 1, 'Minyak kayu putih.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(15, 'Cefixime', 2, 1, 'Antibiotik kapsul.', NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51');

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

--
-- Struktur dari tabel `product_units`
--

CREATE TABLE `product_units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `unit_id` bigint(20) UNSIGNED NOT NULL,
  `conversion_factor` decimal(10,2) NOT NULL,
  `purchase_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `retail_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `wholesale_price` decimal(15,2) NOT NULL DEFAULT 0.00,
  `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 `product_units`
--

INSERT INTO `product_units` (`id`, `product_variant_id`, `unit_id`, `conversion_factor`, `purchase_price`, `retail_price`, `wholesale_price`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1.00, 200.00, 300.00, 250.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(2, 1, 2, 10.00, 2000.00, 3000.00, 2500.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(3, 1, 3, 100.00, 20000.00, 28000.00, 24000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(4, 2, 4, 1.00, 15000.00, 20000.00, 18000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(5, 3, 5, 1.00, 300.00, 500.00, 400.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(6, 3, 2, 10.00, 3000.00, 5000.00, 4000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(7, 3, 3, 100.00, 30000.00, 45000.00, 38000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(8, 4, 1, 1.00, 100.00, 150.00, 120.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(9, 4, 4, 50.00, 4500.00, 6000.00, 5000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(10, 5, 1, 1.00, 700.00, 1000.00, 800.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(11, 5, 2, 12.00, 8400.00, 12000.00, 9600.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(12, 5, 3, 144.00, 100000.00, 130000.00, 110000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(13, 6, 7, 1.00, 1500.00, 2000.00, 1800.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(14, 6, 3, 30.00, 45000.00, 55000.00, 50000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(15, 7, 6, 1.00, 8000.00, 11000.00, 9500.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(16, 8, 1, 1.00, 150.00, 300.00, 200.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(17, 8, 2, 10.00, 1500.00, 3000.00, 2000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(18, 8, 3, 100.00, 15000.00, 28000.00, 20000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(19, 9, 1, 1.00, 180.00, 300.00, 250.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(20, 9, 2, 10.00, 1800.00, 3000.00, 2500.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(21, 9, 3, 100.00, 18000.00, 27000.00, 24000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(22, 10, 4, 1.00, 22000.00, 28000.00, 25000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(23, 11, 8, 1.00, 500.00, 800.00, 600.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(24, 11, 3, 100.00, 45000.00, 60000.00, 50000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(25, 12, 5, 1.00, 300.00, 500.00, 400.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(26, 12, 2, 10.00, 3000.00, 5000.00, 4000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(27, 12, 3, 30.00, 9000.00, 13000.00, 11000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(28, 13, 1, 1.00, 1000.00, 1500.00, 1200.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(29, 13, 2, 10.00, 10000.00, 15000.00, 12000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(30, 14, 4, 1.00, 18000.00, 22000.00, 20000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(31, 15, 5, 1.00, 2500.00, 3500.00, 3000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(32, 15, 2, 10.00, 25000.00, 35000.00, 30000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(33, 15, 3, 50.00, 125000.00, 160000.00, 140000.00, '2025-11-14 18:35:51', '2025-11-14 18:35:51');

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

--
-- Struktur dari tabel `product_variants`
--

CREATE TABLE `product_variants` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `sku` varchar(255) DEFAULT NULL,
  `barcode` varchar(255) DEFAULT NULL,
  `base_unit_id` bigint(20) UNSIGNED NOT NULL,
  `minimum_stock` decimal(15,2) NOT NULL DEFAULT 0.00,
  `image_url` 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 `product_variants`
--

INSERT INTO `product_variants` (`id`, `product_id`, `name`, `sku`, `barcode`, `base_unit_id`, `minimum_stock`, `image_url`, `created_at`, `updated_at`) VALUES
(1, 1, '500mg Tablet', 'PCT500', NULL, 1, 100.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(2, 2, '125mg/5ml - 60ml', 'AMX125', NULL, 4, 10.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(3, 3, '400mg Kapsul', 'IBU400', NULL, 5, 100.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(4, 4, '50mg Tablet', 'VITC50', NULL, 1, 500.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(5, 5, 'Tablet Kunyah', 'PROMAG-TAB', NULL, 1, 200.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(6, 6, 'Sachet 7ml', 'KOMIX-SCT', NULL, 7, 100.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(7, 7, 'Tube 5g', 'BETADINE-5G', NULL, 6, 20.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(8, 8, '5mg Tablet', 'AMLO-5', NULL, 1, 300.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(9, 9, '500mg Tablet', 'MET-500', NULL, 1, 200.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(10, 10, 'Sirup 100ml', 'VICKS-100', NULL, 4, 15.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(11, 11, 'Standard Strip', 'HANSA-STD', NULL, 8, 50.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(12, 12, '20mg Kapsul', 'OMEP-20', NULL, 5, 100.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(13, 13, '50mg Tablet', 'ANTIMO-50', NULL, 1, 50.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(14, 14, 'Botol 60ml', 'MKP-60', NULL, 4, 10.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(15, 15, '200mg Kapsul', 'CEFIX-200', NULL, 5, 50.00, NULL, '2025-11-14 18:35:51', '2025-11-14 18:35:51');

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

--
-- Struktur dari tabel `purchase_orders`
--

CREATE TABLE `purchase_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `po_number` varchar(255) NOT NULL,
  `order_date` datetime NOT NULL,
  `expected_date` date DEFAULT NULL,
  `status` varchar(255) NOT NULL DEFAULT 'Pending',
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_percent` decimal(5,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `calculated_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_type` varchar(255) NOT NULL DEFAULT 'fixed',
  `discount_value` decimal(15,2) NOT NULL DEFAULT 0.00,
  `grand_total` decimal(15,2) NOT NULL DEFAULT 0.00,
  `notes` text DEFAULT NULL,
  `created_by` 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 `purchase_orders`
--

INSERT INTO `purchase_orders` (`id`, `supplier_id`, `po_number`, `order_date`, `expected_date`, `status`, `subtotal`, `tax_percent`, `tax_amount`, `calculated_discount_amount`, `discount_type`, `discount_value`, `grand_total`, `notes`, `created_by`, `created_at`, `updated_at`) VALUES
(1, 1, 'PO-1763690591', '2025-11-21 09:02:00', '2025-11-27', 'Completed', 350000.00, 11.00, 38500.00, 0.00, 'fixed', 0.00, 388500.00, '', 2, '2025-11-21 14:03:11', '2025-11-21 14:07:42'),
(2, 1, 'PO-1763802356', '2025-11-22 16:05:00', '2025-11-28', 'Completed', 1750000.00, 11.00, 192500.00, 0.00, 'fixed', 0.00, 1942500.00, '', 2, '2025-11-22 21:05:56', '2025-11-22 21:07:05');

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

--
-- Struktur dari tabel `purchase_order_details`
--

CREATE TABLE `purchase_order_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_order_id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `unit_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(15,2) NOT NULL,
  `quantity_received` decimal(15,2) NOT NULL DEFAULT 0.00,
  `price_per_unit` decimal(15,2) NOT NULL,
  `calculated_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `discount_type` varchar(255) NOT NULL DEFAULT 'fixed',
  `discount_value` decimal(15,2) NOT NULL DEFAULT 0.00,
  `subtotal` decimal(15,2) NOT NULL,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `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_order_details`
--

INSERT INTO `purchase_order_details` (`id`, `purchase_order_id`, `product_variant_id`, `unit_id`, `quantity`, `quantity_received`, `price_per_unit`, `calculated_discount_amount`, `discount_type`, `discount_value`, `subtotal`, `tax_amount`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, 1000.00, 1000.00, 200.00, 0.00, 'fixed', 0.00, 200000.00, 22000.00, NULL, NULL),
(2, 1, 8, 1, 1000.00, 1000.00, 150.00, 0.00, 'fixed', 0.00, 150000.00, 16500.00, NULL, NULL),
(3, 2, 8, 1, 1000.00, 1000.00, 150.00, 0.00, 'fixed', 0.00, 150000.00, 16500.00, NULL, NULL),
(4, 2, 4, 1, 1000.00, 1000.00, 100.00, 0.00, 'fixed', 0.00, 100000.00, 11000.00, NULL, NULL),
(5, 2, 6, 7, 1000.00, 1000.00, 1500.00, 0.00, 'fixed', 0.00, 1500000.00, 165000.00, NULL, NULL);

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

--
-- Struktur dari tabel `purchase_returns`
--

CREATE TABLE `purchase_returns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `goods_receipt_id` bigint(20) UNSIGNED DEFAULT NULL,
  `supplier_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `return_date` datetime NOT NULL,
  `return_number` varchar(255) NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `grand_total` decimal(15,2) NOT NULL,
  `reason` text NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `purchase_return_details`
--

CREATE TABLE `purchase_return_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `purchase_return_id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `stock_batch_id` bigint(20) UNSIGNED NOT NULL,
  `quantity_returned` decimal(15,4) NOT NULL,
  `amount` decimal(15,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

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

CREATE TABLE `roles` (
  `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 `roles`
--

INSERT INTO `roles` (`id`, `name`, `created_at`, `updated_at`) VALUES
(1, 'Administrator', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(2, 'Kasir', '2025-11-14 18:35:51', '2025-11-14 18:35:51'),
(3, 'Demo', '2025-11-22 21:03:38', '2025-11-22 21:03:38');

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

--
-- Struktur dari tabel `sales_orders`
--

CREATE TABLE `sales_orders` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `customer_id` bigint(20) UNSIGNED DEFAULT NULL,
  `order_number` varchar(255) NOT NULL,
  `order_date` timestamp NOT NULL,
  `total_amount` decimal(15,2) NOT NULL,
  `discount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_percent` decimal(5,2) NOT NULL DEFAULT 11.00,
  `grand_total` decimal(15,2) NOT NULL,
  `payment_method` varchar(255) 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 `sales_orders`
--

INSERT INTO `sales_orders` (`id`, `customer_id`, `order_number`, `order_date`, `total_amount`, `discount`, `tax`, `tax_percent`, `grand_total`, `payment_method`, `status`, `notes`, `user_id`, `created_at`, `updated_at`) VALUES
(1, 1, 'INV-1763690910', '2025-11-21 14:08:30', 33000.00, 0.00, 3630.00, 11.00, 36630.00, 'Cash', 'Paid', NULL, 2, '2025-11-21 14:08:30', '2025-11-21 14:08:30');

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

--
-- Struktur dari tabel `sales_order_details`
--

CREATE TABLE `sales_order_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sales_order_id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `unit_id` bigint(20) UNSIGNED NOT NULL,
  `quantity` decimal(15,2) NOT NULL,
  `price_per_unit` decimal(15,2) NOT NULL,
  `discount_type` varchar(255) NOT NULL DEFAULT 'fixed',
  `discount_value` decimal(15,2) NOT NULL DEFAULT 0.00,
  `calculated_discount_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `hpp_per_unit` decimal(15,2) DEFAULT NULL,
  `subtotal` decimal(15,2) NOT NULL,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `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_order_details`
--

INSERT INTO `sales_order_details` (`id`, `sales_order_id`, `product_variant_id`, `unit_id`, `quantity`, `price_per_unit`, `discount_type`, `discount_value`, `calculated_discount_amount`, `hpp_per_unit`, `subtotal`, `tax_amount`, `created_at`, `updated_at`) VALUES
(1, 1, 8, 2, 10.00, 3000.00, 'fixed', 0.00, 0.00, 150.00, 30000.00, 3300.00, NULL, NULL),
(2, 1, 1, 2, 1.00, 3000.00, 'fixed', 0.00, 0.00, 200.00, 3000.00, 330.00, NULL, NULL);

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

--
-- Struktur dari tabel `sales_returns`
--

CREATE TABLE `sales_returns` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sales_order_id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) UNSIGNED NOT NULL,
  `return_date` datetime NOT NULL,
  `subtotal` decimal(15,2) NOT NULL DEFAULT 0.00,
  `tax_amount` decimal(15,2) NOT NULL DEFAULT 0.00,
  `grand_total` decimal(15,2) NOT NULL,
  `reason` text NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `sales_return_details`
--

CREATE TABLE `sales_return_details` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `sales_return_id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `quantity_returned` decimal(15,2) NOT NULL,
  `amount` decimal(15,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- 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
('ExRoenublpRNdRd84mrQKlMzwNBuqF5fcWZX98Lq', 2, '103.147.8.9', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36', 'YTo0OntzOjY6Il90b2tlbiI7czo0MDoiZUltQ2R4dGd2NTA3QVZCTTQ0cDFBaWQ5bjBOelNLRm52VnRnOFFsNSI7czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6NDI6Imh0dHBzOi8vZGVtb3Bvc2l0Lm11a3VsaW5rLm15LmlkL2Rhc2hib2FyZCI7czo1OiJyb3V0ZSI7czo5OiJkYXNoYm9hcmQiO31zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToyO30=', 1763803368),
('RaORCenaOyQTZfUKjhmCjphgzOGR4pWqoAnalzO9', NULL, '74.7.227.170', 'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.3; +https://openai.com/gptbot)', 'YTozOntzOjY6Il90b2tlbiI7czo0MDoiS3I0NEpyTVZaUEVRVXdsaDQ4WUFNOThBMEZJVThaRTlOZWlJdUFUViI7czo5OiJfcHJldmlvdXMiO2E6Mjp7czozOiJ1cmwiO3M6MzY6Imh0dHBzOi8vd3d3LmRlbW9wb3NpdC5tdWt1bGluay5teS5pZCI7czo1OiJyb3V0ZSI7Tjt9czo2OiJfZmxhc2giO2E6Mjp7czozOiJvbGQiO2E6MDp7fXM6MzoibmV3IjthOjA6e319fQ==', 1763793023),
('UQ4Z37Si1MwXUedCl37nS3RtdA2aNWpd5Z9tYDdB', 2, '140.213.104.147', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36', 'YTo1OntzOjY6Il90b2tlbiI7czo0MDoiMjhRMzB5RWhCRURhU0N4TkpibWRMY0hZV1JYS1VPbUtaTlRFSnc4dyI7czozOiJ1cmwiO2E6MDp7fXM6OToiX3ByZXZpb3VzIjthOjI6e3M6MzoidXJsIjtzOjQ0OiJodHRwczovL2RlbW9wb3NpdC5tdWt1bGluay5teS5pZC9hZG1pbi91c2VycyI7czo1OiJyb3V0ZSI7czoxMToiYWRtaW4udXNlcnMiO31zOjY6Il9mbGFzaCI7YToyOntzOjM6Im9sZCI7YTowOnt9czozOiJuZXciO2E6MDp7fX1zOjUwOiJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI7aToyO30=', 1763776901);

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

--
-- Struktur dari tabel `stock_batches`
--

CREATE TABLE `stock_batches` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `batch_number` varchar(255) NOT NULL,
  `expired_date` date NOT NULL,
  `quantity` decimal(15,4) NOT NULL,
  `purchase_price` 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 `stock_batches`
--

INSERT INTO `stock_batches` (`id`, `product_variant_id`, `batch_number`, `expired_date`, `quantity`, `purchase_price`, `created_at`, `updated_at`) VALUES
(3, 1, 'dfgfdgf4', '2025-11-29', 990.0000, 200.00, '2025-11-21 14:07:42', '2025-11-21 14:08:30'),
(4, 8, 'fdvfdg2', '2025-11-29', 900.0000, 150.00, '2025-11-21 14:07:42', '2025-11-21 14:08:30'),
(5, 8, 'sdfdf', '2025-12-26', 1000.0000, 150.00, '2025-11-22 21:07:05', '2025-11-22 21:07:05'),
(6, 4, 'were', '2025-12-26', 1000.0000, 100.00, '2025-11-22 21:07:05', '2025-11-22 21:07:05'),
(7, 6, 'ddg', '2025-12-25', 1000.0000, 1500.00, '2025-11-22 21:07:05', '2025-11-22 21:07:05');

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

--
-- Struktur dari tabel `stock_mutations`
--

CREATE TABLE `stock_mutations` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `product_variant_id` bigint(20) UNSIGNED NOT NULL,
  `stock_batch_id` bigint(20) UNSIGNED NOT NULL,
  `quantity_change` decimal(15,4) NOT NULL,
  `current_quantity_batch` decimal(15,4) NOT NULL,
  `description` varchar(255) NOT NULL,
  `reference_type` varchar(255) NOT NULL,
  `reference_id` bigint(20) UNSIGNED NOT NULL,
  `created_by` 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_mutations`
--

INSERT INTO `stock_mutations` (`id`, `product_variant_id`, `stock_batch_id`, `quantity_change`, `current_quantity_batch`, `description`, `reference_type`, `reference_id`, `created_by`, `created_at`, `updated_at`) VALUES
(3, 1, 3, 1000.0000, 1000.0000, 'Penerimaan Barang (GR: dfggfg)', 'App\\Models\\GoodsReceiptDetail', 3, 2, '2025-11-21 14:07:42', NULL),
(4, 8, 4, 1000.0000, 1000.0000, 'Penerimaan Barang (GR: dfggfg)', 'App\\Models\\GoodsReceiptDetail', 4, 2, '2025-11-21 14:07:42', NULL),
(5, 8, 4, -100.0000, 900.0000, 'Penjualan (INV: INV-1763690910)', 'App\\Models\\SalesOrderDetail', 1, 2, '2025-11-21 14:08:30', NULL),
(6, 1, 3, -10.0000, 990.0000, 'Penjualan (INV: INV-1763690910)', 'App\\Models\\SalesOrderDetail', 2, 2, '2025-11-21 14:08:30', NULL),
(7, 8, 5, 1000.0000, 1000.0000, 'Penerimaan Barang (GR: sdfd)', 'App\\Models\\GoodsReceiptDetail', 5, 2, '2025-11-22 21:07:05', NULL),
(8, 4, 6, 1000.0000, 1000.0000, 'Penerimaan Barang (GR: sdfd)', 'App\\Models\\GoodsReceiptDetail', 6, 2, '2025-11-22 21:07:05', NULL),
(9, 6, 7, 1000.0000, 1000.0000, 'Penerimaan Barang (GR: sdfd)', 'App\\Models\\GoodsReceiptDetail', 7, 2, '2025-11-22 21:07:05', NULL);

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

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

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

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

INSERT INTO `suppliers` (`id`, `name`, `address`, `phone`, `email`, `contact_person`, `created_at`, `updated_at`, `deleted_at`) VALUES
(1, 'PT. Kimia Farma (PBF)', 'Jl. Pasteur No. 28, Bandung', '022-123456', 'kf@example.com', 'Budi Santoso', '2025-11-14 18:35:51', '2025-11-14 18:35:51', NULL),
(2, 'PT. Bio Farma (PBF)', 'Jl. Sudirman No. 1, Jakarta', '021-789012', 'biofarma@example.com', 'Siti Aminah', '2025-11-14 18:35:51', '2025-11-14 18:35:51', NULL);

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

--
-- Struktur dari tabel `units`
--

CREATE TABLE `units` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `short_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 `units`
--

INSERT INTO `units` (`id`, `name`, `short_name`, `created_at`, `updated_at`) VALUES
(1, 'Tablet', 'tab', NULL, NULL),
(2, 'Strip', 'strip', NULL, NULL),
(3, 'Box', 'box', NULL, NULL),
(4, 'Botol', 'btl', NULL, NULL),
(5, 'Kapsul', 'kaps', NULL, NULL),
(6, 'Tube', 'tube', NULL, NULL),
(7, 'Sachet', 'sct', NULL, NULL),
(8, 'Pcs', 'pcs', NULL, NULL);

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

--
-- Struktur dari tabel `vouchers`
--

CREATE TABLE `vouchers` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `code` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  `value` decimal(15,2) NOT NULL,
  `min_purchase` decimal(15,2) NOT NULL DEFAULT 0.00,
  `expires_at` datetime DEFAULT NULL,
  `used_at` datetime DEFAULT NULL,
  `customer_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;

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `accounts`
--
ALTER TABLE `accounts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `accounts_account_number_unique` (`account_number`);

--
-- Indeks untuk tabel `accounts_payables`
--
ALTER TABLE `accounts_payables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accounts_payables_supplier_id_foreign` (`supplier_id`),
  ADD KEY `accounts_payables_goods_receipt_id_foreign` (`goods_receipt_id`);

--
-- Indeks untuk tabel `accounts_receivables`
--
ALTER TABLE `accounts_receivables`
  ADD PRIMARY KEY (`id`),
  ADD KEY `accounts_receivables_customer_id_foreign` (`customer_id`),
  ADD KEY `accounts_receivables_sales_order_id_foreign` (`sales_order_id`);

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

--
-- Indeks untuk tabel `cash_transactions`
--
ALTER TABLE `cash_transactions`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cash_transactions_created_by_foreign` (`created_by`);

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

--
-- Indeks untuk tabel `customers`
--
ALTER TABLE `customers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `customers_phone_unique` (`phone`);

--
-- Indeks untuk tabel `customer_point_histories`
--
ALTER TABLE `customer_point_histories`
  ADD PRIMARY KEY (`id`),
  ADD KEY `customer_point_histories_customer_id_foreign` (`customer_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 `general_journals`
--
ALTER TABLE `general_journals`
  ADD PRIMARY KEY (`id`),
  ADD KEY `general_journals_user_id_foreign` (`user_id`),
  ADD KEY `general_journals_reference_type_reference_id_index` (`reference_type`,`reference_id`);

--
-- Indeks untuk tabel `general_journal_details`
--
ALTER TABLE `general_journal_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `general_journal_details_account_id_foreign` (`account_id`),
  ADD KEY `general_journal_details_general_journal_id_account_id_index` (`general_journal_id`,`account_id`);

--
-- Indeks untuk tabel `goods_receipts`
--
ALTER TABLE `goods_receipts`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `goods_receipts_receipt_number_unique` (`receipt_number`),
  ADD KEY `goods_receipts_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `goods_receipts_supplier_id_foreign` (`supplier_id`),
  ADD KEY `goods_receipts_created_by_foreign` (`created_by`);

--
-- Indeks untuk tabel `goods_receipt_details`
--
ALTER TABLE `goods_receipt_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `goods_receipt_details_goods_receipt_id_foreign` (`goods_receipt_id`),
  ADD KEY `goods_receipt_details_product_variant_id_foreign` (`product_variant_id`),
  ADD KEY `goods_receipt_details_unit_id_foreign` (`unit_id`);

--
-- 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 `operational_costs`
--
ALTER TABLE `operational_costs`
  ADD PRIMARY KEY (`id`),
  ADD KEY `operational_costs_created_by_foreign` (`created_by`);

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

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

--
-- Indeks untuk tabel `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD KEY `products_category_id_foreign` (`category_id`),
  ADD KEY `products_supplier_id_foreign` (`supplier_id`);

--
-- Indeks untuk tabel `product_units`
--
ALTER TABLE `product_units`
  ADD PRIMARY KEY (`id`),
  ADD KEY `product_units_product_variant_id_foreign` (`product_variant_id`),
  ADD KEY `product_units_unit_id_foreign` (`unit_id`);

--
-- Indeks untuk tabel `product_variants`
--
ALTER TABLE `product_variants`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `product_variants_sku_unique` (`sku`),
  ADD UNIQUE KEY `product_variants_barcode_unique` (`barcode`),
  ADD KEY `product_variants_product_id_foreign` (`product_id`),
  ADD KEY `product_variants_base_unit_id_foreign` (`base_unit_id`);

--
-- Indeks untuk tabel `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchase_orders_po_number_unique` (`po_number`),
  ADD KEY `purchase_orders_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchase_orders_created_by_foreign` (`created_by`);

--
-- Indeks untuk tabel `purchase_order_details`
--
ALTER TABLE `purchase_order_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_order_details_purchase_order_id_foreign` (`purchase_order_id`),
  ADD KEY `purchase_order_details_product_variant_id_foreign` (`product_variant_id`),
  ADD KEY `purchase_order_details_unit_id_foreign` (`unit_id`);

--
-- Indeks untuk tabel `purchase_returns`
--
ALTER TABLE `purchase_returns`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `purchase_returns_return_number_unique` (`return_number`),
  ADD KEY `purchase_returns_goods_receipt_id_foreign` (`goods_receipt_id`),
  ADD KEY `purchase_returns_supplier_id_foreign` (`supplier_id`),
  ADD KEY `purchase_returns_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `purchase_return_details`
--
ALTER TABLE `purchase_return_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `purchase_return_details_purchase_return_id_foreign` (`purchase_return_id`),
  ADD KEY `purchase_return_details_stock_batch_id_foreign` (`stock_batch_id`);

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

--
-- Indeks untuk tabel `sales_orders`
--
ALTER TABLE `sales_orders`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `sales_orders_order_number_unique` (`order_number`),
  ADD KEY `sales_orders_customer_id_foreign` (`customer_id`),
  ADD KEY `sales_orders_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `sales_order_details`
--
ALTER TABLE `sales_order_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_order_details_sales_order_id_foreign` (`sales_order_id`),
  ADD KEY `sales_order_details_product_variant_id_foreign` (`product_variant_id`),
  ADD KEY `sales_order_details_unit_id_foreign` (`unit_id`);

--
-- Indeks untuk tabel `sales_returns`
--
ALTER TABLE `sales_returns`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_returns_sales_order_id_foreign` (`sales_order_id`),
  ADD KEY `sales_returns_user_id_foreign` (`user_id`);

--
-- Indeks untuk tabel `sales_return_details`
--
ALTER TABLE `sales_return_details`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sales_return_details_sales_return_id_foreign` (`sales_return_id`),
  ADD KEY `sales_return_details_product_variant_id_foreign` (`product_variant_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_batches`
--
ALTER TABLE `stock_batches`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_batches_product_variant_id_expired_date_index` (`product_variant_id`,`expired_date`);

--
-- Indeks untuk tabel `stock_mutations`
--
ALTER TABLE `stock_mutations`
  ADD PRIMARY KEY (`id`),
  ADD KEY `stock_mutations_product_variant_id_foreign` (`product_variant_id`),
  ADD KEY `stock_mutations_stock_batch_id_foreign` (`stock_batch_id`),
  ADD KEY `stock_mutations_created_by_foreign` (`created_by`);

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

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

--
-- Indeks untuk tabel `vouchers`
--
ALTER TABLE `vouchers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `vouchers_code_unique` (`code`),
  ADD KEY `vouchers_customer_id_foreign` (`customer_id`);

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

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

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

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

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

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

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

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

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

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

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

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

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

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

--
-- 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=61;

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

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

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

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

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

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

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

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

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

--
-- 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_orders`
--
ALTER TABLE `sales_orders`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

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

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

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

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

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

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

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

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

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

--
-- Ketidakleluasaan untuk tabel `accounts_payables`
--
ALTER TABLE `accounts_payables`
  ADD CONSTRAINT `accounts_payables_goods_receipt_id_foreign` FOREIGN KEY (`goods_receipt_id`) REFERENCES `goods_receipts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `accounts_payables_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Ketidakleluasaan untuk tabel `accounts_receivables`
--
ALTER TABLE `accounts_receivables`
  ADD CONSTRAINT `accounts_receivables_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`),
  ADD CONSTRAINT `accounts_receivables_sales_order_id_foreign` FOREIGN KEY (`sales_order_id`) REFERENCES `sales_orders` (`id`) ON DELETE CASCADE;

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

--
-- Ketidakleluasaan untuk tabel `cash_transactions`
--
ALTER TABLE `cash_transactions`
  ADD CONSTRAINT `cash_transactions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`);

--
-- Ketidakleluasaan untuk tabel `categories`
--
ALTER TABLE `categories`
  ADD CONSTRAINT `categories_parent_id_foreign` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL;

--
-- Ketidakleluasaan untuk tabel `customer_point_histories`
--
ALTER TABLE `customer_point_histories`
  ADD CONSTRAINT `customer_point_histories_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `general_journals`
--
ALTER TABLE `general_journals`
  ADD CONSTRAINT `general_journals_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Ketidakleluasaan untuk tabel `general_journal_details`
--
ALTER TABLE `general_journal_details`
  ADD CONSTRAINT `general_journal_details_account_id_foreign` FOREIGN KEY (`account_id`) REFERENCES `accounts` (`id`),
  ADD CONSTRAINT `general_journal_details_general_journal_id_foreign` FOREIGN KEY (`general_journal_id`) REFERENCES `general_journals` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `goods_receipts`
--
ALTER TABLE `goods_receipts`
  ADD CONSTRAINT `goods_receipts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `goods_receipts_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`),
  ADD CONSTRAINT `goods_receipts_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Ketidakleluasaan untuk tabel `goods_receipt_details`
--
ALTER TABLE `goods_receipt_details`
  ADD CONSTRAINT `goods_receipt_details_goods_receipt_id_foreign` FOREIGN KEY (`goods_receipt_id`) REFERENCES `goods_receipts` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `goods_receipt_details_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`),
  ADD CONSTRAINT `goods_receipt_details_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`);

--
-- Ketidakleluasaan untuk tabel `operational_costs`
--
ALTER TABLE `operational_costs`
  ADD CONSTRAINT `operational_costs_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`);

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

--
-- Ketidakleluasaan untuk tabel `products`
--
ALTER TABLE `products`
  ADD CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `products_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`) ON DELETE SET NULL;

--
-- Ketidakleluasaan untuk tabel `product_units`
--
ALTER TABLE `product_units`
  ADD CONSTRAINT `product_units_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `product_units_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`);

--
-- Ketidakleluasaan untuk tabel `product_variants`
--
ALTER TABLE `product_variants`
  ADD CONSTRAINT `product_variants_base_unit_id_foreign` FOREIGN KEY (`base_unit_id`) REFERENCES `units` (`id`),
  ADD CONSTRAINT `product_variants_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `purchase_orders`
--
ALTER TABLE `purchase_orders`
  ADD CONSTRAINT `purchase_orders_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `purchase_orders_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`);

--
-- Ketidakleluasaan untuk tabel `purchase_order_details`
--
ALTER TABLE `purchase_order_details`
  ADD CONSTRAINT `purchase_order_details_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`),
  ADD CONSTRAINT `purchase_order_details_purchase_order_id_foreign` FOREIGN KEY (`purchase_order_id`) REFERENCES `purchase_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_order_details_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`);

--
-- Ketidakleluasaan untuk tabel `purchase_returns`
--
ALTER TABLE `purchase_returns`
  ADD CONSTRAINT `purchase_returns_goods_receipt_id_foreign` FOREIGN KEY (`goods_receipt_id`) REFERENCES `goods_receipts` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `purchase_returns_supplier_id_foreign` FOREIGN KEY (`supplier_id`) REFERENCES `suppliers` (`id`),
  ADD CONSTRAINT `purchase_returns_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Ketidakleluasaan untuk tabel `purchase_return_details`
--
ALTER TABLE `purchase_return_details`
  ADD CONSTRAINT `purchase_return_details_purchase_return_id_foreign` FOREIGN KEY (`purchase_return_id`) REFERENCES `purchase_returns` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `purchase_return_details_stock_batch_id_foreign` FOREIGN KEY (`stock_batch_id`) REFERENCES `stock_batches` (`id`);

--
-- Ketidakleluasaan untuk tabel `sales_orders`
--
ALTER TABLE `sales_orders`
  ADD CONSTRAINT `sales_orders_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`) ON DELETE SET NULL,
  ADD CONSTRAINT `sales_orders_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Ketidakleluasaan untuk tabel `sales_order_details`
--
ALTER TABLE `sales_order_details`
  ADD CONSTRAINT `sales_order_details_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`),
  ADD CONSTRAINT `sales_order_details_sales_order_id_foreign` FOREIGN KEY (`sales_order_id`) REFERENCES `sales_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sales_order_details_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`);

--
-- Ketidakleluasaan untuk tabel `sales_returns`
--
ALTER TABLE `sales_returns`
  ADD CONSTRAINT `sales_returns_sales_order_id_foreign` FOREIGN KEY (`sales_order_id`) REFERENCES `sales_orders` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `sales_returns_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`);

--
-- Ketidakleluasaan untuk tabel `sales_return_details`
--
ALTER TABLE `sales_return_details`
  ADD CONSTRAINT `sales_return_details_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`),
  ADD CONSTRAINT `sales_return_details_sales_return_id_foreign` FOREIGN KEY (`sales_return_id`) REFERENCES `sales_returns` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stock_batches`
--
ALTER TABLE `stock_batches`
  ADD CONSTRAINT `stock_batches_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`) ON DELETE CASCADE;

--
-- Ketidakleluasaan untuk tabel `stock_mutations`
--
ALTER TABLE `stock_mutations`
  ADD CONSTRAINT `stock_mutations_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
  ADD CONSTRAINT `stock_mutations_product_variant_id_foreign` FOREIGN KEY (`product_variant_id`) REFERENCES `product_variants` (`id`),
  ADD CONSTRAINT `stock_mutations_stock_batch_id_foreign` FOREIGN KEY (`stock_batch_id`) REFERENCES `stock_batches` (`id`);

--
-- Ketidakleluasaan untuk tabel `vouchers`
--
ALTER TABLE `vouchers`
  ADD CONSTRAINT `vouchers_customer_id_foreign` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`id`);
COMMIT;

