-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 25, 2025 at 10:30 AM
-- Server version: 10.4.32-MariaDB
-- PHP Version: 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: `sparepart_app`
--

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

--
-- Table structure for table `kategori`
--

CREATE TABLE `kategori` (
  `id` int(11) NOT NULL,
  `nama_kategori` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `kategori`
--

INSERT INTO `kategori` (`id`, `nama_kategori`) VALUES
(1, 'Oli'),
(2, 'Ban'),
(3, 'Aki'),
(4, 'Sparepart Mesin');

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

--
-- Table structure for table `tabel_pelanggan`
--

CREATE TABLE `tabel_pelanggan` (
  `id` int(11) NOT NULL,
  `nama` varchar(100) NOT NULL,
  `alamat` text DEFAULT NULL,
  `telepon` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tabel_pelanggan`
--

INSERT INTO `tabel_pelanggan` (`id`, `nama`, `alamat`, `telepon`, `email`) VALUES
(1, 'andi', 'boyolali', '024 8798', 'kristwib@gmail.com'),
(2, 'jony', 'Jl Percetaka Negara No.23 A', '02144240406', 'kristwib@gmail.com');

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

--
-- Table structure for table `tabel_pengeluaran`
--

CREATE TABLE `tabel_pengeluaran` (
  `id` int(11) NOT NULL,
  `tanggal` date NOT NULL,
  `keterangan` varchar(255) NOT NULL,
  `jumlah` decimal(15,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tabel_pengeluaran`
--

INSERT INTO `tabel_pengeluaran` (`id`, `tanggal`, `keterangan`, `jumlah`) VALUES
(5, '2025-09-23', 'beli mur 10 buah', 30000.00);

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

--
-- Table structure for table `tabel_produk`
--

CREATE TABLE `tabel_produk` (
  `id` int(11) NOT NULL,
  `kode_barang` varchar(50) NOT NULL,
  `nama_produk` varchar(100) NOT NULL,
  `stok` int(11) DEFAULT 0,
  `harga_beli` decimal(15,2) NOT NULL,
  `harga_eceran` decimal(15,2) NOT NULL,
  `kategori` varchar(50) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tabel_produk`
--

INSERT INTO `tabel_produk` (`id`, `kode_barang`, `nama_produk`, `stok`, `harga_beli`, `harga_eceran`, `kategori`, `created_at`) VALUES
(1, 'ARBTP3', 'TIGER BLK', -1, 30000.00, 35000.00, 'SEHER/PISTON', '2025-09-23 04:26:23'),
(2, 'ARBTP5', 'VIXION BLK', 9, 45000.00, 55000.00, 'SEHER/PISTON', '2025-09-23 04:27:58'),
(6, 'ARTE29', 'ban dalam', 8, 10000.00, 12000.00, 'ban', '2025-09-23 05:20:53'),
(7, 'ARTE23', 'ban dalam supra', 10, 10000.00, 12000.00, 'Ban', '2025-09-23 05:23:44'),
(8, 'ARTE26', 'Kanvas Ren Shogun', 4, 35000.00, 50000.00, 'kanvas', '2025-09-23 08:15:47'),
(44, 'OTP1', 'Pertamina SUper 0,8 Mesran ', 3, 37694.00, 43000.00, 'Oli', '2025-09-24 14:03:50'),
(45, 'OTP2', 'Pertamina Mesran 2T 1L', 6, 42501.00, 52000.00, 'Oli', '2025-09-24 14:03:50'),
(46, 'OTP3', 'Pertamina Mesran OB 2T 1L', 5, 38130.00, 48000.00, 'Oli', '2025-09-24 14:03:50'),
(47, 'OTP4', 'Federal ultratec 0,8', 12, 37500.00, 46000.00, 'Oli', '2025-09-24 14:03:50'),
(48, 'OTP5', 'Iride 2 tak moto 0,7', 5, 28000.00, 30000.00, 'Oli', '2025-09-24 14:03:50'),
(49, 'OTP6', 'Yamalube matic 0,8', 5, 41000.00, 48000.00, 'Oli', '2025-09-24 14:03:50'),
(50, 'OTP7', 'Castrol active low smoke 2 tak 0,7', 14, 38000.00, 40000.00, 'Oli', '2025-09-24 14:03:50'),
(51, 'OTP8', 'AHM Oil MPX1 0,8 L', 10, 49155.00, 57000.00, 'Oli', '2025-09-24 14:03:50'),
(52, 'OTP9', 'AHM Oil MPX2 0,8 L ', 9, 50740.00, 57000.00, 'Oli', '2025-09-24 14:03:50'),
(53, 'OTP10', 'Yamalube super matic 1 L', 4, 65000.00, 76000.00, 'Oli', '2025-09-24 14:03:50'),
(54, 'OTP11', 'Yamalube silver 0,8L', 10, 41000.00, 48000.00, 'Oli', '2025-09-24 14:03:50'),
(55, 'OTP12', 'Yamalube sport 1L', 5, 51000.00, 58000.00, 'Oli', '2025-09-24 14:03:50'),
(56, 'OTP13', 'Federal Matic Ultratec 0.8L', 9, 37000.00, 45000.00, 'Oli', '2025-09-24 14:03:50'),
(57, 'OTP14', 'Evalube pro 2t 0,7L', 9, 28000.00, 35000.00, 'Oli', '2025-09-24 14:03:50'),
(58, 'OTP15', 'Enduro 4TRacing 1L ', 4, 56964.00, 63000.00, 'Oli', '2025-09-24 14:03:50'),
(59, 'OTP16', 'Pertamina SUper 1L Mesran ', 3, 49800.00, 49000.00, 'Oli', '2025-09-24 14:03:50'),
(60, 'OTP17', 'Yamalube 4T XP 0.8L', 2, 33000.00, 42000.00, 'Oli', '2025-09-24 14:03:50'),
(61, 'OTP18', 'AHM MPX2 0.65 L', 26, 43500.00, 52000.00, 'Oli', '2025-09-24 14:03:50'),
(62, 'OTP19', 'AHM MPX1 1L', 4, 56330.00, 65000.00, 'Oli', '2025-09-24 14:03:50'),
(63, 'OTP20', 'Federal Ultratec 1L', 2, 47000.00, 54000.00, 'Oli', '2025-09-24 14:03:50'),
(64, 'OTP21', 'Enduro Matic 0.8 L', 3, 36190.00, 45000.00, 'Oli', '2025-09-24 14:03:50'),
(65, 'OTP22', 'Motul 2T 1L', 2, 99000.00, 115000.00, 'Oli', '2025-09-24 14:03:50'),
(66, 'OTP23', 'Idemitsu irg3 2T 0.7L', 6, 46750.00, 57000.00, 'Oli', '2025-09-24 14:03:50'),
(67, 'OTP24', 'Deltalube 0.8L', 4, 75000.00, 82000.00, 'Oli', '2025-09-24 14:03:50'),
(68, 'OTP25', 'Deltalube 1L', 3, 78000.00, 88000.00, 'Oli', '2025-09-24 14:03:50'),
(69, 'OTP26', 'Shell Advance Matic AX5 0.8L ', 8, 36000.00, 45000.00, 'Oli', '2025-09-24 14:03:50'),
(70, 'OTP27', 'Shell Advance AX5 0.8L', 1, 38500.00, 47000.00, 'Oli', '2025-09-24 14:03:50'),
(71, 'OTP28', 'Shell Advance Matic AX7 0.8L', 11, 44500.00, 51000.00, 'Oli', '2025-09-24 14:03:50'),
(72, 'OTP29', 'Shell Advance Matic AX7 1L', 7, 55000.00, 63000.00, 'Oli', '2025-09-24 14:03:50'),
(74, 'OTP31', 'Shell Advance  AX7 1L', 3, 54000.00, 65000.00, 'Oli', '2025-09-24 14:03:50'),
(75, 'OTP32', 'ECSTAR R5000 0.8L', 4, 35670.00, 43000.00, 'Oli', '2025-09-24 14:03:50'),
(76, 'OTP33', 'ECSTAR R5000 1L', 4, 43050.00, 52000.00, 'Oli', '2025-09-24 14:03:50'),
(77, 'OTP34', 'ECSTAR R7000 0.8L', 6, 41500.00, 49000.00, 'Oli', '2025-09-24 14:03:50');

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

--
-- Table structure for table `tabel_supplier`
--

CREATE TABLE `tabel_supplier` (
  `id` int(11) NOT NULL,
  `nama_supplier` varchar(100) NOT NULL,
  `kontak` varchar(100) DEFAULT NULL,
  `alamat` text DEFAULT NULL,
  `telepon` varchar(20) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tabel_supplier`
--

INSERT INTO `tabel_supplier` (`id`, `nama_supplier`, `kontak`, `alamat`, `telepon`, `email`, `created_at`) VALUES
(1, 'PT. anugerah motor', 'dedi', 'Jl Percetaka Negara No.23 A', '021 9099887', 'kristwib@gmail.com', '2025-09-23 14:00:55');

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

--
-- Table structure for table `tabel_transaksi`
--

CREATE TABLE `tabel_transaksi` (
  `id` int(11) NOT NULL,
  `no_transaksi` varchar(50) DEFAULT NULL,
  `tanggal` date NOT NULL,
  `customer` varchar(100) NOT NULL,
  `total` decimal(15,2) DEFAULT 0.00,
  `ppn` decimal(15,2) DEFAULT 0.00,
  `grand_total` decimal(15,2) DEFAULT 0.00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tabel_transaksi`
--

INSERT INTO `tabel_transaksi` (`id`, `no_transaksi`, `tanggal`, `customer`, `total`, `ppn`, `grand_total`) VALUES
(16, 'TRX20250923162510', '2025-09-23', 'ian', 55000.00, 6050.00, 55000.00);

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

--
-- Table structure for table `tabel_transaksi_detail`
--

CREATE TABLE `tabel_transaksi_detail` (
  `id` int(11) NOT NULL,
  `transaksi_id` int(11) NOT NULL,
  `produk_id` int(11) NOT NULL,
  `qty` int(11) NOT NULL,
  `harga` decimal(15,2) NOT NULL,
  `subtotal` decimal(15,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `tabel_transaksi_detail`
--

INSERT INTO `tabel_transaksi_detail` (`id`, `transaksi_id`, `produk_id`, `qty`, `harga`, `subtotal`) VALUES
(28, 16, 2, 1, 55000.00, 55000.00);

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` enum('admin','kasir','owner') DEFAULT 'kasir',
  `nama_lengkap` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`, `role`, `nama_lengkap`) VALUES
(1, 'admin', '$2y$10$yKeLLn5Lt2R12WR0/j2WdOp62PpxRLllDYGJwa8WTY28u7m52pXZy', 'admin', 'kristian'),
(2, 'limpat', '$2y$10$dKNoyglyrBfNQGqbcBNIIudgHHyxXKAcM028.2mtv9XPXtKfxFWEC', 'admin', 'limpat T'),
(3, 'pria', '$2y$10$8tVREXstEqYtedi5xu58i.DeBnncnCY99NwXfIUhKIjNQ0jXMwMim', 'kasir', 'pria');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `kategori`
--
ALTER TABLE `kategori`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tabel_pelanggan`
--
ALTER TABLE `tabel_pelanggan`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tabel_pengeluaran`
--
ALTER TABLE `tabel_pengeluaran`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tabel_produk`
--
ALTER TABLE `tabel_produk`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `kode_barang` (`kode_barang`);

--
-- Indexes for table `tabel_supplier`
--
ALTER TABLE `tabel_supplier`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `tabel_transaksi`
--
ALTER TABLE `tabel_transaksi`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `no_transaksi` (`no_transaksi`);

--
-- Indexes for table `tabel_transaksi_detail`
--
ALTER TABLE `tabel_transaksi_detail`
  ADD PRIMARY KEY (`id`),
  ADD KEY `transaksi_id` (`transaksi_id`),
  ADD KEY `produk_id` (`produk_id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `kategori`
--
ALTER TABLE `kategori`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `tabel_pelanggan`
--
ALTER TABLE `tabel_pelanggan`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `tabel_pengeluaran`
--
ALTER TABLE `tabel_pengeluaran`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `tabel_produk`
--
ALTER TABLE `tabel_produk`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=79;

--
-- AUTO_INCREMENT for table `tabel_supplier`
--
ALTER TABLE `tabel_supplier`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `tabel_transaksi`
--
ALTER TABLE `tabel_transaksi`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `tabel_transaksi_detail`
--
ALTER TABLE `tabel_transaksi_detail`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `tabel_transaksi_detail`
--
ALTER TABLE `tabel_transaksi_detail`
  ADD CONSTRAINT `tabel_transaksi_detail_ibfk_1` FOREIGN KEY (`transaksi_id`) REFERENCES `tabel_transaksi` (`id`) ON DELETE CASCADE,
  ADD CONSTRAINT `tabel_transaksi_detail_ibfk_2` FOREIGN KEY (`produk_id`) REFERENCES `tabel_produk` (`id`);
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 */;
