-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 09 Jun 2025 pada 05.02
-- Versi server: 10.4.32-MariaDB
-- Versi PHP: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `bumi_code`
--

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

--
-- Struktur dari tabel `barang`
--

CREATE TABLE `barang` (
  `uuid` varchar(50) NOT NULL,
  `uuid_user` varchar(50) NOT NULL,
  `nama_barang` varchar(100) NOT NULL,
  `harga_jual` varchar(100) NOT NULL,
  `deskripsi` varchar(100) NOT NULL,
  `foto` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `keranjang`
--

CREATE TABLE `keranjang` (
  `uuid` varchar(50) NOT NULL,
  `uuid_barang` varchar(50) NOT NULL,
  `session_id` varchar(100) NOT NULL,
  `harga_beli` varchar(100) NOT NULL,
  `jumlah` varchar(100) NOT NULL,
  `ppn` varchar(100) NOT NULL,
  `total` varchar(100) NOT NULL,
  `created_at` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `keranjang_penjualan`
--

CREATE TABLE `keranjang_penjualan` (
  `uuid` varchar(50) NOT NULL,
  `uuid_barang` varchar(50) NOT NULL,
  `session_id` varchar(50) NOT NULL,
  `harga` varchar(50) NOT NULL,
  `jumlah` varchar(50) NOT NULL,
  `sub_total` varchar(50) NOT NULL,
  `created_at` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `pembayaran`
--

CREATE TABLE `pembayaran` (
  `uuid` varchar(50) NOT NULL,
  `uuid_pembelian` varchar(100) NOT NULL,
  `uuid_user` varchar(100) NOT NULL,
  `tgl_bayar` date NOT NULL,
  `uuid_barang` varchar(100) NOT NULL,
  `nama_barang` varchar(200) NOT NULL,
  `nominal` varchar(200) NOT NULL,
  `foto` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `pembelian`
--

CREATE TABLE `pembelian` (
  `uuid` varchar(50) NOT NULL,
  `tanggal` date NOT NULL,
  `uuid_barang` varchar(200) NOT NULL,
  `nama_barang` varchar(50) NOT NULL,
  `nama_supplier` varchar(50) NOT NULL,
  `nohp_supplier` varchar(50) NOT NULL,
  `harga_beli` varchar(50) NOT NULL,
  `ppn` varchar(50) NOT NULL,
  `jumlah` int(50) NOT NULL,
  `uuid_user` varchar(200) NOT NULL,
  `total` varchar(50) NOT NULL,
  `tipe` enum('kredit','transfer') NOT NULL,
  `jatuh_tempo` varchar(50) NOT NULL,
  `status` varchar(50) NOT NULL DEFAULT 'Belum Datang',
  `no_nota` varchar(50) NOT NULL,
  `created_at` date NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `penjualan`
--

CREATE TABLE `penjualan` (
  `uuid` varchar(50) NOT NULL,
  `uuid_user` varchar(50) NOT NULL,
  `nota` varchar(50) NOT NULL,
  `total` varchar(50) NOT NULL,
  `dibayar` varchar(50) NOT NULL,
  `kembalian` varchar(50) NOT NULL,
  `tipe_pembayaran` varchar(50) NOT NULL,
  `pelanggan` varchar(500) NOT NULL,
  `nohp_pelanggan` varchar(15) NOT NULL,
  `alamat_pelanggan` text NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `penjualan_produk`
--

CREATE TABLE `penjualan_produk` (
  `uuid` varchar(50) NOT NULL,
  `uuid_user` varchar(50) NOT NULL,
  `nota` varchar(50) NOT NULL,
  `uuid_barang` varchar(50) NOT NULL,
  `nama_barang` varchar(1000) NOT NULL,
  `harga` varchar(50) NOT NULL,
  `diskon` varchar(30) NOT NULL DEFAULT '0',
  `jumlah_beli` varchar(50) NOT NULL,
  `sub_total` varchar(50) NOT NULL,
  `pelanggan` varchar(500) NOT NULL,
  `nohp_pelanggan` varchar(15) NOT NULL,
  `alamat_pelanggan` text NOT NULL,
  `tipe_pembayaran` varchar(30) NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `terima`
--

CREATE TABLE `terima` (
  `uuid` varchar(50) NOT NULL,
  `uuid_pembelian` varchar(50) NOT NULL,
  `uuid_user` varchar(50) NOT NULL,
  `tgl_terima` date NOT NULL,
  `uuid_barang` varchar(200) NOT NULL,
  `nama_barang` varchar(200) NOT NULL,
  `jumlah_terima` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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

--
-- Struktur dari tabel `users`
--

CREATE TABLE `users` (
  `uuid` varchar(50) NOT NULL,
  `nama_lengkap` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  `email` varchar(100) NOT NULL,
  `no_hp` varchar(100) NOT NULL,
  `nama_instansi` varchar(100) NOT NULL,
  `role` enum('admin','toko','gudang','kasir') NOT NULL,
  `plan` varchar(25) NOT NULL DEFAULT 'free'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indexes for dumped tables
--

--
-- Indeks untuk tabel `barang`
--
ALTER TABLE `barang`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `keranjang`
--
ALTER TABLE `keranjang`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `pembayaran`
--
ALTER TABLE `pembayaran`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `pembelian`
--
ALTER TABLE `pembelian`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `penjualan`
--
ALTER TABLE `penjualan`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `penjualan_produk`
--
ALTER TABLE `penjualan_produk`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `terima`
--
ALTER TABLE `terima`
  ADD PRIMARY KEY (`uuid`);

--
-- Indeks untuk tabel `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`uuid`),
  ADD UNIQUE KEY `username` (`nama_lengkap`);
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
