-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 05 Jul 2022 pada 09.03
-- Versi server: 10.4.24-MariaDB
-- Versi PHP: 8.1.6

START TRANSACTION;



--
-- Database: `edwin-erp-db`
--

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

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

CREATE TABLE `brands` (
  `id` varchar(8) NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

INSERT INTO `brands` (`id`, `name`, `description`) VALUES
('MER-0001', 'N1', 'd1'),
('MER-0002', 'N2', 'd2');

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

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

CREATE TABLE `categories` (
  `id` varchar(10) NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

INSERT INTO `categories` (`id`, `name`, `description`) VALUES
('CAT-0001', 'n1', 'd1'),
('CAT-0002', 'n2', 'd2'),
('CAT-0003', 'n3', 'd3'),
('CAT-0004', 'n4', 'd4');

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

--
-- Struktur dari tabel `crud_logs`
--

CREATE TABLE `crud_logs` (
  `id` varchar(20) NOT NULL,
  `date_time` datetime NOT NULL,
  `user_id` varchar(10) NOT NULL,
  `table_name` varchar(50) NOT NULL,
  `operation` varchar(20) NOT NULL,
  `primary_key` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

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

CREATE TABLE `customers` (
  `id` varchar(9) NOT NULL,
  `name` varchar(50) NOT NULL,
  `business_entity` varchar(20) NOT NULL,
  `phone_number` int(20) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `npwp` int(20) DEFAULT NULL,
  `term` int(10) DEFAULT NULL,
  `discount` double DEFAULT NULL,
  `status` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

INSERT INTO `customers` (`id`, `name`, `business_entity`, `phone_number`, `email`, `npwp`, `term`, `discount`, `status`) VALUES
('CUS-00001', 'N11', 'CV', 11, 'e11', 11, 11, 40, 'active'),
('CUS-00002', 'N1', 'PT', 2, 'e1', 1, 1, 50, 'b'),
('CUS-00003', 'N1', 'PT', 2, 'e1', 1, 1, 50, 'active'),
('CUS-00004', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00005', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00006', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00007', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00008', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00009', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00010', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active'),
('CUS-00011', 'N1', 'PT', NULL, 'e1', 1, 1, 50, 'active');

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

--
-- Struktur dari tabel `customer_addresses`
--

CREATE TABLE `customer_addresses` (
  `customer_id` varchar(9) NOT NULL,
  `id` int(5) NOT NULL,
  `address` varchar(250) NOT NULL,
  `city` varchar(100) DEFAULT NULL,
  `sub_district` varchar(100) DEFAULT NULL,
  `urban_village` varchar(100) DEFAULT NULL,
  `postal_code` int(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `customer_addresses`
--

INSERT INTO `customer_addresses` (`customer_id`, `id`, `address`, `city`, `sub_district`, `urban_village`, `postal_code`) VALUES
('CUS-00004', 1, 'a1', 'k1', 'kk1', 'kkk1', 1),
('CUS-00004', 2, 'a11', 'k11', 'kk11', 'kkk11', 11),
('CUS-00004', 3, 'a1', 'k1', 'kk1', 'kkk1', 1),
('CUS-00004', 4, 'a12', 'k12', 'kk12', 'kkk12', 12),
('CUS-00005', 1, 'a1', 'k1', 'kk1', 'kkk1', 1),
('CUS-00005', 2, 'a11', 'k11', 'kk11', 'kkk11', 11),
('CUS-00010', 1, 'a1', 'k1', 'kk1', 'kkk1', 1),
('CUS-00011', 1, 'a1', 'k1', 'kk1', 'kkk1', 1),
('CUS-00011', 2, 'a11', 'k11', 'kk11', 'kkk11', 11);

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

--
-- Struktur dari tabel `delivery_notes`
--

CREATE TABLE `delivery_notes` (
  `id` varchar(14) NOT NULL,
  `date` date NOT NULL,
  `customer_id` varchar(9) NOT NULL,
  `customer_address` varchar(250) NOT NULL,
  `recipient` varchar(9) NOT NULL,
  `recipient_address` varchar(250) NOT NULL,
  `vehicle` varchar(20) DEFAULT NULL,
  `sender` varchar(50) DEFAULT NULL,
  `notes` varchar(100) DEFAULT NULL,
  `status` varchar(10) NOT NULL,
  `is_delivered` int(1) NOT NULL,
  `sales_invoice_id` varchar(14) DEFAULT NULL,
  `drafted_by` varchar(10) NOT NULL,
  `last_edited_by` varchar(10) NOT NULL,
  `last_edited_at` datetime NOT NULL,
  `submitted_by` varchar(10) DEFAULT NULL,
  `submitted_at` datetime DEFAULT NULL,
  `delivered_by` varchar(10) DEFAULT NULL,
  `delivered_at` datetime DEFAULT NULL,
  `done_by` varchar(10) DEFAULT NULL,
  `done_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `delivery_notes`
--

INSERT INTO `delivery_notes` (`id`, `date`, `customer_id`, `customer_address`, `recipient`, `recipient_address`, `vehicle`, `sender`, `notes`, `status`, `is_delivered`, `sales_invoice_id`, `drafted_by`, `last_edited_by`, `last_edited_at`, `submitted_by`, `submitted_at`, `delivered_by`, `delivered_at`, `done_by`, `done_at`) VALUES
('BM220704-SJ001', '2022-07-04', 'CUS-00001', '1', 'CUS-00001', 'a_pelanggan_baru', 'Skuter', 'Megawatiiii', 'cc', 'Submitted', 1, 'BM/2207/00001', 'EMP-00001', 'EMP-00001', '2022-07-04 16:32:52', 'EMP-00001', '2022-07-04 16:32:52', 'EMP-00001', '2022-07-04 15:32:47', NULL, NULL),
('BM220704-SJ002', '2022-07-04', 'CUS-00001', 'a_pelanggan', 'CUS-00001', 'a_pelanggan', 'Truk', 'Soekarno', 'c1', 'Submitted', 1, 'BM/2207/00001', 'EMP-00001', 'EMP-00001', '2022-07-04 15:29:30', 'EMP-00001', '2022-07-04 15:29:30', 'EMP-00001', '2022-07-04 16:50:56', NULL, NULL);

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

--
-- Struktur dari tabel `delivery_note_details`
--

CREATE TABLE `delivery_note_details` (
  `delivery_note_id` varchar(14) NOT NULL,
  `tally_sheet_id` varchar(14) NOT NULL,
  `sales_order_id` varchar(14) NOT NULL,
  `product_id` varchar(10) NOT NULL,
  `product_alias_name` varchar(100) NOT NULL,
  `product_name` varchar(100) NOT NULL,
  `quantity` double NOT NULL,
  `unit` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `delivery_note_details`
--

INSERT INTO `delivery_note_details` (`delivery_note_id`, `tally_sheet_id`, `sales_order_id`, `product_id`, `product_alias_name`, `product_name`, `quantity`, `unit`) VALUES
('BM220704-SJ001', 'BM220629-TO001', 'BM220629-SO001', 'STO-000001', 'AN', 'N1', 1, 'kg'),
('BM220704-SJ001', 'BM220629-TO001', 'BM220629-SO001', 'STO-000002', 'AN2', 'N2', 1.5, 'kg'),
('BM220704-SJ002', 'BM220629-TO002', 'BM220629-SO001', 'STO-000001', 'AN', 'N1', 1, 'kg'),
('BM220704-SJ002', 'BM220629-TO002', 'BM220629-SO001', 'STO-000002', 'AN2', 'N2', 1.5, 'kg');

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

--
-- Struktur dari tabel `departments`
--

CREATE TABLE `departments` (
  `id` varchar(10) NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `departments`
--

INSERT INTO `departments` (`id`, `name`, `description`) VALUES
('D-00001', 'DD1d', 'dd1d'),
('D-00003', 'D3', 'd3'),
('D-00004', 'A3', 'a3'),
('D-00005', 'D1', 'd1'),
('D-00006', 'D1', 'd1'),
('D-00007', 'D1', 'd1'),
('D-00008', 'D1', 'd1'),
('D-00009', 'D1', 'd1'),
('D-00010', 'D1', 'd1'),
('D-00011', 'D1', 'd1'),
('D-00012', 'D1111', 'd1111');

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

--
-- Struktur dari tabel `employees`
--

CREATE TABLE `employees` (
  `id` varchar(9) NOT NULL,
  `nip` varchar(20) DEFAULT NULL,
  `name` varchar(50) NOT NULL,
  `initial` varchar(5) DEFAULT NULL,
  `department_id` varchar(10) DEFAULT NULL,
  `position_id` varchar(10) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `phone_number` int(20) DEFAULT NULL,
  `nik` int(20) DEFAULT NULL,
  `npwp` int(20) DEFAULT NULL,
  `date_of_birth` date DEFAULT NULL,
  `start_date` date DEFAULT NULL,
  `address` varchar(250) DEFAULT NULL,
  `city` varchar(100) DEFAULT NULL,
  `sub_district` varchar(100) DEFAULT NULL,
  `urban_village` varchar(100) DEFAULT NULL,
  `postal_code` int(10) DEFAULT NULL,
  `status` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `employees`
--

INSERT INTO `employees` (`id`, `nip`, `name`, `initial`, `department_id`, `position_id`, `email`, `phone_number`, `nik`, `npwp`, `date_of_birth`, `start_date`, `address`, `city`, `sub_district`, `urban_village`, `postal_code`, `status`) VALUES
('EMP-00001', '11', 'EMP1', 'e11', 'D-00012', 'P-00003', 'e11', 11, 11, 11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active'),
('EMP-00002', '1', 'EMP2', 'e1', 'D-00012', 'P-00003', 'e1', NULL, 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active'),
('EMP-00003', '12', 'E12', 'e12', NULL, NULL, 'e12', 12, 12, 12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active'),
('EMP-00004', '12', 'E12', 'e12', NULL, NULL, 'e12', 12, 12, 12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active'),
('EMP-00005', '12', 'E12', 'e12', NULL, NULL, 'e12', 12, 12, 12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'active'),
('EMP-00006', '12', 'E12', 'e12', NULL, NULL, 'e12', 12, 12, 12, NULL, NULL, 'a1', 'k1', 'kc1', 'kl1', 1, 'active');

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

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

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

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

--
-- Struktur dari tabel `grades`
--

CREATE TABLE `grades` (
  `id` varchar(10) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `grades`
--

INSERT INTO `grades` (`id`, `name`, `description`) VALUES
('G-00001', 'N11', 'dd1'),
('G-00002', 'NEWW', 'NEWW D');

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

--
-- Struktur dari tabel `groups`
--

CREATE TABLE `groups` (
  `id` varchar(10) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `groups`
--

INSERT INTO `groups` (`id`, `name`, `description`) VALUES
('G-00001', 'admin', 'admin_desc'),
('G-00002', 'Human Resources', NULL),
('G-00003', 'N11', 'D11'),
('G-00004', 'Human Resources', NULL),
('G-00005', 'Human Resources', NULL),
('G-00006', 'Human Resources', NULL),
('G-00007', 'Human Resources', NULL),
('G-00008', 'Human Resources', NULL),
('G-00009', 'Human Resources', NULL),
('G-00010', 'Human Resources', NULL),
('G-00011', 'Human Resources', NULL),
('G-00012', 'Human Resources', NULL);

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

--
-- Struktur dari tabel `group_access_rights`
--

CREATE TABLE `group_access_rights` (
  `group_id` varchar(10) NOT NULL,
  `module_id` varchar(10) NOT NULL,
  `menu_id` int(5) NOT NULL,
  `access_right_id` int(5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `group_access_rights`
--

INSERT INTO `group_access_rights` (`group_id`, `module_id`, `menu_id`, `access_right_id`) VALUES
('G-00001', 'MOD-004', 15, 1),
('G-00001', 'MOD-004', 15, 2),
('G-00001', 'MOD-004', 15, 3),
('G-00001', 'MOD-004', 15, 4),
('G-00001', 'MOD-004', 16, 1),
('G-00001', 'MOD-004', 16, 2),
('G-00001', 'MOD-004', 16, 3),
('G-00001', 'MOD-004', 16, 4),
('G-00002', 'MOD-004', 1, 1),
('G-00002', 'MOD-004', 1, 2),
('G-00002', 'MOD-004', 1, 3),
('G-00002', 'MOD-004', 1, 4),
('G-00002', 'MOD-004', 2, 1),
('G-00002', 'MOD-004', 2, 2),
('G-00002', 'MOD-004', 2, 3),
('G-00002', 'MOD-004', 2, 4),
('G-00002', 'MOD-004', 2, 5),
('G-00002', 'MOD-004', 2, 6),
('G-00002', 'MOD-004', 2, 7),
('G-00002', 'MOD-004', 2, 8),
('G-00002', 'MOD-004', 2, 9),
('G-00002', 'MOD-004', 2, 10),
('G-00002', 'MOD-004', 3, 1),
('G-00002', 'MOD-004', 3, 2),
('G-00002', 'MOD-004', 3, 3),
('G-00002', 'MOD-004', 3, 4),
('G-00002', 'MOD-004', 4, 1),
('G-00002', 'MOD-004', 4, 2),
('G-00002', 'MOD-004', 4, 3),
('G-00002', 'MOD-004', 4, 4),
('G-00002', 'MOD-004', 5, 1),
('G-00002', 'MOD-004', 5, 2),
('G-00002', 'MOD-004', 5, 3),
('G-00002', 'MOD-004', 5, 4),
('G-00002', 'MOD-004', 6, 1),
('G-00002', 'MOD-004', 6, 2),
('G-00002', 'MOD-004', 6, 3),
('G-00002', 'MOD-004', 6, 4),
('G-00002', 'MOD-004', 7, 1),
('G-00002', 'MOD-004', 7, 2),
('G-00002', 'MOD-004', 7, 3),
('G-00002', 'MOD-004', 7, 4),
('G-00002', 'MOD-004', 8, 1),
('G-00002', 'MOD-004', 8, 2),
('G-00002', 'MOD-004', 8, 3),
('G-00002', 'MOD-004', 8, 4),
('G-00002', 'MOD-004', 9, 1),
('G-00002', 'MOD-004', 9, 2),
('G-00002', 'MOD-004', 9, 3),
('G-00002', 'MOD-004', 9, 4),
('G-00002', 'MOD-004', 10, 1),
('G-00002', 'MOD-004', 10, 2),
('G-00002', 'MOD-004', 10, 3),
('G-00002', 'MOD-004', 10, 4),
('G-00002', 'MOD-004', 11, 1),
('G-00002', 'MOD-004', 11, 2),
('G-00002', 'MOD-004', 11, 3),
('G-00002', 'MOD-004', 11, 4),
('G-00002', 'MOD-004', 12, 1),
('G-00002', 'MOD-004', 12, 2),
('G-00002', 'MOD-004', 12, 3),
('G-00002', 'MOD-004', 12, 4),
('G-00002', 'MOD-004', 13, 1),
('G-00002', 'MOD-004', 13, 2),
('G-00002', 'MOD-004', 13, 3),
('G-00002', 'MOD-004', 13, 4),
('G-00002', 'MOD-004', 14, 1),
('G-00002', 'MOD-004', 14, 2),
('G-00002', 'MOD-004', 14, 3),
('G-00002', 'MOD-004', 14, 4),
('G-00002', 'MOD-004', 15, 1),
('G-00002', 'MOD-004', 15, 2),
('G-00002', 'MOD-004', 15, 3),
('G-00002', 'MOD-004', 15, 4),
('G-00002', 'MOD-004', 16, 1),
('G-00002', 'MOD-004', 16, 2),
('G-00002', 'MOD-004', 16, 3),
('G-00002', 'MOD-004', 16, 4),
('G-00002', 'MOD-004', 17, 1),
('G-00002', 'MOD-004', 17, 2),
('G-00002', 'MOD-004', 17, 3),
('G-00002', 'MOD-004', 17, 4),
('G-00002', 'MOD-004', 18, 1),
('G-00002', 'MOD-004', 18, 2),
('G-00002', 'MOD-004', 18, 3),
('G-00002', 'MOD-004', 18, 4),
('G-00002', 'MOD-004', 18, 5),
('G-00002', 'MOD-004', 18, 6),
('G-00002', 'MOD-004', 19, 1),
('G-00002', 'MOD-004', 19, 2),
('G-00002', 'MOD-004', 19, 3),
('G-00002', 'MOD-004', 19, 4),
('G-00002', 'MOD-004', 20, 1),
('G-00002', 'MOD-004', 20, 2),
('G-00002', 'MOD-004', 20, 3),
('G-00002', 'MOD-004', 20, 4),
('G-00011', 'MOD-004', 16, 1),
('G-00011', 'MOD-004', 16, 2),
('G-00012', 'MOD-004', 16, 1),
('G-00012', 'MOD-004', 16, 2);

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

--
-- Struktur dari tabel `group_users`
--

CREATE TABLE `group_users` (
  `group_id` varchar(10) NOT NULL,
  `user_id` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `group_users`
--

INSERT INTO `group_users` (`group_id`, `user_id`) VALUES
('G-00001', 'USER-00001'),
('G-00002', 'USER-00001'),
('G-00010', 'USER-00001'),
('G-00011', 'USER-00001'),
('G-00012', 'USER-00001'),
('G-00001', 'USER-00002'),
('G-00002', 'USER-00002'),
('G-00010', 'USER-00002'),
('G-00011', 'USER-00002'),
('G-00012', 'USER-00002'),
('G-00004', 'USER-00004'),
('G-00005', 'USER-00004'),
('G-00004', 'USER-00005'),
('G-00005', 'USER-00005'),
('G-00004', 'USER-00011'),
('G-00005', 'USER-00011');

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

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

CREATE TABLE `migrations` (
  `id` int(10) UNSIGNED NOT NULL,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci 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, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2016_06_01_000001_create_oauth_auth_codes_table', 1),
(4, '2016_06_01_000002_create_oauth_access_tokens_table', 1),
(5, '2016_06_01_000003_create_oauth_refresh_tokens_table', 1),
(6, '2016_06_01_000004_create_oauth_clients_table', 1),
(7, '2016_06_01_000005_create_oauth_personal_access_clients_table', 1),
(8, '2019_08_19_000000_create_failed_jobs_table', 1),
(9, '2019_12_14_000001_create_personal_access_tokens_table', 1);

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

--
-- Struktur dari tabel `modules`
--

CREATE TABLE `modules` (
  `id` varchar(10) NOT NULL,
  `name` varchar(50) NOT NULL,
  `number` int(5) DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `modules`
--

INSERT INTO `modules` (`id`, `name`, `number`, `description`) VALUES
('MOD-001', 'misc', 99, NULL),
('MOD-002', 'Sales', 1, NULL),
('MOD-003', 'inventory', 2, NULL),
('MOD-004', 'All', 0, NULL);

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

--
-- Struktur dari tabel `module_menus`
--

CREATE TABLE `module_menus` (
  `module_id` varchar(10) NOT NULL,
  `id` int(5) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `module_menus`
--

INSERT INTO `module_menus` (`module_id`, `id`, `name`, `description`) VALUES
('MOD-001', 1, 'test', 't'),
('MOD-002', 1, 'Customer', NULL),
('MOD-004', 1, 'User', NULL),
('MOD-004', 2, 'Group', NULL),
('MOD-004', 3, 'Department', NULL),
('MOD-004', 4, 'Position', NULL),
('MOD-004', 5, 'Employee', NULL),
('MOD-004', 6, 'Customer', NULL),
('MOD-004', 7, 'Warehouse', NULL),
('MOD-004', 8, 'Grade', NULL),
('MOD-004', 9, 'Type', NULL),
('MOD-004', 10, 'Piece', NULL),
('MOD-004', 11, 'Category', NULL),
('MOD-004', 12, 'Brand', NULL),
('MOD-004', 13, 'Product', NULL),
('MOD-004', 14, 'Tax', NULL),
('MOD-004', 15, 'Sales Order', NULL),
('MOD-004', 16, 'Tally Sheet', NULL),
('MOD-004', 17, 'Surat Jalan', NULL),
('MOD-004', 18, 'Faktur Penjualan', NULL),
('MOD-004', 19, 'Pelunasan Faktur', NULL),
('MOD-004', 20, 'Retur Penjualan', NULL);

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

--
-- Struktur dari tabel `module_menu_access_rights`
--

CREATE TABLE `module_menu_access_rights` (
  `module_id` varchar(10) NOT NULL,
  `module_menu_id` int(5) NOT NULL,
  `id` int(5) NOT NULL,
  `name` varchar(100) NOT NULL,
  `ability_name` varchar(100) DEFAULT NULL,
  `ability_name_parent` varchar(100) DEFAULT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `module_menu_access_rights`
--

INSERT INTO `module_menu_access_rights` (`module_id`, `module_menu_id`, `id`, `name`, `ability_name`, `ability_name_parent`, `description`) VALUES
('MOD-002', 1, 1, 'Create Customer', 'create-customer', NULL, NULL),
('MOD-002', 1, 2, 'Read Customer', 'read-customer', NULL, NULL),
('MOD-002', 1, 3, 'Update Customer', 'update-customer', NULL, NULL),
('MOD-002', 1, 4, 'Delete Customer', 'delete-customer', NULL, NULL),
('MOD-004', 1, 1, 'create', 'create-user', NULL, NULL),
('MOD-004', 1, 2, 'Read', 'read-user', NULL, NULL),
('MOD-004', 1, 3, 'Update', 'update-user', NULL, NULL),
('MOD-004', 1, 4, 'Delete', 'delete-user', NULL, NULL),
('MOD-004', 2, 1, 'Create', 'create-group', NULL, NULL),
('MOD-004', 2, 2, 'Read', 'read-group', NULL, NULL),
('MOD-004', 2, 3, 'Update', 'update-group', NULL, NULL),
('MOD-004', 2, 4, 'Delete', 'delete-group', NULL, NULL),
('MOD-004', 2, 5, 'Create Group User', 'create-group_user', NULL, NULL),
('MOD-004', 2, 6, 'Read Group User', 'read-group_user', NULL, NULL),
('MOD-004', 2, 7, 'Delete Group User', 'delete-group_user', NULL, NULL),
('MOD-004', 2, 8, 'Create Group Access Right', 'create-group_access_right', NULL, NULL),
('MOD-004', 2, 9, 'Read Group Access Right', 'read-group_access_right', NULL, NULL),
('MOD-004', 2, 10, 'Delete Group Access Right', 'delete-group_access_right', NULL, NULL),
('MOD-004', 3, 1, 'Create Department', 'create-department', NULL, NULL),
('MOD-004', 3, 2, 'Read Department', 'read-department', NULL, NULL),
('MOD-004', 3, 3, 'Update Department', 'update-department', NULL, NULL),
('MOD-004', 3, 4, 'Delete Department', 'delete-department', NULL, NULL),
('MOD-004', 4, 1, 'Create Position', 'create-position', NULL, NULL),
('MOD-004', 4, 2, 'Read Position', 'read-position', NULL, NULL),
('MOD-004', 4, 3, 'Update Position', 'update-position', NULL, NULL),
('MOD-004', 4, 4, 'Delete Position', 'delete-position', NULL, NULL),
('MOD-004', 5, 1, 'Create Employee', 'create-employee', NULL, NULL),
('MOD-004', 5, 2, 'Read Employee', 'read-employee', NULL, NULL),
('MOD-004', 5, 3, 'Update Employee', 'update-employee', NULL, NULL),
('MOD-004', 5, 4, 'Delete Employee', 'delete-employee', NULL, NULL),
('MOD-004', 6, 1, 'Create Customer', 'create-customer', NULL, NULL),
('MOD-004', 6, 2, 'Read Customer', 'read-customer', NULL, NULL),
('MOD-004', 6, 3, 'Update Customer', 'update-customer', NULL, NULL),
('MOD-004', 6, 4, 'Delete Customer', 'delete-customer', NULL, NULL),
('MOD-004', 7, 1, 'Create Warehouse', 'create-warehouse', NULL, NULL),
('MOD-004', 7, 2, 'Read Warehouse', 'read-warehouse', NULL, NULL),
('MOD-004', 7, 3, 'Update Warehouse', 'update-warehouse', NULL, NULL),
('MOD-004', 7, 4, 'Delete Warehouse', 'delete-warehouse', NULL, NULL),
('MOD-004', 8, 1, 'Create Grade', 'create-grade', NULL, NULL),
('MOD-004', 8, 2, 'Read Grade', 'read-grade', NULL, NULL),
('MOD-004', 8, 3, 'Update Grade', 'update-grade', NULL, NULL),
('MOD-004', 8, 4, 'Delete Grade', 'delete-grade', NULL, NULL),
('MOD-004', 9, 1, 'Create Type', 'create-type', NULL, NULL),
('MOD-004', 9, 2, 'Read Type', 'read-type', NULL, NULL),
('MOD-004', 9, 3, 'Update Type', 'update-type', NULL, NULL),
('MOD-004', 9, 4, 'Delete Type', 'delete-type', NULL, NULL),
('MOD-004', 10, 1, 'Create Piece', 'create-piece', NULL, NULL),
('MOD-004', 10, 2, 'Read Piece', 'read-piece', NULL, NULL),
('MOD-004', 10, 3, 'Update Piece', 'update-piece', NULL, NULL),
('MOD-004', 10, 4, 'Delete Piece', 'delete-piece', NULL, NULL),
('MOD-004', 11, 1, 'Create Category', 'create-category', NULL, NULL),
('MOD-004', 11, 2, 'Read Category', 'read-category', NULL, NULL),
('MOD-004', 11, 3, 'Update Category', 'update-category', NULL, NULL),
('MOD-004', 11, 4, 'Delete Category', 'delete-category', NULL, NULL),
('MOD-004', 12, 1, 'Create Brand', 'create-brand', NULL, NULL),
('MOD-004', 12, 2, 'Read Brand', 'read-brand', NULL, NULL),
('MOD-004', 12, 3, 'Update Brand', 'update-brand', NULL, NULL),
('MOD-004', 12, 4, 'Delete Brand', 'delete-brand', NULL, NULL),
('MOD-004', 13, 1, 'Create Product', 'create-product', NULL, NULL),
('MOD-004', 13, 2, 'Read Product', 'read-product', NULL, NULL),
('MOD-004', 13, 3, 'Update Product', 'update-product', NULL, NULL),
('MOD-004', 13, 4, 'Delete Product', 'delete-product', NULL, NULL),
('MOD-004', 14, 1, 'Create Tax', 'create-tax', NULL, NULL),
('MOD-004', 14, 2, 'Read Tax', 'read-tax', NULL, NULL),
('MOD-004', 14, 3, 'Update Tax', 'update-tax', NULL, NULL),
('MOD-004', 14, 4, 'Delete Tax', 'delete-tax', NULL, NULL),
('MOD-004', 15, 1, 'Buat Pesanan Penjualan', 'create-sales_order', NULL, NULL),
('MOD-004', 15, 2, 'Baca Pesanan Penjualan', 'read-sales_order', NULL, NULL),
('MOD-004', 15, 3, 'Ubah Pesanan Penjualan', 'update-sales_order', NULL, NULL),
('MOD-004', 15, 4, 'Hapus Pesanan Penjualan', 'delete-sales_order', NULL, NULL),
('MOD-004', 16, 1, 'Buat Tally Sheet', 'create-tally_sheet', NULL, NULL),
('MOD-004', 16, 2, 'Baca Tally Sheet', 'read-tally_sheet', NULL, NULL),
('MOD-004', 16, 3, 'Ubah Tally Sheet', 'update-tally_sheet', NULL, NULL),
('MOD-004', 16, 4, 'Hapus Tally Sheet', 'delete-tally_sheet', NULL, NULL),
('MOD-004', 17, 1, 'Buat Surat Jalan', 'create-delivery_note', NULL, NULL),
('MOD-004', 17, 2, 'Baca Surat Jalan', 'read-delivery_note', NULL, NULL),
('MOD-004', 17, 3, 'Ubah Surat Jalan', 'update-delivery_note', NULL, NULL),
('MOD-004', 17, 4, 'Hapus Surat Jalan', 'delete-delivery_note', NULL, NULL),
('MOD-004', 18, 1, 'Buat Faktur Penjualan', 'create-sales_invoice', NULL, NULL),
('MOD-004', 18, 2, 'Baca Faktur Penjualan', 'read-sales_invoice', NULL, NULL),
('MOD-004', 18, 3, 'Ubah Faktur Penjualan', 'update-sales_invoice', NULL, NULL),
('MOD-004', 18, 4, 'Hapus Faktur Penjualan', 'delete-sales_invoice', NULL, NULL),
('MOD-004', 18, 5, 'Ubah Status Faktur Penjualan dari Submitted ke Draft', 'submitted_to_draft-sales_invoice', NULL, NULL),
('MOD-004', 18, 6, 'Void Faktur Penjualan', 'void-sales_invoice', NULL, NULL),
('MOD-004', 19, 1, 'Buat Pelunasan Faktur', 'create-invoice_payment', NULL, NULL),
('MOD-004', 19, 2, 'Baca Pelunasan Faktur', 'read-invoice_payment', NULL, NULL),
('MOD-004', 19, 3, 'Ubah Pelunasan Faktur', 'update-invoice_payment', NULL, NULL),
('MOD-004', 19, 4, 'Hapus Pelunasan Faktur', 'delete-invoice_payment', NULL, NULL),
('MOD-004', 20, 1, 'Buat Retur Penjualan', 'create-sales_return', NULL, NULL),
('MOD-004', 20, 2, 'Baca Retur Penjualan', 'read-sales_return', NULL, NULL),
('MOD-004', 20, 3, 'Ubah Retur Penjualan', 'update-sales_return', NULL, NULL),
('MOD-004', 20, 4, 'Hapus Retur Penjualan', 'delete-sales_return', NULL, NULL);

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

--
-- Struktur dari tabel `oauth_auth_codes`
--

CREATE TABLE `oauth_auth_codes` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_id` bigint(20) UNSIGNED NOT NULL,
  `scopes` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `revoked` tinyint(1) NOT NULL,
  `expires_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

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

--
-- Struktur dari tabel `oauth_personal_access_clients`
--

CREATE TABLE `oauth_personal_access_clients` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `client_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 `oauth_personal_access_clients`
--

INSERT INTO `oauth_personal_access_clients` (`id`, `client_id`, `created_at`, `updated_at`) VALUES
(1, 1, '2022-05-22 18:55:52', '2022-05-22 18:55:52');

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

--
-- Struktur dari tabel `pieces`
--

CREATE TABLE `pieces` (
  `id` varchar(10) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `pieces`
--

INSERT INTO `pieces` (`id`, `name`, `description`) VALUES
('BAG-0001', 'NN1', 'DD1'),
('BAG-0002', 'New', 'D New');

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

--
-- Struktur dari tabel `positions`
--

CREATE TABLE `positions` (
  `id` varchar(10) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `positions`
--

INSERT INTO `positions` (`id`, `name`, `description`) VALUES
('P-00001', 'New', 'New D'),
('P-00002', 'New 2', 'New D2'),
('P-00003', 'New 3', 'New D3');

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

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

CREATE TABLE `products` (
  `id` varchar(10) NOT NULL,
  `name` varchar(100) NOT NULL,
  `alias_name` varchar(100) NOT NULL,
  `piece_id` varchar(10) NOT NULL,
  `_group` varchar(10) NOT NULL,
  `category_id` varchar(10) DEFAULT NULL,
  `grade_id` varchar(10) DEFAULT NULL,
  `type_id` varchar(10) DEFAULT NULL,
  `brand_id` varchar(10) DEFAULT NULL,
  `unit` varchar(20) NOT NULL,
  `purchase_price` double DEFAULT NULL,
  `selling_price` double NOT NULL,
  `discount` double DEFAULT NULL,
  `tax_id` varchar(10) DEFAULT NULL,
  `status` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

INSERT INTO `products` (`id`, `name`, `alias_name`, `piece_id`, `_group`, `category_id`, `grade_id`, `type_id`, `brand_id`, `unit`, `purchase_price`, `selling_price`, `discount`, `tax_id`, `status`) VALUES
('STO-000001', 'N1', 'AN', 'BAG-0001', 'g1', 'CAT-0004', NULL, 'T-00001', NULL, 'kg', 5000, 10000, 0, 'TAX-001', 'Active'),
('STO-000002', 'N2', 'AN2', 'BAG-0001', 'g2', 'CAT-0001', NULL, 'T-00001', NULL, 'kg', 50000, 100000, 0, 'TAX-001', 'Active'),
('STO-000003', 'N3', 'AN', 'BAG-0001', 'g3', 'CAT-0002', 'g11', 't1', 'MER-0001', 'u1', 2500, 5000, 10, 'TAX-001', 'Active'),
('STO-000004', 'N4', 'AN4', 'BAG-0001', 'g1', 'CAT-0003', 'g111', 't111', 'b11', 'u1', 1000, 2000, 10, 'TAX-001', 'Active');

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

--
-- Struktur dari tabel `sales_invoices`
--

CREATE TABLE `sales_invoices` (
  `id` varchar(14) NOT NULL,
  `date` date NOT NULL,
  `type` varchar(10) NOT NULL,
  `recipient` varchar(9) NOT NULL,
  `discount` double NOT NULL,
  `ppn` double NOT NULL,
  `total` double NOT NULL,
  `down_payment` double NOT NULL,
  `notes` varchar(100) NOT NULL,
  `tax_included` int(1) NOT NULL,
  `status` varchar(10) NOT NULL,
  `drafted_by` varchar(10) NOT NULL,
  `last_edited_by` varchar(10) NOT NULL,
  `last_edited_at` datetime NOT NULL,
  `submitted_by` varchar(10) DEFAULT NULL,
  `submitted_at` datetime DEFAULT NULL,
  `done_by` varchar(10) DEFAULT NULL,
  `done_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `sales_invoices`
--

INSERT INTO `sales_invoices` (`id`, `date`, `type`, `recipient`, `discount`, `ppn`, `total`, `down_payment`, `notes`, `tax_included`, `status`, `drafted_by`, `last_edited_by`, `last_edited_at`, `submitted_by`, `submitted_at`, `done_by`, `done_at`) VALUES
('BM/2207/00001', '2022-07-04', 'Lokal', 'CUS-00001', 0, 0, 0, 0, 'cccc', 1, 'Cancelled', 'EMP-00001', 'EMP-00001', '2022-07-04 16:51:11', 'EMP-00001', '2022-07-04 17:06:09', NULL, NULL);

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

--
-- Struktur dari tabel `sales_invoice_details`
--

CREATE TABLE `sales_invoice_details` (
  `sales_invoice_id` varchar(14) NOT NULL,
  `product_alias_name` varchar(100) NOT NULL,
  `is_delivered` int(1) NOT NULL,
  `quantity` double NOT NULL,
  `unit` varchar(20) NOT NULL,
  `price` double NOT NULL,
  `subtotal` double NOT NULL,
  `discount_percentage` double NOT NULL,
  `fixed_discount` double NOT NULL,
  `subtotal_after_discount` double NOT NULL,
  `ppn` double NOT NULL,
  `total` double NOT NULL,
  `shrink` double NOT NULL,
  `returned` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `sales_invoice_details`
--

INSERT INTO `sales_invoice_details` (`sales_invoice_id`, `product_alias_name`, `is_delivered`, `quantity`, `unit`, `price`, `subtotal`, `discount_percentage`, `fixed_discount`, `subtotal_after_discount`, `ppn`, `total`, `shrink`, `returned`) VALUES
('BM/2207/00001', 'AN', 1, 10, 'kg', 10000, 100000, 90, 500, 9500, 0, 9500, -8, 0),
('BM/2207/00001', 'AN2', 1, 5, 'kg', 5000, 25000, 0, 5000, 20000, 0, 20000, -2, 0);

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

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

CREATE TABLE `sales_orders` (
  `id` varchar(14) NOT NULL,
  `date` date NOT NULL,
  `customer_id` varchar(9) NOT NULL,
  `discount` double NOT NULL,
  `ppn` double NOT NULL,
  `total` double NOT NULL,
  `reference` varchar(20) NOT NULL,
  `notes` varchar(100) NOT NULL,
  `tax_included` int(1) NOT NULL,
  `status` varchar(10) NOT NULL,
  `drafted_by` varchar(10) NOT NULL,
  `last_edited_by` varchar(10) NOT NULL,
  `last_edited_at` datetime NOT NULL,
  `submitted_by` varchar(10) DEFAULT NULL,
  `submitted_at` datetime DEFAULT NULL,
  `done_by` varchar(10) DEFAULT NULL,
  `done_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `sales_orders`
--

INSERT INTO `sales_orders` (`id`, `date`, `customer_id`, `discount`, `ppn`, `total`, `reference`, `notes`, `tax_included`, `status`, `drafted_by`, `last_edited_by`, `last_edited_at`, `submitted_by`, `submitted_at`, `done_by`, `done_at`) VALUES
('BM220603-SO001', '2022-06-21', 'CUS-00001', 68500, 10100, 2961600, 'r1', 'c1', 0, 'Done', 'EMP-00001', 'EMP-00001', '2022-06-21 10:50:17', 'EMP-00001', '2022-06-21 10:50:17', NULL, NULL),
('BM220623-SO001', '2022-06-23', 'CUS-00001', 23500, 26955, 296500, 'r1', 'c1', 1, 'Done', 'EMP-00001', 'EMP-00001', '2022-06-23 16:35:15', 'EMP-00001', '2022-06-23 16:35:15', NULL, NULL),
('BM220629-SO001', '2022-06-29', 'CUS-00001', 23500, 26954.545454545, 296500, 'r1', 'c1', 1, 'Done', 'EMP-00001', 'EMP-00001', '2022-06-29 11:12:42', 'EMP-00001', '2022-06-29 11:12:42', 'EMP-00001', '2022-06-29 11:31:20');

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

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

CREATE TABLE `sales_order_details` (
  `sales_order_id` varchar(14) NOT NULL,
  `product_alias_name` varchar(100) NOT NULL,
  `quantity` double NOT NULL,
  `unit` varchar(20) NOT NULL,
  `price` double NOT NULL,
  `subtotal` double NOT NULL,
  `discount_percentage` double NOT NULL,
  `fixed_discount` double NOT NULL,
  `subtotal_after_discount` double NOT NULL,
  `ppn` double NOT NULL,
  `total` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `sales_order_details`
--

INSERT INTO `sales_order_details` (`sales_order_id`, `product_alias_name`, `quantity`, `unit`, `price`, `subtotal`, `discount_percentage`, `fixed_discount`, `subtotal_after_discount`, `ppn`, `total`) VALUES
('BM220603-SO001', 'AN', 20, 'kg', 10000, 20000, 90, 500, 1500, 100, 1600),
('BM220603-SO001', 'AN2', 1, 'kg', 1000000, 3000000, 0, 50000, 2950000, 10000, 2960000),
('BM220623-SO001', 'AN2', 3, 'kg', 100000, 300000, 0, 5000, 295000, 0, 295000),
('BM220629-SO001', 'AN', 2, 'kg', 10000, 20000, 90, 500, 1500, 0, 1500),
('BM220629-SO001', 'AN2', 3, 'kg', 100000, 300000, 0, 5000, 295000, 0, 295000);

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

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

CREATE TABLE `sales_returns` (
  `id` varchar(14) NOT NULL,
  `sales_invoice_id` varchar(14) NOT NULL,
  `customer_id` varchar(9) NOT NULL,
  `customer_name` varchar(50) NOT NULL,
  `total` int(20) NOT NULL,
  `description` varchar(100) DEFAULT NULL,
  `drafted_by` varchar(10) NOT NULL,
  `submitted_by` varchar(10) DEFAULT NULL,
  `submitted_at` date DEFAULT NULL,
  `deleted_at` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

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

CREATE TABLE `sales_return_details` (
  `sales_return_id` varchar(14) NOT NULL,
  `delivery_note_id` varchar(14) NOT NULL,
  `sales_order_id` varchar(14) NOT NULL,
  `product_id` varchar(10) NOT NULL,
  `product_name` varchar(50) NOT NULL,
  `quantity` double NOT NULL,
  `unit` varchar(10) NOT NULL,
  `price` int(20) NOT NULL,
  `subtotal` int(20) NOT NULL,
  `percentage_discount` int(5) DEFAULT NULL,
  `fixed_discount` int(20) DEFAULT NULL,
  `subtotal_after_discount` int(20) NOT NULL,
  `ppn` int(10) DEFAULT NULL,
  `total` int(20) NOT NULL,
  `deleted_at` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Struktur dari tabel `sections`
--

CREATE TABLE `sections` (
  `id` varchar(8) NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(100) DEFAULT NULL,
  `deleted_at` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Struktur dari tabel `tally_sheets`
--

CREATE TABLE `tally_sheets` (
  `id` varchar(14) NOT NULL,
  `date` date NOT NULL,
  `customer_id` varchar(9) NOT NULL,
  `warehouse_id` varchar(8) NOT NULL,
  `notes` varchar(100) DEFAULT NULL,
  `status` varchar(10) NOT NULL,
  `drafted_by` varchar(10) NOT NULL,
  `last_edited_by` varchar(10) NOT NULL,
  `last_edited_at` datetime NOT NULL,
  `submitted_by` varchar(10) DEFAULT NULL,
  `submitted_at` datetime DEFAULT NULL,
  `done_by` varchar(10) DEFAULT NULL,
  `done_at` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tally_sheets`
--

INSERT INTO `tally_sheets` (`id`, `date`, `customer_id`, `warehouse_id`, `notes`, `status`, `drafted_by`, `last_edited_by`, `last_edited_at`, `submitted_by`, `submitted_at`, `done_by`, `done_at`) VALUES
('BM220623-TO002', '2022-06-23', 'CUS-00001', 'g1', 'c1', 'Submitted', 'EMP-00001', 'EMP-00001', '2022-06-23 17:34:01', 'EMP-00001', '2022-06-23 17:34:01', 'EMP-00001', '2022-06-27 13:26:14'),
('BM220623-TO003', '2022-06-23', 'CUS-00001', 'g1', 'c1', 'Cancelled', 'EMP-00001', 'EMP-00001', '2022-06-23 17:26:52', 'EMP-00001', '2022-06-23 17:26:52', NULL, NULL),
('BM220623-TO004', '2022-06-27', 'CUS-00001', 'WAR-0001', 'c1', 'Submitted', 'EMP-00001', 'EMP-00001', '2022-06-27 11:05:53', 'EMP-00001', '2022-06-27 11:05:53', 'EMP-00001', '2022-06-27 13:26:14'),
('BM220623-TO006', '2022-06-29', 'CUS-00001', 'WAR-0001', 'c1', 'Draft', 'EMP-00001', 'EMP-00001', '2022-06-29 12:55:12', 'EMP-00001', '2022-06-29 10:29:57', NULL, NULL),
('BM220629-TO001', '2022-06-29', 'CUS-00001', 'g1', 'c1', 'Done', 'EMP-00001', 'EMP-00001', '2022-06-29 11:31:18', 'EMP-00001', '2022-06-29 11:31:18', 'EMP-00001', '2022-07-04 16:32:52'),
('BM220629-TO002', '2022-06-29', 'CUS-00001', 'g1', 'c1', 'Done', 'EMP-00001', 'EMP-00001', '2022-06-29 11:31:20', 'EMP-00001', '2022-06-29 11:31:20', 'EMP-00001', '2022-07-04 15:29:30');

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

--
-- Struktur dari tabel `tally_sheet_details`
--

CREATE TABLE `tally_sheet_details` (
  `tally_sheet_id` varchar(14) NOT NULL,
  `sales_order_id` varchar(14) NOT NULL,
  `product_id` varchar(10) NOT NULL,
  `product_alias_name` varchar(100) NOT NULL,
  `product_name` varchar(100) NOT NULL,
  `number_of_boxes` int(5) DEFAULT NULL,
  `boxes_quantity` double NOT NULL,
  `boxes_unit` varchar(20) NOT NULL,
  `action` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tally_sheet_details`
--

INSERT INTO `tally_sheet_details` (`tally_sheet_id`, `sales_order_id`, `product_id`, `product_alias_name`, `product_name`, `number_of_boxes`, `boxes_quantity`, `boxes_unit`, `action`) VALUES
('BM220623-TO002', 'BM220603-SO001', 'STO-000001', 'AN', 'N1', 2, 4, 'kg', 'Next delivery'),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 'AN2', 'N2', 6, 6, 'kg', 'Done'),
('BM220623-TO002', 'BM220603-SO001', 'STO-000003', 'AN', 'N3', 2, 14, 'kg', 'Next delivery'),
('BM220623-TO002', 'BM220623-SO001', 'STO-000002', 'AN2', 'N2', 1, 1, 'kg', 'Next delivery'),
('BM220623-TO003', 'BM220603-SO001', 'STO-000001', 'AN', 'N1', 2, 4, 'kg', 'Done'),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 'AN2', 'N2', 6, 6, 'kg', 'Done'),
('BM220623-TO003', 'BM220603-SO001', 'STO-000003', 'AN', 'N3', 2, 15, 'kg', 'Done'),
('BM220623-TO003', 'BM220623-SO001', 'STO-000002', 'AN2', 'N2', 1, 1, 'kg', 'Done'),
('BM220623-TO004', 'BM220603-SO001', 'STO-000001', 'AN', 'N1', 2, 4, 'kg', 'Done'),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 'AN2', 'N2', 6, 6, 'kg', 'Done'),
('BM220623-TO004', 'BM220603-SO001', 'STO-000003', 'AN', 'N3', 2, 15, 'kg', 'Done'),
('BM220623-TO004', 'BM220623-SO001', 'STO-000002', 'AN2', 'N2', 1, 2, 'kg', 'Done'),
('BM220623-TO006', 'BM220603-SO001', 'STO-000001', 'AN', 'N1', 2, 4, 'kg', 'Next delivery'),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 'AN2', 'N2', 6, 6, 'kg', 'Done'),
('BM220623-TO006', 'BM220603-SO001', 'STO-000003', 'AN', 'N3', 2, 15, 'kg', 'Next delivery'),
('BM220623-TO006', 'BM220623-SO001', 'STO-000002', 'AN2', 'N2', 1, 2, 'kg', 'Next delivery'),
('BM220629-TO001', 'BM220629-SO001', 'STO-000001', 'AN', 'N1', 1, 1, 'kg', 'Next delivery'),
('BM220629-TO001', 'BM220629-SO001', 'STO-000002', 'AN2', 'N2', 1, 1.5, 'kg', 'Next delivery'),
('BM220629-TO002', 'BM220629-SO001', 'STO-000001', 'AN', 'N1', 1, 1, 'kg', 'Done'),
('BM220629-TO002', 'BM220629-SO001', 'STO-000002', 'AN2', 'N2', 1, 1.5, 'kg', 'Done');

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

--
-- Struktur dari tabel `tally_sheet_detail_boxes`
--

CREATE TABLE `tally_sheet_detail_boxes` (
  `tally_sheet_id` varchar(14) NOT NULL,
  `sales_order_id` varchar(14) NOT NULL,
  `product_id` varchar(10) NOT NULL,
  `box_id` int(5) NOT NULL,
  `quantity` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tally_sheet_detail_boxes`
--

INSERT INTO `tally_sheet_detail_boxes` (`tally_sheet_id`, `sales_order_id`, `product_id`, `box_id`, `quantity`) VALUES
('BM220623-TO002', 'BM220603-SO001', 'STO-000001', 1, 2),
('BM220623-TO002', 'BM220603-SO001', 'STO-000001', 2, 2),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 1, 1),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 2, 1),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 3, 1),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 4, 1),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 5, 1),
('BM220623-TO002', 'BM220603-SO001', 'STO-000002', 6, 1),
('BM220623-TO002', 'BM220603-SO001', 'STO-000003', 1, 12),
('BM220623-TO002', 'BM220603-SO001', 'STO-000003', 2, 2),
('BM220623-TO002', 'BM220623-SO001', 'STO-000002', 1, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000001', 1, 2),
('BM220623-TO003', 'BM220603-SO001', 'STO-000001', 2, 2),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 1, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 2, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 3, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 4, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 5, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000002', 6, 1),
('BM220623-TO003', 'BM220603-SO001', 'STO-000003', 1, 13),
('BM220623-TO003', 'BM220603-SO001', 'STO-000003', 2, 2),
('BM220623-TO003', 'BM220623-SO001', 'STO-000002', 1, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000001', 1, 2),
('BM220623-TO004', 'BM220603-SO001', 'STO-000001', 2, 2),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 1, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 2, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 3, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 4, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 5, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000002', 6, 1),
('BM220623-TO004', 'BM220603-SO001', 'STO-000003', 1, 13),
('BM220623-TO004', 'BM220603-SO001', 'STO-000003', 2, 2),
('BM220623-TO004', 'BM220623-SO001', 'STO-000002', 1, 2),
('BM220623-TO006', 'BM220603-SO001', 'STO-000001', 1, 2),
('BM220623-TO006', 'BM220603-SO001', 'STO-000001', 2, 2),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 1, 1),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 2, 1),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 3, 1),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 4, 1),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 5, 1),
('BM220623-TO006', 'BM220603-SO001', 'STO-000002', 6, 1),
('BM220623-TO006', 'BM220603-SO001', 'STO-000003', 1, 13),
('BM220623-TO006', 'BM220603-SO001', 'STO-000003', 2, 2),
('BM220623-TO006', 'BM220623-SO001', 'STO-000002', 1, 2),
('BM220629-TO001', 'BM220629-SO001', 'STO-000001', 1, 1),
('BM220629-TO001', 'BM220629-SO001', 'STO-000002', 1, 1.5),
('BM220629-TO002', 'BM220629-SO001', 'STO-000001', 1, 1),
('BM220629-TO002', 'BM220629-SO001', 'STO-000002', 1, 1.5);

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

--
-- Struktur dari tabel `taxes`
--

CREATE TABLE `taxes` (
  `id` varchar(10) NOT NULL,
  `type` varchar(20) NOT NULL,
  `rate` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `taxes`
--

INSERT INTO `taxes` (`id`, `type`, `rate`) VALUES
('TAX-001', 'PPN', 10),
('TAX-002', 'N1', 1),
('TAX-003', 'N1', 1),
('TAX-004', 'N1', 1),
('TAX-005', 'N1', 1),
('TAX-006', 'N1', 1);

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

--
-- Struktur dari tabel `types`
--

CREATE TABLE `types` (
  `id` varchar(10) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `types`
--

INSERT INTO `types` (`id`, `name`, `description`) VALUES
('T-00001', 'NN1', 'DD1'),
('T-00002', 'New', 'D New');

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

--
-- Struktur dari tabel `warehouses`
--

CREATE TABLE `warehouses` (
  `id` varchar(8) NOT NULL,
  `name` varchar(50) NOT NULL,
  `address` varchar(250) NOT NULL,
  `city` varchar(100) DEFAULT NULL,
  `postal_code` int(10) DEFAULT NULL,
  `phone_number` int(20) DEFAULT NULL,
  `employee_id` varchar(9) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `warehouses`
--

INSERT INTO `warehouses` (`id`, `name`, `address`, `city`, `postal_code`, `phone_number`, `employee_id`) VALUES
('WAR-0001', 'N11', 'a11', 'c11', 11, 11, 'EMP-00006'),
('WAR-0002', 'N2', 'a2', 'c2', 2, 2, 'EMP-00006');

--
-- Indexes for dumped tables
--

--
-- 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`);

--
-- Indeks untuk tabel `customer_addresses`
--
ALTER TABLE `customer_addresses`
  ADD PRIMARY KEY (`customer_id`,`id`) USING BTREE;

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

--
-- Indeks untuk tabel `delivery_note_details`
--
ALTER TABLE `delivery_note_details`
  ADD PRIMARY KEY (`delivery_note_id`,`tally_sheet_id`,`sales_order_id`,`product_id`);

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

--
-- Indeks untuk tabel `employees`
--
ALTER TABLE `employees`
  ADD PRIMARY KEY (`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 `grades`
--
ALTER TABLE `grades`
  ADD PRIMARY KEY (`id`);

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

--
-- Indeks untuk tabel `group_access_rights`
--
ALTER TABLE `group_access_rights`
  ADD PRIMARY KEY (`group_id`,`module_id`,`menu_id`,`access_right_id`) USING BTREE;

--
-- Indeks untuk tabel `group_users`
--
ALTER TABLE `group_users`
  ADD PRIMARY KEY (`user_id`,`group_id`);

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

--
-- Indeks untuk tabel `modules`
--
ALTER TABLE `modules`
  ADD PRIMARY KEY (`id`) USING BTREE;

--
-- Indeks untuk tabel `module_menus`
--
ALTER TABLE `module_menus`
  ADD PRIMARY KEY (`module_id`,`id`) USING BTREE;

--
-- Indeks untuk tabel `module_menu_access_rights`
--
ALTER TABLE `module_menu_access_rights`
  ADD PRIMARY KEY (`module_id`,`module_menu_id`,`id`) USING BTREE;

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

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

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

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

--
-- Indeks untuk tabel `products`
--
ALTER TABLE `products`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `UNIQUE_NAME` (`name`),
  ADD UNIQUE KEY `UNIQUE` (`piece_id`,`grade_id`,`type_id`,`brand_id`);

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

--
-- Indeks untuk tabel `sales_invoice_details`
--
ALTER TABLE `sales_invoice_details`
  ADD PRIMARY KEY (`sales_invoice_id`,`product_alias_name`) USING BTREE;

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

--
-- Indeks untuk tabel `sales_order_details`
--
ALTER TABLE `sales_order_details`
  ADD PRIMARY KEY (`sales_order_id`,`product_alias_name`) USING BTREE;

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

--
-- Indeks untuk tabel `sales_return_details`
--
ALTER TABLE `sales_return_details`
  ADD PRIMARY KEY (`sales_return_id`,`delivery_note_id`,`sales_order_id`,`product_id`);

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

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

--
-- Indeks untuk tabel `tally_sheet_details`
--
ALTER TABLE `tally_sheet_details`
  ADD PRIMARY KEY (`tally_sheet_id`,`sales_order_id`,`product_id`);

--
-- Indeks untuk tabel `tally_sheet_detail_boxes`
--
ALTER TABLE `tally_sheet_detail_boxes`
  ADD PRIMARY KEY (`tally_sheet_id`,`sales_order_id`,`product_id`,`box_id`);

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

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

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

--
-- AUTO_INCREMENT untuk tabel yang dibuang
--

--
-- AUTO_INCREMENT untuk tabel `failed_jobs`
--
ALTER TABLE `failed_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=10;

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

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

--
-- Ketidakleluasaan untuk tabel `group_access_rights`
--
ALTER TABLE `group_access_rights`
  ADD CONSTRAINT `fk_group_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
COMMIT;

