Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
948
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. <h1>Stok Barang </h1>
  2. <?php
  3. include("koneksi.php");
  4.  
  5. if(isset($_POST["simpan"]))
  6. {
  7. $a=$_POST["kodebrg1"];
  8. $sqlnya="select * from barang where KodeBrg='$a'";
  9. $hasil=mysqli_query($koneksinya,$sqlnya);
  10.  
  11. echo "<center><table></center>";
  12. echo "<tr><td>Kode Barang</td><td>Nama Barang</td><td>Stok Awal </td> <td>Stok Jual</td><td>Stok Beli</td><td>Stok Sekarang</td></tr>";
  13. if(mysqli_num_rows($hasil)>0)
  14. {
  15. while($baris=mysqli_fetch_assoc($hasil))
  16. {
  17. $a=$baris["KodeBrg"];
  18. $b=$baris["NamaBrg"];
  19. // $c=$baris["HargaBeli"];
  20. // $d=$baris["HargaJual"];
  21. $e=$baris["Stock"];
  22. $f=$baris["StokJual"];
  23. $g=$baris["StokBeli"];
  24. $h=$e+$g-$f;
  25. echo "<form action='' method='post'>";
  26. echo "<tr><td><input type='text' value = '$a' name='kodebrg1'></td>";
  27. echo "<td><input type='text' value = '$b' name='namabrg1'></td>";
  28. // echo "<td><input type='text' value = '$c' name='hrgbeli1'></td>";
  29. // echo "<td><input type='text' value = '$d' name='hrgjual1'></td>";
  30. echo "<td><input type='text' value = '$e' name='stok1'></td>";
  31. echo "<td><input type='text' value = '$f' name='stok2'></td>";
  32. echo "<td><input type='text' value = '$g' name='stok3'></td>";
  33. echo "<td><input type='text' value = '$h' name='stok3'></td>";
  34. echo "</form>";
  35. }
  36. }
  37. }
  38. else{
  39. $sqlnya="select * from barang order by KodeBrg asc";
  40. $hasil=mysqli_query($koneksinya,$sqlnya);
  41.  
  42. echo "<center><table></center>";
  43. echo "<tr><td>Kode Barang</td><td>Nama Barang</td><td>Stok Awal </td> <td>Stok Jual</td><td>Stok Beli</td><td>Stok Sekarang</td></tr>";
  44. if(mysqli_num_rows($hasil)>0)
  45. {
  46. while($baris=mysqli_fetch_assoc($hasil))
  47. {
  48. $a=$baris["KodeBrg"];
  49. $b=$baris["NamaBrg"];
  50. // $c=$baris["HargaBeli"];
  51. // $d=$baris["HargaJual"];
  52. $e=$baris["Stock"];
  53. $f=$baris["StokJual"];
  54. $g=$baris["StokBeli"];
  55. $h=$e+$g-$f;
  56. echo "<form action='' method='post'>";
  57. echo "<tr><td><input type='text' value = '$a' name='kodebrg1'></td>";
  58. echo "<td><input type='text' value = '$b' name='namabrg1'></td>";
  59. // echo "<td><input type='text' value = '$c' name='hrgbeli1'></td>";
  60. // echo "<td><input type='text' value = '$d' name='hrgjual1'></td>";
  61. echo "<td><input type='text' value = '$e' name='stok1'></td>";
  62. echo "<td><input type='text' value = '$f' name='stok2'></td>";
  63. echo "<td><input type='text' value = '$g' name='stok3'></td>";
  64. echo "<td><input type='text' value = '$h' name='stok3'></td>";
  65. echo "</form>";
  66. }
  67. }
  68. }
  69. echo "</table>";
  70. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement