Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_GET['hapus'])) {
- $barang->hapus_keranjang($_GET['hapus']);
- echo "<script>location='home.php?page=keranjang';</script>";
- }
- else if (isset($_GET['kurang'])) {
- $barang->kurang_keranjang($_GET['kurang']);
- echo "<script>location='home.php?page=keranjang';</script>";
- }
- else if (isset($_GET['tambah'])) {
- $barang->tambah_keranjang($_GET['tambah']);
- echo "<script>location='home.php?page=keranjang';</script>";
- }
- ?>
- <div class="row">
- <div class="col-md-12">
- <!-- Advanced Tables -->
- <div class="panel panel-default">
- <div class="panel-heading">
- Data Barang
- </div>
- <div class="panel-body">
- <div class="table">
- <table class="table table-striped table-bordered table-hover" id="tabelku">
- <thead>
- <tr>
- <th>No</th>
- <th>ID Barang</th>
- <th>Nama</th>
- <th>Harga Jual</th>
- <th>Jumlah</th>
- <th>Total</th>
- <th>Aksi</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $total = 0;
- error_reporting(0);
- $brg = $barang->tampil_keranjang();
- foreach ($brg as $home => $data) {
- ?>
- <tr class="odd gradeX">
- <td><?php echo $home + 1; ?></td>
- <td><?php echo $data['id_barang']; ?></td>
- <td><?php echo $data['nama_barang']; ?></td>
- <td><?php echo number_format($data['harga_jual']); ?></td>
- <td><?php echo $data['jumlah']; ?></td>
- <td><?php echo number_format($data['jumlah']*$data['harga_jual']); $total=($data['jumlah']*$data['harga_jual'])+$total;?></td>
- <td>
- <a href="home.php?page=keranjang&kurang=<?php echo $data['id_barang']; ?>" class="btn btn-info btn-xs"><i class="fa fa-pencil"></i>-</a>
- <a href="home.php?page=keranjang&tambah=<?php echo $data['id_barang']; ?>" class="btn btn-info btn-xs"><i class="fa fa-pencil"></i>+</a>
- <a href="home.php?page=keranjang&hapus=<?php echo $data['id_barang']; ?>" class="btn btn-danger btn-xs" id="alertHapus"><i class="fa fa-trash"></i> Hapus</a>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- <tr class="odd gradeX">
- <td colspan="5" align="right">Jumlah</td>
- <td><?php echo number_format($total); ?></td>
- <td></td>
- </tr>
- </table>
- </div>
- </div>
- <div class="panel-footer">
- <form action="/tambahkeranjang.php" method="post">
- <input type="text" id="id_barang" name="id_barang" placeholder="Id Barang">
- <input type="text" id="jumlah" name="jumlah" placeholder="Jumlah">
- <input type="submit" value="Tambah Barang" class="btn btn-info">
- </form>
- <button onclick="window.location.href='https://contohta.000webhostapp.com/transaksikeranjang.php'" class="btn btn-info">Continue</button>
- </div>
- </div>
- <!--End Advanced Tables -->
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement