text: -- phpMyAdmin SQL Dump
  -- version 4.9.0.1
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: Oct 19, 2019 at 06:46 AM
  -- Server version: 10.4.6-MariaDB
  -- PHP Version: 7.1.32
  
  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_erpresto`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `admin`
  --
  
  CREATE TABLE `admin` (
    `kd_admin` int(11) NOT NULL,
    `nama` varchar(100) NOT NULL,
    `username` varchar(100) NOT NULL,
    `password` varchar(100) NOT NULL,
    `level` char(20) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `admin`
  --
  
  INSERT INTO `admin` (`kd_admin`, `nama`, `username`, `password`, `level`) VALUES
  (1, 'admin andi', 'admin', 'admin', 'owner'),
  (2, 'Kasir 1', 'kasir', 'kasir', 'kasir'),
  (3, 'pelayan 1', 'pelayan', 'pelayan', 'pelayan');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_transaksi`
  --
  
  CREATE TABLE `detail_transaksi` (
    `kd_transaksi` int(11) NOT NULL,
    `kd_menu` int(11) NOT NULL,
    `harga` double NOT NULL,
    `jumlah` int(11) NOT NULL,
    `sub_total` double NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `detail_transaksi`
  --
  
  INSERT INTO `detail_transaksi` (`kd_transaksi`, `kd_menu`, `harga`, `jumlah`, `sub_total`) VALUES
  (5, 10, 25000, 1, 25000),
  (5, 12, 30000, 2, 60000),
  (5, 13, 8000, 3, 24000),
  (6, 11, 5000, 2, 10000);
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `kategori`
  --
  
  CREATE TABLE `kategori` (
    `kd_kategori` int(11) NOT NULL,
    `kategori` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `kategori`
  --
  
  INSERT INTO `kategori` (`kd_kategori`, `kategori`) VALUES
  (1, 'Minuman'),
  (2, 'Makanan');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `meja`
  --
  
  CREATE TABLE `meja` (
    `kd_meja` int(11) NOT NULL,
    `no_meja` varchar(10) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `meja`
  --
  
  INSERT INTO `meja` (`kd_meja`, `no_meja`) VALUES
  (1, 'M01'),
  (2, 'M02'),
  (3, 'M03'),
  (4, 'M04'),
  (5, 'M05'),
  (6, 'M06'),
  (8, 'M07'),
  (9, 'M06');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `menu`
  --
  
  CREATE TABLE `menu` (
    `kd_menu` int(11) NOT NULL,
    `kd_kategori` int(11) NOT NULL,
    `nama` varchar(100) NOT NULL,
    `gambar` varchar(100) NOT NULL,
    `harga` double NOT NULL,
    `status_menu` varchar(20) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `menu`
  --
  
  INSERT INTO `menu` (`kd_menu`, `kd_kategori`, `nama`, `gambar`, `harga`, `status_menu`) VALUES
  (10, 2, 'Ikan Bakar Slengseng', 'ikan.jpg', 25000, 'ready'),
  (11, 1, 'Es Teh ', 'es_teh1.jpg', 5000, 'ready'),
  (12, 2, 'Ayam Bakar ', 'ayambakar1.jpg', 30000, 'ready'),
  (13, 1, 'Es Jeruk', 'es_jeruk1.jpg', 8000, 'ready');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `transaksi`
  --
  
  CREATE TABLE `transaksi` (
    `kd_transaksi` int(11) NOT NULL,
    `kd_admin` int(11) NOT NULL,
    `kd_meja` int(11) NOT NULL,
    `tgl_transaksi` date NOT NULL,
    `total` double NOT NULL,
    `status` char(10) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Dumping data for table `transaksi`
  --
  
  INSERT INTO `transaksi` (`kd_transaksi`, `kd_admin`, `kd_meja`, `tgl_transaksi`, `total`, `status`) VALUES
  (5, 2, 1, '2019-10-19', 109000, 'aktif'),
  (6, 3, 3, '2019-10-19', 10000, 'aktif');
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `admin`
  --
  ALTER TABLE `admin`
    ADD PRIMARY KEY (`kd_admin`);
  
  --
  -- Indexes for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    ADD KEY `kd_transaksi` (`kd_transaksi`),
    ADD KEY `kd_menu` (`kd_menu`);
  
  --
  -- Indexes for table `kategori`
  --
  ALTER TABLE `kategori`
    ADD PRIMARY KEY (`kd_kategori`);
  
  --
  -- Indexes for table `meja`
  --
  ALTER TABLE `meja`
    ADD PRIMARY KEY (`kd_meja`);
  
  --
  -- Indexes for table `menu`
  --
  ALTER TABLE `menu`
    ADD PRIMARY KEY (`kd_menu`),
    ADD KEY `kd_kategori` (`kd_kategori`);
  
  --
  -- Indexes for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD PRIMARY KEY (`kd_transaksi`),
    ADD KEY `kd_meja` (`kd_meja`),
    ADD KEY `kd_admin` (`kd_admin`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `admin`
  --
  ALTER TABLE `admin`
    MODIFY `kd_admin` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
  
  --
  -- AUTO_INCREMENT for table `kategori`
  --
  ALTER TABLE `kategori`
    MODIFY `kd_kategori` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
  
  --
  -- AUTO_INCREMENT for table `meja`
  --
  ALTER TABLE `meja`
    MODIFY `kd_meja` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
  
  --
  -- AUTO_INCREMENT for table `menu`
  --
  ALTER TABLE `menu`
    MODIFY `kd_menu` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
  
  --
  -- AUTO_INCREMENT for table `transaksi`
  --
  ALTER TABLE `transaksi`
    MODIFY `kd_transaksi` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
  
  --
  -- Constraints for dumped tables
  --
  
  --
  -- Constraints for table `detail_transaksi`
  --
  ALTER TABLE `detail_transaksi`
    ADD CONSTRAINT `detail_transaksi_ibfk_2` FOREIGN KEY (`kd_menu`) REFERENCES `menu` (`kd_menu`) ON DELETE NO ACTION ON UPDATE NO ACTION,
    ADD CONSTRAINT `detail_transaksi_ibfk_3` FOREIGN KEY (`kd_transaksi`) REFERENCES `transaksi` (`kd_transaksi`) ON DELETE CASCADE;
  
  --
  -- Constraints for table `menu`
  --
  ALTER TABLE `menu`
    ADD CONSTRAINT `menu_ibfk_1` FOREIGN KEY (`kd_kategori`) REFERENCES `kategori` (`kd_kategori`);
  
  --
  -- Constraints for table `transaksi`
  --
  ALTER TABLE `transaksi`
    ADD CONSTRAINT `transaksi_ibfk_1` FOREIGN KEY (`kd_meja`) REFERENCES `meja` (`kd_meja`),
    ADD CONSTRAINT `transaksi_ibfk_2` FOREIGN KEY (`kd_admin`) REFERENCES `admin` (`kd_admin`) ON DELETE NO ACTION ON UPDATE CASCADE;
  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 */;
  