Advertisement
Guest User

Untitled

a guest
May 19th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.97 KB | None | 0 0
  1. <?php  
  2.     if (isset($_GET['hapus'])) {
  3.         $barang->hapus_keranjang($_GET['hapus']);
  4.         echo "<script>location='home.php?page=keranjang';</script>";
  5.     }
  6.     else if (isset($_GET['kurang'])) {
  7.         $barang->kurang_keranjang($_GET['kurang']);
  8.         echo "<script>location='home.php?page=keranjang';</script>";
  9.     }
  10.     else if (isset($_GET['tambah'])) {
  11.         $barang->tambah_keranjang($_GET['tambah']);
  12.         echo "<script>location='home.php?page=keranjang';</script>";
  13.     }
  14. ?>
  15. <div class="row">
  16.     <div class="col-md-12">
  17.         <!-- Advanced Tables -->
  18.         <div class="panel panel-default">
  19.             <div class="panel-heading">
  20.                 Data Barang
  21.             </div>
  22.             <div class="panel-body">
  23.                 <div class="table">
  24.                     <table class="table table-striped table-bordered table-hover" id="tabelku">
  25.                         <thead>
  26.                             <tr>
  27.                                 <th>No</th>
  28.                                 <th>ID Barang</th>
  29.                                 <th>Nama</th>
  30.                                 <th>Harga Jual</th>
  31.                                 <th>Jumlah</th>
  32.                                 <th>Total</th>
  33.                                 <th>Aksi</th>
  34.                             </tr>
  35.                         </thead>
  36.                         <tbody>
  37.                             <?php  
  38.                                 $total = 0;
  39.                                 error_reporting(0);
  40.                                 $brg = $barang->tampil_keranjang();
  41.                                 foreach ($brg as $home => $data) {
  42.                             ?>
  43.                             <tr class="odd gradeX">
  44.                                 <td><?php echo $home + 1; ?></td>
  45.                                 <td><?php echo $data['id_barang']; ?></td>
  46.                                 <td><?php echo $data['nama_barang']; ?></td>
  47.                                 <td><?php echo number_format($data['harga_jual']); ?></td>
  48.                                 <td><?php echo $data['jumlah']; ?></td>
  49.                                 <td><?php echo number_format($data['jumlah']*$data['harga_jual']); $total=($data['jumlah']*$data['harga_jual'])+$total;?></td>
  50.                                 <td>
  51.                                     <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>
  52.                                     <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>
  53.                                     <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>
  54.                                 </td>
  55.                             </tr>
  56.                             <?php } ?>
  57.                             </tbody>
  58.                             <tr class="odd gradeX">
  59.                                 <td colspan="5" align="right">Jumlah</td>
  60.                                 <td><?php echo number_format($total); ?></td>
  61.                                 <td></td>
  62.                             </tr>                            
  63.                     </table>
  64.                 </div>  
  65.             </div>
  66.             <div class="panel-footer">
  67.             <form action="/tambahkeranjang.php" method="post">
  68.                 <input type="text" id="id_barang" name="id_barang" placeholder="Id Barang">
  69.                 <input type="text" id="jumlah" name="jumlah" placeholder="Jumlah">
  70.                 <input type="submit" value="Tambah Barang" class="btn btn-info">
  71.             </form>
  72.             <button onclick="window.location.href='https://contohta.000webhostapp.com/transaksikeranjang.php'" class="btn btn-info">Continue</button>
  73.             </div>
  74.         </div>
  75.         <!--End Advanced Tables -->
  76.     </div>
  77. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement