-
Notifications
You must be signed in to change notification settings - Fork 0
/
sistemub.sql
311 lines (256 loc) · 9.06 KB
/
sistemub.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 11, 2019 at 04:43 PM
-- Server version: 10.1.29-MariaDB
-- PHP Version: 7.1.12
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: `sistemub`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE `admin` (
`id_admin` int(11) NOT NULL,
`nama_lengkap` varchar(100) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`id_admin`, `nama_lengkap`, `username`, `password`) VALUES
(1, 'Nando Oktoviandi', 'admin', '21232f297a57a5a743894a0e4a801fc3');
-- --------------------------------------------------------
--
-- Table structure for table `barang`
--
CREATE TABLE `barang` (
`kode_barang` varchar(20) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`jumlah_stok` int(11) NOT NULL,
`satuan` char(10) NOT NULL,
`merk_barang` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang`
--
INSERT INTO `barang` (`kode_barang`, `nama_barang`, `jumlah_stok`, `satuan`, `merk_barang`) VALUES
('P0001', 'Enduro 4T (24x0,8)', 15, 'Dus', 'Pertamina'),
('P0002', 'Enduro Racing (6x1)', 10, 'Dus', 'Pertamina'),
('P0003', 'Enduro Matic (6x0,8)', 5, 'Dus', 'Pertamina'),
('P0004', 'Fastron Tecno 10/40 (20x1)', 20, 'Dus', 'Pertamina'),
('P0005', 'Fastron Tecno 10/40 (6x4)', 20, 'Dus', 'Pertamina'),
('P0006', 'Fastron Tecno 15/40 (20x1)', 10, 'Dus', 'Pertamina'),
('P0007', 'Fastron Tecno 15/40 (6x4)', 12, 'Dus', 'Pertamina'),
('P0008', 'Meditran sc (20x1)', 7, 'Dus', 'Pertamina'),
('P0009', 'Meditran sc (2x10)', 40, 'Dus', 'Pertamina'),
('P0010', 'Meditran sc (4x5)', 25, 'Dus', 'Pertamina'),
('P0011', 'Meditran s40 (20x1)', 25, 'Dus', 'Pertamina'),
('P0012', 'Meditran s40 (2x10)', 70, 'Dus', 'Pertamina'),
('P0013', 'Meditran s40 (4x5)', 55, 'Dus', 'Pertamina'),
('P0014', 'Meditran sx (20x1)', 5, 'Dus', 'Pertamina'),
('P0015', 'Meditran sx (2x10)', 28, 'Dus', 'Pertamina'),
('P0016', 'Meditran sx (6x4)', 25, 'Dus', 'Pertamina'),
('P0017', 'Mesran 40 (20x1)', 20, 'Dus', 'Pertamina'),
('P0018', 'Mesran 40 (6x4)', 3, 'Dus', 'Pertamina'),
('P0019', 'Prima xp (20x1)', 45, 'Dus', 'Pertamina'),
('P0020', 'Prima xp (6x4)', 58, 'Dus', 'Pertamina');
-- --------------------------------------------------------
--
-- Table structure for table `barang_keluar`
--
CREATE TABLE `barang_keluar` (
`id_keluar` varchar(20) NOT NULL,
`kode_barang` varchar(20) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`jumlah_barang` int(11) NOT NULL,
`satuan` char(10) NOT NULL,
`nama_konsumen` varchar(100) NOT NULL,
`tanggal` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Triggers `barang_keluar`
--
DELIMITER $$
CREATE TRIGGER `pengeluaran_barang` AFTER INSERT ON `barang_keluar` FOR EACH ROW BEGIN
UPDATE barang SET jumlah_barang=jumlah_stok-NEW.jumlah_barang
WHERE id_keluar=NEW.kode_barang;
END
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `barang_masuk`
--
CREATE TABLE `barang_masuk` (
`id_masuk` varchar(20) NOT NULL,
`kode_barang` varchar(20) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`jumlah_barang` int(11) NOT NULL,
`satuan` char(10) NOT NULL,
`nama_supplier` varchar(100) NOT NULL,
`tanggal` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang_masuk`
--
INSERT INTO `barang_masuk` (`id_masuk`, `kode_barang`, `nama_barang`, `jumlah_barang`, `satuan`, `nama_supplier`, `tanggal`) VALUES
('BM01', 'P0012', 'Meditran s40 (2x10)', 25, 'Dus', 'PT. Natiotama Pusaka Cotranda', '2019-03-08'),
('BM02', 'P0012', 'Meditran s40 (2x10)', 30, 'Dus', 'PT. Arjuna Lumas Dwiguna', '2019-03-08'),
('BM03', 'P0012', 'Meditran s40 (2x10)', 7, 'Dus', 'PT. Arjuna Lumas Dwiguna', '2019-03-10');
-- --------------------------------------------------------
--
-- Table structure for table `barang_out`
--
CREATE TABLE `barang_out` (
`id_out` varchar(20) NOT NULL,
`kode_barang` varchar(20) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`jumlah_barang` int(11) NOT NULL,
`satuan` char(10) NOT NULL,
`nama_konsumen` varchar(100) NOT NULL,
`tanggal` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `barang_return`
--
CREATE TABLE `barang_return` (
`id_return` varchar(20) NOT NULL,
`kode_barang` varchar(20) NOT NULL,
`nama_barang` varchar(100) NOT NULL,
`jumlah_barang` int(11) NOT NULL,
`satuan` char(10) NOT NULL,
`ket` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `barang_return`
--
INSERT INTO `barang_return` (`id_return`, `kode_barang`, `nama_barang`, `jumlah_barang`, `satuan`, `ket`) VALUES
('R01', 'P0012', 'Meditran s40 (2x10)', 1, 'Dus', 'Barang Bocor pada bagian atas');
-- --------------------------------------------------------
--
-- Table structure for table `konsumen`
--
CREATE TABLE `konsumen` (
`kode_konsumen` varchar(20) NOT NULL,
`nama_konsumen` varchar(100) NOT NULL,
`alamat_konsumen` varchar(100) NOT NULL,
`telepon` varchar(15) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `konsumen`
--
INSERT INTO `konsumen` (`kode_konsumen`, `nama_konsumen`, `alamat_konsumen`, `telepon`) VALUES
('K0001', 'Adelia Service', 'Jl. KH Nasution', '-'),
('K0002', 'Fauzan Motor', 'Jl. Tengku Bey', ''),
('K0003', 'Baro Motor', 'Jl. KH Nasution', ''),
('K0004', 'Family Motor', 'Jl. KH Nasution', ''),
('K0005', 'Indah Service', 'Jl. Raya Kubang', ''),
('K0006', 'Sapta Jaya', 'Jl. Soekarno Hatta', ''),
('K0007', 'Budi Agung', 'Jl. Soekarno Hatta', ''),
('K0008', 'Ikomiyato', 'Jl. Soekarno Hatta', '');
-- --------------------------------------------------------
--
-- Table structure for table `supplier`
--
CREATE TABLE `supplier` (
`kode_supplier` varchar(20) NOT NULL,
`nama_supplier` varchar(100) NOT NULL,
`alamat_supplier` varchar(100) NOT NULL,
`telp` varchar(15) NOT NULL,
`merk_barang` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `supplier`
--
INSERT INTO `supplier` (`kode_supplier`, `nama_supplier`, `alamat_supplier`, `telp`, `merk_barang`) VALUES
('S0001', 'PT. Natiotama Pusaka Cotranda', 'Jl. Panglima Undan No. 73', '0761-22184', 'Pertamina'),
('S0002', 'PT. Arjuna Lumas Dwiguna', 'Jl. Pahlawan No. 2', '0761-1234', 'Pertamina'),
('S0003', 'PT. Riau Mandiri Eka Sakti', 'Jl. Riau No. 73', '0761-88123', 'Pertamina'),
('S0004', 'PT. Calispo Jaya Abadi', 'Jl. SM Amin', '', 'Castrol'),
('S0005', 'PT. Rianda Ganda Mandiri', 'Jl. Rajawali', '', 'Shell'),
('S0006', 'PT. Dirgantara Mitrakarya', 'Jl. Riau Ujung', '', 'Unioil'),
('S0007', 'PT. Agung Automall', 'Jl. SM Amin', '', 'Toyota'),
('S0008', 'PT. Jasa Barutama Perkasa', 'Jl. Tuanku Tambusai', '', 'Top1'),
('S0009', 'PT. Oto Wira Eka Nusa', 'Jl. Cempaka', '', 'Total');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admin`
--
ALTER TABLE `admin`
ADD PRIMARY KEY (`id_admin`);
--
-- Indexes for table `barang`
--
ALTER TABLE `barang`
ADD PRIMARY KEY (`kode_barang`);
--
-- Indexes for table `barang_keluar`
--
ALTER TABLE `barang_keluar`
ADD PRIMARY KEY (`id_keluar`),
ADD KEY `kode_barang` (`kode_barang`);
--
-- Indexes for table `barang_masuk`
--
ALTER TABLE `barang_masuk`
ADD PRIMARY KEY (`id_masuk`),
ADD KEY `kode_barang` (`kode_barang`);
--
-- Indexes for table `barang_out`
--
ALTER TABLE `barang_out`
ADD PRIMARY KEY (`id_out`);
--
-- Indexes for table `barang_return`
--
ALTER TABLE `barang_return`
ADD PRIMARY KEY (`id_return`),
ADD KEY `kode_barang` (`kode_barang`);
--
-- Indexes for table `konsumen`
--
ALTER TABLE `konsumen`
ADD PRIMARY KEY (`kode_konsumen`);
--
-- Indexes for table `supplier`
--
ALTER TABLE `supplier`
ADD PRIMARY KEY (`kode_supplier`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `barang_keluar`
--
ALTER TABLE `barang_keluar`
ADD CONSTRAINT `barang_keluar_ibfk_1` FOREIGN KEY (`kode_barang`) REFERENCES `barang` (`kode_barang`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `barang_masuk`
--
ALTER TABLE `barang_masuk`
ADD CONSTRAINT `barang_masuk_ibfk_1` FOREIGN KEY (`kode_barang`) REFERENCES `barang` (`kode_barang`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `barang_return`
--
ALTER TABLE `barang_return`
ADD CONSTRAINT `barang_return_ibfk_1` FOREIGN KEY (`kode_barang`) REFERENCES `barang` (`kode_barang`) 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 */;