-
Notifications
You must be signed in to change notification settings - Fork 0
/
obat.php
551 lines (407 loc) · 28.5 KB
/
obat.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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<?php
session_start();
include('function.php');
if (!isset($_SESSION['login'])) {
header("Location: index.php");
exit;
}
$query = "SELECT barang.id_barang,
barang.nama_barang,
barang.id_jenis_barang,
jenis_barang.id_jenis_barang,
jenis_barang.jenis_barang,
satuan.satuan ,
detail_barang_masuk.stok FROM barang
LEFT JOIN jenis_barang
on jenis_barang.id_jenis_barang = barang.id_jenis_barang
LEFT JOIN detail_barang_masuk
on detail_barang_masuk.id_barang = barang.id_barang
LEFT JOIN satuan
on satuan.id_satuan = detail_barang_masuk.id_satuan
ORDER BY barang.id_barang DESC LIMIT 0";
$result = mysqli_query($conn, $query);
if (isset($_GET['menukategori'])) {
$jenis_barang = $_GET['jenis_barang'];
if ($jenis_barang=='null') {
header('Location:obat.php');
}else if ($jenis_barang) {
$query = "SELECT barang.id_barang,
barang.nama_barang,
barang.id_jenis_barang,
jenis_barang.id_jenis_barang,
jenis_barang.jenis_barang,
satuan.satuan ,
detail_barang_masuk.stok FROM barang
LEFT JOIN jenis_barang
on jenis_barang.id_jenis_barang = barang.id_jenis_barang
LEFT JOIN detail_barang_masuk
on detail_barang_masuk.id_barang = barang.id_barang
LEFT JOIN satuan
on satuan.id_satuan = detail_barang_masuk.id_satuan
WHERE jenis_barang = '$jenis_barang'";
}
$result = mysqli_query($conn, $query);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content=""/>
<meta name="author" content="" />
<title>SISTEM INFORMASI LOGISTIK DINAS KESEHATAN</title>
<link rel="icon" href="img/dinkes.png">
<!-- My css -->
<link href="css/obat.css" rel="stylesheet" />
<style>
tbody tr:hover {background-color: #f5f5f5;}
</style>
<!-- data table -->
<link rel="stylesheet" type="text/css" href="js/DataTables-1.10.23/css/dataTables.bootstrap4.min.css"/>
<!-- font awesome -->
<script src="fontawesome-free-5.15.2-web/js/all.min.js" crossorigin="anonymous"></script>
</head>
<body class="sb-nav-fixed" style="font-family: roboto">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark" >
<a class="navbar-brand" href="index.php">Dinkes Sumbar</a>
<button class="btn btn-link btn-lg order-1 order-lg-0" id="sidebarToggle" href="#"><i class="fas fa-bars"></i></button>
<!-- Navbar Search-->
<div class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">
<!-- <div class="input-group">
<input class="form-control" name="cari" type="text" placeholder="Cari barang.." aria-label="Search" aria-describedby="basic-addon2" autocomplete="off" />
<div class="input-group-append">
<button class="btn btn-primary" type="submit" name="menucari"><i class="fas fa-search"></i></button>
</div>
</div> -->
</div>
<!-- Navbar-->
<!-- Alarm -->
<ul class="navbar-nav ml-auto ml-md-0" >
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="userDropdown" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" >
<i class="fas fa-bell fa-fw "></i>
<span>
<span class="badge badge-pill badge-danger" style=" color: white;"><?= nilai_alarm(); ?></span>
<span class="sr-only">unread messages</span>
</span>
</a>
<div class="dropdown-menu dropdown-menu-right p-1" style="max-height: 300px; overflow: auto; border-radius: 5px;" aria-labelledby="userDropdown">
<?= alarm(); ?>
<!-- <a class="dropdown-item" href="#">Activity Log</a> -->
</div>
</li>
</ul>
<!-- Alarm -->
<ul class="navbar-nav ml-auto ml-md-0">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="userDropdown" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-user fa-fw"></i></a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<a class="dropdown-item" href="kelolaakun.php">Kelola akun</a>
<!-- <a class="dropdown-item" href="#">Activity Log</a> -->
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="logout.php">Logout</a>
</div>
</li>
</ul>
</nav>
<div id="layoutSidenav">
<div id="layoutSidenav_nav">
<nav class="sb-sidenav accordion sb-sidenav-dark" id="sidenavAccordion" >
<div class="sb-sidenav-menu">
<div class="nav">
<!-- <div class="sb-sidenav-menu-heading">Core</div> -->
<a class="nav-link" href="index.php">
<div class="sb-nav-link-icon"><i class="fa fa-home"></i></div>
Beranda
</a>
<!-- awal data barang -->
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseLayouts" aria-expanded="false" aria-controls="collapseLayouts">
<div class="sb-nav-link-icon"><i class="fas fa-list"></i></div>
Data Barang
<div class="sb-sidenav-collapse-arrow"><i class="fas fa-angle-down"></i></div>
</a>
<div class="collapse" id="collapseLayouts" aria-labelledby="headingOne" data-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link " href="obat.php"> Barang</a>
<a class="nav-link" href="expired.php"> Barang Kadaluarsa</a>
</nav>
</div>
<!-- akhir data barang -->
<!-- awal transaksi -->
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseLayouts2" aria-expanded="false" aria-controls="collapseLayouts">
<div class="sb-nav-link-icon"><i class="fas fa-list"></i></div> Data
Transaksi
<div class="sb-sidenav-collapse-arrow"><i class="fas fa-angle-down"></i></div>
</a>
<div class="collapse" id="collapseLayouts2" aria-labelledby="headingOne" data-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link" href="barangmasuk.php"> <i class="fas fa-plus-square mr-1"></i>Barang Masuk</a>
<a class="nav-link" href="barangkeluar.php"> <i class="fas fa-minus-square mr-1"></i> Barang Keluar</a>
</nav>
</div>
<!-- akhir transaksi -->
<!-- awal Laporan barang -->
<div class="sb-sidenav-menu-heading">Laporan</div>
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseLayouts4" aria-expanded="false" aria-controls="collapseLayouts">
<div class="sb-nav-link-icon"><i class="fas fa-envelope"></i></div>
Laporan Barang
<div class="sb-sidenav-collapse-arrow"><i class="fas fa-angle-down"></i></div>
</a>
<div class="collapse" id="collapseLayouts4" aria-labelledby="headingOne" data-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link " href="laporan_barang.php"><i class="fas fa-layer-group mr-1"></i> Laporan Periode</a>
</nav>
</div>
<!-- akhir Laporan barang -->
<div class="sb-sidenav-menu-heading">Pengaturan</div>
<!-- awal data barang -->
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseLayouts3" aria-expanded="false" aria-controls="collapseLayouts">
<div class="sb-nav-link-icon"><i class="fas fa-cog"></i></div>
Kategori Barang
<div class="sb-sidenav-collapse-arrow"><i class="fas fa-angle-down"></i></div>
</a>
<div class="collapse" id="collapseLayouts3" aria-labelledby="headingOne" data-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link " href="jenis_barang.php"><i class="fas fa-layer-group mr-1"></i> Jenis Barang</a>
<a class="nav-link " href="sumber.php"><i class="fas fa-comment-dollar mr-1"></i> Sumber Anggaran</a>
<a class="nav-link " href="satuan.php"><i class="fab fa-unity mr-1"></i> Satuan Barang</a>
<a class="nav-link " href="program.php"><i class="fas fa-address-book mr-1"> </i> Program </a>
</nav>
</div>
<!-- akhir data barang -->
</div>
</div>
<div class="sb-sidenav-footer">
<div class="small">Nama pengguna</div>
<?= user(); ?>
</div>
</nav>
</div>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid">
<h1 class="mt-4"></h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="index.php">Beranda</a></li>
<li class="breadcrumb-item active">Barang</li>
<li class="breadcrumb-item">
<!-- AWal jam digital -->
<div class="jam-digital-malasngoding text-center">
<div class="kotak">
<a id="jam"></a>
<a >:</a>
<a id="menit"></a>
<a >:</a>
<a id="detik"></a>
</div>
</div>
<!-- akhir jam digital -->
</li>
<li class="breadcrumb-item"> <?= date('l - d - m - Y'); ?> </li>
</ol>
<div class="card mb-4 ">
<div class="card-header">
<!-- Button to Open the Modal -->
<div class="col">
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal" title="Tambah Data Barang Baru">
<i class="fas fa-plus-square fa-lg"></i> Tambah Barang
</button>
<a class="btn btn-info" href="laporan_barang.php">Laporan Barang</a>
<!-- Awal jenis barang -->
<form action="" method="GET" class="form-inline mt-2 mb-2">
<select name="jenis_barang" class="form-control mr-1">
<option value="null">Pilih jenis barang</option>
<?= pilih_jenis_barang(); ?>
</select>
<button type="submit" name="menukategori" class="btn btn-primary pt-2 pb-2 mr-2"><i class="fas fa-sync-alt"></i></button>
</form>
</div>
<!-- Akhir jenis barang -->
<!-- Awal tambah Barang-->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Tambah barang </h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<form action="function.php" method="POST">
<div class="modal-body">
<div class="input-group mb-3">
<span class="input-group-text" style="width: 9rem;">Nama barang</span>
<input type="text" name="namabarang" id="nama_barang" class="form-control" required autocomplete="off">
</div>
<div class="input-group mb-3">
<span class="input-group-text" style="width: 9rem;">Jenis barang</span>
<select name="jenis_barang" id="jenis_barang" class="form-control bg-light" required>
<?php
$query = "SELECT * FROM jenis_barang ORDER BY jenis_barang";
$result1 = mysqli_query($conn, $query);
while ($row1 = mysqli_fetch_assoc($result1)) {
$jenis_barang= $row1['jenis_barang'];
$id_jenis_barang = $row1['id_jenis_barang'];
?>
<option value="<?= $id_jenis_barang; ?>" ><?= $jenis_barang; ?></option>
<?php
}
?>
<option value="" selected="">-pilih jenis barang-</option>
</select>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="submit" id="doubleclick" name="tambahdatabarang" class="btn btn-primary ">Masukan</button>
</div>
</form>
</div>
</div>
</div>
<!-- Akhir tambah barang-->
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0" >
<thead>
<tr>
<th >No </th>
<th >Nama Barang</th>
<th >Jenis Barang</th>
<th >Satuan</th>
<th >Stok</th>
<th class="text-center">Aksi</th>
</tr>
</thead>
<tbody>
<!-- -->
<?php
$no = 1;
while ($row = mysqli_fetch_assoc($result)) {
$id_barang = $row['id_barang'];
$namabarang = $row['nama_barang'];
$jenis_barang =$row['jenis_barang'];
$id_jenis_barang =$row['id_jenis_barang'];
$satuan = $row['satuan'];
$stok = $row['stok'];
?>
<!-- -->
<tr>
<td ><?= $no++ ?></td>
<td ><?= $namabarang ?></td>
<td ><?= $jenis_barang ?></td>
<td ><?= $satuan ?></td>
<td ><?= $stok; ?></td>
<td class="text-center">
<button type="button" class="fa fa-edit mr-3" style="color: #6bb4ff;" data-toggle="modal" data-target="#edit<?=$id_barang;?>" title="Edit"></button>
<button type="button" class="fa fa-trash" style="color: #e60003;" data-toggle="modal" data-target="#hapus<?=$id_barang;?>" title="Hapus "></button>
</td>
</tr>
<!-- awal edit modal -->
<div class="modal fade" id="edit<?=$id_barang;?>">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Edit Data Barang</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<form action="function.php" method="POST">
<div class="modal-body">
<input type="hidden" name="id_barang" value="<?=$id_barang?>" class="form-control" >
<div class="input-group mb-3">
<span class="input-group-text" style="width: 9rem;">Nama barang</span>
<input type="text" name="nama_barang" value="<?= $namabarang ?>" class="form-control" autocomplete="off" required>
</div>
<div class="input-group mb-3">
<span class="input-group-text" style="width: 9rem;">Jenis barang</span>
<select name="jenis_barang" class="form-control">
<?php
$query = "SELECT * FROM jenis_barang";
$result_jb = mysqli_query($conn, $query);
while ($row_jb = mysqli_fetch_assoc($result_jb)) {
$jenis_barang1= $row_jb['jenis_barang'];
$id_jenis_barang1 = $row_jb['id_jenis_barang'];
?>
<option value="<?= $id_jenis_barang1; ?>"><?= $jenis_barang1; ?></option>
<?php
}
?>
<option value="<?= $id_jenis_barang ?>" selected=""><?= $jenis_barang ?></option>
</select>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="submit" name="editbarang" class="btn btn-primary">Edit barang</button>
</div>
</form>
</div>
</div>
</div>
<!-- akhir edit modal -->
<!-- awal hapus modal -->
<div class="modal fade" id="hapus<?=$id_barang;?>">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Hapus data barang</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<!-- Modal body -->
<form action="function.php" method="POST">
<div class="modal-body">
<input type="hidden" name="id_barang" value="<?= $id_barang?>" class="form-control" autocomplete="off">
Apakah anda yakin ingin menghapus <?= $namabarang ?> ?
</div>
<!-- Modal footer -->
<div class="modal-footer">
<p style="color: red; font-size: 13px;">*Note : Barang yang bisa dihapus adalah barang yang belum pernah melakukan transaksi</p>
<button type="submit" name="hapusbarang" class="btn btn-danger">Hapus</button>
</div>
</form>
</div>
</div>
</div>
<!-- akhir hapus modal -->
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
<footer class="py-4 bg-light mt-auto">
<div class="container-fluid">
<div class="d-flex align-items-center justify-content-between small">
<div class="text-muted">Copyright © Dinas Kesehatan Provinsi Sumatera Barat 2021</div>
<div>
<!-- <a href="#">Privacy Policy</a>
·
<a href="#">Terms & Conditions</a> -->
</div>
</div>
</div>
</footer>
</div>
</div>
<!-- Sweetalert -->
<script src="js/dist/sweetalert2.all.min.js"></script>
<!-- Jquery -->
<script src="js/jquery/jquery-3.5.1.js" ></script>
<!-- akhir Jquery -->
<!-- Css Js Bootsrap 4 -->
<script src="css/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<!--My Js -->
<script src="assets/demo/datatables-demo.js"></script>
<!-- akhir My Js -->
<!-- data table -->
<script type="text/javascript" src="js/datatables.min.js" crossorigin="anonymous"></script>
<script src="js/dataTables-1.10.23/js/dataTables.bootstrap4.min.js" crossorigin="anonymous"></script>
</body>
</html>