-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Apr 12, 2022 at 04:51 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.1

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `db_inventaris`
--

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

--
-- Table structure for table `barang`
--

CREATE TABLE `barang` (
  `idbarang` varchar(20) NOT NULL,
  `nama_barang` varchar(128) NOT NULL,
  `merek_id` varchar(20) NOT NULL,
  `tipe` varchar(255) NOT NULL,
  `sn` varchar(255) NOT NULL,
  `stok` int(11) NOT NULL,
  `satuan_id` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `barang`
--

INSERT INTO `barang` (`idbarang`, `nama_barang`, `merek_id`, `tipe`, `sn`, `stok`, `satuan_id`) VALUES
('BRG-1454017952', 'Laptop Asus TUF ', '53', 'Gaming A15', 'Nfss389yriiqZa', 1, 2),
('BRG-3190916969', 'asd', '56', 'sn', 'sn', 2, 12),
('BRG-3260407872', 'Hp Redmi Note 11', '27', 'Redmi', '', -102, 2),
('BRG-7548716883', 'Laptop Asus TUF ', '53', 'Gaming 15', 'G2730rnbbufq9', 12, 2),
('BRG-8706349743', 'Kamera Camrecorder', '47', 'Video', '', 19, 2);

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

--
-- Table structure for table `barang_keluar`
--

CREATE TABLE `barang_keluar` (
  `idbarang_keluar` int(11) NOT NULL,
  `barang_id` varchar(255) NOT NULL,
  `jumlah` int(11) NOT NULL,
  `keterangan` varchar(256) NOT NULL,
  `tanggal` date NOT NULL,
  `tanggal_bast` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `barang_keluar`
--

INSERT INTO `barang_keluar` (`idbarang_keluar`, `barang_id`, `jumlah`, `keterangan`, `tanggal`, `tanggal_bast`) VALUES
(28, 'BRG-3260407872', 2, 'Barang dari inti', '2022-03-29', '2022-03-29'),
(29, 'BRG-7548716883', 5, 'Barang keluar', '2022-03-29', '2022-03-29'),
(30, 'BRG-3260407872', 5, 'rusak', '2022-03-29', '2022-03-29');

--
-- Triggers `barang_keluar`
--
DELIMITER $$
CREATE TRIGGER `kurang_stok` AFTER INSERT ON `barang_keluar` FOR EACH ROW BEGIN
	UPDATE barang SET stok = stok - new.jumlah WHERE idbarang = new.barang_id;
END
$$
DELIMITER ;

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

--
-- Table structure for table `barang_masuk`
--

CREATE TABLE `barang_masuk` (
  `idbarang_masuk` int(11) NOT NULL,
  `barang_id` varchar(255) NOT NULL,
  `jumlah` int(11) NOT NULL,
  `satuan_id` int(20) NOT NULL,
  `tanggal` date NOT NULL,
  `tanggal_po` date NOT NULL,
  `no_po` varchar(255) NOT NULL,
  `project_name` varchar(60) NOT NULL,
  `keterangan` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `barang_masuk`
--

INSERT INTO `barang_masuk` (`idbarang_masuk`, `barang_id`, `jumlah`, `satuan_id`, `tanggal`, `tanggal_po`, `no_po`, `project_name`, `keterangan`) VALUES
(47, 'BRG-8706349743', 10, 2, '2022-03-29', '2022-03-29', '', 'Multimedia', 'Barang dari Inti'),
(48, 'BRG-8706349743', 10, 2, '2022-03-29', '2022-02-21', 'DSADHUUEWygsavFW', 'Multimedia', 'Barang dari inti'),
(49, 'BRG-5751988870', 1, 2, '2022-04-07', '2022-04-09', '', 'No', 'Baru'),
(50, 'BRG-3190916969', 12, 1, '2022-04-11', '2022-04-12', '', 'ASD', 'WQEQERTYU'),
(51, 'BRG-3190916969', 12, 12, '2022-04-11', '2022-04-11', '', 'ASD', 'WEQWQE');

--
-- Triggers `barang_masuk`
--
DELIMITER $$
CREATE TRIGGER `tambah_stok` AFTER INSERT ON `barang_masuk` FOR EACH ROW BEGIN
	UPDATE barang SET stok = stok + new.jumlah WHERE idbarang = new.barang_id;
END
$$
DELIMITER ;

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

--
-- Table structure for table `divisi`
--

CREATE TABLE `divisi` (
  `id_divisi` int(12) NOT NULL,
  `nama_divisi` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `divisi`
--

INSERT INTO `divisi` (`id_divisi`, `nama_divisi`) VALUES
(1, 'IT Solution'),
(3, 'Marketing & SE'),
(4, 'Teknologi'),
(11, 'Procurement'),
(12, 'Corporate Service & Finance'),
(13, 'Unit'),
(14, 'SoftDev');

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

--
-- Table structure for table `konsumen`
--

CREATE TABLE `konsumen` (
  `id_konsumen` int(12) NOT NULL,
  `nama_konsumen` varchar(255) NOT NULL,
  `lokasi` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `konsumen`
--

INSERT INTO `konsumen` (`id_konsumen`, `nama_konsumen`, `lokasi`) VALUES
(5, 'PT. Diantama Rekanusa', 'Manado'),
(6, 'DPMD Barito Kuala', 'Barito Kuala'),
(7, 'PT IDPAY', 'Bandung'),
(8, 'Dinas PMD', 'Situbondo'),
(10, 'Ruang Project', 'Bandung');

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

--
-- Table structure for table `merek`
--

CREATE TABLE `merek` (
  `idmerek` int(11) NOT NULL,
  `nama_merek` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `merek`
--

INSERT INTO `merek` (`idmerek`, `nama_merek`) VALUES
(27, 'Xiaomi'),
(28, 'XEON'),
(29, 'Telkomsel'),
(30, 'Secugen'),
(31, 'Schneider'),
(32, 'SanDisk'),
(33, 'Samsung'),
(35, 'Powerbeam'),
(36, 'Lokal'),
(37, 'Logitec MK215'),
(39, 'Jerman'),
(40, 'INTI'),
(41, 'Intel'),
(42, 'In Power'),
(43, 'IDPAY'),
(44, 'Huawei'),
(45, 'HP'),
(46, 'Hiled'),
(47, 'HD Camera'),
(48, 'Fujitsu'),
(49, 'Eterna (2x 1.5)'),
(50, 'Embeded'),
(51, 'Custom'),
(52, 'Belden'),
(53, 'Asus'),
(54, 'Alinone'),
(55, 'ACR'),
(56, 'Acer'),
(57, 'Canon');

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

--
-- Table structure for table `peminjaman`
--

CREATE TABLE `peminjaman` (
  `id_peminjaman` varchar(12) NOT NULL,
  `barang_id` varchar(255) NOT NULL,
  `jumlah` int(12) NOT NULL,
  `tgl_pinjam` date NOT NULL,
  `tgl_kembali` date NOT NULL,
  `konsumen_id` int(12) NOT NULL,
  `divisi_id` int(12) NOT NULL,
  `status` varchar(60) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `peminjaman`
--

INSERT INTO `peminjaman` (`id_peminjaman`, `barang_id`, `jumlah`, `tgl_pinjam`, `tgl_kembali`, `konsumen_id`, `divisi_id`, `status`) VALUES
('PM-09414', 'BRG-3260407872', 2, '2022-04-08', '2022-04-20', 8, 12, '1'),
('PM-13486', 'BRG-3190916969', 1, '2022-04-11', '2022-04-14', 8, 1, '1'),
('PM-14257', 'BRG-8706349743', 10, '2022-04-14', '2022-04-13', 6, 1, '1'),
('PM-21550', 'BRG-8706349743', 12, '2022-04-11', '2022-04-15', 8, 1, '1'),
('PM-28479', 'BRG-3190916969', 2, '2022-04-06', '2022-04-07', 6, 1, '1'),
('PM-52461', 'BRG-7548716883', 1, '2022-04-12', '2022-04-15', 6, 1, '1'),
('PM-62045', 'BRG-1454017952', 1, '2022-04-11', '2022-04-11', 6, 12, '1'),
('PM-96981', 'BRG-8706349743', 1, '2022-04-01', '2022-04-15', 6, 12, '1');

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

--
-- Table structure for table `pengembalian`
--

CREATE TABLE `pengembalian` (
  `id_pengembalian` int(12) NOT NULL,
  `barang_id` varchar(255) NOT NULL,
  `jumlah` int(12) NOT NULL,
  `satuan_id` int(12) NOT NULL,
  `tgl_pinjam` date NOT NULL,
  `tgl_kembali` date NOT NULL,
  `konsumen_id` int(12) NOT NULL,
  `divisi_id` int(12) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `pengembalian`
--

INSERT INTO `pengembalian` (`id_pengembalian`, `barang_id`, `jumlah`, `satuan_id`, `tgl_pinjam`, `tgl_kembali`, `konsumen_id`, `divisi_id`) VALUES
(8, 'BRG-6949069110', 10, 1, '2022-04-07', '2022-04-09', 8, 12),
(9, 'BRG-3260407872', 10, 2, '2022-04-07', '2022-04-16', 8, 12),
(10, 'BRG-3260407872', 100, 2, '2022-04-07', '2022-04-23', 10, 11),
(11, 'BRG-7548716883', 1, 2, '2022-04-07', '2022-04-09', 7, 1),
(12, 'BRG-8706349743', 1, 2, '2022-04-07', '2022-04-16', 8, 12);

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

--
-- Table structure for table `satuan`
--

CREATE TABLE `satuan` (
  `id_satuan` int(20) NOT NULL,
  `nama_satuan` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

--
-- Dumping data for table `satuan`
--

INSERT INTO `satuan` (`id_satuan`, `nama_satuan`) VALUES
(1, 'pcs'),
(2, 'unit'),
(7, 'roll'),
(12, 'bulan'),
(13, 'bungkus'),
(14, 'meter'),
(15, 'set');

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

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

CREATE TABLE `users` (
  `id_users` int(5) NOT NULL,
  `nama_pengguna` varchar(20) NOT NULL,
  `kata_sandi` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

INSERT INTO `users` (`id_users`, `nama_pengguna`, `kata_sandi`) VALUES
(13, 'username1', '2222b0104b5621b7a68474f2741bcbf1'),
(14, 'administrator', '200ceb26807d6bf99fd6f4f0d1ca54d4'),
(20, 'irwanrham', '5808d250a8a66c0ba26376a54048cceb');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `barang`
--
ALTER TABLE `barang`
  ADD PRIMARY KEY (`idbarang`);

--
-- Indexes for table `barang_keluar`
--
ALTER TABLE `barang_keluar`
  ADD PRIMARY KEY (`idbarang_keluar`);

--
-- Indexes for table `barang_masuk`
--
ALTER TABLE `barang_masuk`
  ADD PRIMARY KEY (`idbarang_masuk`);

--
-- Indexes for table `divisi`
--
ALTER TABLE `divisi`
  ADD PRIMARY KEY (`id_divisi`);

--
-- Indexes for table `konsumen`
--
ALTER TABLE `konsumen`
  ADD PRIMARY KEY (`id_konsumen`);

--
-- Indexes for table `merek`
--
ALTER TABLE `merek`
  ADD PRIMARY KEY (`idmerek`);

--
-- Indexes for table `peminjaman`
--
ALTER TABLE `peminjaman`
  ADD PRIMARY KEY (`id_peminjaman`);

--
-- Indexes for table `pengembalian`
--
ALTER TABLE `pengembalian`
  ADD PRIMARY KEY (`id_pengembalian`);

--
-- Indexes for table `satuan`
--
ALTER TABLE `satuan`
  ADD PRIMARY KEY (`id_satuan`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id_users`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `barang_keluar`
--
ALTER TABLE `barang_keluar`
  MODIFY `idbarang_keluar` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;

--
-- AUTO_INCREMENT for table `barang_masuk`
--
ALTER TABLE `barang_masuk`
  MODIFY `idbarang_masuk` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;

--
-- AUTO_INCREMENT for table `divisi`
--
ALTER TABLE `divisi`
  MODIFY `id_divisi` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;

--
-- AUTO_INCREMENT for table `konsumen`
--
ALTER TABLE `konsumen`
  MODIFY `id_konsumen` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;

--
-- AUTO_INCREMENT for table `merek`
--
ALTER TABLE `merek`
  MODIFY `idmerek` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=58;

--
-- AUTO_INCREMENT for table `pengembalian`
--
ALTER TABLE `pengembalian`
  MODIFY `id_pengembalian` int(12) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `satuan`
--
ALTER TABLE `satuan`
  MODIFY `id_satuan` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id_users` int(5) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
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 */;
