-
Notifications
You must be signed in to change notification settings - Fork 0
/
barang.php
386 lines (340 loc) · 16.7 KB
/
barang.php
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?php
include_once 'koneksi.php';
if(isset($_COOKIE['sukses']))
{
echo '<script type="text/javascript">
alert('.$_COOKIE["sukses"].')
</script>';
}
$supplier = mysqli_query($koneksi,"SELECT * FROM m_supplier");
$barang = mysqli_query($koneksi,"SELECT * FROM m_item");
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$start_date = isset($_POST['start_date']) ? $_POST['start_date'] : '';
$end_date = isset($_POST['end_date']) ? $_POST['end_date'] : '';
$search = isset($_POST['search']) ? $_POST['search'] : '';
$query = "SELECT * FROM m_item WHERE 1=1";
if (!empty($start_date) && !empty($end_date)) {
// Ubah format tanggal untuk cocok dengan format di database (YYYY-MM-DD)
$start_date_formatted = date("Y-m-d", strtotime($start_date));
$end_date_formatted = date("Y-m-d", strtotime($end_date));
$query .= " AND item_date BETWEEN ? AND ?";
}
if (!empty($search)) {
$query .= " AND (item_code LIKE ? OR workshop_name LIKE ? OR item_name LIKE ?)";
}
$stmt = mysqli_prepare($koneksi, $query);
if (!empty($start_date) && !empty($end_date)) {
mysqli_stmt_bind_param($stmt, "ss", $start_date_formatted, $end_date_formatted);
}
if (!empty($search)) {
$searchParam = "%" . $search . "%";
mysqli_stmt_bind_param($stmt, "sss", $searchParam, $searchParam, $searchParam);
}
mysqli_stmt_execute($stmt);
$barang = mysqli_stmt_get_result($stmt);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>StockGudang | Barang - Kelola gudang barang anda dengan cepat</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/fonts/css/font-awesome.min.css">
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-white">
<a class="navbar-brand" href="#"><img src="assets/img/warehouse.png" alt="" style="max-width: 55px;"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="supplier.php">Data Supplier</a>
</li>
<li class="nav-item <?php if(basename($_SERVER['PHP_SELF']) == 'barang.php') echo 'active'; ?>">
<a class="nav-link" href="barang.php">Barang Masuk <?php if(basename($_SERVER['PHP_SELF']) == 'barang.php') echo '<span class="sr-only">(current)</span>'; ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="mutasi.php">Barang Keluar</a>
</li>
<li>
<button class="btn btn-primary" onclick="printPage()">Print</button>
</li>
</ul>
<form class="form-inline" method="POST">
<div class="form-group mx-2">
<label class="mr-2">Search</label>
<input type="text" class="form-control" id="search" name="search" placeholder="Search...">
</div>
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</form>
<form class="form-inline" method="POST">
<div class="form-group mx-2">
<label class="mr-2">Tanggal Masuk</label>
<input type="date" class="form-control" id="start_date" name="start_date">
</div>
<div class="form-group mx-2">
<label class="mr-2">Tanggal Akhir</label>
<input type="date" class="form-control" id="end_date" name="end_date">
</div>
<button type="submit" class="btn btn-primary btn-sm">Filter</button>
</form>
</div>
</nav>s
<br><br>
<div class="container">
<table class="table" style="border-top:#56DE2F 4px solid;">
<thead class="thead">
<tr>
<th scope="col">No</th>
<th scope="col">Part Number</th>
<th scope="col">Nama Bengkel</th>
<th scope="col">Nama Barang Masuk</th>
<th scope="col">Quantity Barang Masuk</th>
<th scope="col">Satuan Barang</th>
<th scope="col">Tanggal Masuk</th>
<!-- <th scope="col">Nomor Polisi</th> -->
<th scope="col">Harga</th>
<th scope="col">Keterangan</th>
<th scope="col">Action <a type="button" class="btn btn-sm ml-2" href="javascript:void(0)" onclick="modal_barang()" style="background-color: #CD853F"><i class="fa fa-plus" style="color: #fff"></i></a></th>
</tr>
</thead>
<tbody>
<?php $no=1; foreach($barang as $databarang) { ?>
<!-- Kodingan Tambah Barang -->
<tr>
<th scope="row"><?php echo $no; ?></th>
<td><?php echo $databarang['item_code']; ?></td>
<td><?php echo $databarang['workshop_name']; ?></td>
<td><?php echo $databarang['item_name']; ?></td>
<td id="tablequantity"><?php echo $databarang['item_quantity']; ?></td>
<td><?php echo $databarang['item_satuan']; ?></td>
<td><?php echo $databarang['item_date']; ?></td>
<td><?php echo $databarang['item_price']; ?></td>
<td><?php echo $databarang['information']; ?></td>
<!-- Kodingan Button Edit Barang, Hapus Barang, Mutasi Barang -->
<td>
<a href="javascript:void(0)" onclick="edit_barang('<?php echo $databarang['item_id']?>')" class="btn btn-sm bg-warning" title="Edit"><i class="fa fa-pencil" style="color: #fff"></i></a>
<a href="processbarang.php?do=delete&id=<?php echo $databarang['item_id']?>" class="btn btn-sm bg-danger" title="Hapus!"><i class="fa fa-trash" style="color: #fff"></i></a>
<a href="javascript:void(0)" onclick="mutasi_barang('<?php echo $databarang['item_id']?>')" class="btn btn-sm bg-primary" title="Mutasi!"><i class="fa fa-truck" style="color: #fff"></i></a>
</td>
</tr>
<?php $no++;} ?>
</tbody>
</table>
</div>
<!-- Ini Kodingan Footer -->
<div class="container-fluid fixed-bottom bg-light" style=" color: #999;">
<div class="row">
<div class="col-sm-12">
<p align="center">© 2023 PT. CMA. ALL RIGHTS RESERVED.</p>
</div>
</div>
</div>
<!-- Kodingan Tambah Data -->
<div class="modal fade" id="form" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="formjudul">Tambah Barang</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<!-- Ini Kodingan Barang Masuk -->
<!-- Kodingan Part Number Masuk -->
<div class="modal-body">
<form action="processbarang.php?do=add" method="POST" id="formbarang">
<div class="form-group row">
<label for="kodebarang" class="col-sm-4 col-form-label">Part Number</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Part Number" id="kodebarang" name="kodebarang">
</div>
</div>
<!-- Kodingan Nama Bengkel Masuk -->
<div class="form-group row">
<label for="namabarang" class="col-sm-4 col-form-label">Nama Bengkel</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Nama Bengkel" id="workshop_name" name="workshop_name">
</div>
</div>
<!-- Kodingan Nama Barang Masuk -->
<div class="form-group row">
<label for="namabarang" class="col-sm-4 col-form-label">Nama Barang</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Nama Barang" id="namabarang" name="namabarang">
</div>
</div>
<!-- Kodingan Stock Quantity Masuk -->
<div class="form-group row">
<label for="quantity" class="col-sm-4 col-form-label">Quantity Stock</label>
<div class="col-sm-8">
<input type="number" class="form-control" placeholder="Quantity Stock" id="quantity" name="quantity">
</div>
</div>
<!-- Kodingan Satuan Quantity Masuk -->
<div class="form-group row">
<label for="satuanbarang" class="col-sm-4 col-form-label">Satuan Barang</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Satuan Barang" id="satuanbarang" name="satuanbarang">
</div>
</div>
<!-- Kodingan Tanggal Barang Masuk -->
<div class="form-group row">
<label for="tanggalmasuk" class="col-sm-4 col-form-label">Tanggal Masuk</label>
<div class="col-sm-8">
<input type="date" class="form-control" id="tanggalmasuk" name="tanggalmasuk">
</div>
</div>
<!-- Kodingan Nomor Polisi Masuk Dikomentar/Dinonaktifkan jika sewaktu-waktu dibutuhkan dan di DB tinggal ditambah Row Baru
<div class="form-group row">
<label for="police_number" class="col-sm-4 col-form-label">Nomer Polisi</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Nomer Polisi" id="police_number" name="police_number">
</div>
</div> -->
<!-- Kodingan Harga Masuk -->
<div class="form-group row">
<label for="harga" class="col-sm-4 col-form-label">Harga</label>
<div class="col-sm-8">
<input type="number" class="form-control" placeholder="harga" id="harga" name="harga">
</div>
</div>
<!-- Kodingan Keterangan Masuk -->
<div class="form-group row">
<label for="information" class="col-sm-4 col-form-label">Keterangan</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Keterangan" id="information" name="information">
</div>
</div>
<!-- Kodingan Supplier Jangan Diaktifkan, Krn Kalau Diaktifkan Nanti Bakal Crash Program -->
<!-- <div class="form-group row">
<label for="supplier" class="col-sm-4 col-form-label">Supplier</label>
<div class="col-sm-8">
<select name="supplier" id="supplier" class="form-control">
<?php
/*
foreach($supplier as $supplierdata){
echo '<option value="'.$supplierdata['supplier_id'].'">'.$supplierdata['supplier_name'].'</option>';
}
*/
?>
</select>
</div>
</div> -->
</div>
<!-- Ini Kodingan Save Changes -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</form>
</div>
</div>
</div>
</div>
<!-- Ini Kodingan Barang Keluar -->
<div class="modal fade" id="formmutasi" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="formtitle">Mutasi Barang</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<!-- Ini Kodingan ID Barang -->
<div class="modal-body">
<form action="processmutasi.php?do=add" method="POST" id="formmutasiform">
<div class="form-group row">
<label for="kodemutasibarang" class="col-sm-4 col-form-label">ID Barang</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Kode Barang" id="kodemutasibarang" name="kodemutasibarang" disabled>
</div>
</div>
<!-- Ini Kodingan Part Number -->
<div class="form-group row">
<label for="partnumbermutasi" class="col-sm-4 col-form-label">Part Number</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Part Number" id="partnumbermutasi" name="partnumbermutasi">
</div>
</div>
<!-- Ini Kodingan Nama Bengkel -->
<div class="form-group row">
<label for="namabengkelmutasi" class="col-sm-4 col-form-label">Nama Bengkel</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Nama Bengkel" id="namabengkelmutasi" name="namabengkelmutasi">
</div>
</div>
<!-- Ini Kodingan Nama Barang Keluar -->
<div class="form-group row">
<label for="namabarangkeluarmutasi" class="col-sm-4 col-form-label">Nama Barang Keluar</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Nama Barang Keluar" id="namabarangkeluarmutasi" name="namabarangkeluarmutasi">
</div>
</div>
<!-- Ini Kodingan Tanggal Mutasi masuk ke kategori Key = Value pada processmutasi -->
<div class="form-group row">
<label for="tanggalmutasi" class="col-sm-4 col-form-label">Tanggal Mutasi</label>
<div class="col-sm-8">
<input type="date" class="form-control" id="tanggalmutasi" name="tanggalmutasi">
</div>
</div>
<!-- Ini Kodingan Quantity masuk ke kategori Key = Value pada quantity -->
<div class="form-group row">
<label for="mutasiquantity" class="col-sm-4 col-form-label">Quantity</label>
<div class="col-sm-8">
<input type="number" class="form-control" placeholder="Quantity" id="mutasiquantity" name="mutasiquantity">
</div>
</div>
<!-- Ini Kodingan Satuan Barang Keluar -->
<div class="form-group row">
<label for="satuanbarangkeluar" class="col-sm-4 col-form-label">Satuan Barang</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Satuan Barang" id="satuanbarangkeluar" name="satuanbarangkeluar">
</div>
</div>
<!-- Ini Kodingan Keterngan Mutasi -->
<div class="form-group row">
<label for="keteranganmutasi" class="col-sm-4 col-form-label">Keterangan Mutasi</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Keterangan Mutasi" id="keteranganmutasi" name="keteranganmutasi">
</div>
</div>
</div>
<!-- Ini Kodingan Save Changes -->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</form>
</div>
</div>
</div>
</div>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/popper.js"></script>
<script src="assets/js/script.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</body>
</html>
<script>
function printPage() {
window.print();
}
// Blokir klik kanan
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
alert("Klik kanan dinonaktifkan!");
});
// Blokir tombol pintas inspect element
document.addEventListener('keydown', function(e) {
if (e.key === 'F12' || (e.ctrlKey && e.shiftKey && e.key === 'I')) {
e.preventDefault();
alert("Inspect Element dinonaktifkan!");
}
});
</script>