Update Fix

This commit is contained in:
2026-03-06 03:26:11 +07:00
commit 8090007f39
15987 changed files with 2350525 additions and 0 deletions

547
sistem_pos.sql Normal file
View File

@@ -0,0 +1,547 @@
/*
Navicat Premium Data Transfer
Source Server : Local
Source Server Type : MySQL
Source Server Version : 100432
Source Host : localhost:3306
Source Schema : sistem_pos
Target Server Type : MySQL
Target Server Version : 100432
File Encoding : 65001
Date: 06/03/2026 01:57:40
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for distributors
-- ----------------------------
DROP TABLE IF EXISTS `distributors`;
CREATE TABLE `distributors` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`nama` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`alamat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`telepon` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of distributors
-- ----------------------------
INSERT INTO `distributors` VALUES (1, 'PT. Tirta Investama Pabrik Pandaan', 'Jalan Raya Surabaya - Malang km 48.5 Sukorejo, Kali Tengah, Karang Jati, Kec. Pandaan, Pasuruan, Jawa Timur 67156', '(0343) 633022', '2026-03-05 16:52:57', '2026-03-05 16:52:57');
-- ----------------------------
-- Table structure for failed_jobs
-- ----------------------------
DROP TABLE IF EXISTS `failed_jobs`;
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`uuid` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp(0) NOT NULL DEFAULT current_timestamp(0),
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `failed_jobs_uuid_unique`(`uuid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for lokasi
-- ----------------------------
DROP TABLE IF EXISTS `lokasi`;
CREATE TABLE `lokasi` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`kode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`nama` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `lokasi_kode_unique`(`kode`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of lokasi
-- ----------------------------
INSERT INTO `lokasi` VALUES (1, 'GUDANG', 'Gudang', '2026-02-20 18:39:45', '2026-02-20 18:39:45');
INSERT INTO `lokasi` VALUES (2, 'TOKO', 'Toko', '2026-02-20 18:39:45', '2026-02-20 18:39:45');
-- ----------------------------
-- Table structure for migrations
-- ----------------------------
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`migration` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of migrations
-- ----------------------------
INSERT INTO `migrations` VALUES (1, '2014_10_12_000000_create_users_table', 1);
INSERT INTO `migrations` VALUES (2, '2014_10_12_100000_create_password_reset_tokens_table', 1);
INSERT INTO `migrations` VALUES (3, '2019_08_19_000000_create_failed_jobs_table', 1);
INSERT INTO `migrations` VALUES (4, '2019_12_14_000001_create_personal_access_tokens_table', 1);
INSERT INTO `migrations` VALUES (5, '2026_02_19_154004_create_lokasi_table', 1);
INSERT INTO `migrations` VALUES (6, '2026_02_19_154010_create_produk_table', 1);
INSERT INTO `migrations` VALUES (7, '2026_02_19_154011_create_penjualan_table', 1);
INSERT INTO `migrations` VALUES (8, '2026_02_19_154011_create_pergerakan_stok_table', 1);
INSERT INTO `migrations` VALUES (9, '2026_02_19_154013_create_penjualan_barang_table', 1);
INSERT INTO `migrations` VALUES (10, '2026_02_20_173434_create_product_units_table', 1);
INSERT INTO `migrations` VALUES (11, '2026_02_21_000002_add_unit_fields_to_pergerakan_stok', 1);
INSERT INTO `migrations` VALUES (12, '2026_02_21_142229_create_transaksi_table', 2);
INSERT INTO `migrations` VALUES (13, '2026_02_21_210000_create_settings_table', 3);
INSERT INTO `migrations` VALUES (14, '2026_02_21_230000_add_user_id_to_penjualan_table', 4);
INSERT INTO `migrations` VALUES (15, '2026_02_21_231000_create_pegawai_table', 5);
INSERT INTO `migrations` VALUES (16, '2026_02_22_120000_add_role_to_users_table', 6);
INSERT INTO `migrations` VALUES (17, '2026_02_22_130000_add_nip_and_pegawai_id_to_users_table', 7);
INSERT INTO `migrations` VALUES (18, '2026_02_22_131000_add_profile_fields_to_pegawai_table', 7);
INSERT INTO `migrations` VALUES (19, '2026_02_27_190000_add_is_aktif_to_produk_table', 8);
INSERT INTO `migrations` VALUES (20, '2026_02_28_000001_create_vouchers_table', 9);
INSERT INTO `migrations` VALUES (21, '2026_02_28_000002_add_piutang_and_voucher_to_penjualan_table', 9);
INSERT INTO `migrations` VALUES (22, '2026_02_28_000004_create_voucher_histories_table', 10);
INSERT INTO `migrations` VALUES (23, '2026_02_28_000006_create_piutang_payments_table', 11);
INSERT INTO `migrations` VALUES (24, '2026_02_28_000007_add_unit_piutang_to_penjualan_table', 12);
INSERT INTO `migrations` VALUES (25, '2026_03_05_000001_add_pegawai_id_to_vouchers_table', 13);
INSERT INTO `migrations` VALUES (26, '2026_03_05_000002_add_voucher_amount_to_penjualan_table', 13);
INSERT INTO `migrations` VALUES (27, '2026_03_05_000003_create_distributors_table', 14);
INSERT INTO `migrations` VALUES (29, '2026_03_06_000001_create_penerimaan_barang_tables', 15);
-- ----------------------------
-- Table structure for password_reset_tokens
-- ----------------------------
DROP TABLE IF EXISTS `password_reset_tokens`;
CREATE TABLE `password_reset_tokens` (
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`email`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for pegawai
-- ----------------------------
DROP TABLE IF EXISTS `pegawai`;
CREATE TABLE `pegawai` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`nama` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`jabatan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`telepon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`alamat` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`is_aktif` tinyint(1) NOT NULL DEFAULT 1,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`nip` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`tempat_lahir` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`tanggal_lahir` date NULL DEFAULT NULL,
`jenis_kelamin` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`kota` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`nik` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`foto` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `pegawai_nip_unique`(`nip`) USING BTREE,
UNIQUE INDEX `pegawai_nik_unique`(`nik`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pegawai
-- ----------------------------
INSERT INTO `pegawai` VALUES (2, 'Andy Cahyono Putra', 'IT', '082140405769', 'JL H Syukur RT 19 RW 09', 1, '2026-03-05 16:37:14', '2026-03-05 16:37:14', '25.01.23.304', 'Sidoarjo', '1998-03-24', 'L', 'Sidoarjo', '351517240398', NULL);
INSERT INTO `pegawai` VALUES (3, 'tes', 'tes', '000000000', 'ts', 1, '2026-03-05 17:44:06', '2026-03-05 17:44:06', 'pegawai2', 'tes', NULL, 'L', 'tes', 'tes', NULL);
INSERT INTO `pegawai` VALUES (4, 'tes3', 'tes3', '00000000000', 'tes3', 1, '2026-03-05 17:44:25', '2026-03-05 17:44:25', 'pegawai 3', 'tes3', NULL, 'L', 'tes3', 'tes3', NULL);
-- ----------------------------
-- Table structure for penerimaan_barang
-- ----------------------------
DROP TABLE IF EXISTS `penerimaan_barang`;
CREATE TABLE `penerimaan_barang` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`nomor_penerimaan` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`no_faktur` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`tanggal_faktur` date NULL DEFAULT NULL,
`tanggal_datang` date NULL DEFAULT NULL,
`distributor_id` bigint(20) UNSIGNED NOT NULL,
`lokasi_id` bigint(20) UNSIGNED NOT NULL,
`user_id` bigint(20) UNSIGNED NOT NULL,
`status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'DRAFT',
`catatan` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
`applied_at` timestamp(0) NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `penerimaan_barang_nomor_penerimaan_unique`(`nomor_penerimaan`) USING BTREE,
INDEX `penerimaan_barang_distributor_id_foreign`(`distributor_id`) USING BTREE,
INDEX `penerimaan_barang_lokasi_id_foreign`(`lokasi_id`) USING BTREE,
INDEX `penerimaan_barang_user_id_foreign`(`user_id`) USING BTREE,
CONSTRAINT `penerimaan_barang_distributor_id_foreign` FOREIGN KEY (`distributor_id`) REFERENCES `distributors` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `penerimaan_barang_lokasi_id_foreign` FOREIGN KEY (`lokasi_id`) REFERENCES `lokasi` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `penerimaan_barang_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of penerimaan_barang
-- ----------------------------
INSERT INTO `penerimaan_barang` VALUES (1, 'RCV260305173335293', '26/03/06/INV222549', '2026-03-06', '2026-03-06', 1, 1, 1, 'SELESAI', NULL, '2026-03-05 17:33:44', '2026-03-05 17:33:35', '2026-03-05 17:33:44');
-- ----------------------------
-- Table structure for penerimaan_barang_items
-- ----------------------------
DROP TABLE IF EXISTS `penerimaan_barang_items`;
CREATE TABLE `penerimaan_barang_items` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`penerimaan_id` bigint(20) UNSIGNED NOT NULL,
`produk_id` bigint(20) UNSIGNED NOT NULL,
`unit_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`qty` int(10) UNSIGNED NOT NULL,
`qty_input` int(10) UNSIGNED NOT NULL DEFAULT 1,
`harga` int(10) UNSIGNED NULL DEFAULT NULL,
`unit` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`multiplier` int(10) UNSIGNED NOT NULL DEFAULT 1,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `penerimaan_barang_items_penerimaan_id_foreign`(`penerimaan_id`) USING BTREE,
INDEX `penerimaan_barang_items_produk_id_foreign`(`produk_id`) USING BTREE,
INDEX `penerimaan_barang_items_unit_id_foreign`(`unit_id`) USING BTREE,
CONSTRAINT `penerimaan_barang_items_penerimaan_id_foreign` FOREIGN KEY (`penerimaan_id`) REFERENCES `penerimaan_barang` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `penerimaan_barang_items_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `produk` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT,
CONSTRAINT `penerimaan_barang_items_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `produk_unit` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of penerimaan_barang_items
-- ----------------------------
INSERT INTO `penerimaan_barang_items` VALUES (2, 1, 3, 1, 120, 5, 51000, 'DUS', 24, '2026-03-05 17:33:44', '2026-03-05 17:33:44');
-- ----------------------------
-- Table structure for penjualan
-- ----------------------------
DROP TABLE IF EXISTS `penjualan`;
CREATE TABLE `penjualan` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`nomor_penjualan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`waktu` timestamp(0) NOT NULL DEFAULT current_timestamp(0),
`subtotal` bigint(20) UNSIGNED NOT NULL,
`diskon` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`pajak` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`total` bigint(20) UNSIGNED NOT NULL,
`metode_pembayaran` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`voucher_kode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`voucher_amount` int(10) UNSIGNED NOT NULL DEFAULT 0,
`unit_piutang` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`status_pembayaran` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'LUNAS',
`jumlah_bayar` bigint(20) UNSIGNED NOT NULL,
`kembalian` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`sisa_piutang` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `penjualan_nomor_penjualan_unique`(`nomor_penjualan`) USING BTREE,
INDEX `penjualan_user_id_foreign`(`user_id`) USING BTREE,
CONSTRAINT `penjualan_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of penjualan
-- ----------------------------
INSERT INTO `penjualan` VALUES (1, NULL, 'PJ260221152403847', '2026-02-21 15:24:03', 3000, 0, 0, 3000, 'CASH', NULL, 0, NULL, 'LUNAS', 3000, 0, 0, '2026-02-21 15:24:03', '2026-02-21 15:24:03');
INSERT INTO `penjualan` VALUES (2, 1, 'PJ260305164052858', '2026-03-05 16:40:52', 9000, 0, 1080, 10080, 'VOUCHER_CASH', 'VCH2603057733', 5000, NULL, 'LUNAS', 5080, 0, 0, '2026-03-05 16:40:52', '2026-03-05 16:40:52');
INSERT INTO `penjualan` VALUES (3, 1, 'PJ260305174813227', '2026-03-05 17:48:13', 45000, 0, 5400, 50400, 'VOUCHER_CASH', 'VCH2603057733', 30000, NULL, 'LUNAS', 20400, 0, 0, '2026-03-05 17:48:13', '2026-03-05 17:48:13');
-- ----------------------------
-- Table structure for penjualan_barang
-- ----------------------------
DROP TABLE IF EXISTS `penjualan_barang`;
CREATE TABLE `penjualan_barang` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`penjualan_id` bigint(20) UNSIGNED NOT NULL,
`produk_id` bigint(20) UNSIGNED NOT NULL,
`jumlah` int(11) NOT NULL,
`harga` bigint(20) UNSIGNED NOT NULL,
`total` bigint(20) UNSIGNED NOT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `penjualan_barang_penjualan_id_foreign`(`penjualan_id`) USING BTREE,
INDEX `penjualan_barang_produk_id_foreign`(`produk_id`) USING BTREE,
CONSTRAINT `penjualan_barang_penjualan_id_foreign` FOREIGN KEY (`penjualan_id`) REFERENCES `penjualan` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `penjualan_barang_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `produk` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of penjualan_barang
-- ----------------------------
INSERT INTO `penjualan_barang` VALUES (1, 1, 3, 1, 3000, 3000, '2026-02-21 15:24:03', '2026-02-21 15:24:03');
INSERT INTO `penjualan_barang` VALUES (2, 2, 3, 3, 3000, 9000, '2026-03-05 16:40:52', '2026-03-05 16:40:52');
INSERT INTO `penjualan_barang` VALUES (3, 3, 3, 15, 3000, 45000, '2026-03-05 17:48:13', '2026-03-05 17:48:13');
-- ----------------------------
-- Table structure for pergerakan_stok
-- ----------------------------
DROP TABLE IF EXISTS `pergerakan_stok`;
CREATE TABLE `pergerakan_stok` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`waktu` timestamp(0) NOT NULL DEFAULT current_timestamp(0),
`produk_id` bigint(20) UNSIGNED NOT NULL,
`dari_lokasi_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`ke_lokasi_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`jenis` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`jumlah` int(11) NOT NULL,
`unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`qty_input` int(11) NULL DEFAULT NULL,
`multiplier` int(11) NULL DEFAULT NULL,
`catatan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`referensi_tipe` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`referensi_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `pergerakan_stok_produk_id_foreign`(`produk_id`) USING BTREE,
INDEX `pergerakan_stok_dari_lokasi_id_foreign`(`dari_lokasi_id`) USING BTREE,
INDEX `pergerakan_stok_ke_lokasi_id_foreign`(`ke_lokasi_id`) USING BTREE,
CONSTRAINT `pergerakan_stok_dari_lokasi_id_foreign` FOREIGN KEY (`dari_lokasi_id`) REFERENCES `lokasi` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT,
CONSTRAINT `pergerakan_stok_ke_lokasi_id_foreign` FOREIGN KEY (`ke_lokasi_id`) REFERENCES `lokasi` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT,
CONSTRAINT `pergerakan_stok_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `produk` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of pergerakan_stok
-- ----------------------------
INSERT INTO `pergerakan_stok` VALUES (1, '2026-02-20 20:49:38', 3, NULL, 1, 'IN', 240, 'DUS', 10, 24, NULL, NULL, NULL, '2026-02-20 20:49:38', '2026-02-20 20:49:38');
INSERT INTO `pergerakan_stok` VALUES (2, '2026-02-20 20:50:34', 3, 1, 2, 'TRANSFER', 30, NULL, NULL, NULL, NULL, 'TR-0001', NULL, '2026-02-20 20:50:34', '2026-02-20 20:50:34');
INSERT INTO `pergerakan_stok` VALUES (3, '2026-02-21 15:24:03', 3, 2, NULL, 'PENJUALAN', 1, 'DUS', 1, 24, 'Penjualan PJ260221152403847', 'PENJUALAN', 1, '2026-02-21 15:24:03', '2026-02-21 15:24:03');
INSERT INTO `pergerakan_stok` VALUES (4, '2026-03-05 16:40:52', 3, 2, NULL, 'PENJUALAN', 3, 'DUS', 3, 24, 'Penjualan PJ260305164052858', 'PENJUALAN', 2, '2026-03-05 16:40:52', '2026-03-05 16:40:52');
INSERT INTO `pergerakan_stok` VALUES (5, '2026-03-05 17:23:24', 3, NULL, 1, 'PENERIMAAN', 5, 'DUS', 5, 24, 'Penerimaan RCV260305172314173', 'PENERIMAAN', 1, '2026-03-05 17:23:24', '2026-03-05 17:23:24');
INSERT INTO `pergerakan_stok` VALUES (6, '2026-03-05 17:33:44', 3, NULL, 1, 'PENERIMAAN', 120, 'DUS', 5, 24, 'Penerimaan RCV260305173335293', 'PENERIMAAN', 1, '2026-03-05 17:33:44', '2026-03-05 17:33:44');
INSERT INTO `pergerakan_stok` VALUES (7, '2026-03-05 17:48:13', 3, 2, NULL, 'PENJUALAN', 15, 'DUS', 15, 24, 'Penjualan PJ260305174813227', 'PENJUALAN', 3, '2026-03-05 17:48:13', '2026-03-05 17:48:13');
-- ----------------------------
-- Table structure for personal_access_tokens
-- ----------------------------
DROP TABLE IF EXISTS `personal_access_tokens`;
CREATE TABLE `personal_access_tokens` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`tokenable_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`tokenable_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`abilities` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
`last_used_at` timestamp(0) NULL DEFAULT NULL,
`expires_at` timestamp(0) NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `personal_access_tokens_token_unique`(`token`) USING BTREE,
INDEX `personal_access_tokens_tokenable_type_tokenable_id_index`(`tokenable_type`, `tokenable_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for piutang_payments
-- ----------------------------
DROP TABLE IF EXISTS `piutang_payments`;
CREATE TABLE `piutang_payments` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`penjualan_id` bigint(20) UNSIGNED NOT NULL,
`jumlah` bigint(20) UNSIGNED NOT NULL,
`metode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CASH',
`catatan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`user_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`sisa_before` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`sisa_after` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `piutang_payments_penjualan_id_index`(`penjualan_id`) USING BTREE,
INDEX `piutang_payments_user_id_index`(`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for produk
-- ----------------------------
DROP TABLE IF EXISTS `produk`;
CREATE TABLE `produk` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`sku` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`nama` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`barcode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`harga_beli` bigint(20) UNSIGNED NULL DEFAULT NULL,
`harga_jual` bigint(20) UNSIGNED NOT NULL,
`is_aktif` tinyint(1) NOT NULL DEFAULT 1,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `produk_barcode_unique`(`barcode`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of produk
-- ----------------------------
INSERT INTO `produk` VALUES (3, 'SKU00001', 'Aqua 330 Ml', '1234657890', 51000, 3000, 1, '2026-02-20 18:38:11', '2026-02-20 18:38:11');
-- ----------------------------
-- Table structure for produk_unit
-- ----------------------------
DROP TABLE IF EXISTS `produk_unit`;
CREATE TABLE `produk_unit` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`produk_id` bigint(20) UNSIGNED NOT NULL,
`nama_unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`multiplier` int(11) NOT NULL DEFAULT 1,
`is_base` tinyint(1) NOT NULL DEFAULT 0,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `produk_unit_produk_id_nama_unit_unique`(`produk_id`, `nama_unit`) USING BTREE,
CONSTRAINT `produk_unit_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `produk` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of produk_unit
-- ----------------------------
INSERT INTO `produk_unit` VALUES (1, 3, 'DUS', 24, 1, '2026-02-20 18:38:11', '2026-02-20 20:11:36');
-- ----------------------------
-- Table structure for settings
-- ----------------------------
DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `settings_key_unique`(`key`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of settings
-- ----------------------------
INSERT INTO `settings` VALUES (1, 'transaksi.pajak_default', '11', '2026-02-21 15:48:56', '2026-03-05 18:03:04');
INSERT INTO `settings` VALUES (2, 'transaksi.diskon_default', '0', '2026-02-21 15:48:56', '2026-02-21 15:48:56');
INSERT INTO `settings` VALUES (3, 'transaksi.metode_default', 'VOUCHER', '2026-02-21 15:48:56', '2026-03-05 18:03:04');
INSERT INTO `settings` VALUES (4, 'stok.low_threshold', '10', '2026-02-21 15:48:56', '2026-02-21 15:48:56');
INSERT INTO `settings` VALUES (5, 'stok.lokasi_kode', 'TOKO', '2026-02-21 15:48:56', '2026-02-21 15:48:56');
INSERT INTO `settings` VALUES (6, 'toko.nama', 'Sehat Mart', '2026-02-21 15:49:52', '2026-02-21 15:49:52');
INSERT INTO `settings` VALUES (7, 'toko.alamat', 'JL. Ronggolawe No. 137 Cepu Blora', '2026-02-21 15:49:52', '2026-02-21 15:49:52');
INSERT INTO `settings` VALUES (8, 'struk.footer', 'Barang yang sudah di beli tidak bisa di kembalikan kembali', '2026-02-21 17:32:00', '2026-02-21 17:32:00');
INSERT INTO `settings` VALUES (9, 'stok.low_threshold_toko', '10', '2026-03-05 18:03:04', '2026-03-05 18:03:04');
INSERT INTO `settings` VALUES (10, 'stok.low_threshold_gudang', '5', '2026-03-05 18:03:04', '2026-03-05 18:03:04');
-- ----------------------------
-- Table structure for transaksi
-- ----------------------------
DROP TABLE IF EXISTS `transaksi`;
CREATE TABLE `transaksi` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`jenis` enum('penjualan','pembelian') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`produk_id` bigint(20) UNSIGNED NOT NULL,
`lokasi_id` bigint(20) UNSIGNED NOT NULL,
`jumlah` int(11) NOT NULL,
`total_harga` decimal(10, 2) NOT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `transaksi_produk_id_foreign`(`produk_id`) USING BTREE,
INDEX `transaksi_lokasi_id_foreign`(`lokasi_id`) USING BTREE,
CONSTRAINT `transaksi_lokasi_id_foreign` FOREIGN KEY (`lokasi_id`) REFERENCES `lokasi` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `transaksi_produk_id_foreign` FOREIGN KEY (`produk_id`) REFERENCES `produk` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`email_verified_at` timestamp(0) NULL DEFAULT NULL,
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
`role` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'admin',
`nip` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`pegawai_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `users_email_unique`(`email`) USING BTREE,
UNIQUE INDEX `users_nip_unique`(`nip`) USING BTREE,
INDEX `users_role_index`(`role`) USING BTREE,
INDEX `users_pegawai_id_index`(`pegawai_id`) USING BTREE,
CONSTRAINT `users_pegawai_id_foreign` FOREIGN KEY (`pegawai_id`) REFERENCES `pegawai` (`id`) ON DELETE SET NULL ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of users
-- ----------------------------
INSERT INTO `users` VALUES (1, 'admin', 'admin@admin.com', NULL, '$2y$12$9qdoT9qtdXwshRR/HbLTY.n/VBKTgBaIj5mVqFzDnlmmJYYkpaasm', NULL, '2026-02-20 18:13:58', '2026-02-23 15:32:35', 'admin', 'admin', NULL);
-- ----------------------------
-- Table structure for voucher_histories
-- ----------------------------
DROP TABLE IF EXISTS `voucher_histories`;
CREATE TABLE `voucher_histories` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`voucher_id` bigint(20) UNSIGNED NOT NULL,
`kode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`tipe` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`jumlah` bigint(20) UNSIGNED NOT NULL,
`saldo_before` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`saldo_after` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`penjualan_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`user_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`catatan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `voucher_histories_voucher_id_index`(`voucher_id`) USING BTREE,
INDEX `voucher_histories_kode_index`(`kode`) USING BTREE,
INDEX `voucher_histories_tipe_index`(`tipe`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of voucher_histories
-- ----------------------------
INSERT INTO `voucher_histories` VALUES (1, 1, 'VCH2603057733', 'USE', 5000, 5000, 0, 2, 1, NULL, '2026-03-05 16:40:52', '2026-03-05 16:40:52');
INSERT INTO `voucher_histories` VALUES (2, 1, 'VCH2603057733', 'TOPUP', 10000, 0, 10000, NULL, 1, 'Top up', '2026-03-05 17:43:38', '2026-03-05 17:43:38');
INSERT INTO `voucher_histories` VALUES (3, 1, 'VCH2603057733', 'USE', 10000, 10000, 0, 3, 1, NULL, '2026-03-05 17:48:13', '2026-03-05 17:48:13');
INSERT INTO `voucher_histories` VALUES (4, 2, 'VCH2603059195', 'USE', 10000, 10000, 0, 3, 1, NULL, '2026-03-05 17:48:13', '2026-03-05 17:48:13');
INSERT INTO `voucher_histories` VALUES (5, 3, 'VCH2603054528', 'USE', 10000, 10000, 0, 3, 1, NULL, '2026-03-05 17:48:13', '2026-03-05 17:48:13');
-- ----------------------------
-- Table structure for vouchers
-- ----------------------------
DROP TABLE IF EXISTS `vouchers`;
CREATE TABLE `vouchers` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`pegawai_id` bigint(20) UNSIGNED NULL DEFAULT NULL,
`kode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`saldo` bigint(20) UNSIGNED NOT NULL DEFAULT 0,
`aktif` tinyint(1) NOT NULL DEFAULT 1,
`catatan` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL,
`created_by` bigint(20) UNSIGNED NULL DEFAULT NULL,
`created_at` timestamp(0) NULL DEFAULT NULL,
`updated_at` timestamp(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `vouchers_kode_unique`(`kode`) USING BTREE,
INDEX `vouchers_pegawai_id_idx`(`pegawai_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of vouchers
-- ----------------------------
INSERT INTO `vouchers` VALUES (1, 2, 'VCH2603057733', 0, 1, NULL, 1, '2026-03-05 16:37:33', '2026-03-05 17:48:13');
INSERT INTO `vouchers` VALUES (2, 3, 'VCH2603059195', 0, 1, NULL, 1, '2026-03-05 17:44:43', '2026-03-05 17:48:13');
INSERT INTO `vouchers` VALUES (3, 4, 'VCH2603054528', 0, 1, NULL, 1, '2026-03-05 17:44:55', '2026-03-05 17:48:13');
SET FOREIGN_KEY_CHECKS = 1;