Commit 70f01d04 by Roy Junedi Simamora

perbaikan pemesanan

parent 6f6c74f0
......@@ -11,7 +11,7 @@
<tr>
<th> No </th>
<th> Nama </th>
<th> Harga </th>
<th> Harga Satuan </th>
<th> Jumlah </th>
<th> Subtotal </th>
<th> Opsi</th>
......@@ -29,7 +29,7 @@
<tr>
<td> <?= $no?> </td>
<td> <?php echo $row['nama_menu'] ?> </td>
<td> <?= $row['harga']?> </td>
<td> Rp. <?= number_format($row['harga'])?>,- </td>
<td> <?= $row['jumlah']?> </td>
<td> Rp. <?= number_format($subtotal)?>,- </td>
<td> <a onclick="if(confirm('Apakah anda yakin ingin membatalkan pesanan ini?')){
......@@ -38,14 +38,19 @@
</tr>
<?php
global $total;
$total += $subtotal;
$no++;
global $total;
$total = $total += $subtotal;
$no++;
}
?>
</table>
<div align="right">
<font face="arial" size="5"> Total : Rp. <?= number_format($total)?>,- </font>
<font face="arial" size="5"> Total : Rp. <?php if(mysqli_num_rows($query)){
echo number_format($total);
}else{
echo '0';
}
?>,- </font>
</div>
<div align="center">
......
<?php
include 'koneksi.php';
global $total;
$member_id = $_GET['id_member'];
$query = mysqli_query($koneksi, "SELECT menu.harga, pemesanan.jumlah FROM menu
INNER JOIN (pemesanan INNER JOIN member ON member_id = id_member) ON menu_id= id_menu WHERE member_id= '$member_id'");
while($row = mysqli_fetch_assoc($query)){
$jumlah = $row['jumlah'] * $row['harga'];
$total = $total += $jumlah;
}
$bukti = $_FILES['bukti']['name'];
move_uploaded_file($_FILES['bukti']['tmp_name'], 'picture/'. $bukti);
mysqli_query($koneksi, "INSERT INTO pembayaran VALUES('', '$member_id', '$total', '$bukti', '') ");
header('Location: bayar.php?id_member='. $member_id);
?>
\ No newline at end of file
<?php
include 'koneksi.php';
include 'common/header.php';
?>
<h2> <span class="glyphicon glyphicon-credit-card"></span> Daftar Pesanan </h2>
<br><hr>
<table class="table table-hover table-condensed">
<tr>
<th class="col-md-1"> NO</th>
<th class="col-md-3"> Nama Pemesan</th>
<th class="col-md-2"> Total </th>
<th class="col-md-3"> Bukti </th>
<th class="col-md-3"> opsi </th>
</tr>
<?php
$no = 1;
$sql = mysqli_query($koneksi,"SELECT pembayaran.id_pembayaran, pembayaran.total_harga, pembayaran.bukti, pembayaran.status, member.nama
FROM pembayaran INNER JOIN member ON member_id = id_member");
while($row = mysqli_fetch_assoc($sql)){
?>
<tr>
<td> <?= $no?> </td>
<td> <?= $row['nama']?> </td>
<td> <?= $row['total_harga']?> </td>
<td>
<?php
if($row['bukti'] == NULL){
echo 'Gambar bukti belum di upload!';
}else{
echo '<a href="picture/'. $row['bukti'] .'">
<img src="picture/'. $row['bukti'] .'" width="170" height="150">
</a>';
}
?>
</td>
<td>
<?php
if($row['status'] != 'Diterima' && $row['status'] == NULL){
echo '<a href="konfirmasi.php?id='. $row['id_pembayaran']. '" class="btn btn-success"> Konfirmasi </a>';
}else{
echo $row['status'];
}
?>
</td>
</tr>
<?php
$no++;
}
?>
</table>
<?php
include 'common/footer.php';
?>
\ No newline at end of file
<?php
include 'koneksi.php';
$id = $_GET['id'];
$status = 'Diterima';
mysqli_query($koneksi, "UPDATE pembayaran SET status = '$status' WHERE id_pembayaran = '$id'");
header('Location: daftar_pesanan.php');
?>
\ No newline at end of file
<?php
include 'koneksi.php';
global $total;
$member_id = $_GET['id_member'];
$query = mysqli_query($koneksi, "SELECT menu.harga, pemesanan.jumlah FROM menu
INNER JOIN (pemesanan INNER JOIN member ON member_id = id_member) ON menu_id= id_menu WHERE member_id= '$id_member'");
while($row = mysqli_fetch_assoc($query)){
$jumlah = $row['jumlah'] * $row['harga'];
$total = $total += $jumlah;
}
$bukti = $_FILES['bukti']['name'];
$id = $_GET['id'];
move_uploaded_file($_FILES['bukti']['tmp_name'], 'picture/'. $bukti);
mysqli_query($koneksi, "INSERT INTO pembayaran VALUES('', '$member_id', '$total_harga', '$bukti') ");
header('Location: bayar.php?id_member='. $member_id);
mysqli_query($koneksi, "DELETE FROM pemesanan WHERE member_id = '$id'");
mysqli_query($koneksi, "DELETE FROM pembayaran WHERE member_id = '$id'");
header('Location: member_menu.php');
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment