-- https://www.phpmyadmin.net/
--
-- Waktu pembuatan: 08 Nov 2021 pada 10.44
-- Versi server: 10.4.17-MariaDB
-- Versi PHP: 7.4.15

START TRANSACTION;



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

--
-- Struktur dari tabel `tm_bank`
--

CREATE TABLE `tm_bank` (
  `id` char(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `account_number` varchar(30) NOT NULL,
  `account_holder` varchar(70) NOT NULL,
  `region` varchar(70) NOT NULL,
  `description` varchar(100) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_bank`
--

INSERT INTO `tm_bank` (`id`, `name`, `account_number`, `account_holder`, `region`, `description`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('BNK-21040001', 'BCA Cab. Raden Saleh', '546.0302.635', 'PT. SEDANA PANEN SEJAHTERA', '', 'BCA', '2021-05-31 11:00:00', 'USR-21040000', '2021-08-02 16:36:10', 'USR-21040000', NULL, NULL),
('BNK-21050001', 'Bank Danamons', '12345678', '', '', 'DANAMON', '2021-05-31 11:38:40', 'USR-21040000', '2021-05-31 13:34:04', 'USR-21040000', '2021-05-31 13:34:04', 'USR-21040000'),
('BNK-21080001', 'tes', '111', '', '', 'dev', '2021-08-02 18:48:37', 'USR-21040000', '2021-08-02 19:09:52', 'USR-21040000', '2021-08-02 19:09:52', 'USR-21040000'),
('BNK-21080002', 'tes', '111', '', '', 'dev', '2021-08-02 18:52:02', 'USR-21040000', '2021-08-02 19:09:44', 'USR-21040000', '2021-08-02 19:09:44', 'USR-21040000'),
('BNK-21080003', 'tes', '111', '', '', 'dev', '2021-08-02 18:52:45', 'USR-21040000', '2021-08-02 19:09:48', 'USR-21040000', '2021-08-02 19:09:48', 'USR-21040000');

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

--
-- Struktur dari tabel `tm_brand`
--

CREATE TABLE `tm_brand` (
  `id` varchar(15) NOT NULL,
  `product_sub_category_id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_brand`
--

INSERT INTO `tm_brand` (`id`, `product_sub_category_id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('BRN-21050002', 'ITMS-21050003', 'Sorghum Putih', '2021-05-17 14:15:40', 'USR-21040000', '2021-07-23 10:21:52', 'USR-21040000', NULL, NULL),
('BRN-21050003', 'PRDSC-21050001', 'Nektar Sorghum', '2021-05-18 15:02:55', 'USR-21040000', '2021-05-21 14:46:05', 'USR-21040000', NULL, NULL),
('BRN-21050004', 'ITMS-21050003', 'tes', '2021-05-21 14:46:23', 'USR-21040000', '2021-05-21 14:46:28', 'USR-21040000', '2021-05-21 14:46:28', 'USR-21040000'),
('BRN-21070001', 'PRDSC-21070001', 'Kecap Manis Sorghum', '0000-00-00 00:00:00', '', '2021-07-23 10:20:47', 'USR-21040000', NULL, NULL),
('BRN-21070002', 'ITMS-21050001', 'Gula Sorghum', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL),
('BRN-21070003', 'ITMS-21050001', 'Gula Coklat Sorghum', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL),
('BRN-21070004', 'PRDSC-21070001', 'Kecap Manis Sorghum Premium ', '0000-00-00 00:00:00', '', '2021-07-23 10:21:27', 'USR-21040000', NULL, NULL),
('BRN-21070005', 'ITMS-21050003', 'Sorghum Merah', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL),
('BRN-21070006', 'PRDSC-21070002', 'Tepung Sorghum Premium', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL),
('BRN-21070007', 'ITMS-21050001', 'Gula Kristal Kelapa', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL),
('BRN-21070008', 'PRDSC-21070003', 'Sirup', '0000-00-00 00:00:00', '', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_customers`
--

CREATE TABLE `tm_customers` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `credit_limit` decimal(10,0) NOT NULL DEFAULT 0,
  `credit_limit_day` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `can_use_as_partner` tinyint(4) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_customers`
--

INSERT INTO `tm_customers` (`id`, `name`, `credit_limit`, `credit_limit_day`, `can_use_as_partner`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('CST-21050001', 'Miftah', '1000000', 1, 0, '2021-05-10 14:25:38', 'USR-21040000', '2021-05-10 14:33:08', 'USR-21040000', '2021-05-10 14:33:08', 'USR-21040000'),
('CST-21050002', 'Miftah', '1000000', 2, 0, '2021-05-10 14:33:22', 'USR-21040000', '2021-05-19 09:45:12', 'USR-21040000', NULL, NULL),
('CST-21050003', 'asdsa', '9', 7, 0, '2021-05-19 09:38:33', 'USR-21040000', '2021-05-19 09:38:40', 'USR-21040000', '2021-05-19 09:38:40', 'USR-21040000');

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

--
-- Struktur dari tabel `tm_customer_type`
--

CREATE TABLE `tm_customer_type` (
  `id` char(12) NOT NULL,
  `name` varchar(20) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_customer_type`
--

INSERT INTO `tm_customer_type` (`id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('CTYP-2107001', 'Retail', '2021-07-22 09:53:08', 'USR-21040000', '2021-07-22 10:46:19', 'USR-21040000', NULL, NULL),
('CTYP-2107002', 'Reseller A', '2021-07-22 09:53:08', 'USR-21040000', NULL, NULL, NULL, NULL),
('CTYP-2107003', 'Reseller B', '2021-07-22 09:53:08', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_group`
--

CREATE TABLE `tm_group` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_group`
--

INSERT INTO `tm_group` (`id`, `name`, `description`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('GRP-21040001', 'Developer', NULL, '2021-04-29 07:36:52', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_machine`
--

CREATE TABLE `tm_machine` (
  `id` char(10) NOT NULL,
  `mapping_id` varchar(2) NOT NULL,
  `category_id` char(11) DEFAULT NULL,
  `name` varchar(100) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_machine`
--

INSERT INTO `tm_machine` (`id`, `mapping_id`, `category_id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('M-21070001', '01', 'CAT-2107002', 'Open Pan', '2021-07-15 13:59:04', 'USR-21040000', '2021-07-27 19:29:48', 'USR-21040000', NULL, NULL),
('M-21070002', '01', NULL, 'Vacuum A', '2021-07-15 16:24:22', 'USR-21040000', '2021-07-23 11:06:39', 'USR-21040000', NULL, NULL),
('M-21070004', '01', NULL, 'Sentrifugal', '2021-07-15 22:34:39', 'USR-21040000', '2021-07-23 16:20:45', 'USR-21040000', NULL, NULL),
('M-21070005', '01', '', 'Vacuum Pan', '2021-07-23 16:19:39', 'USR-21040000', '2021-07-28 14:15:09', 'USR-21040000', NULL, NULL),
('M-21070006', '11', 'CAT-2107002', 'test', '2021-07-27 19:31:07', 'USR-21040000', NULL, NULL, '2021-07-27 19:31:12', 'USR-21040000');

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

--
-- Struktur dari tabel `tm_machine_category`
--

CREATE TABLE `tm_machine_category` (
  `id` char(11) NOT NULL,
  `name` varchar(25) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(12) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(12) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(12) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_machine_category`
--

INSERT INTO `tm_machine_category` (`id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('CAT-2107001', 'Produksi', '2021-07-27 19:20:10', 'USR-21050000', NULL, NULL, NULL, NULL),
('CAT-2107002', 'Packaging', '2021-07-27 19:20:10', 'USR-21050000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_menu`
--

CREATE TABLE `tm_menu` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `caption` varchar(50) NOT NULL,
  `url` varchar(256) NOT NULL,
  `icon` varchar(50) DEFAULT NULL,
  `parent` varchar(15) DEFAULT NULL,
  `hierarchy` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_menu`
--

INSERT INTO `tm_menu` (`id`, `name`, `caption`, `url`, `icon`, `parent`, `hierarchy`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('MNU-21040001', 'Dashboard', 'Dasbor', 'dashboard', 'bx bx-tachometer', NULL, 1, '2021-04-29 07:51:35', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21040002', 'Data Master', 'Master', '#', 'bx bx-data', NULL, 2, '2021-04-29 07:51:35', 'USR-21040000', '2021-05-17 15:45:04', 'USR-21040000', NULL, NULL),
('MNU-21040003', 'Warehouse', 'Gudang', 'master/warehouse', NULL, 'MNU-21040002', 1, '2021-04-29 07:51:35', 'USR-21040000', '2021-05-31 14:23:10', 'USR-21040000', NULL, NULL),
('MNU-21040004', 'User', 'User', 'master/user', NULL, 'MNU-21040002', 2, '2021-04-29 07:51:35', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21040005', 'Menu', 'Menu', 'master/menu', NULL, 'MNU-21040002', 3, '2021-04-29 07:51:35', 'USR-21040000', '2021-05-05 17:17:29', 'USR-21040000', NULL, NULL),
('MNU-21050002', 'Customer', 'Customer', 'master/customer', '', 'MNU-21040002', 4, '2021-05-10 13:54:37', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050003', 'Role', 'Role', 'master/role', '', 'MNU-21040002', 5, '2021-05-11 11:24:18', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050005', 'Brand', 'Brand', 'master/brand', '', 'MNU-21040002', 6, '2021-05-17 11:38:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050006', 'Product Category', 'Kategori Produk', 'master/product_category', '', 'MNU-21040002', 8, '2021-05-17 11:48:57', 'USR-21040000', '2021-05-20 10:22:04', 'USR-21040000', NULL, NULL),
('MNU-21050007', 'Factory', 'Pabrik', '#', 'bx bxs-factory', NULL, 3, '2021-05-17 14:24:14', 'USR-21040000', '2021-05-17 16:46:46', 'USR-21040000', NULL, NULL),
('MNU-21050008', 'Production', 'Produksi', 'factory/production', '', 'MNU-21050007', 1, '2021-05-17 14:24:31', 'USR-21040000', '2021-07-15 09:16:48', 'USR-21040000', NULL, NULL),
('MNU-21050009', 'Product', 'Produk', 'master/product', '', 'MNU-21040002', 7, '2021-05-18 10:01:24', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050010', 'Product Sub Category', 'Sub Kategori Produk', 'master/product_sub_category', '', 'MNU-21040002', 9, '2021-05-18 14:03:16', 'USR-21040000', '2021-05-20 10:23:30', 'USR-21040000', NULL, NULL),
('MNU-21050011', 'Stock', 'Packaging', 'factory/stock', '', 'MNU-21050007', 2, '2021-05-19 10:31:17', 'USR-21040000', '2021-07-15 09:16:57', 'USR-21040000', NULL, NULL),
('MNU-21050012', 'Stock Transfer', 'Stok Transfer', 'factory/stock_transfer', '', 'MNU-21050007', 3, '2021-05-19 10:32:05', 'USR-21040000', '2021-05-20 09:39:54', 'USR-21040000', NULL, NULL),
('MNU-21050013', 'Stock Transfer Return', 'Stok Transfer Return', 'factory/stock_transfer_return', '', 'MNU-21050007', 4, '2021-05-19 10:32:29', 'USR-21040000', '2021-08-10 11:01:15', 'USR-21040000', NULL, NULL),
('MNU-21050014', 'Test', 'Tes', 'master/test', 'bx bx-planet', NULL, 4, '2021-05-21 13:41:17', 'USR-21040000', '2021-07-13 10:59:18', 'USR-21040000', NULL, NULL),
('MNU-21050015', 'Marketing', 'Marketing', 'master/marketing', '', 'MNU-21040002', 10, '2021-05-25 10:24:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050016', 'Bank', 'Bank', 'master/bank', '', 'MNU-21040002', 11, '2021-05-31 11:16:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050017', 'Warehouse', 'Gudang', '#', 'bx bx-home-alt', NULL, 5, '2021-05-31 14:03:14', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21050018', 'Stock Transfer', 'Stok Transfer', 'warehouse/stock_transfer', '', 'MNU-21050017', 2, '2021-05-31 14:24:01', 'USR-21040000', '2021-05-31 14:30:32', 'USR-21040000', NULL, NULL),
('MNU-21050019', 'Stock', 'Purchase', 'warehouse/stock', '', 'MNU-21050017', 1, '2021-05-31 14:30:20', 'USR-21040000', '2021-07-13 17:20:48', 'USR-21040000', NULL, NULL),
('MNU-21060001', 'Stock Transfer Return', 'Stok Transfer Return', 'warehouse/stock_transfer_return', '', 'MNU-21050017', 5, '2021-06-21 13:31:06', 'USR-21040000', '2021-08-10 14:36:48', 'USR-21040000', NULL, NULL),
('MNU-21070001', 'Config', 'Konfigurasi Aplikasi', 'master/config', '', 'MNU-21040002', 12, '2021-07-01 10:47:56', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21070002', 'Sales', 'Sales', 'warehouse/sales', '', 'MNU-21050017', 3, '2021-07-05 10:44:17', 'USR-21040000', '2021-07-15 09:08:04', 'USR-21040000', NULL, NULL),
('MNU-21070003', 'Purchase Return', 'Purchase Return', 'warehouse/purchase_return', '', 'MNU-21050017', 4, '2021-07-13 17:22:58', 'USR-21040000', '2021-08-10 14:36:25', 'USR-21040000', NULL, NULL),
('MNU-21070004', 'Availabile Stock', 'Stok Tersedia', 'warehouse/available_stock', '', 'MNU-21050017', 7, '2021-07-15 09:34:09', 'USR-21040000', '2021-08-10 14:39:04', 'USR-21040000', NULL, NULL),
('MNU-21070005', 'Finished Goods Stock', 'Stok Barang Jadi', 'factory/finished_goods_stock', '', 'MNU-21050007', 5, '2021-07-15 09:35:32', 'USR-21040000', '2021-08-16 13:44:58', 'USR-21040000', NULL, NULL),
('MNU-21070006', 'Machine', 'Mesin', 'master/machine', '', 'MNU-21040002', 13, '2021-07-15 11:33:22', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21070007', 'Customer Type', 'Tipe Customer', 'master/customer_type', '', 'MNU-21040002', 14, '2021-07-22 10:31:13', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21080001', 'Sales Return', 'Sales Return', 'warehouse/sales_return', '', 'MNU-21050017', 6, '2021-08-10 14:37:43', 'USR-21040000', '2021-08-10 14:38:54', 'USR-21040000', NULL, NULL),
('MNU-21080002', 'Promotion', 'Promosi', 'warehouse/promotion', '', 'MNU-21050017', 8, '2021-08-12 11:10:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('MNU-21080003', 'Semi Finished Goods Stock', 'Stok Barang Setengah Jadi', 'factory/semi_finished_goods_stock', '', 'MNU-21050007', 6, '2021-08-16 13:45:27', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_payment_type`
--

CREATE TABLE `tm_payment_type` (
  `id` char(15) NOT NULL,
  `description` varchar(50) NOT NULL,
  `remark` varchar(100) DEFAULT NULL,
  `due_date_required` tinyint(4) NOT NULL DEFAULT 0,
  `bank_ref_required` tinyint(4) NOT NULL DEFAULT 0,
  `use_in_payment_module` tinyint(4) NOT NULL DEFAULT 1,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_payment_type`
--

INSERT INTO `tm_payment_type` (`id`, `description`, `remark`, `due_date_required`, `bank_ref_required`, `use_in_payment_module`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PAY-21040001', 'Cash', NULL, 1, 0, 1, '2021-05-31 11:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PAY-21040002', 'Transfer', NULL, 0, 1, 1, '2021-05-31 11:00:00', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_permission`
--

CREATE TABLE `tm_permission` (
  `id` varchar(15) NOT NULL,
  `menu_id` varchar(15) NOT NULL,
  `description` varchar(50) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_permission`
--

INSERT INTO `tm_permission` (`id`, `menu_id`, `description`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PRM-21050001', 'MNU-21040004', 'read User', '2021-05-04 09:51:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050002', 'MNU-21040004', 'write User', '2021-05-04 09:51:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050003', 'MNU-21040005', 'read Menu', '2021-05-04 09:51:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050004', 'MNU-21040005', 'write Menu', '2021-05-04 09:51:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050005', 'MNU-21040003', 'read Warehouse', '2021-05-04 09:51:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050006', 'MNU-21040001', 'read Dashboard', '2021-05-04 09:51:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050007', 'MNU-21050004', 'read Test', '2021-05-17 10:13:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050008', 'MNU-21050004', 'write Test', '2021-05-17 10:13:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050009', 'MNU-21050002', 'read Customer', '2021-05-17 10:13:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050010', 'MNU-21050002', 'write Customer', '2021-05-17 10:13:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050011', 'MNU-21050003', 'read Role', '2021-05-17 10:13:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050012', 'MNU-21050003', 'write Role', '2021-05-17 10:13:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050013', 'MNU-21050005', 'read Brand', '2021-05-17 11:38:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050014', 'MNU-21050005', 'write Brand', '2021-05-17 11:38:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050015', 'MNU-21050006', 'read Product Category', '2021-05-17 11:48:57', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050016', 'MNU-21050006', 'write Product Category', '2021-05-17 11:48:57', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050019', 'MNU-21050008', 'read Production', '2021-05-17 14:24:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050020', 'MNU-21050008', 'write Production', '2021-05-17 14:24:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050021', 'MNU-21050007', 'read Factory', '2021-05-17 14:24:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050022', 'MNU-21050007', 'write Factory', '2021-05-17 14:24:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050023', 'MNU-21050009', 'read Product', '2021-05-18 10:01:24', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050024', 'MNU-21050009', 'write Product', '2021-05-18 10:01:24', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050025', 'MNU-21050010', 'read Product Sub Category', '2021-05-18 14:03:16', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050026', 'MNU-21050010', 'write Product Sub Category', '2021-05-18 14:03:16', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050027', 'MNU-21050011', 'read Stock', '2021-05-19 10:31:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050028', 'MNU-21050011', 'write Stock', '2021-05-19 10:31:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050029', 'MNU-21050012', 'read Stock Transfer', '2021-05-19 10:32:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050030', 'MNU-21050012', 'write Stock Transfer', '2021-05-19 10:32:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050031', 'MNU-21050013', 'read Stock Transfer Return', '2021-05-19 10:32:29', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050032', 'MNU-21050013', 'write Stock Transfer Return', '2021-05-19 10:32:29', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050033', 'MNU-21040003', 'write Warehouse', '2021-05-19 10:32:29', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050034', 'MNU-21050014', 'read Test', '2021-05-21 13:41:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050035', 'MNU-21050014', 'write Test', '2021-05-21 13:41:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050036', 'MNU-21050015', 'read Marketing', '2021-05-25 10:24:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050037', 'MNU-21050015', 'write Marketing', '2021-05-25 10:24:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050038', 'MNU-21050016', 'read Bank', '2021-05-31 11:16:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050039', 'MNU-21050016', 'write Bank', '2021-05-31 11:16:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050040', 'MNU-21050017', 'read Warehouse', '2021-05-31 14:03:14', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050041', 'MNU-21050017', 'write Warehouse', '2021-05-31 14:03:14', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050042', 'MNU-21050018', 'read Stock Transfer', '2021-05-31 14:24:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050043', 'MNU-21050018', 'write Stock Transfer', '2021-05-31 14:24:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050044', 'MNU-21050019', 'read Stock', '2021-05-31 14:30:20', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050045', 'MNU-21050019', 'write Stock', '2021-05-31 14:30:20', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050046', 'MNU-21040002', 'read Data Master', '2021-05-31 14:30:20', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050047', 'MNU-21040002', 'write Data Master', '2021-05-31 14:30:20', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050048', 'MNU-21050007', 'read Factory', '2021-05-31 14:30:20', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21050049', 'MNU-21050007', 'write Factory', '2021-05-31 14:30:20', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21060001', 'MNU-21060001', 'read Stock Transfer Return', '2021-06-21 13:31:06', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21060002', 'MNU-21060001', 'write Stock Transfer Return', '2021-06-21 13:31:06', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070001', 'MNU-21070001', 'read Config', '2021-07-01 10:47:56', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070002', 'MNU-21070001', 'write Config', '2021-07-01 10:47:56', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070003', 'MNU-21070002', 'read Sales', '2021-07-05 10:44:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070004', 'MNU-21070002', 'write Sales', '2021-07-05 10:44:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070005', 'MNU-21070003', 'read Purchase Return', '2021-07-13 17:22:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070006', 'MNU-21070003', 'write Purchase Return', '2021-07-13 17:22:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070007', 'MNU-21070004', 'read Availabile Stock', '2021-07-15 09:34:09', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070008', 'MNU-21070004', 'write Availabile Stock', '2021-07-15 09:34:09', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070009', 'MNU-21070005', 'read Finished Goods Stock', '2021-07-15 09:35:32', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070010', 'MNU-21070005', 'write Finished Goods Stock', '2021-07-15 09:35:32', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070011', 'MNU-21070006', 'read Machine', '2021-07-15 11:33:22', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070012', 'MNU-21070006', 'write Machine', '2021-07-15 11:33:22', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070013', 'MNU-21070007', 'read Customer Type', '2021-07-22 10:31:13', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21070014', 'MNU-21070007', 'write Customer Type', '2021-07-22 10:31:13', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21080001', 'MNU-21080001', 'read Sales Return', '2021-08-10 14:37:43', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21080002', 'MNU-21080001', 'write Sales Return', '2021-08-10 14:37:43', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21080003', 'MNU-21080002', 'read Promotion', '2021-08-12 11:10:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21080004', 'MNU-21080002', 'write Promotion', '2021-08-12 11:10:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21080005', 'MNU-21080003', 'read Semi Finished Goods Stock', '2021-08-16 13:45:27', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRM-21080006', 'MNU-21080003', 'write Semi Finished Goods Stock', '2021-08-16 13:45:27', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_product`
--

CREATE TABLE `tm_product` (
  `id` varchar(15) NOT NULL,
  `brand_id` varchar(15) NOT NULL,
  `barcode` char(13) DEFAULT NULL,
  `name` varchar(50) NOT NULL,
  `unit_in_kg` decimal(5,3) UNSIGNED NOT NULL DEFAULT 0.000,
  `currency_value` decimal(10,2) NOT NULL DEFAULT 0.00,
  `base_price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `min_sale_price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `sale_price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_product`
--

INSERT INTO `tm_product` (`id`, `brand_id`, `barcode`, `name`, `unit_in_kg`, `currency_value`, `base_price`, `min_sale_price`, `sale_price`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PRD-21070003', 'BRN-21070002', '8997219230224', '250gr', '0.250', '0.00', '16435.19', '0.00', '21435.19', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:45:15', 'USR-21040000', NULL, NULL),
('PRD-21070004', 'BRN-21070002', '8997219230385', '500gr', '0.500', '0.00', '28270.37', '0.00', '33270.37', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 10:37:00', 'USR-21040000', NULL, NULL),
('PRD-21070005', 'BRN-21070002', NULL, 'Curah', '0.000', '0.00', '48240.74', '0.00', '53240.74', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070006', 'BRN-21070002', NULL, 'M-40 Curah', '0.000', '0.00', '53240.74', '0.00', '58240.74', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070007', 'BRN-21070003', '8997219230439', '500gr', '0.500', '0.00', '18800.00', '0.00', '23800.00', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:48:54', 'USR-21040000', NULL, NULL),
('PRD-21070008', 'BRN-21070003', NULL, 'Curah', '0.000', '0.00', '20087.00', '0.00', '25087.00', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070009', 'BRN-21050003', '8997219230255', '330ml', '0.450', '0.00', '13345.70', '0.00', '18345.70', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:50:34', 'USR-21040000', NULL, NULL),
('PRD-21070010', 'BRN-21050003', NULL, 'Curah', '0.000', '0.00', '25542.86', '0.00', '30542.86', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070011', 'BRN-21070008', NULL, 'Sirup Curah', '0.000', '0.00', '15103.57', '0.00', '20103.57', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070013', 'BRN-21070001', '8997219230231', '330ml', '0.457', '0.00', '6923.52', '0.00', '11923.52', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:51:38', 'USR-21040000', NULL, NULL),
('PRD-21070014', 'BRN-21070001', '8997219230217', '640ml', '0.886', '0.00', '11531.05', '0.00', '16531.05', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:52:01', 'USR-21040000', NULL, NULL),
('PRD-21070015', 'BRN-21070001', NULL, 'Curah', '0.000', '0.00', '10661.95', '0.00', '15661.95', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070017', 'BRN-21070004', '8997219230248', '330ml', '0.457', '0.00', '14595.13', '0.00', '19595.13', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:52:21', 'USR-21040000', NULL, NULL),
('PRD-21070018', 'BRN-21070004', NULL, '640ml', '0.886', '0.00', '25784.32', '0.00', '30784.32', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070019', 'BRN-21070004', NULL, 'Curah', '0.000', '0.00', '27032.86', '0.00', '32032.86', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070021', 'BRN-21050002', '8997219230316', 'Utuh 1kg', '1.000', '0.00', '9732.00', '0.00', '14732.00', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:52:47', 'USR-21040000', NULL, NULL),
('PRD-21070022', 'BRN-21050002', NULL, 'Utuh Curah', '0.000', '0.00', '6501.00', '0.00', '11501.00', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070023', 'BRN-21050002', '8997219230279', 'Kupas 1kg', '1.000', '0.00', '17552.00', '0.00', '22552.00', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:53:05', 'USR-21040000', NULL, NULL),
('PRD-21070024', 'BRN-21050002', NULL, 'Kupas Curah', '0.000', '0.00', '14321.00', '0.00', '19321.00', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070025', 'BRN-21070005', '8997219230309', 'Utuh 1kg', '1.000', '0.00', '9732.00', '0.00', '14732.00', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:53:19', 'USR-21040000', NULL, NULL),
('PRD-21070026', 'BRN-21070005', NULL, 'Utuh Curah', '0.000', '0.00', '6501.00', '0.00', '11501.00', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070027', 'BRN-21070005', '8997219230262', 'Kupas 1kg', '1.000', '0.00', '17552.00', '0.00', '22552.00', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:53:31', 'USR-21040000', NULL, NULL),
('PRD-21070028', 'BRN-21070005', NULL, 'Kupas Curah', '0.000', '0.00', '14321.00', '0.00', '19321.00', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070030', 'BRN-21070006', '8997219230392', '1kg', '1.000', '0.00', '32362.44', '0.00', '37362.44', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:53:52', 'USR-21040000', NULL, NULL),
('PRD-21070031', 'BRN-21070006', NULL, 'Curah', '0.000', '0.00', '28854.44', '0.00', '33854.44', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRD-21070033', 'BRN-21070007', '8997219230408', '250gr', '0.250', '0.00', '16742.86', '0.00', '21742.86', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:54:11', 'USR-21040000', NULL, NULL),
('PRD-21070034', 'BRN-21070007', '8997219230408', '500gr', '0.500', '0.00', '28885.71', '0.00', '33885.71', '2021-07-23 00:00:00', 'USR-21040000', '2021-08-19 09:54:34', 'USR-21040000', NULL, NULL),
('PRD-21070035', 'BRN-21070007', NULL, 'Curah', '0.000', '0.00', '51071.43', '0.00', '56071.43', '2021-07-23 00:00:00', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_product_category`
--

CREATE TABLE `tm_product_category` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_product_category`
--

INSERT INTO `tm_product_category` (`id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PRDC-21050001', 'Sweets', '2021-05-18 14:22:55', 'USR-21040000', '2021-05-18 14:26:13', 'USR-21040000', '2021-05-18 14:27:15', 'USR-21040000'),
('PRDC-21050002', 'Grain', '2021-05-18 14:23:41', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRDC-21050003', 'Flour', '2021-05-18 14:23:46', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRDC-21050004', 'Sweet', '2021-05-18 14:28:06', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_product_sub_category`
--

CREATE TABLE `tm_product_sub_category` (
  `id` varchar(15) NOT NULL,
  `product_category_id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `initial` varchar(5) NOT NULL,
  `unit` char(5) DEFAULT NULL COMMENT 'allowed units: kg; liter.',
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_product_sub_category`
--

INSERT INTO `tm_product_sub_category` (`id`, `product_category_id`, `name`, `initial`, `unit`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('ITMS-21050001', 'PRDC-21050004', 'Gula', 'GUL', 'kg', '2021-05-17 13:40:51', 'USR-21040000', '2021-05-17 13:44:57', 'USR-21040000', NULL, NULL),
('ITMS-21050002', 'PRDC-21050004', 'Nektars', 'NEs', 'liter', '2021-05-18 14:53:16', 'USR-21040000', '2021-05-18 14:53:16', 'USR-21040000', '2021-05-18 14:53:21', 'USR-21040000'),
('ITMS-21050003', 'PRDC-21050002', 'Beras', 'BE', 'kg', '2021-07-14 10:31:42', 'USR-21040000', '2021-07-14 10:31:42', 'USR-21040000', NULL, NULL),
('PRDSC-21050001', 'PRDC-21050004', 'Nektar', 'NE', 'liter', '2021-07-14 11:20:07', 'USR-21040000', '2021-07-14 11:20:07', 'USR-21040000', NULL, NULL),
('PRDSC-21070001', 'PRDC-21050004', 'Kecap', 'KCP', 'liter', '2021-07-14 11:20:21', 'USR-21040000', '2021-07-14 11:20:21', 'USR-21040000', NULL, NULL),
('PRDSC-21070002', 'PRDC-21050003', 'Tepung', 'TP', 'kg', '2021-07-23 10:22:45', 'USR-21040000', NULL, NULL, NULL, NULL),
('PRDSC-21070003', 'PRDC-21050004', 'Sirup', 'SR', 'liter', '2021-07-23 10:34:51', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_province`
--

CREATE TABLE `tm_province` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_province`
--

INSERT INTO `tm_province` (`id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PRO-201509011', 'Aceh', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509012', 'Sumatera Utara', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509013', 'Sumatera Barat', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509014', 'Riau', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509015', 'Jambi', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509016', 'Sumatera Selatan', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509017', 'Bengkulu', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509018', 'Lampung', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509019', 'Kepulauan Bangka Belitung', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509021', 'Kepulauan Riau', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509031', 'DKI Jakarta', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509032', 'Jawa Barat', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509033', 'Jawa Tengah', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509034', 'DI Yogyakarta', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509035', 'Jawa Timur', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509036', 'Banten', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509051', 'Bali', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509052', 'Nusa Tenggara Barat', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509053', 'Nusa Tenggara Timur', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509061', 'Kalimantan Barat', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509062', 'Kalimantan Tengah', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509063', 'Kalimantan Selatan', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509064', 'Kalimantan Timur', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509071', 'Sulawesi Utara', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509072', 'Sulawesi Tengah', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509073', 'Sulawesi Selatan', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509074', 'Sulawesi Tenggara', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509075', 'Gorontalo', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509076', 'Sulawesi Barat', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509081', 'Maluku', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509082', 'Maluku Utara', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509091', 'Papua Barat', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201509094', 'Papua', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL),
('PRO-201703001', 'Kalimantan Utara', '2021-05-04 11:47:00', 'USR-2104000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_region`
--

CREATE TABLE `tm_region` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `symbol` varchar(2) NOT NULL,
  `remark` varchar(100) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_region`
--

INSERT INTO `tm_region` (`id`, `name`, `symbol`, `remark`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('RGN-21040001', 'Jakarta', 'JK', '', '2021-04-29 11:49:00', 'USR-21040001', NULL, NULL, NULL, NULL),
('RGN-21040002', 'Jombang', 'JB', '', '2021-04-29 11:49:00', 'USR-21040001', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_role`
--

CREATE TABLE `tm_role` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `description` varchar(200) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_role`
--

INSERT INTO `tm_role` (`id`, `name`, `description`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('ROL-21050001', 'Administrator', 'Admin dari sistem internal Sedana Agro', '2021-05-05 10:10:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050002', 'Developer', 'Test', '2021-05-05 10:10:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'Gudang', '', '2021-05-31 15:16:19', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'Pabrik', '', '2021-06-07 17:21:45', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_third_party`
--

CREATE TABLE `tm_third_party` (
  `id` varchar(15) NOT NULL,
  `region_id` varchar(15) DEFAULT NULL,
  `third_party_type_id` varchar(15) NOT NULL,
  `customer_type_id` char(12) DEFAULT NULL,
  `name` varchar(50) NOT NULL,
  `credit_limit` decimal(10,0) NOT NULL DEFAULT 0,
  `credit_limit_day` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `can_use_as_partner` tinyint(4) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_third_party`
--

INSERT INTO `tm_third_party` (`id`, `region_id`, `third_party_type_id`, `customer_type_id`, `name`, `credit_limit`, `credit_limit_day`, `can_use_as_partner`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('3RDP-21050000', NULL, '3RDPT-21040001', NULL, 'Pabrik', '0', 0, 0, '2021-05-19 15:02:50', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDP-21050001', NULL, '3RDPT-21040002', NULL, 'Miftah', '1000000', 1, 0, '2021-05-10 14:25:38', 'USR-21040000', '2021-05-10 14:33:08', 'USR-21040000', '2021-05-10 14:33:08', 'USR-21040000'),
('3RDP-21050002', 'RGN-21040002', '3RDPT-21040002', 'CTYP-2107002', 'Miftah', '1000000', 2, 0, '2021-05-10 14:33:22', 'USR-21040000', '2021-07-22 10:26:16', 'USR-21040000', NULL, NULL),
('3RDP-21050003', NULL, '3RDPT-21040002', NULL, 'asdsa', '9', 7, 0, '2021-05-19 09:38:33', 'USR-21040000', '2021-05-19 09:38:40', 'USR-21040000', '2021-05-19 09:38:40', 'USR-21040000'),
('3RDP-21050004', 'RGN-21040002', '3RDPT-21040001', NULL, 'SEDANA AGRO JOMBANG', '0', 0, 0, '2021-05-19 09:38:33', 'USR-21040000', '2021-05-19 14:47:35', 'USR-21040000', NULL, NULL),
('3RDP-21050005', 'RGN-21040002', '3RDPT-21040001', NULL, 'asd', '0', 0, 0, '2021-05-19 14:55:33', 'USR-21040000', '2021-05-19 14:56:43', 'USR-21040000', '2021-05-19 14:56:43', 'USR-21040000'),
('3RDP-21050006', NULL, '3RDPT-21040002', NULL, 'asd', '3', 1, 0, '2021-05-19 15:02:50', 'USR-21040000', '2021-05-19 15:02:58', 'USR-21040000', '2021-05-19 15:02:58', 'USR-21040000'),
('3RDP-21050007', NULL, '3RDPT-21040003', NULL, 'Marketing', '0', 0, 0, '2021-05-25 11:06:11', 'USR-21040000', '2021-05-25 11:12:54', 'USR-21040000', NULL, NULL),
('3RDP-21060001', 'RGN-21040001', '3RDPT-21040001', NULL, 'SEDANA AGRO JAKARTA', '0', 0, 0, '2021-06-07 09:26:34', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDP-21070001', NULL, '3RDPT-21040002', 'CTYP-2107001', 'Tokopedia', '0', 0, 0, '2021-07-14 15:44:51', 'USR-21040000', '2021-07-23 15:25:09', 'USR-21040000', NULL, NULL),
('3RDP-21070002', NULL, '3RDPT-21040002', 'CTYP-2107001', 'Shopee', '0', 0, 0, '2021-07-14 15:45:30', 'USR-21040000', '2021-07-23 15:24:59', 'USR-21040000', NULL, NULL),
('3RDP-21070003', NULL, '3RDPT-21040002', 'CTYP-2107001', 'asd', '1', 1, 0, '2021-07-22 10:27:19', 'USR-21040000', '2021-07-22 10:28:38', 'USR-21040000', '2021-07-22 10:28:38', 'USR-21040000');

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

--
-- Struktur dari tabel `tm_third_party_address`
--

CREATE TABLE `tm_third_party_address` (
  `id` varchar(16) NOT NULL,
  `third_party_id` varchar(15) NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `name` varchar(50) NOT NULL DEFAULT 'Alamat utama.',
  `address` text NOT NULL,
  `sub_district` varchar(100) NOT NULL,
  `city` varchar(100) NOT NULL,
  `postal_code` varchar(5) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_third_party_address`
--

INSERT INTO `tm_third_party_address` (`id`, `third_party_id`, `is_default`, `name`, `address`, `sub_district`, `city`, `postal_code`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('3RDPADR-2105000', '3RDP-21050002', 0, 'Alamat Utama', 'Jalan Raya Bekasi Timur No. 1', 'Senen', 'Jakarta Pusat', '12345', '2021-05-19 15:12:33', 'USR-21040000', '2021-07-27 15:13:19', 'USR-21040000', NULL, NULL),
('3RDPADR-21055001', '3RDP-21050004', 0, 'Alamat Utama', 'fff', '', '', '555', '2021-05-19 16:32:27', 'USR-21040000', '2021-05-19 16:33:45', 'USR-21040000', '2021-05-19 16:33:45', 'USR-21040000'),
('3RDPADR-21055002', '3RDP-21050004', 0, 'gggs', 'fff', '', '', '555', '2021-05-19 16:33:59', 'USR-21040000', '2021-05-19 16:35:50', 'USR-21040000', '2021-05-19 16:35:50', 'USR-21040000'),
('3RDPADR-21070001', '3RDP-21050004', 0, 'Alamat Utama', 'Gd. Graha Tirtadi, Jalan Raden Saleh Raya No. 20', 'Cikini', 'Jakarta Pusat', '10330', '2021-07-21 11:37:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPADR-21070002', '3RDP-21060001', 0, 'Utama', 'Gd. Graha Tirtadi, Jalan Raden Saleh Raya, No. 20', 'Cikini', 'Jakarta Pusat', '10330', '2021-07-21 21:30:24', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPADR-21070003', '3RDP-21050002', 0, 'Alamat Kantor', 'Jalan Kenangan No. 20', '', '', '65656', '2021-07-27 15:13:06', 'USR-21040000', '2021-07-28 16:28:59', 'USR-21050007', NULL, NULL),
('3RDPADR-21070005', '3RDP-21050002', 1, 'qwe', 'aaasss', '', '', '2222', '2021-07-29 16:22:46', 'USR-21050007', NULL, NULL, NULL, NULL),
('3RDPADR-21070006', '3RDP-21050002', 0, 'asd', 'aaa', '', 'Jakarta Pusat', '11112', '2021-07-29 16:30:34', 'USR-21050007', NULL, NULL, NULL, NULL),
('3RDPADR-21070007', '3RDP-21070001', 1, 'ssss', 'wewewewewe', '', 'Jakarta Selatan', '44444', '2021-07-29 16:35:52', 'USR-21050007', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_third_party_phone`
--

CREATE TABLE `tm_third_party_phone` (
  `id` varchar(16) NOT NULL,
  `third_party_id` varchar(15) NOT NULL,
  `is_default` tinyint(1) NOT NULL DEFAULT 0,
  `name` varchar(50) NOT NULL DEFAULT 'Utama',
  `number` varchar(20) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_third_party_phone`
--

INSERT INTO `tm_third_party_phone` (`id`, `third_party_id`, `is_default`, `name`, `number`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('3RDPPHN-2105000', '3RDP-21050002', 0, 'asdss', '(5489) 1561-1237', '2021-05-19 15:56:31', 'USR-21040000', '2021-05-19 16:06:11', 'USR-21040000', '2021-05-19 16:06:11', 'USR-21040000'),
('3RDPPHN-21050001', '3RDP-21050002', 0, 'Nomor Utama', '(5489) 1561-8510', '2021-05-19 16:08:28', 'USR-21040000', '2021-07-28 17:31:18', 'USR-21050007', NULL, NULL),
('3RDPPHN-21055001', '3RDP-21050004', 0, 'Utama', '+62 21 3917 060', '2021-05-19 16:14:25', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPPHN-21055002', '3RDP-21050004', 0, 'asxczxcz', '(5489) 1561-1465', '2021-05-19 16:24:50', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPPHN-21055003', '3RDP-21050004', 0, 'xxxx', '(0000) 0111-1222', '2021-05-19 16:36:51', 'USR-21040000', '2021-05-19 16:37:03', 'USR-21040000', '2021-05-19 16:37:03', 'USR-21040000'),
('3RDPPHN-21070001', '3RDP-21060001', 0, 'Utama', '(6221) 1122-3344', '2021-07-21 21:30:52', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPPHN-21070002', '3RDP-21050002', 0, 'Nomor Telepon Utama', '(0857) 1992-1515', '2021-07-27 15:50:16', 'USR-21040000', '2021-07-27 15:53:07', 'USR-21040000', '2021-07-27 15:53:07', 'USR-21040000'),
('3RDPPHN-21070003', '3RDP-21050002', 1, 'asd', '6281212345678', '2021-07-29 19:20:23', 'USR-21050007', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_third_party_type`
--

CREATE TABLE `tm_third_party_type` (
  `id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_third_party_type`
--

INSERT INTO `tm_third_party_type` (`id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('3RDPT-21040001', 'Warehouse', '2021-05-19 14:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPT-21040002', 'Customer', '2021-05-19 14:00:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('3RDPT-21040003', 'Marketing', '2021-05-25 10:18:46', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tm_warehouses`
--

CREATE TABLE `tm_warehouses` (
  `id` varchar(15) NOT NULL,
  `region_id` varchar(15) NOT NULL,
  `name` varchar(50) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tm_warehouses`
--

INSERT INTO `tm_warehouses` (`id`, `region_id`, `name`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('WHS-21040001', 'RGN-21040001', 'Head Office Jakartaa', '2021-04-29 11:51:00', 'USR-21040001', '2021-05-05 11:53:09', 'USR-21040000', NULL, NULL);

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

--
-- Struktur dari tabel `tp_customer_type_product_sale_price`
--

CREATE TABLE `tp_customer_type_product_sale_price` (
  `customer_type_id` char(12) NOT NULL,
  `product_id` char(15) NOT NULL,
  `sale_price` decimal(10,2) NOT NULL DEFAULT 0.00,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_customer_type_product_sale_price`
--

INSERT INTO `tp_customer_type_product_sale_price` (`customer_type_id`, `product_id`, `sale_price`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('CTYP-2107001', 'PRD-21050001', '2500.00', '2021-07-22 15:22:53', 'USR-21040000', '2021-07-22 15:40:13', 'USR-21040000', NULL, NULL),
('CTYP-2107001', 'PRD-21070002', '1400.00', '2021-07-22 15:22:59', 'USR-21040000', NULL, NULL, NULL, NULL),
('CTYP-2107001', 'PRD-21070001', '500.00', '2021-07-22 15:23:12', 'USR-21040000', NULL, NULL, NULL, NULL),
('CTYP-2107001', 'PRD-21050002', '0.00', '2021-07-22 15:24:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('CTYP-2107001', 'PRD-21070009', '60000.00', '2021-07-23 15:35:30', 'USR-21040000', NULL, NULL, NULL, NULL),
('CTYP-2107001', 'PRD-21070013', '19000.00', '2021-07-23 15:35:40', 'USR-21040000', NULL, NULL, NULL, NULL),
('CTYP-2107001', 'PRD-21070014', '30000.00', '2021-07-23 15:35:50', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tp_factory_batch`
--

CREATE TABLE `tp_factory_batch` (
  `id` varchar(15) NOT NULL,
  `brand_id` varchar(15) NOT NULL,
  `machine_id` char(10) NOT NULL,
  `number` char(11) NOT NULL,
  `process_date` date NOT NULL,
  `qty` float(9,2) NOT NULL DEFAULT 0.00,
  `remaining_qty` float(9,2) NOT NULL DEFAULT 0.00,
  `used_qty` float(9,2) NOT NULL DEFAULT 0.00,
  `wasted_qty` float(9,2) NOT NULL DEFAULT 0.00,
  `expired_date` date DEFAULT NULL,
  `is_used` tinyint(1) NOT NULL DEFAULT 1,
  `description` varchar(200) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_factory_batch`
--

INSERT INTO `tp_factory_batch` (`id`, `brand_id`, `machine_id`, `number`, `process_date`, `qty`, `remaining_qty`, `used_qty`, `wasted_qty`, `expired_date`, `is_used`, `description`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('BTH-21080001', 'BRN-21050003', 'M-21070005', '01001210813', '2021-08-13', 100.00, 20.50, 76.50, 3.00, '2022-08-13', 1, '', '2021-08-13 15:33:06', 'USR-21060002', '2021-08-16 16:45:34', 'USR-21060002', NULL, NULL),
('BTH-21080002', 'BRN-21070002', 'M-21070004', '01001210816', '2021-08-16', 50.00, 14.00, 28.75, 7.25, '2021-08-31', 1, 'dev', '2021-08-16 17:34:56', 'USR-21060002', '2021-08-18 16:00:45', 'USR-21060002', NULL, NULL);

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

--
-- Struktur dari tabel `tp_factory_purchase`
--

CREATE TABLE `tp_factory_purchase` (
  `purchase_id` char(12) NOT NULL,
  `qty` float(9,2) NOT NULL,
  `remaining_qty` float(9,2) NOT NULL,
  `used_qty` float(9,2) NOT NULL DEFAULT 0.00,
  `wasted_qty` float(9,2) NOT NULL DEFAULT 0.00,
  `remark` varchar(255) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(12) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(12) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(12) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_factory_purchase`
--

INSERT INTO `tp_factory_purchase` (`purchase_id`, `qty`, `remaining_qty`, `used_qty`, `wasted_qty`, `remark`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PUR-21080005', 50.00, 25.00, 20.00, 5.00, 'dev', '2021-08-16 17:37:09', 'USR-21060002', '2021-08-18 10:36:28', '3RDP-2105000', NULL, NULL),
('PUR-21080006', 25.00, 17.00, 7.50, 0.50, 'dev', '2021-08-18 11:39:19', 'USR-21060002', '2021-08-18 15:23:59', '3RDP-2105000', NULL, NULL),
('PUR-21080007', 17.00, 17.00, 0.00, 0.00, 'dev', '2021-08-18 15:59:41', 'USR-21060002', '2021-08-18 16:05:05', '3RDP-2105000', NULL, NULL),
('PUR-21080008', 14.00, 14.00, 0.00, 0.00, 'dev', '2021-08-18 16:13:22', 'USR-21060002', '2021-08-18 16:18:51', 'USR-21060002', '2021-08-18 16:18:51', 'USR-21060002'),
('PUR-21080009', 20.50, 20.50, 0.00, 0.00, 'dev', '2021-08-18 16:29:11', 'USR-21060002', '2021-08-18 16:29:40', 'USR-21060002', '2021-08-18 16:29:40', 'USR-21060002');

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

--
-- Struktur dari tabel `tp_machine_brand`
--

CREATE TABLE `tp_machine_brand` (
  `machine_id` char(15) NOT NULL,
  `brand_id` char(15) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_machine_brand`
--

INSERT INTO `tp_machine_brand` (`machine_id`, `brand_id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('M-21070001', 'BRN-21050002', '2021-07-15 17:04:45', 'USR-21040000', '2021-07-23 11:05:40', 'USR-21040000', '2021-07-23 11:05:40', 'USR-21040000'),
('M-21070001', 'BRN-21050003', '2021-07-15 17:04:45', 'USR-21040000', '2021-07-23 16:19:08', 'USR-21040000', '2021-07-23 16:19:08', 'USR-21040000'),
('M-21070002', 'BRN-21070001', '2021-07-15 17:04:52', 'USR-21040000', '2021-07-23 11:06:39', 'USR-21040000', '2021-07-23 11:06:39', 'USR-21040000'),
('M-21070004', 'BRN-21050003', '2021-07-15 22:34:39', 'USR-21040000', '2021-07-23 11:07:19', 'USR-21040000', '2021-07-23 11:07:19', 'USR-21040000'),
('M-21070004', 'BRN-21070001', '2021-07-15 22:34:39', 'USR-21040000', '2021-07-16 15:55:29', 'USR-21040000', '2021-07-16 15:55:29', 'USR-21040000'),
('M-21070004', 'BRN-21050002', '2021-07-15 23:12:21', 'USR-21040000', '2021-07-23 11:07:19', 'USR-21040000', '2021-07-23 11:07:19', 'USR-21040000'),
('M-21070002', 'BRN-21050002', '2021-07-16 16:19:14', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070002', 'BRN-21050003', '2021-07-17 22:49:58', 'USR-21040000', '2021-07-23 11:06:39', 'USR-21040000', '2021-07-23 11:06:39', 'USR-21040000'),
('M-21070001', 'BRN-21070001', '2021-07-23 11:05:40', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070001', 'BRN-21070004', '2021-07-23 11:05:40', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070002', 'BRN-21070005', '2021-07-23 11:06:39', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070004', 'BRN-21070002', '2021-07-23 11:07:19', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070004', 'BRN-21070003', '2021-07-23 11:07:19', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070004', 'BRN-21070006', '2021-07-23 11:07:19', 'USR-21040000', '2021-07-23 16:20:45', 'USR-21040000', '2021-07-23 16:20:45', 'USR-21040000'),
('M-21070005', 'BRN-21050003', '2021-07-23 16:19:39', 'USR-21040000', NULL, NULL, NULL, NULL),
('M-21070006', 'BRN-21070003', '2021-07-27 19:31:07', 'USR-21040000', NULL, NULL, '2021-07-27 19:31:12', 'USR-21040000'),
('M-21070005', 'BRN-21070005', '2021-07-28 14:14:42', 'USR-21040000', '2021-07-28 14:15:09', 'USR-21040000', '2021-07-28 14:15:09', 'USR-21040000');

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

--
-- Struktur dari tabel `tp_product_stock`
--

CREATE TABLE `tp_product_stock` (
  `product_id` char(15) NOT NULL,
  `warehouse_id` char(15) NOT NULL,
  `expired_date` date NOT NULL,
  `qty` int(11) NOT NULL DEFAULT 0,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_product_stock`
--

INSERT INTO `tp_product_stock` (`product_id`, `warehouse_id`, `expired_date`, `qty`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PRD-21070003', '3RDP-21050000', '2021-08-31', 60, '2021-08-18 11:08:00', 'USR-21060002', '2021-08-18 16:02:39', 'USR-21060002', NULL, NULL),
('PRD-21070004', '3RDP-21050000', '2021-08-31', 25, '2021-08-18 11:08:00', 'USR-21060002', '2021-08-18 15:58:44', 'USR-21060002', NULL, NULL),
('PRD-21070009', '3RDP-21050000', '2022-08-13', -140, '2021-08-13 15:35:32', 'USR-21060002', '2021-08-16 17:15:21', 'USR-21060002', NULL, NULL),
('PRD-21070009', '3RDP-21050004', '2022-08-13', 0, '2021-08-13 16:26:50', 'USR-21050007', '2021-08-15 18:02:47', 'USR-21050007', NULL, NULL),
('PRD-21070010', '3RDP-21050000', '2022-08-13', 0, '2021-08-13 16:47:41', 'USR-21060002', '2021-08-13 16:48:03', 'USR-21060002', NULL, NULL);

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

--
-- Struktur dari tabel `tp_purchase`
--

CREATE TABLE `tp_purchase` (
  `id` char(15) NOT NULL,
  `no_ref` varchar(30) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0: purchase;\r\n1: stock transfer return;\r\n2: sales return;',
  `supplier_id` varchar(15) NOT NULL,
  `warehouse_id` varchar(15) NOT NULL,
  `total_discount` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_tax` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_net` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `remark` varchar(255) DEFAULT NULL,
  `posted_at` datetime DEFAULT NULL,
  `posted_by` char(15) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_purchase`
--

INSERT INTO `tp_purchase` (`id`, `no_ref`, `date`, `type`, `supplier_id`, `warehouse_id`, `total_discount`, `total_tax`, `total_net`, `remark`, `posted_at`, `posted_by`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PUR-21080002', 'BTH-21080001', '2021-08-13', 0, '3RDP-21050000', '3RDP-21050000', '0.0000', '0.0000', '266914.0000', '', '2021-08-16 16:47:32', 'USR-21060002', '2021-08-13 15:35:53', 'USR-21060002', '2021-08-16 16:47:32', 'USR-21060002', NULL, NULL),
('PUR-21080003', 'ST-21080001', '2021-08-08', 0, '3RDP-21050000', '3RDP-21050004', '0.0000', '0.0000', '0.0000', '', NULL, NULL, '2021-08-13 16:26:50', 'USR-21050007', '2021-08-13 16:26:50', 'USR-21050007', NULL, NULL),
('PUR-21080005', 'BTH-21080002', '2021-08-16', 0, '3RDP-21050000', '3RDP-21050000', '0.0000', '0.0000', '1222815.0000', 'dev', '2021-08-18 11:08:00', 'USR-21060002', '2021-08-16 17:37:09', 'USR-21060002', '2021-08-18 11:08:00', 'USR-21060002', NULL, NULL),
('PUR-21080006', 'BTH-21080002', '2021-08-16', 0, '3RDP-21050000', '3RDP-21050000', '0.0000', '0.0000', '470055.6500', 'dev', '2021-08-18 15:58:44', 'USR-21060002', '2021-08-18 11:39:19', 'USR-21060002', '2021-08-18 15:58:44', 'USR-21060002', NULL, NULL),
('PUR-21080007', 'BTH-21080002', '2021-08-16', 0, '3RDP-21050000', '3RDP-21050000', '0.0000', '0.0000', '82175.9500', 'dev', NULL, NULL, '2021-08-18 15:59:41', 'USR-21060002', '2021-08-18 16:05:05', 'USR-21060002', '2021-08-18 16:05:05', 'USR-21060002'),
('PUR-21080008', 'BTH-21080002', '2021-08-16', 0, '3RDP-21050000', '3RDP-21050000', '0.0000', '0.0000', '0.0000', 'dev', NULL, NULL, '2021-08-18 16:13:22', 'USR-21060002', '2021-08-18 16:18:51', 'USR-21060002', '2021-08-18 16:18:51', 'USR-21060002'),
('PUR-21080009', 'BTH-21080001', '2021-08-13', 0, '3RDP-21050000', '3RDP-21050000', '0.0000', '0.0000', '0.0000', 'dev', NULL, NULL, '2021-08-18 16:29:11', 'USR-21060002', '2021-08-18 16:29:40', 'USR-21060002', '2021-08-18 16:29:40', 'USR-21060002'),
('TR-21080001', 'PR-21080001', '2021-08-13', 1, '3RDP-21050004', '3RDP-21050000', '0.0000', '0.0000', '0.0000', '', '2021-08-13 16:52:22', 'USR-21060002', '2021-08-13 16:52:22', 'USR-21060002', '2021-08-13 16:52:22', 'USR-21060002', NULL, NULL);

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

--
-- Struktur dari tabel `tp_purchase_detail`
--

CREATE TABLE `tp_purchase_detail` (
  `purchase_id` char(15) NOT NULL,
  `product_id` char(15) NOT NULL,
  `expired_date` date NOT NULL,
  `qty` smallint(6) NOT NULL DEFAULT 0,
  `price` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `discount` float NOT NULL DEFAULT 0,
  `tax` float NOT NULL DEFAULT 0,
  `sub_total` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_purchase_detail`
--

INSERT INTO `tp_purchase_detail` (`purchase_id`, `product_id`, `expired_date`, `qty`, `price`, `discount`, `tax`, `sub_total`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PUR-21080002', 'PRD-21070009', '2022-08-13', 20, '13345.7000', 0, 0, '266914.0000', '2021-08-13 15:39:53', 'USR-21060002', NULL, NULL, NULL, NULL),
('PUR-21080003', 'PRD-21070009', '2022-08-13', 120, '0.0000', 0, 0, '0.0000', '2021-08-13 16:26:50', 'USR-21050007', NULL, NULL, NULL, NULL),
('PUR-21080005', 'PRD-21070003', '2021-08-31', 40, '16435.1900', 0, 0, '657407.6000', '2021-08-18 10:21:07', 'USR-21060002', '2021-08-18 10:31:06', 'USR-21060002', NULL, NULL),
('PUR-21080005', 'PRD-21070004', '2021-08-31', 20, '28270.3700', 0, 0, '565407.4000', '2021-08-18 10:35:56', 'USR-21060002', '2021-08-18 10:36:28', 'USR-21060002', NULL, NULL),
('PUR-21080006', 'PRD-21070003', '2021-08-31', 20, '16435.1900', 0, 0, '328703.8000', '2021-08-18 14:13:05', 'USR-21060002', NULL, NULL, NULL, NULL),
('PUR-21080006', 'PRD-21070004', '2021-08-31', 5, '28270.3700', 0, 0, '141351.8500', '2021-08-18 15:23:59', 'USR-21060002', NULL, NULL, NULL, NULL),
('TR-21080001', 'PRD-21070009', '2022-08-13', 10, '0.0000', 0, 0, '0.0000', '2021-08-13 16:52:22', 'USR-21060002', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tp_role_permission`
--

CREATE TABLE `tp_role_permission` (
  `role_id` varchar(15) NOT NULL,
  `permission_id` varchar(15) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_role_permission`
--

INSERT INTO `tp_role_permission` (`role_id`, `permission_id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('ROL-21050001', 'PRM-21050002', '2021-05-11 15:28:33', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050006', '2021-05-17 09:42:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050005', '2021-05-17 09:42:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050001', '2021-05-17 09:42:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050009', '2021-05-17 10:30:47', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050011', '2021-05-17 10:31:55', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050012', '2021-05-17 10:31:55', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050013', '2021-05-17 13:49:52', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050014', '2021-05-17 13:50:07', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050010', '2021-05-17 14:28:21', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050003', '2021-05-17 14:58:27', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050019', '2021-05-18 09:09:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050020', '2021-05-18 09:09:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050023', '2021-05-18 10:01:34', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050024', '2021-05-18 10:01:34', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050033', '2021-05-19 14:46:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050004', '2021-05-20 10:09:08', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050015', '2021-05-20 10:38:07', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050016', '2021-05-20 10:38:07', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050025', '2021-05-20 10:38:07', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050026', '2021-05-20 10:38:07', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050027', '2021-05-20 10:55:30', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050028', '2021-05-20 10:55:30', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050029', '2021-05-24 16:11:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050030', '2021-05-24 16:11:05', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050036', '2021-05-25 10:24:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050037', '2021-05-25 10:24:58', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050038', '2021-05-31 11:16:28', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050039', '2021-05-31 11:16:28', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050006', '2021-05-31 15:16:51', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050027', '2021-05-31 15:16:51', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050028', '2021-05-31 15:16:51', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050029', '2021-05-31 15:16:51', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050030', '2021-05-31 15:16:51', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050046', '2021-06-02 09:27:01', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21050021', '2021-06-02 09:28:57', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050006', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050021', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050022', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050019', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050020', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050027', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050028', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050029', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050030', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050031', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21050032', '2021-06-07 17:23:17', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070001', '2021-07-01 10:48:11', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070002', '2021-07-01 10:48:11', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21070001', '2021-07-01 10:48:32', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21070002', '2021-07-01 10:48:32', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050046', '2021-07-01 10:49:11', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050005', '2021-07-01 10:50:51', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070003', '2021-07-05 10:44:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070004', '2021-07-05 10:44:31', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070005', '2021-07-13 17:23:27', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070006', '2021-07-13 17:23:27', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050031', '2021-07-13 17:24:25', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050032', '2021-07-13 17:24:25', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070009', '2021-07-15 09:36:38', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070010', '2021-07-15 09:36:38', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21070011', '2021-07-15 11:33:38', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21070012', '2021-07-15 11:33:38', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070007', '2021-07-21 16:12:52', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21070008', '2021-07-21 16:12:52', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21070013', '2021-07-22 10:31:27', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21070014', '2021-07-22 10:31:27', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050009', '2021-07-27 16:52:10', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21050010', '2021-07-27 16:52:10', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21080001', '2021-08-10 14:38:06', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21080002', '2021-08-10 14:38:06', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21080003', '2021-08-12 11:10:59', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050003', 'PRM-21080004', '2021-08-12 11:10:59', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21080003', '2021-08-12 11:11:28', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21050001', 'PRM-21080004', '2021-08-12 11:11:28', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21070009', '2021-08-16 14:10:03', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21070010', '2021-08-16 14:10:03', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21080005', '2021-08-16 14:10:03', 'USR-21040000', NULL, NULL, NULL, NULL),
('ROL-21060001', 'PRM-21080006', '2021-08-16 14:10:03', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tp_sales`
--

CREATE TABLE `tp_sales` (
  `id` char(15) NOT NULL,
  `no_ref` varchar(30) DEFAULT NULL,
  `serial_number` smallint(5) UNSIGNED DEFAULT 1 COMMENT 'nomor urut pada surat jalan',
  `date` date NOT NULL,
  `type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0: sales;\r\n1: stok transfer;\r\n2: purchase return;',
  `warehouse_id` char(15) NOT NULL,
  `warehouse_owner_id` char(15) DEFAULT NULL,
  `is_sold_from_partner` tinyint(4) NOT NULL DEFAULT 0,
  `salesman_id` char(15) DEFAULT NULL,
  `customer_id` char(15) NOT NULL,
  `customer_address_id` char(16) DEFAULT NULL,
  `customer_phone_id` char(16) DEFAULT NULL,
  `payment_type_id` char(4) DEFAULT NULL,
  `term` smallint(6) NOT NULL DEFAULT 0,
  `due_date` date DEFAULT NULL,
  `total_discount` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_tax` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_shipping` int(11) NOT NULL DEFAULT 0,
  `total_net` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_payment` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `remark` varchar(255) DEFAULT NULL,
  `shipping_cost_status` tinyint(4) NOT NULL DEFAULT 0,
  `posted_at` datetime DEFAULT NULL,
  `posted_by` char(15) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_sales`
--

INSERT INTO `tp_sales` (`id`, `no_ref`, `serial_number`, `date`, `type`, `warehouse_id`, `warehouse_owner_id`, `is_sold_from_partner`, `salesman_id`, `customer_id`, `customer_address_id`, `customer_phone_id`, `payment_type_id`, `term`, `due_date`, `total_discount`, `total_tax`, `total_shipping`, `total_net`, `total_payment`, `remark`, `shipping_cost_status`, `posted_at`, `posted_by`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PR-21080001', 'PUR-21080003', 1, '2021-08-13', 2, '3RDP-21050004', '3RDP-21050004', 0, NULL, '3RDP-21050000', NULL, NULL, NULL, 0, NULL, '0.0000', '0.0000', 0, '0.0000', '0.0000', '', 0, '2021-08-13 16:29:04', 'USR-21050007', '2021-08-13 16:28:23', 'USR-21050007', '2021-08-13 16:29:04', 'USR-21050007', NULL, NULL),
('SL-21080001', NULL, 1, '2021-08-15', 0, '3RDP-21060001', '3RDP-21060001', 0, '3RDP-21050007', '3RDP-21050002', '3RDPADR-21070005', '3RDPPHN-21070003', NULL, 0, '2021-08-22', '0.0000', '0.0000', 0, '0.0000', '0.0000', 'dev', 0, NULL, NULL, '2021-08-15 17:01:24', 'USR-21060001', NULL, NULL, NULL, NULL),
('SL-21080002', NULL, 1, '2021-08-15', 0, '3RDP-21050004', '3RDP-21050004', 0, '3RDP-21050007', '3RDP-21050002', '3RDPADR-2105000', '3RDPPHN-21070003', NULL, 0, '2021-08-22', '0.0000', '0.0000', 0, '0.0000', '0.0000', 'dev', 0, '2021-08-15 18:02:45', 'USR-21050007', '2021-08-15 17:02:00', 'USR-21050007', '2021-08-15 18:02:47', 'USR-21050007', NULL, NULL),
('ST-21080001', 'STPBR-2108001', 1, '2021-08-08', 0, '3RDP-21050000', '3RDP-21050000', 0, NULL, '3RDP-21050004', NULL, NULL, NULL, 0, '2021-08-15', '0.0000', '0.0000', 0, '0.0000', '0.0000', '', 0, '2021-08-13 16:07:08', 'USR-21060002', '2021-08-13 16:02:30', 'USR-21060002', '2021-08-13 16:07:09', 'USR-21060002', NULL, NULL),
('ST-21080002', 'STPBR-2108002', 2, '2021-08-09', 0, '3RDP-21050000', '3RDP-21050000', 0, NULL, '3RDP-21050004', NULL, NULL, NULL, 0, '2021-08-16', '0.0000', '0.0000', 0, '0.0000', '0.0000', '', 0, '2021-08-16 11:55:55', 'USR-21060002', '2021-08-13 16:46:29', 'USR-21060002', '2021-08-16 11:56:00', 'USR-21060002', NULL, NULL);

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

--
-- Struktur dari tabel `tp_sales_detail`
--

CREATE TABLE `tp_sales_detail` (
  `sales_id` char(15) NOT NULL,
  `product_id` char(15) NOT NULL,
  `expired_date` date NOT NULL,
  `qty` decimal(10,0) NOT NULL DEFAULT 0,
  `price` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `discount` float NOT NULL DEFAULT 0,
  `tax` float NOT NULL DEFAULT 0,
  `sub_total` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `remark` text DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_sales_detail`
--

INSERT INTO `tp_sales_detail` (`sales_id`, `product_id`, `expired_date`, `qty`, `price`, `discount`, `tax`, `sub_total`, `remark`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('PR-21080001', 'PRD-21070009', '2022-08-13', '10', '0.0000', 0, 0, '0.0000', NULL, '2021-08-13 16:28:46', 'USR-21050007', NULL, NULL, NULL, NULL),
('SL-21080002', 'PRD-21070009', '2022-08-13', '110', '0.0000', 0, 0, '0.0000', 'dev', '2021-08-15 17:02:09', 'USR-21050007', NULL, NULL, NULL, NULL),
('ST-21080001', 'PRD-21070009', '2022-08-13', '120', '0.0000', 0, 0, '0.0000', NULL, '2021-08-13 16:06:40', 'USR-21060002', NULL, NULL, NULL, NULL),
('ST-21080002', 'PRD-21070009', '2022-08-13', '50', '0.0000', 0, 0, '0.0000', NULL, '2021-08-13 16:50:05', 'USR-21060002', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `tp_sales_promotion`
--

CREATE TABLE `tp_sales_promotion` (
  `id` char(15) NOT NULL,
  `no_ref` varchar(30) DEFAULT NULL,
  `serial_number` smallint(5) UNSIGNED DEFAULT 1 COMMENT 'nomor urut pada surat jalan',
  `date` date NOT NULL,
  `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0: promotion;\r\n1: discount;',
  `warehouse_id` char(15) NOT NULL,
  `warehouse_owner_id` char(15) DEFAULT NULL,
  `is_sold_from_partner` tinyint(4) NOT NULL DEFAULT 0,
  `salesman_id` char(15) DEFAULT NULL,
  `customer_id` char(15) NOT NULL,
  `customer_address_id` char(16) DEFAULT NULL,
  `customer_phone_id` char(16) DEFAULT NULL,
  `payment_type_id` char(4) DEFAULT NULL,
  `term` smallint(6) NOT NULL DEFAULT 0,
  `due_date` date DEFAULT NULL,
  `total_discount` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_tax` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_shipping` int(11) NOT NULL DEFAULT 0,
  `total_net` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `total_payment` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `remark` varchar(255) DEFAULT NULL,
  `shipping_cost_status` tinyint(4) NOT NULL DEFAULT 0,
  `posted_at` datetime DEFAULT NULL,
  `posted_by` char(15) DEFAULT NULL,
  `is_approved` tinyint(1) NOT NULL DEFAULT 0,
  `approved_at` datetime DEFAULT NULL,
  `approved_by` char(12) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Struktur dari tabel `tp_sales_promotion_detail`
--

CREATE TABLE `tp_sales_promotion_detail` (
  `promotion_id` char(15) NOT NULL,
  `product_id` char(15) NOT NULL,
  `expired_date` date NOT NULL,
  `qty` decimal(10,0) NOT NULL DEFAULT 0,
  `price` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `discount` float NOT NULL DEFAULT 0,
  `tax` float NOT NULL DEFAULT 0,
  `sub_total` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `remark` text DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Struktur dari tabel `tp_sp`
--

CREATE TABLE `tp_sp` (
  `id` char(15) NOT NULL,
  `date` date NOT NULL,
  `ref` char(30) DEFAULT NULL,
  `type` tinyint(1) NOT NULL DEFAULT 0,
  `sales_id` char(12) NOT NULL,
  `payment_type_id` char(12) NOT NULL,
  `warehouse_id` char(15) NOT NULL,
  `wh_owner_id` char(15) DEFAULT NULL,
  `customer_id` char(15) NOT NULL,
  `currency_id` char(12) DEFAULT NULL,
  `bank_id` char(12) NOT NULL,
  `bank_info` varchar(120) NOT NULL,
  `bank_date` date DEFAULT NULL,
  `bank_fee` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `amount` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `cashback` decimal(15,4) NOT NULL DEFAULT 0.0000,
  `is_add_to_coh` tinyint(1) NOT NULL DEFAULT 0,
  `remark` varchar(100) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `created_by` char(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` char(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` char(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

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

--
-- Struktur dari tabel `tp_user_role`
--

CREATE TABLE `tp_user_role` (
  `user_id` varchar(15) NOT NULL,
  `role_id` varchar(15) NOT NULL,
  `created_at` datetime NOT NULL,
  `created_by` varchar(15) NOT NULL,
  `updated_at` datetime DEFAULT NULL,
  `updated_by` varchar(15) DEFAULT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` varchar(15) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data untuk tabel `tp_user_role`
--

INSERT INTO `tp_user_role` (`user_id`, `role_id`, `created_at`, `created_by`, `updated_at`, `updated_by`, `deleted_at`, `deleted_by`) VALUES
('USR-21040000', 'ROL-21050001', '2021-05-05 10:10:00', 'USR-21040000', NULL, NULL, NULL, NULL),
('USR-21050007', 'ROL-21050003', '2021-05-31 17:17:48', 'USR-21040000', NULL, NULL, NULL, NULL),
('USR-21060001', 'ROL-21050003', '2021-06-07 09:38:35', 'USR-21040000', NULL, NULL, NULL, NULL),
('USR-21060002', 'ROL-21060001', '2021-06-07 17:23:42', 'USR-21040000', NULL, NULL, NULL, NULL);

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

--
-- Indeks untuk tabel `tm_brand`
--
ALTER TABLE `tm_brand`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_item_sub_brand` (`product_sub_category_id`);

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

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

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

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

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

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

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

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

--
-- Indeks untuk tabel `tm_product`
--
ALTER TABLE `tm_product`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_brand_product` (`brand_id`);

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

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

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

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

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

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

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

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

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

--
-- Indeks untuk tabel `tm_warehouses`
--
ALTER TABLE `tm_warehouses`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `fk_warehouse_region` (`region_id`);

--
-- Indeks untuk tabel `tp_factory_batch`
--
ALTER TABLE `tp_factory_batch`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_brand_id_factory_batch` (`brand_id`);

--
-- Indeks untuk tabel `tp_factory_purchase`
--
ALTER TABLE `tp_factory_purchase`
  ADD PRIMARY KEY (`purchase_id`);

--
-- Indeks untuk tabel `tp_product_stock`
--
ALTER TABLE `tp_product_stock`
  ADD PRIMARY KEY (`product_id`,`warehouse_id`,`expired_date`) USING BTREE,
  ADD KEY `fk_warehouse_product_stock` (`warehouse_id`);

--
-- Indeks untuk tabel `tp_purchase`
--
ALTER TABLE `tp_purchase`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_warehouse_purchase` (`warehouse_id`),
  ADD KEY `fk_supplier_purchase` (`supplier_id`);

--
-- Indeks untuk tabel `tp_purchase_detail`
--
ALTER TABLE `tp_purchase_detail`
  ADD PRIMARY KEY (`purchase_id`,`product_id`,`expired_date`) USING BTREE;

--
-- Indeks untuk tabel `tp_role_permission`
--
ALTER TABLE `tp_role_permission`
  ADD KEY `fk_permission_role_permission` (`role_id`),
  ADD KEY `fk_permission_role_role` (`permission_id`);

--
-- Indeks untuk tabel `tp_sales`
--
ALTER TABLE `tp_sales`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_customer_sales` (`customer_id`),
  ADD KEY `fk_salesman_sales` (`salesman_id`),
  ADD KEY `fk_warehouse_owner_sales` (`warehouse_owner_id`),
  ADD KEY `fk_warehouse_sales` (`warehouse_id`);

--
-- Indeks untuk tabel `tp_sales_detail`
--
ALTER TABLE `tp_sales_detail`
  ADD PRIMARY KEY (`sales_id`,`product_id`,`expired_date`) USING BTREE;

--
-- Indeks untuk tabel `tp_sales_promotion`
--
ALTER TABLE `tp_sales_promotion`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_customer_sales` (`customer_id`),
  ADD KEY `fk_salesman_sales` (`salesman_id`),
  ADD KEY `fk_warehouse_owner_sales` (`warehouse_owner_id`),
  ADD KEY `fk_warehouse_sales` (`warehouse_id`);

--
-- Indeks untuk tabel `tp_sales_promotion_detail`
--
ALTER TABLE `tp_sales_promotion_detail`
  ADD PRIMARY KEY (`promotion_id`,`product_id`,`expired_date`) USING BTREE;

--
-- Indeks untuk tabel `tp_sp`
--
ALTER TABLE `tp_sp`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fk_sales_sp` (`sales_id`),
  ADD KEY `fk_bank_sp` (`bank_id`),
  ADD KEY `fk_payment_type_sp` (`payment_type_id`),
  ADD KEY `fk_warehouse_sp` (`warehouse_id`),
  ADD KEY `fk_customer_sp` (`customer_id`);

--
-- Indeks untuk tabel `tp_user_role`
--
ALTER TABLE `tp_user_role`
  ADD KEY `fk_user_role_user` (`user_id`),
  ADD KEY `fk_user_role_role` (`role_id`);

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

--
-- Ketidakleluasaan untuk tabel `tm_brand`
--
ALTER TABLE `tm_brand`
  ADD CONSTRAINT `fk_item_sub_brand` FOREIGN KEY (`product_sub_category_id`) REFERENCES `tm_product_sub_category` (`id`);

--
-- Ketidakleluasaan untuk tabel `tm_product`
--
ALTER TABLE `tm_product`
  ADD CONSTRAINT `fk_brand_product` FOREIGN KEY (`brand_id`) REFERENCES `tm_brand` (`id`);

--
-- Ketidakleluasaan untuk tabel `tm_warehouses`
--
ALTER TABLE `tm_warehouses`
  ADD CONSTRAINT `fk_warehouse_region` FOREIGN KEY (`region_id`) REFERENCES `tm_region` (`id`);

--
-- Ketidakleluasaan untuk tabel `tp_factory_batch`
--
ALTER TABLE `tp_factory_batch`
  ADD CONSTRAINT `fk_brand_id_factory_batch` FOREIGN KEY (`brand_id`) REFERENCES `tm_brand` (`id`);

--
-- Ketidakleluasaan untuk tabel `tp_product_stock`
--
ALTER TABLE `tp_product_stock`
  ADD CONSTRAINT `fk_product_product_stock` FOREIGN KEY (`product_id`) REFERENCES `tm_product` (`id`),
  ADD CONSTRAINT `fk_warehouse_product_stock` FOREIGN KEY (`warehouse_id`) REFERENCES `tm_third_party` (`id`);

--
-- Ketidakleluasaan untuk tabel `tp_purchase`
--
ALTER TABLE `tp_purchase`
  ADD CONSTRAINT `fk_supplier_purchase` FOREIGN KEY (`supplier_id`) REFERENCES `tm_third_party` (`id`),
  ADD CONSTRAINT `fk_warehouse_purchase` FOREIGN KEY (`warehouse_id`) REFERENCES `tm_third_party` (`id`);

--
-- Ketidakleluasaan untuk tabel `tp_role_permission`
--
ALTER TABLE `tp_role_permission`
  ADD CONSTRAINT `fk_role_permission_permission` FOREIGN KEY (`role_id`) REFERENCES `tm_role` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_role_permission_role` FOREIGN KEY (`permission_id`) REFERENCES `tm_permission` (`id`) ON UPDATE CASCADE;

--
-- Ketidakleluasaan untuk tabel `tp_sales`
--
ALTER TABLE `tp_sales`
  ADD CONSTRAINT `fk_customer_sales` FOREIGN KEY (`customer_id`) REFERENCES `tm_third_party` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `fk_salesman_sales` FOREIGN KEY (`salesman_id`) REFERENCES `tm_third_party` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `fk_warehouse_owner_sales` FOREIGN KEY (`warehouse_owner_id`) REFERENCES `tm_third_party` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  ADD CONSTRAINT `fk_warehouse_sales` FOREIGN KEY (`warehouse_id`) REFERENCES `tm_third_party` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;

--
-- Ketidakleluasaan untuk tabel `tp_sales_detail`
--
ALTER TABLE `tp_sales_detail`
  ADD CONSTRAINT `fk_sales_sales_detail` FOREIGN KEY (`sales_id`) REFERENCES `tp_sales` (`id`);

--
-- Ketidakleluasaan untuk tabel `tp_sp`
--
ALTER TABLE `tp_sp`
  ADD CONSTRAINT `fk_bank_sp` FOREIGN KEY (`bank_id`) REFERENCES `tm_bank` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_customer_sp` FOREIGN KEY (`customer_id`) REFERENCES `tm_third_party` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_payment_type_sp` FOREIGN KEY (`payment_type_id`) REFERENCES `tm_payment_type` (`id`) ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_sales_sp` FOREIGN KEY (`sales_id`) REFERENCES `tp_sales` (`id`),
  ADD CONSTRAINT `fk_warehouse_sp` FOREIGN KEY (`warehouse_id`) REFERENCES `tm_third_party` (`id`) ON UPDATE CASCADE;

--
-- Ketidakleluasaan untuk tabel `tp_user_role`
--
ALTER TABLE `tp_user_role`
  ADD CONSTRAINT `fk_user_role_role` FOREIGN KEY (`role_id`) REFERENCES `tm_role` (`id`),
  ADD CONSTRAINT `fk_user_role_user` FOREIGN KEY (`user_id`) REFERENCES `tm_user` (`id`);
COMMIT;

