-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
226 lines (211 loc) · 11.4 KB
/
index.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
<?php
require 'checklogin.php';
$h1 = mysqli_query($c, "SELECT * FROM pesanan");
$h2 = mysqli_num_rows($h1);
?>
<!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>Data Pesanan</title>
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" />
<link href="css/styles.css" rel="stylesheet" />
<script src="https://use.fontawesome.com/releases/v6.1.0/js/all.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body class="sb-nav-fixed">
<nav class="sb-topnav navbar navbar-expand navbar-dark bg-dark">
<!-- Navbar Brand-->
<a class="navbar-brand ps-3" href="index.php">Aplikasi Kasir</a>
<!-- Sidebar Toggle-->
<button class="btn btn-link btn-sm order-1 order-lg-0 me-4 me-lg-0" id="sidebarToggle" href="#!"><i class="fas fa-bars"></i></button>
</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">Menu</div>
<a class="nav-link" href="index.php">
<div class="sb-nav-link-icon"><i class="fas fa-cart-plus"></i></div>
Order
</a>
<a class="nav-link" href="stock.php">
<div class="sb-nav-link-icon"><i class="fas fa-coffee"></i></div>
Stock Barang
</a>
<a class="nav-link" href="masuk.php">
<div class="sb-nav-link-icon"><i class="fas fa-truck"></i></div>
Barang Masuk
</a>
<a class="nav-link" href="pelanggan.php">
<div class="sb-nav-link-icon"><i class="fas fa-user-alt"></i></div>
Pelanggan
</a>
<a class="nav-link" href="logout.php">
<div class="sb-nav-link-icon"><i class="fas fa-sign-out-alt"></i></div>
Logout
</a>
</div>
</div>
<!-- <div class="sb-sidenav-footer">
<div class="small">Logged in as:</div>
</div> -->
</nav>
</div>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h1 class="mt-4">Data Pesanan</h1>
<ol class="breadcrumb mb-4">
<li class="breadcrumb-item active">Welcome!</li>
</ol>
<div class="row">
<div class="col-xl-3 col-md-6">
<div class="card bg-primary text-white mb-4">
<div class="card-body">Jumlah Pesanan : <?= $h2; ?></div>
</div>
</div>
</div>
<button type="button" class="btn btn-info mb-4" data-toggle="modal" data-target="#myModal">
Tambah Pesanan Baru
</button>
<div class="card mb-4">
<div class="card-header">
<i class="fas fa-table me-1"></i>
DataTable Example
</div>
<div class="card-body">
<table id="datatablesSimple">
<thead>
<tr>
<th>ID Pesanan</th>
<th>Tanggal</th>
<th>Pelanggan</th>
<th>Jumlah</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$ambil = mysqli_query($c, "SELECT * FROM pesanan p, pelanggan pl where p.idpelanggan=pl.idpelanggan");
while ($p = mysqli_fetch_array($ambil)) {
$idpesanan = $p['idorder'];
$tanggal = $p['tanggal'];
$namapelanggan = $p['namapelanggan'];
$hitungjumlah = mysqli_query($c, "SELECT * FROM detailpesanan WHERE idpesanan='$idpesanan'");
$jumlah = mysqli_num_rows($hitungjumlah);
// $harga = $p['harga'];
?>
<tr>
<td><?= $idpesanan; ?></td>
<td><?= $tanggal; ?></td>
<td><?= $namapelanggan; ?></td>
<td><?= $jumlah; ?></td>
<td>
<a href="view.php?idp=<?= $idpesanan; ?>" class="btn btn-primary" target="blank">Tampilkan</a>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delete<?= $idpesanan; ?>">
Delete
</button>
</td>
</tr>
<!-- delete Modal -->
<div class="modal fade" id="delete<?= $idpesanan; ?>">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">Hapus Data Pesanan</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<form method="post">
<!-- Modal body -->
<div class="modal-body">
Yakin ingin menghapus data pesanan ini?
<input type="hidden" name="idp" value="<?= $idpesanan; ?>">
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="submit" class="btn btn-danger" name="hapuspesanan">Delete</button>
<button type="button" class="btn btn-success" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</main>
<footer class="py-4 bg-light mt-auto">
<div class="container-fluid px-4">
<div class="d-flex align-items-center justify-content-between small">
<div class="text-muted">Copyright © Your Website 2022</div>
<div>
<a href="#">Privacy Policy</a>
·
<a href="#">Terms & Conditions</a>
</div>
</div>
</div>
</footer>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script>
<script src="assets/demo/chart-area-demo.js"></script>
<script src="assets/demo/chart-bar-demo.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" crossorigin="anonymous"></script>
<script src="js/datatables-simple-demo.js"></script>
</body>
<!-- The Modal -->
<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 Pesanan baru</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<form method="post">
<!-- Modal body -->
<div class="modal-body">
Pilih Pelanggan
<select name="idpelanggan" class="form-control">
<?php
$getpelanggan = mysqli_query($c, "SELECT * FROM pelanggan");
while ($pl = mysqli_fetch_array($getpelanggan)) {
$namamember = $pl['namapelanggan'];
$idpelanggan = $pl['idpelanggan'];
$alamat = $pl['alamat'];
?>
<option value="<?= $idpelanggan ?>"><?= $namamember; ?> - <?= $alamat; ?></option>
<?php
}
?>
</select>
<!-- <input type="text"name="namaproduk" class="form-control" placeholder="Nama Produk"> -->
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="submit" class="btn btn-success" name="tambahpesanan">Submit</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</html>