-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: 31 Des 2019 pada 01.38
-- Versi Server: 10.1.28-MariaDB
-- PHP Version: 5.6.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: `azkasir`
--

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

--
-- Struktur dari tabel `ci_sessions`
--

CREATE TABLE `ci_sessions` (
  `id` varchar(128) NOT NULL,
  `ip_address` varchar(45) NOT NULL,
  `timestamp` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `data` blob NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `ci_sessions`
--

INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES
('bc2748c31e20b0b6bd81cec8e85609fedeb45692', '::1', 1570749045, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303734383831313b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d473353436c4f6e76496f636568383775223b),
('b12eab3004d85ccbd618dfd300cbc07c284c281b', '::1', 1570749379, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303734393234353b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d473353436c4f6e76496f636568383775223b),
('c310d70a4d57f8750d3955409eb3dbfc75540eda', '::1', 1570749871, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303734393537353b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d473353436c4f6e76496f636568383775223b),
('111246c80edd548c4029de4d2bd5b28180e171b8', '::1', 1570750011, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303734393933313b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d473353436c4f6e76496f636568383775223b),
('fd7951c1eb742fc19777cc196d68c714084abad3', '::1', 1570750371, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303735303332303b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d473353436c4f6e76496f636568383775223b),
('30bb9bf64cc602985edfd988f4e2a45d486fabf1', '::1', 1570799024, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303739393031343b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d61684d42756f444943374a3469563078223b),
('2a449cd6fc15f9d9f0c5094b62021034b6493519', '::1', 1570803729, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303830333635383b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d61684d42756f444943374a3469563078223b),
('1b2c5da7ee922b393fd8de6ace1b71f582c6ce8e', '::1', 1570805275, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303830343934343b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d61684d42756f444943374a3469563078223b),
('c489def1bdfa69561ea7c1e6d0bcd3fa0f53833e', '::1', 1570805548, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537303830353331353b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d61684d42756f444943374a3469563078223b),
('edcb1a499cd54351bcad3706cb97df001d33fc99', '::1', 1577749882, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537373734393731373b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d477243306b78676f7644585145795a6d223b),
('e455f50b2392e1806480da39528dab631fefa07b', '::1', 1577750336, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537373735303134363b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d477243306b78676f7644585145795a6d223b),
('c3aac6d19f2991c4e9d9357660f4127ce5967965', '::1', 1577750951, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537373735303631383b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d477243306b78676f7644585145795a6d223b),
('00d2765948e55e85e4d65425f4ee9feaac447f88', '::1', 1577751258, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537373735303935383b757365726e616d657c733a31333a2261646d696e6973747261746f72223b6964757365727c733a313a2231223b757365725f747970657c733a31333a2261646d696e6973747261746f72223b6e616d657c733a31333a2241646d696e6973747261746f72223b7472616e735f73657373696f6e7c733a32303a223a3a312d477243306b78676f7644585145795a6d223b),
('83753f5fbeed7a61fe1881b1dc8e92179a24609c', '::1', 1577751794, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537373735313639343b757365726e616d657c733a353a2261646d696e223b6964757365727c733a313a2239223b757365725f747970657c733a353a2261646d696e223b6e616d657c733a353a2241646d696e223b7472616e735f73657373696f6e7c733a32303a223a3a312d5171634b6d69764938615942434f6b70223b),
('63b8d86bec7468bb7be49bad08835ecbfaddf7aa', '::1', 1577752627, 0x5f5f63695f6c6173745f726567656e65726174657c693a313537373735323535383b757365726e616d657c733a353a2261646d696e223b6964757365727c733a313a2239223b757365725f747970657c733a353a2261646d696e223b6e616d657c733a353a2241646d696e223b7472616e735f73657373696f6e7c733a32303a223a3a312d5171634b6d69764938615942434f6b70223b);

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

--
-- Struktur dari tabel `config`
--

CREATE TABLE `config` (
  `idconfig` int(11) NOT NULL,
  `key` varchar(100) DEFAULT NULL,
  `value` text,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `config`
--

INSERT INTO `config` (`idconfig`, `key`, `value`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'prefix_barcode', 'KPS', '2016-03-14 00:00:00', 'system', NULL, NULL),
(2, 'prefix_nota', 'TPM', '2016-04-19 00:00:00', 'system', NULL, NULL),
(3, 'store_name', 'TOKO PUTRI MELATI', '2016-05-03 00:00:00', 'System', NULL, NULL),
(4, 'store_description', 'Jl. Raya Indonesia Raya', '2016-05-03 00:00:00', 'System', NULL, NULL),
(5, 'store_phone', '08123123123', '2016-06-09 00:00:00', 'system', NULL, NULL),
(6, 'ppn', '10', '2017-12-24 07:42:28', NULL, '2017-12-24 07:42:29', NULL),
(7, 'ppn', '10', '2017-12-24 07:42:28', NULL, '2017-12-24 07:42:29', NULL);

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

--
-- Struktur dari tabel `customer`
--

CREATE TABLE `customer` (
  `idcustomer` int(11) NOT NULL,
  `name` varchar(200) DEFAULT NULL,
  `gender` varchar(100) DEFAULT NULL,
  `address` varchar(300) DEFAULT NULL,
  `phone` varchar(100) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(50) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `customer`
--

INSERT INTO `customer` (`idcustomer`, `name`, `gender`, `address`, `phone`, `email`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'tes', 'laki-laki', '', '', NULL, '2016-07-31 23:22:26', 'administrator', '2016-07-31 23:22:26', 'administrator'),
(2, 'e', 'laki-laki', '', '', NULL, '2016-07-31 23:22:34', 'administrator', '2016-07-31 23:22:34', 'administrator');

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

--
-- Struktur dari tabel `group`
--

CREATE TABLE `group` (
  `idgroup` int(11) NOT NULL,
  `group_name` varchar(200) DEFAULT NULL,
  `description` varchar(200) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(200) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `group`
--

INSERT INTO `group` (`idgroup`, `group_name`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'administrator', 'Administrator', '2016-04-26 00:04:00', 'System', NULL, NULL),
(2, 'kasir', 'Kasir', '2016-04-26 00:05:00', 'System', NULL, NULL),
(3, 'admin', 'Admin', '2017-01-19 23:55:09', NULL, '2017-01-19 23:55:09', NULL);

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

--
-- Struktur dari tabel `product`
--

CREATE TABLE `product` (
  `idproduct` bigint(11) UNSIGNED NOT NULL,
  `idproduct_unit` bigint(11) UNSIGNED DEFAULT NULL,
  `idproduct_category` bigint(11) UNSIGNED DEFAULT NULL,
  `barcode` varchar(100) DEFAULT NULL,
  `name` varchar(300) DEFAULT NULL,
  `modal_price` double DEFAULT NULL,
  `price` double UNSIGNED DEFAULT NULL,
  `grosir_price` double UNSIGNED DEFAULT NULL,
  `semi_grosir_price` double UNSIGNED DEFAULT NULL,
  `stock` double DEFAULT '0',
  `description` varchar(300) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `product`
--

INSERT INTO `product` (`idproduct`, `idproduct_unit`, `idproduct_category`, `barcode`, `name`, `modal_price`, `price`, `grosir_price`, `semi_grosir_price`, `stock`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(34, 1, 1, '1111', 'pulpen', 1000, 1500, 1200, 1300, 17, '', '2019-12-31 07:09:10', 'administrator', '2019-12-31 07:09:10', 'administrator');

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

--
-- Struktur dari tabel `product_category`
--

CREATE TABLE `product_category` (
  `idproduct_category` bigint(11) UNSIGNED NOT NULL,
  `name` varchar(200) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `product_category`
--

INSERT INTO `product_category` (`idproduct_category`, `name`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'MINUMAN', '2019-10-11 21:47:54', 'administrator', '2019-10-11 21:47:55', 'administrator');

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

--
-- Struktur dari tabel `product_stock`
--

CREATE TABLE `product_stock` (
  `idproduct_stock` bigint(11) UNSIGNED NOT NULL,
  `idproduct` bigint(11) UNSIGNED DEFAULT NULL,
  `idtransaction_group` bigint(20) UNSIGNED DEFAULT NULL,
  `iduser` int(11) DEFAULT NULL,
  `idsupplier` bigint(11) UNSIGNED DEFAULT NULL,
  `stock_date` datetime DEFAULT NULL,
  `type` varchar(100) DEFAULT NULL,
  `detail` varchar(100) DEFAULT NULL,
  `detail2` varchar(300) DEFAULT NULL,
  `total` bigint(11) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `product_stock`
--

INSERT INTO `product_stock` (`idproduct_stock`, `idproduct`, `idtransaction_group`, `iduser`, `idsupplier`, `stock_date`, `type`, `detail`, `detail2`, `total`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(31, 34, NULL, NULL, NULL, '2019-12-31 07:09:18', 'stok_masuk', 'penambahan_stok', '', 20, '2019-12-31 07:09:41', 'administrator', '2019-12-31 07:09:41', 'administrator'),
(32, 34, 48, NULL, NULL, '2019-12-31 07:12:35', 'stok_keluar', 'penjualan', NULL, 1, '2019-12-31 07:12:35', 'administrator', '2019-12-31 07:12:35', 'administrator'),
(33, 34, 50, NULL, NULL, '2019-12-31 07:21:18', 'stok_keluar', 'penjualan', NULL, 2, '2019-12-31 07:21:18', 'kasir1', '2019-12-31 07:21:18', 'kasir1');

--
-- Trigger `product_stock`
--
DELIMITER $$
CREATE TRIGGER `delete_product_stock` AFTER DELETE ON `product_stock` FOR EACH ROW BEGIN
	IF OLD.type = 'stok_masuk' THEN
    	BEGIN
        	UPDATE product set stock = stock - OLD.total 
  			WHERE idproduct = OLD.idproduct;
        END;
    END IF;
    IF OLD.type = 'stok_keluar' THEN
    	BEGIN
        	UPDATE product set stock = stock + OLD.total 
  			WHERE idproduct = OLD.idproduct;
        END;
    END IF;
    
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `insert_product_stock` AFTER INSERT ON `product_stock` FOR EACH ROW BEGIN
	IF NEW.type = 'stok_masuk' THEN
    	BEGIN
        	UPDATE product set stock = stock + NEW.total 
  			WHERE idproduct = NEW.idproduct;
        END;
    END IF;
    IF NEW.type = 'stok_keluar' THEN
    	BEGIN
        	UPDATE product set stock = stock - NEW.total 
  			WHERE idproduct = NEW.idproduct;
        END;
    END IF;
    
END
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `update_product_stock` AFTER UPDATE ON `product_stock` FOR EACH ROW BEGIN
	IF OLD.type = 'stok_masuk' THEN
    	BEGIN
            UPDATE product set stock = stock - OLD.total WHERE idproduct = OLD.idproduct; 
     	END;
    END IF;
    IF OLD.type = 'stok_keluar' THEN
    	BEGIN
        	UPDATE product set stock = stock + OLD.total WHERE idproduct = OLD.idproduct;
        END;
    END IF;
    IF NEW.type = 'stok_masuk' THEN
    	BEGIN
        	UPDATE product set stock = stock + NEW.total 
  			WHERE idproduct = NEW.idproduct;
        END;
    END IF;
    IF NEW.type = 'stok_keluar' THEN
    	BEGIN
        	UPDATE product set stock = stock - NEW.total 
  			WHERE idproduct = NEW.idproduct;
        END;
    END IF;
END
$$
DELIMITER ;

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

--
-- Struktur dari tabel `product_unit`
--

CREATE TABLE `product_unit` (
  `idproduct_unit` bigint(11) UNSIGNED NOT NULL,
  `name` varchar(200) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `product_unit`
--

INSERT INTO `product_unit` (`idproduct_unit`, `name`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'PCS', NULL, NULL, NULL, NULL);

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

--
-- Struktur dari tabel `supplier`
--

CREATE TABLE `supplier` (
  `idsupplier` bigint(11) UNSIGNED NOT NULL,
  `name` varchar(200) DEFAULT NULL,
  `address` varchar(300) DEFAULT NULL,
  `address2` varchar(500) DEFAULT NULL,
  `phone` varchar(100) DEFAULT NULL,
  `phone2` varchar(50) DEFAULT NULL,
  `phone3` varchar(50) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `email2` varchar(50) DEFAULT NULL,
  `bbm` varchar(50) DEFAULT NULL,
  `bbm2` varchar(50) DEFAULT NULL,
  `description` text,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(50) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `supplier`
--

INSERT INTO `supplier` (`idsupplier`, `name`, `address`, `address2`, `phone`, `phone2`, `phone3`, `email`, `email2`, `bbm`, `bbm2`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'Angel Karambol', 'Jl. Raya Mekarjaya 90', NULL, 'Umum', NULL, NULL, NULL, NULL, NULL, NULL, '', '2016-07-25 21:43:47', 'administrator', '2016-07-25 22:57:38', 'administrator'),
(2, 'Robin Jonathan', 'Jl. Raya Indonesia 123', NULL, 'Umum', NULL, NULL, NULL, NULL, NULL, NULL, '', '2016-07-25 21:43:53', 'administrator', '2016-07-25 22:56:42', 'administrator');

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

--
-- Struktur dari tabel `transaction`
--

CREATE TABLE `transaction` (
  `idtransaction` bigint(20) NOT NULL,
  `idtransaction_group` bigint(20) UNSIGNED DEFAULT NULL,
  `idproduct` bigint(20) UNSIGNED DEFAULT NULL,
  `qty` double DEFAULT NULL,
  `discount` double UNSIGNED DEFAULT NULL,
  `modal_price` double UNSIGNED DEFAULT NULL,
  `sell_price` double UNSIGNED DEFAULT NULL,
  `final_price` double UNSIGNED DEFAULT NULL,
  `status` varchar(10) DEFAULT NULL,
  `description` text,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `transaction`
--

INSERT INTO `transaction` (`idtransaction`, `idtransaction_group`, `idproduct`, `qty`, `discount`, `modal_price`, `sell_price`, `final_price`, `status`, `description`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(49, 48, 34, 1, 0, 1000, 1500, 1500, 'OK', NULL, '2019-12-31 07:12:24', 'administrator', '2019-12-31 07:12:24', 'administrator'),
(50, 49, 34, 1, 0, 1000, 1300, 1300, 'PROCESS', NULL, '2019-12-31 07:17:46', 'kasir1', '2019-12-31 07:17:46', 'kasir1'),
(51, 50, 34, 2, 0, 1000, 1500, 3000, 'OK', NULL, '2019-12-31 07:21:10', 'kasir1', '2019-12-31 07:21:10', 'kasir1');

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

--
-- Struktur dari tabel `transaction_group`
--

CREATE TABLE `transaction_group` (
  `idtransaction_group` bigint(20) UNSIGNED NOT NULL,
  `idcustomer` int(11) DEFAULT NULL,
  `iduser` int(11) DEFAULT NULL,
  `idemployee` int(11) DEFAULT NULL,
  `code` varchar(200) DEFAULT NULL,
  `total_discount` double UNSIGNED DEFAULT NULL,
  `total_discount_percent` double DEFAULT NULL,
  `total_sell_price` double UNSIGNED DEFAULT NULL,
  `total_final_price` double UNSIGNED DEFAULT NULL,
  `transaction_date` datetime DEFAULT NULL,
  `total_cash` double UNSIGNED DEFAULT NULL,
  `total_change` double DEFAULT NULL,
  `payment_type` varchar(20) DEFAULT NULL,
  `bank` varchar(100) DEFAULT NULL,
  `status` varchar(100) DEFAULT NULL COMMENT 'PROCESS, PENDING, OK',
  `note` text,
  `session` varchar(200) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `transaction_group`
--

INSERT INTO `transaction_group` (`idtransaction_group`, `idcustomer`, `iduser`, `idemployee`, `code`, `total_discount`, `total_discount_percent`, `total_sell_price`, `total_final_price`, `transaction_date`, `total_cash`, `total_change`, `payment_type`, `bank`, `status`, `note`, `session`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(48, NULL, 1, NULL, 'AZPJ191231E35BJJ', 0, NULL, 1500, 1500, '2019-12-31 07:11:22', 2000, 500, 'cash', NULL, 'OK', NULL, '::1-GrC0kxgovDXQEyZm', '2019-12-31 07:11:39', 'administrator', '2019-12-31 07:12:35', 'administrator'),
(49, NULL, 2, NULL, NULL, NULL, NULL, 1300, 1300, '2019-12-31 07:17:35', NULL, NULL, NULL, NULL, 'PROCESS', NULL, '::1-DZfprvLV29WYqnyk', '2019-12-31 07:17:46', 'kasir1', '2019-12-31 07:17:46', 'kasir1'),
(50, NULL, 2, NULL, 'TPM191231QBPTW0', 0, NULL, 3000, 3000, '2019-12-31 07:21:01', 5000, 2000, 'cash', NULL, 'OK', NULL, '::1-znbSYq8rP2BatL79', '2019-12-31 07:21:09', 'kasir1', '2019-12-31 07:21:18', 'kasir1');

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

--
-- Struktur dari tabel `user`
--

CREATE TABLE `user` (
  `iduser` int(11) NOT NULL,
  `username` varchar(200) DEFAULT NULL,
  `password` varchar(300) DEFAULT NULL,
  `name` varchar(200) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(200) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `user`
--

INSERT INTO `user` (`iduser`, `username`, `password`, `name`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 'administrator', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2016-04-26 00:08:00', 'System', NULL, NULL),
(2, 'kasir1', '29c748d4d8f4bd5cbc0f3f60cb7ed3d0', 'Mas Kasir', '2016-04-26 00:09:00', 'System', '2019-12-31 07:16:51', 'administrator'),
(3, 'kasir2', '698d51a19d8a121ce581499d7b701668', 'Mbak Kasir', '2016-04-26 00:09:00', 'System', '2016-04-28 20:55:49', 'administrator'),
(8, 'kasir3', '81dc9bdb52d04dc20036dbd8313ed055', 'Kasir 3', '2016-05-03 19:44:39', NULL, '2016-05-03 19:44:59', NULL),
(9, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'Admin', NULL, NULL, '2019-12-31 07:18:39', 'administrator');

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

--
-- Struktur dari tabel `user_group`
--

CREATE TABLE `user_group` (
  `iduser_group` int(11) NOT NULL,
  `iduser` int(11) DEFAULT NULL,
  `idgroup` int(11) DEFAULT NULL,
  `created` datetime DEFAULT NULL,
  `createdby` varchar(200) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `user_group`
--

INSERT INTO `user_group` (`iduser_group`, `iduser`, `idgroup`, `created`, `createdby`, `updated`, `updatedby`) VALUES
(1, 1, 1, '2016-04-26 00:10:00', 'System', NULL, NULL),
(2, 2, 2, '2016-04-26 00:11:00', 'System', NULL, NULL),
(3, 3, 2, '2016-04-26 00:12:00', 'System', NULL, NULL),
(6, 8, 2, '2016-05-03 19:44:39', NULL, NULL, NULL),
(7, 9, 3, '2017-01-19 23:56:57', NULL, '2017-01-19 23:56:58', NULL);

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

--
-- Struktur dari tabel `user_role`
--

CREATE TABLE `user_role` (
  `iduser_role` int(11) NOT NULL,
  `idrole` int(11) DEFAULT NULL,
  `menu_name` varchar(50) DEFAULT NULL,
  `access` int(11) DEFAULT '0',
  `created` datetime DEFAULT NULL,
  `createdby` varchar(50) DEFAULT NULL,
  `updated` datetime DEFAULT NULL,
  `updatedby` varchar(50) DEFAULT NULL,
  `status` int(11) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data untuk tabel `user_role`
--

INSERT INTO `user_role` (`iduser_role`, `idrole`, `menu_name`, `access`, `created`, `createdby`, `updated`, `updatedby`, `status`) VALUES
(1, 2, 'dasboard', 1, '2017-12-23 02:34:34', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(2, 2, 'supplier', 0, '2017-12-23 02:34:34', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(3, 2, 'customer', 0, '2017-12-23 02:34:34', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(4, 2, 'product', 0, '2017-12-23 02:34:34', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(5, 2, 'product_category', 0, '2017-12-23 02:34:34', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(6, 2, 'product_unit', 0, '2017-12-23 02:34:34', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(7, 2, 'stock', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(8, 2, 'stock_in', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(9, 2, 'stock_out', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(10, 2, 'transaction', 1, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:44', 'administrator', 1),
(11, 2, 'transaction_list', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:45', 'administrator', 1),
(12, 2, 'resport_stock_in', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:45', 'administrator', 1),
(13, 2, 'report_stock_out', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:45', 'administrator', 1),
(14, 2, 'setting', 0, '2017-12-23 02:34:35', 'administrator', '2017-12-23 02:36:45', 'administrator', 1),
(15, 2, 'transaction_sale', 1, '2017-12-23 02:36:44', 'administrator', NULL, NULL, 1);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `ci_sessions`
--
ALTER TABLE `ci_sessions`
  ADD KEY `ci_sessions_timestamp` (`timestamp`);

--
-- Indexes for table `config`
--
ALTER TABLE `config`
  ADD PRIMARY KEY (`idconfig`);

--
-- Indexes for table `customer`
--
ALTER TABLE `customer`
  ADD PRIMARY KEY (`idcustomer`);

--
-- Indexes for table `group`
--
ALTER TABLE `group`
  ADD PRIMARY KEY (`idgroup`);

--
-- Indexes for table `product`
--
ALTER TABLE `product`
  ADD PRIMARY KEY (`idproduct`),
  ADD UNIQUE KEY `barcode` (`barcode`),
  ADD KEY `idsupplier` (`idproduct_category`),
  ADD KEY `idproduct_unit` (`idproduct_unit`),
  ADD KEY `idkategori` (`idproduct_category`);

--
-- Indexes for table `product_category`
--
ALTER TABLE `product_category`
  ADD PRIMARY KEY (`idproduct_category`);

--
-- Indexes for table `product_stock`
--
ALTER TABLE `product_stock`
  ADD PRIMARY KEY (`idproduct_stock`),
  ADD KEY `idproduct` (`idproduct`),
  ADD KEY `idtransaction_group` (`idtransaction_group`),
  ADD KEY `iduser` (`iduser`),
  ADD KEY `idsupplier` (`idsupplier`);

--
-- Indexes for table `product_unit`
--
ALTER TABLE `product_unit`
  ADD PRIMARY KEY (`idproduct_unit`);

--
-- Indexes for table `supplier`
--
ALTER TABLE `supplier`
  ADD PRIMARY KEY (`idsupplier`);

--
-- Indexes for table `transaction`
--
ALTER TABLE `transaction`
  ADD PRIMARY KEY (`idtransaction`),
  ADD KEY `idproduct` (`idproduct`),
  ADD KEY `idtransaction_group` (`idtransaction_group`);

--
-- Indexes for table `transaction_group`
--
ALTER TABLE `transaction_group`
  ADD PRIMARY KEY (`idtransaction_group`),
  ADD UNIQUE KEY `code` (`code`),
  ADD KEY `idcustomer` (`idcustomer`),
  ADD KEY `iduser` (`iduser`),
  ADD KEY `FK_transaction_group_employee` (`idemployee`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`iduser`);

--
-- Indexes for table `user_group`
--
ALTER TABLE `user_group`
  ADD PRIMARY KEY (`iduser_group`),
  ADD KEY `iduser` (`iduser`,`idgroup`),
  ADD KEY `idgroup` (`idgroup`);

--
-- Indexes for table `user_role`
--
ALTER TABLE `user_role`
  ADD PRIMARY KEY (`iduser_role`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `config`
--
ALTER TABLE `config`
  MODIFY `idconfig` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

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

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

--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
  MODIFY `idproduct` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;

--
-- AUTO_INCREMENT for table `product_category`
--
ALTER TABLE `product_category`
  MODIFY `idproduct_category` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `product_stock`
--
ALTER TABLE `product_stock`
  MODIFY `idproduct_stock` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;

--
-- AUTO_INCREMENT for table `product_unit`
--
ALTER TABLE `product_unit`
  MODIFY `idproduct_unit` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `supplier`
--
ALTER TABLE `supplier`
  MODIFY `idsupplier` bigint(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `transaction`
--
ALTER TABLE `transaction`
  MODIFY `idtransaction` bigint(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=52;

--
-- AUTO_INCREMENT for table `transaction_group`
--
ALTER TABLE `transaction_group`
  MODIFY `idtransaction_group` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=51;

--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `iduser` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;

--
-- AUTO_INCREMENT for table `user_group`
--
ALTER TABLE `user_group`
  MODIFY `iduser_group` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `user_role`
--
ALTER TABLE `user_role`
  MODIFY `iduser_role` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables)
--

--
-- Ketidakleluasaan untuk tabel `product`
--
ALTER TABLE `product`
  ADD CONSTRAINT `product_ibfk_2` FOREIGN KEY (`idproduct_unit`) REFERENCES `product_unit` (`idproduct_unit`),
  ADD CONSTRAINT `product_ibfk_3` FOREIGN KEY (`idproduct_category`) REFERENCES `product_category` (`idproduct_category`);

--
-- Ketidakleluasaan untuk tabel `product_stock`
--
ALTER TABLE `product_stock`
  ADD CONSTRAINT `product_stock_ibfk_1` FOREIGN KEY (`idproduct`) REFERENCES `product` (`idproduct`),
  ADD CONSTRAINT `product_stock_ibfk_2` FOREIGN KEY (`idtransaction_group`) REFERENCES `transaction_group` (`idtransaction_group`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `product_stock_ibfk_3` FOREIGN KEY (`iduser`) REFERENCES `user` (`iduser`),
  ADD CONSTRAINT `product_stock_ibfk_4` FOREIGN KEY (`idsupplier`) REFERENCES `supplier` (`idsupplier`);

--
-- Ketidakleluasaan untuk tabel `transaction`
--
ALTER TABLE `transaction`
  ADD CONSTRAINT `transaction_ibfk_1` FOREIGN KEY (`idproduct`) REFERENCES `product` (`idproduct`),
  ADD CONSTRAINT `transaction_ibfk_2` FOREIGN KEY (`idtransaction_group`) REFERENCES `transaction_group` (`idtransaction_group`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Ketidakleluasaan untuk tabel `transaction_group`
--
ALTER TABLE `transaction_group`
  ADD CONSTRAINT `FK_transaction_group_employee` FOREIGN KEY (`idemployee`) REFERENCES `employee` (`idemployee`),
  ADD CONSTRAINT `transaction_group_ibfk_1` FOREIGN KEY (`idcustomer`) REFERENCES `customer` (`idcustomer`),
  ADD CONSTRAINT `transaction_group_ibfk_2` FOREIGN KEY (`iduser`) REFERENCES `user` (`iduser`);

--
-- Ketidakleluasaan untuk tabel `user_group`
--
ALTER TABLE `user_group`
  ADD CONSTRAINT `user_group_ibfk_1` FOREIGN KEY (`iduser`) REFERENCES `user` (`iduser`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `user_group_ibfk_2` FOREIGN KEY (`idgroup`) REFERENCES `group` (`idgroup`) ON DELETE CASCADE 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 */;
