text: -- phpMyAdmin SQL Dump
  -- version 4.8.5
  -- https://www.phpmyadmin.net/
  --
  -- Host: 127.0.0.1
  -- Generation Time: May 19, 2020 at 04:48 PM
  -- Server version: 10.1.38-MariaDB
  -- PHP Version: 5.6.40
  
  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: `sia_rolas`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_obat`
  --
  
  CREATE TABLE `detail_obat` (
    `id` int(11) NOT NULL,
    `id_supplier` varchar(30) NOT NULL,
    `id_obat` int(11) NOT NULL,
    `batch` varchar(10) NOT NULL,
    `exp_date` date NOT NULL,
    `harga_beli` bigint(13) NOT NULL,
    `harga_ecer` bigint(13) NOT NULL,
    `harga_grosir` bigint(13) NOT NULL,
    `qty` int(5) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_pembelian`
  --
  
  CREATE TABLE `detail_pembelian` (
    `id` int(11) NOT NULL,
    `id_pembelian_obat` int(11) NOT NULL,
    `id_obat` int(11) NOT NULL,
    `id_supplier` int(11) NOT NULL,
    `batch` varchar(10) NOT NULL,
    `exp_date` date NOT NULL,
    `qty` int(5) NOT NULL,
    `id_satuan_obat` int(11) NOT NULL,
    `harga` bigint(13) NOT NULL,
    `sub_total` bigint(13) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_penjualan`
  --
  
  CREATE TABLE `detail_penjualan` (
    `id` int(11) NOT NULL,
    `id_penjualan` int(11) NOT NULL,
    `kode_obat` varchar(5) NOT NULL,
    `batch` varchar(10) NOT NULL,
    `qty` int(5) NOT NULL,
    `id_satuan_obat` int(11) NOT NULL,
    `harga` bigint(13) NOT NULL,
    `sub_total` bigint(13) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_resep`
  --
  
  CREATE TABLE `detail_resep` (
    `id` int(11) NOT NULL,
    `id_resep` int(11) NOT NULL,
    `kode_obat` varchar(5) NOT NULL,
    `batch` varchar(10) NOT NULL,
    `qty` int(5) NOT NULL,
    `id_satuan_obat` int(11) NOT NULL,
    `id_dosis` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `detail_retur`
  --
  
  CREATE TABLE `detail_retur` (
    `id` int(11) NOT NULL,
    `id_retur` int(11) NOT NULL,
    `kode_obat` varchar(5) NOT NULL,
    `id_satuan_obat` int(11) NOT NULL,
    `qty` int(5) NOT NULL,
    `sub_total` bigint(13) NOT NULL,
    `keterangan` enum('RUSAK','EXP') NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `dosis`
  --
  
  CREATE TABLE `dosis` (
    `id` int(11) NOT NULL,
    `konsumsi_obat` text NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `jabatan`
  --
  
  CREATE TABLE `jabatan` (
    `id` int(11) NOT NULL,
    `nama_jabatan` varchar(15) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `jenis_obat`
  --
  
  CREATE TABLE `jenis_obat` (
    `id` int(11) NOT NULL,
    `jenis_obat` varchar(10) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `obat`
  --
  
  CREATE TABLE `obat` (
    `id` int(11) NOT NULL,
    `kode_obat` varchar(5) NOT NULL,
    `nama_obat` varchar(15) NOT NULL,
    `id_jenis_obat` varchar(10) NOT NULL,
    `total_qty` bigint(13) NOT NULL,
    `id_satuan_obat` varchar(7) NOT NULL,
    `status` enum('ADA','EXP','KOSONG') NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pasien`
  --
  
  CREATE TABLE `pasien` (
    `id` int(11) NOT NULL,
    `no_pasien` int(6) NOT NULL,
    `nama_pasien` varchar(20) NOT NULL,
    `jenis` enum('UMUM','BPJS') NOT NULL,
    `jenis_kelamin` enum('Perempuan','Laki-Laki') NOT NULL,
    `no_hp` int(14) NOT NULL,
    `alamat` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `pembelian_obat`
  --
  
  CREATE TABLE `pembelian_obat` (
    `id` int(11) NOT NULL,
    `no_transaksi` varchar(6) NOT NULL,
    `tgl_pembelian` date NOT NULL,
    `total_qty` bigint(13) NOT NULL,
    `total_harga` bigint(13) NOT NULL,
    `id_user` int(11) NOT NULL,
    `bukti_pembelian` varchar(50) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `penjualan`
  --
  
  CREATE TABLE `penjualan` (
    `id` int(11) NOT NULL,
    `no_transaksi` varchar(6) NOT NULL,
    `tgl_penjualan` date NOT NULL,
    `id_resep` int(11) NOT NULL,
    `tujuan` text NOT NULL,
    `total_qty` bigint(13) NOT NULL,
    `total_harga` bigint(13) NOT NULL,
    `id_user` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `resep`
  --
  
  CREATE TABLE `resep` (
    `id` int(11) NOT NULL,
    `no_resep` varchar(6) NOT NULL,
    `tgl_resep` date NOT NULL,
    `id_user` int(11) NOT NULL,
    `id_pasien` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `retur`
  --
  
  CREATE TABLE `retur` (
    `id` int(11) NOT NULL,
    `id_pembelian_obat` int(11) NOT NULL,
    `id_supplier` int(11) NOT NULL,
    `total_harga` bigint(13) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `satuan_obat`
  --
  
  CREATE TABLE `satuan_obat` (
    `id` int(11) NOT NULL,
    `satuan_obat` varchar(7) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `supplier`
  --
  
  CREATE TABLE `supplier` (
    `id` int(11) NOT NULL,
    `kode_supplier` varchar(5) NOT NULL,
    `nama_supplier` varchar(30) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `user`
  --
  
  CREATE TABLE `user` (
    `id` int(11) NOT NULL,
    `kode_user` int(5) NOT NULL,
    `nama_user` varchar(10) NOT NULL,
    `username` varchar(15) NOT NULL,
    `password` varchar(10) NOT NULL,
    `id_jabatan` int(11) NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  
  --
  -- Indexes for dumped tables
  --
  
  --
  -- Indexes for table `detail_obat`
  --
  ALTER TABLE `detail_obat`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `detail_pembelian`
  --
  ALTER TABLE `detail_pembelian`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `detail_penjualan`
  --
  ALTER TABLE `detail_penjualan`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `detail_resep`
  --
  ALTER TABLE `detail_resep`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `detail_retur`
  --
  ALTER TABLE `detail_retur`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `dosis`
  --
  ALTER TABLE `dosis`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `jabatan`
  --
  ALTER TABLE `jabatan`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `jenis_obat`
  --
  ALTER TABLE `jenis_obat`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `obat`
  --
  ALTER TABLE `obat`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `pasien`
  --
  ALTER TABLE `pasien`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `pembelian_obat`
  --
  ALTER TABLE `pembelian_obat`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `penjualan`
  --
  ALTER TABLE `penjualan`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `resep`
  --
  ALTER TABLE `resep`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `retur`
  --
  ALTER TABLE `retur`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `satuan_obat`
  --
  ALTER TABLE `satuan_obat`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `supplier`
  --
  ALTER TABLE `supplier`
    ADD PRIMARY KEY (`id`);
  
  --
  -- Indexes for table `user`
  --
  ALTER TABLE `user`
    ADD PRIMARY KEY (`id`);
  
  --
  -- AUTO_INCREMENT for dumped tables
  --
  
  --
  -- AUTO_INCREMENT for table `detail_obat`
  --
  ALTER TABLE `detail_obat`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `detail_pembelian`
  --
  ALTER TABLE `detail_pembelian`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `detail_penjualan`
  --
  ALTER TABLE `detail_penjualan`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `detail_resep`
  --
  ALTER TABLE `detail_resep`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `detail_retur`
  --
  ALTER TABLE `detail_retur`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `dosis`
  --
  ALTER TABLE `dosis`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `jabatan`
  --
  ALTER TABLE `jabatan`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `jenis_obat`
  --
  ALTER TABLE `jenis_obat`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `obat`
  --
  ALTER TABLE `obat`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `pasien`
  --
  ALTER TABLE `pasien`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `pembelian_obat`
  --
  ALTER TABLE `pembelian_obat`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `penjualan`
  --
  ALTER TABLE `penjualan`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `resep`
  --
  ALTER TABLE `resep`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `retur`
  --
  ALTER TABLE `retur`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `satuan_obat`
  --
  ALTER TABLE `satuan_obat`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `supplier`
  --
  ALTER TABLE `supplier`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  
  --
  -- AUTO_INCREMENT for table `user`
  --
  ALTER TABLE `user`
    MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
  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 */;
  