Guest User

Untitled

a guest
Jul 25th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.36 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <?php
  4. include "configuration/config_etc.php";
  5. include "configuration/config_include.php";
  6. etc();encryption();session();connect();head();body();timing();
  7. //alltotal();
  8. pagination();
  9. ?>
  10.  
  11. <?php
  12. if (!login_check()) {
  13. ?>
  14. <meta http-equiv="refresh" content="0; url=logout" />
  15. <?php
  16. exit(0);
  17. }
  18. ?>
  19. <div class="wrapper">
  20. <?php
  21. theader();
  22. menu();
  23. ?>
  24. <div class="content-wrapper">
  25. <section class="content-header">
  26. </section>
  27. <section class="content">
  28. <div class="row">
  29. <div class="col-lg-12">
  30. <!-- SETTING START-->
  31.  
  32. <?php
  33. error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
  34. include "configuration/config_chmod.php";
  35. $halaman = "barang"; // halaman
  36. $dataapa = "Barang"; // data
  37. $tabeldatabase = "barang"; // tabel database
  38. $chmod = $chmenu4; // Hak akses Menu
  39. $forward = mysql_real_escape_string($tabeldatabase); // tabel database
  40. $forwardpage = mysql_real_escape_string($halaman); // halaman
  41. $search = $_POST['search'];
  42.  
  43. ?>
  44.  
  45. <!-- SETTING STOP -->
  46. <?php
  47. $decimal ="0";
  48. $a_decimal =",";
  49. $thousand =".";
  50. ?>
  51.  
  52.  
  53. <!-- BREADCRUMB -->
  54.  
  55. <ol class="breadcrumb ">
  56. <li><a href="<?php echo $_SESSION['baseurl']; ?>">Dashboard </a></li>
  57. <li><a href="<?php echo $halaman;?>"><?php echo $dataapa ?></a></li>
  58. <?php
  59.  
  60. if ($search != null || $search != "") {
  61. ?>
  62. <li> <a href="<?php echo $halaman;?>">Data <?php echo $dataapa ?></a></li>
  63. <li class="active"><?php
  64. echo $search;
  65. ?></li>
  66. <?php
  67. } else {
  68. ?>
  69. <li class="active">Data <?php echo $dataapa ?></li>
  70. <?php
  71. }
  72. ?>
  73. </ol>
  74.  
  75. <!-- BREADCRUMB -->
  76.  
  77. <!-- BOX HAPUS BERHASIL -->
  78.  
  79. <script>
  80. window.setTimeout(function() {
  81. $("#myAlert").fadeTo(500, 0).slideUp(1000, function(){
  82. $(this).remove();
  83. });
  84. }, 5000);
  85. </script>
  86.  
  87. <?php
  88. $hapusberhasil = $_POST['hapusberhasil'];
  89.  
  90. if ($hapusberhasil == 1) {
  91. ?>
  92. <div id="myAlert" class="alert alert-success alert-dismissible fade in" role="alert">
  93. <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  94. <strong>Berhasil!</strong> <?php echo $dataapa;?> telah berhasil dihapus dari Data <?php echo $dataapa;?>.
  95. </div>
  96.  
  97. <!-- BOX HAPUS BERHASIL -->
  98. <?php
  99. } elseif ($hapusberhasil == 2) {
  100. ?>
  101. <div id="myAlert" class="alert alert-danger alert-dismissible fade in" role="alert">
  102. <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  103. <strong>Gagal!</strong> <?php echo $dataapa;?> tidak bisa dihapus dari Data <?php echo $dataapa;?> karena telah melakukan transaksi sebelumnya, gunakan menu update untuk merubah informasi <?php echo $dataapa;?> .
  104. </div>
  105. <?php
  106. } elseif ($hapusberhasil == 3) {
  107. ?>
  108. <div id="myAlert" class="alert alert-danger alert-dismissible fade in" role="alert">
  109. <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  110. <strong>Gagal!</strong> Hanya user tertentu yang dapat mengupdate Data <?php echo $dataapa;?> .
  111. </div>
  112. <?php
  113. }
  114.  
  115. ?>
  116. <!-- BOX INFORMASI -->
  117. <?php
  118. if ($chmod == '1' || $chmod == '2' || $chmod == '3' || $chmod == '4' || $chmod == '5' || $_SESSION['jabatan'] == 'admin') {
  119. } else {
  120. ?>
  121. <div class="callout callout-danger">
  122. <h4>Info</h4>
  123. <b>Hanya user tertentu yang dapat mengakses halaman <?php echo $dataapa;?> ini .</b>
  124. </div>
  125. <?php
  126. }
  127. ?>
  128.  
  129. <?php
  130. if ($chmod >= 1 || $_SESSION['jabatan'] == 'admin') {
  131. ?>
  132.  
  133. <?php
  134.  
  135. $sqla="SELECT no, COUNT( * ) AS totaldata FROM $forward";
  136. $hasila=mysqli_query($conn,$sqla);
  137. $rowa=mysqli_fetch_assoc($hasila);
  138. $totaldata=$rowa['totaldata'];
  139.  
  140. ?>
  141. <div class="box">
  142. <div class="box-header">
  143. <h3 class="box-title">Data <?php echo $forward ?> <span class="label label-default"><?php echo $totaldata; ?></span>
  144. </h3>
  145.  
  146. <form method="post">
  147. <br/>
  148. <div class="input-group input-group-sm" style="width: 250px;">
  149. <input type="text" name="search" class="form-control pull-right" placeholder="Cari">
  150.  
  151. <div class="input-group-btn">
  152. <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
  153. </div>
  154. </div>
  155.  
  156. </form>
  157.  
  158.  
  159. </div>
  160.  
  161. <!-- /.box-header -->
  162. <!-- /.Paginasi -->
  163. <?php
  164. error_reporting(E_ALL ^ E_DEPRECATED);
  165. $sql = "select *, barang.no as no,barang.kode as kode, barang.nama as nama, kategori.nama as kategori from $forward inner join kategori on kategori.kode = barang.kategori order by barang.no";
  166. $result = mysqli_query($conn, $sql);
  167. $rpp = 15;
  168. $reload = "$halaman"."?pagination=true";
  169. $page = intval(isset($_GET["page"]) ? $_GET["page"] : 0);
  170.  
  171. if ($page <= 0)
  172. $page = 1;
  173. $tcount = mysqli_num_rows($result);
  174. $tpages = ($tcount) ? ceil($tcount / $rpp) : 1;
  175. $count = 0;
  176. $i = ($page - 1) * $rpp;
  177. $no_urut = ($page - 1) * $rpp;
  178. ?>
  179. <div class="box-body table-responsive">
  180. <table class="table table-hover ">
  181. <thead>
  182. <tr>
  183. <th>No</th>
  184. <th>Kode Barang</th>
  185. <th>Nama</th>
  186. <th>Harga Beli</th>
  187. <th>Harga Jual</th>
  188. <th>Kategori</th>
  189. <th>Keterangan</th>
  190. <?php if ($chmod >= 3 || $_SESSION['jabatan'] == 'admin') { ?>
  191. <th>Opsi</th>
  192. <?php }else{} ?>
  193. </tr>
  194. </thead>
  195. <?php
  196. error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
  197. $search = $_POST['search'];
  198.  
  199. if ($search != null || $search != "") {
  200.  
  201. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  202.  
  203. if(isset($_POST['search'])){
  204. $query1="SELECT *,barang.no as no,barang.kode as kode, barang.nama as nama, kategori.nama as kategori FROM $forward inner join kategori on kategori.kode = barang.kategori where barang.kode like '%$search%' or barang.nama like '%$search%' order by barang.no limit $rpp";
  205. $hasil = mysqli_query($conn,$query1);
  206. $no = 1;
  207. while ($fill = mysqli_fetch_assoc($hasil)){
  208. ?>
  209. <tbody>
  210. <tr>
  211. <td><?php echo ++$no_urut;?></td>
  212. <td><?php echo mysql_real_escape_string($fill['kode']); ?></td>
  213. <td><?php echo mysql_real_escape_string($fill['nama']); ?></td>
  214. <td><?php echo mysql_real_escape_string(number_format($fill['hargabeli'], $decimal, $a_decimal, $thousand).',-'); ?></td>
  215. <td><?php echo mysql_real_escape_string(number_format($fill['hargajual'], $decimal, $a_decimal, $thousand).',-'); ?></td>
  216. <td><?php echo mysql_real_escape_string($fill['kategori']); ?></td>
  217. <td><?php echo mysql_real_escape_string($fill['keterangan']); ?></td>
  218. <td>
  219. <?php if ($chmod >= 3 || $_SESSION['jabatan'] == 'admin') { ?>
  220. <button type="button" class="btn btn-success btn-xs" onclick="window.location.href='add_<?php echo $halaman;?>?no=<?php echo $fill['no']; ?>'">Edit</button>
  221. <?php } else {}?>
  222.  
  223. <?php if ($chmod >= 4 || $_SESSION['jabatan'] == 'admin') { ?>
  224. <button type="button" class="btn btn-danger btn-xs" onclick="window.location.href='component/delete/delete_master?no=<?php echo $fill['no'].'&'; ?>forward=<?php echo $forward.'&';?>forwardpage=<?php echo $forwardpage.'&'; ?>chmod=<?php echo $chmod; ?>'">Hapus</button>
  225. <?php } else {}?>
  226. </td></tr><?php
  227. ;
  228. }
  229.  
  230. ?>
  231. </tbody></table>
  232. <div align="right"><?php if($tcount>=$rpp){ echo paginate_one($reload, $page, $tpages);}else{} ?></div>
  233. <?php
  234. }
  235.  
  236. }
  237.  
  238. } else {
  239. while(($count<$rpp) && ($i<$tcount)) {
  240. mysqli_data_seek($result,$i);
  241. $fill = mysqli_fetch_array($result);
  242. ?>
  243. <tbody>
  244. <tr>
  245. <td><?php echo ++$no_urut;?></td>
  246. <td><?php echo mysql_real_escape_string($fill['kode']); ?></td>
  247. <td><?php echo mysql_real_escape_string($fill['nama']); ?></td>
  248. <td><?php echo mysql_real_escape_string(number_format($fill['hargabeli'], $decimal, $a_decimal, $thousand).',-'); ?></td>
  249. <td><?php echo mysql_real_escape_string(number_format($fill['hargajual'], $decimal, $a_decimal, $thousand).',-'); ?></td>
  250. <td><?php echo mysql_real_escape_string($fill['kategori']); ?></td>
  251. <td><?php echo mysql_real_escape_string($fill['keterangan']); ?></td>
  252. <td>
  253. <?php if ($chmod >= 3 || $_SESSION['jabatan'] == 'admin') { ?>
  254. <button type="button" class="btn btn-success btn-xs" onclick="window.location.href='add_<?php echo $halaman;?>?no=<?php echo $fill['no']; ?>'">Edit</button>
  255. <?php } else {}?>
  256.  
  257. <?php if ($chmod >= 4 || $_SESSION['jabatan'] == 'admin') { ?>
  258. <button type="button" class="btn btn-danger btn-xs" onclick="window.location.href='component/delete/delete_master?no=<?php echo $fill['no'].'&'; ?>forward=<?php echo $forward.'&';?>forwardpage=<?php echo $forwardpage.'&'; ?>chmod=<?php echo $chmod; ?>'">Hapus</button>
  259. <?php } else {}?>
  260. </td></tr>
  261. <?php
  262. $i++;
  263. $count++;
  264. }
  265.  
  266. ?>
  267. </tbody></table>
  268. <div align="right"><?php if($tcount>=$rpp){ echo paginate_one($reload, $page, $tpages);}else{} ?></div>
  269. <?php } ?>
  270.  
  271. </div>
  272. <!-- /.box-body -->
  273. </div>
  274.  
  275. <?php } else {} ?>
  276. </div>
  277. <!-- ./col -->
  278. </div>
  279. <!-- /.row -->
  280. <!-- Main row -->
  281. <div class="row">
  282. </div>
  283. <!-- /.row (main row) -->
  284. </section>
  285. <!-- /.content -->
  286. </div>
  287. <!-- /.content-wrapper -->
  288. <?php footer();?>
  289. <div class="control-sidebar-bg"></div>
  290. </div>
  291. <!-- ./wrapper -->
  292. <script src="dist/plugins/jQuery/jquery-2.2.3.min.js"></script>
  293. <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
  294. <script>
  295. $.widget.bridge('uibutton', $.ui.button);
  296. </script>
  297. <script src="dist/bootstrap/js/bootstrap.min.js"></script>
  298. <script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
  299. <script src="dist/plugins/morris/morris.min.js"></script>
  300. <script src="dist/plugins/sparkline/jquery.sparkline.min.js"></script>
  301. <script src="dist/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
  302. <script src="dist/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
  303. <script src="dist/plugins/knob/jquery.knob.js"></script>
  304. <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
  305. <script src="dist/plugins/daterangepicker/daterangepicker.js"></script>
  306. <script src="dist/plugins/datepicker/bootstrap-datepicker.js"></script>
  307. <script src="dist/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
  308. <script src="dist/plugins/slimScroll/jquery.slimscroll.min.js"></script>
  309. <script src="dist/plugins/fastclick/fastclick.js"></script>
  310. <script src="dist/js/app.min.js"></script>
  311. <script src="dist/js/pages/dashboard.js"></script>
  312. <script src="dist/js/demo.js"></script>
  313. <script src="dist/plugins/datatables/jquery.dataTables.min.js"></script>
  314. <script src="dist/plugins/datatables/dataTables.bootstrap.min.js"></script>
  315. <script src="dist/plugins/slimScroll/jquery.slimscroll.min.js"></script>
  316. <script src="dist/plugins/fastclick/fastclick.js"></script>
  317.  
  318. </body>
  319. </html>
Advertisement
Add Comment
Please, Sign In to add comment