Advertisement
retmin

product_list.php

Jun 25th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. <?php empty( $app ) ? header('location:./index.php') : '' ; if(isset($_SESSION['level'])){?>
  2. <?php
  3.  
  4. $base_url = 'http://'.$_SERVER['HTTP_HOST'].'/login_multiuser/';
  5.  
  6. isset ($_GET['master']) ? $app = $_GET['master'] : $app = 'home';
  7.  
  8. ?>
  9. <!doctype html>
  10. <html>
  11. <head>
  12. <title>Product List</title>
  13. <link href="bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
  14. <script src="js/jquery.js"></script>
  15. <script src="bootstrap/js/bootstrap.js"></script>
  16. </head>
  17.  
  18. <body>
  19. <div class="container">
  20. <div>
  21. <h1> Product List </h1>
  22. <hr>
  23. <a align="right" href="#"
  24. onclick="window.open( 'app/tambah.php', 'name', 'location=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,width=800,height=1500' )" class="btn btn-info">
  25. <span class="glyphicon glyphicon-plus"></span> Add Product</a>
  26. <button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal<?php echo "a"?>"><span class="glyphicon glyphicon-plus"></span> New Product</button>
  27. <a href="modal.php" data-toggle="modal" data-target="#theModals">Lab 6</a>
  28. </hr>
  29. <div class="modal fade text-center" id="theModals">
  30. <div class="modal-dialog">
  31. <div class="modal-content">
  32. </div>
  33. </div>
  34. </div>
  35. <p></p>
  36. <!-- Modal -->
  37. <div id="myModal<?php echo "a"?>" class="modal fade" role="dialog">
  38. <div class="modal-dialog">
  39.  
  40. <!-- konten modal-->
  41. <div class="modal-content">
  42. <!-- heading modal -->
  43. <div class="modal-header">
  44. <button type="button" class="close" data-dismiss="modal">&times;</button>
  45. <h4 class="modal-title">Bagian heading modal</h4>
  46. </div>
  47. <!-- body modal -->
  48. <div class="modal-body">
  49. <form method="post" action="app/prosesnew.php" enctype="multipart/form-data">
  50.  
  51. <div class="form-group">
  52.  
  53. <label>Name </label>
  54. <div class="form-group">
  55. <input type="text" class="form-control" name="nama" required autofocus>
  56. </div>
  57.  
  58. <div class="form-group">
  59. <label>Type</label>
  60. <select class="form-control" name="jenis">
  61. <option value="">Choose..</option>
  62. <option value="food">Food</option>
  63. <option value="officekit">Office Kit</option>
  64. </select>
  65. </div>
  66.  
  67. <label>Quantity </label>
  68. <div class="form-group">
  69. <input type="text" class="form-control" name="qty" required autofocus>
  70. </div>
  71.  
  72. <label>Count As </label>
  73. <div class="form-group">
  74. <input type="text" class="form-control" name="satuan" required autofocus>
  75. </div>
  76.  
  77. <label>Desription </label>
  78. <div class="form-group">
  79. <input type="text" class="form-control" name="deskripsi" required autofocus>
  80. </div>
  81.  
  82. <label>Price </label>
  83. <div class="form-group">
  84. <input type="text" class="form-control" name="harga" required autofocus>
  85. </div>
  86. </div>
  87. <!-- footer modal -->
  88. <div class="modal-footer">
  89. <button type="submit" id="simpan" class="btn btn-primary">Save</button>
  90. <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
  91. </div>
  92. </div>
  93. </form>
  94. </div>
  95. </div>
  96.  
  97.  
  98. </div>
  99. <table id="product" class="table table-hover table-bordered">
  100.  
  101. <thead>
  102. <tr class="active" >
  103. <th class="text-center" rowspan="2" width="5%">Nomor</th>
  104. <th class="text-center" rowspan="2" width="20%">Nama</th>
  105. <th class="text-center" rowspan="2" width="20%">Jenis</th>
  106. <th class="text-center" colspan="3" width="10%">Quantity</th>
  107.  
  108. <th class="text-center" rowspan="2" width="5%">Unit</th>
  109. <th class="text-center" rowspan="2" width="15%">Price (Rp)</th>
  110. <th class="text-center" rowspan="2" width="20%">Action</th>
  111.  
  112. <tr class="active">
  113. <th scope="col" width="5%">In</th>
  114. <th scope="col" width="5%">Out</th>
  115. <th scope="col" width="5%">End</th>
  116. </tr>
  117.  
  118. </thead>
  119. </thead>
  120. <tbody>
  121. <?php
  122.  
  123. //Data mentah yang ditampilkan ke tabel
  124. mysql_connect('localhost', 'root', '');
  125. mysql_select_db('inventory');
  126. $sql = mysql_query('SELECT * FROM product order by procode desc');
  127. $no = 1;
  128. while ($r = mysql_fetch_array($sql)) {
  129. $id = $r['procode'];
  130. ?>
  131.  
  132. <tr align="center">
  133. <td><?php echo $no;?></td>
  134. <td><?php echo"$r[nama]";?></td>
  135. <td><?php echo"$r[jenis]";?></td>
  136. <td><?php echo"$r[qtyin]";?></td>
  137. <td><?php echo"$r[qtyout]";?></td>
  138. <td><?php echo"$r[qtyend]";?></td>
  139. <td><?php echo"$r[satuan]";?></td>
  140. <td><?php echo"$r[harga]";?></td>
  141.  
  142. <td>
  143. <a href="app/edit.php?procode=<?php echo"$r[procode]";?>" class="edit-record" data-id="<?php echo"$r[procode]";?>" data-toggle="modal" data-target="#myModal<?php echo "a"?>"><span class="glyphicon glyphicon-edit"></span> edit</a>
  144. <a href="del.php?del=<?php echo"$r[procode]";?>" onClick="return confirm('Apakah anda yakin akan menghapus data ini?')"><span class="glyphicon glyphicon-trash"></span> Hapus</a>
  145. </td>
  146. </tr>
  147.  
  148. <?php
  149. $no++;
  150. }
  151. ?>
  152. </tbody>
  153. </table>
  154. </div>
  155. </div>
  156.  
  157. <script type="text/javascript">
  158. $(function() {
  159. $("#product").dataTable();
  160. });
  161. </script>
  162. </body>
  163.  
  164. </html>
  165. <?php
  166. }else{
  167. echo '<div class="alert alert-error"> Maaf Anda Harus Login terlebih dahulu untuk mengakses halaman ini </div>';
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement