gimana cara biar ada peringatan stok kurang dari permintaan keluar??
  1. <?php
  2. error_reporting(0);
  3. error_reporting(E_ERROR | E_WARNING | E_PARSE);
  4. error_reporting(E_ALL);
  5. ini_set("error_reporting", E_ALL);
  6. error_reporting(E_ALL & ~E_NOTICE);
  7. ?>
  8. <?php
  9. //kondisi jika data SES_USER masih kosong maka...
  10. if (isset($_SESSION['SES_USER'])=="") {
  11. //merefresh halaman ke index.php
  12. echo"<meta http-equiv='refresh' content='0;url=index.php'>";
  13. } else { //jika SES_USER tidak kosong maka...
  14. include "koneksi.php"; //memanggil koneksi
  15. ?>
  16. <?php
  17. mysql_connect("localhost","root","");
  18. mysql_select_db("dbstok");
  19.  
  20. $query = "select max(id_trans_klr) as Kode from brg_klr";
  21. $hasil = mysql_query($query);
  22. $data = mysql_fetch_array($hasil);
  23. $kode = $data['Kode'];
  24.  
  25. $nourut = (int) substr($kode, 3, 3);
  26. $nourut++;
  27.  
  28. //karakter tetap
  29. $char = "OUT";
  30. //mengatur 02 karakter berubah-ubah
  31. $IdBaru = $char.sprintf("%03s",$nourut);
  32. ?>
  33.  
  34.  
  35. <style type="text/css">
  36. caption {font-size:x-large}
  37. </style>
  38.  
  39. <!-- link ke jQuery-1.4.4 -->
  40. <link rel="stylesheet" href="jQuery-1.4.4/bundle/themes/base/jquery.ui.all.css">
  41. <script type="text/javascript" src="jQuery-1.4.4/jscript/jquery-1.4.4.min.js"></script>
  42. <script type="text/javascript" src="jQuery-1.4.4/jscript/jquery-ui-1.8.9.custom.min.js"></script>
  43. <script type="text/javascript" src="jQuery-1.4.4/bundle/ui/jquery.ui.datepicker.js"></script>
  44.  
  45. <script> <!-- Javascript untuk fungsi kalender -->
  46. $(function() {
  47. $( "#tanggal" ).datepicker({
  48. changeMonth: true,
  49. changeYear: true,
  50. dateFormat:'yy-mm-dd',
  51. yearRange: '1980:c+9'
  52. });
  53. });
  54. </script>
  55. <style type="text/css">
  56. a {
  57. text-decoration: none;
  58. }
  59. .inputnonaktif {
  60. background-color:#6F9;
  61. }
  62. </style>
  63. <link href="thickbox/thickbox.css" rel="stylesheet" type="text/css" />
  64. <script language="javascript" src="jquery/jquery-1.2.6.js"></script>
  65. <script language="javascript" src="thickbox/thickbox.js"></script>
  66.  
  67. <script language="javascript">
  68.  
  69. var $jnoc = jQuery.noConflict();
  70. $jnoc(document).ready(function(){
  71. $jnoc("a.slick").click(function(){
  72. $jnoc(".active").removeClass("active");
  73. $jnoc(this).addClass("active");
  74. $jnoc(".content-slick").slideUp();
  75. var content_show = $jnoc(this).attr("title");
  76. $jnoc("#" +content_show).slideDown();
  77. });
  78. });
  79.  
  80.  
  81. function selectbarang(kode_brg,nama_brg,kualitas,id_suplier){
  82. $jnoc('input[@name=kode_brg]').val(kode_brg);
  83. $jnoc('input[@name=nama_brg]').val(nama_brg);
  84. $jnoc('input[@name=kualitas]').val(kualitas);
  85. $jnoc('input[@name=id_suplier]').val(id_suplier);
  86. tb_remove(); // hilangkan dialog thickbox
  87. }
  88.  
  89. function selectbrg_klr(kode_brg,nama_brg,kualitas,id_suplier){
  90. $jnoc('input[@name=kode_brg]').val(kode_brg);
  91. $jnoc('input[@name=nama_brg]').val(nama_brg);
  92. $jnoc('input[@name=kualitas]').val(kualitas);
  93. $jnoc('input[@name=id_suplier]').val(id_suplier);
  94. tb_remove(); // hilangkan dialog thickbox
  95. }
  96. </script>
  97.  
  98. <form name="frmSimpan" method="post" action="" enctype="multipart/form-data">
  99. <table width="450" align="center">
  100. <caption>INPUT BARANG KELUAR<br><br></caption>
  101. <tr>
  102. <td width="50%">ID Transaksi Keluar</td>
  103. <td width="2%">:</td>
  104. <td width="66%">
  105. <!-- echo $data['nim']; digunakan untuk menampilkan data dari field nim -->
  106. <input type="text" name="id_trans_klr" maxlength="15" size="9" required="" value="<?php echo $IdBaru; ?>" readonly>
  107.  
  108. </td>
  109. </tr>
  110. <tr>
  111. <td width="50%">Kode Barang</td>
  112. <td width="2%">:</td>
  113. <td width="66%">
  114. <input type="text" name="kode_brg" size="30" class="inputnonaktif" maxlength="8" required="" readonly id="kode_brg"><a href="cari_barang.php?width=400&amp;height=400" class="thickbox"><input type="submit" name="browse" id="browse3" value="Browse" /></a>
  115. *cari kode barang</tr></td>
  116.  
  117. <tr>
  118. <td width="50%">Nama Barang</td>
  119. <td width="2%">:</td>
  120. <td width="66%">
  121. <input name="nama_brg" size="30" maxlength="30" required="" readonly>
  122. </td>
  123. </tr>
  124. <!--<input type="text" name="id_daftar" size="30" class="inputnonaktif" maxlength="8" required="" readonly id="id_daftar"><a href="cari_daftar.php?width=600&height=400" class="thickbox"><input type="submit" name="browse" id="browse3" value="Browse" /></a>
  125. *cari id pendaftaran</tr></td> -->
  126. <tr>
  127. <td width="50%">Kualitas</td>
  128. <td width="2%">:</td>
  129. <td width="66%">
  130. <!-- echo $data['nama']; digunakan untuk menampilkan data dari field nama -->
  131. <input name="kualitas" size="30" maxlength="30" required="" readonly>
  132.  
  133. </td>
  134. </tr>
  135. <tr>
  136. <td width="50%">ID Suplier</td>
  137. <td width="2%">:</td>
  138. <td width="66%">
  139. <!-- echo $data['nama']; digunakan untuk menampilkan data dari field nama -->
  140. <input name="id_suplier" size="30" maxlength="30" required="" readonly>
  141.  
  142. </td>
  143. </tr>
  144. <tr>
  145. <td width="32%">Tanggal Keluar</td>
  146. <td width="2%">:</td>
  147. <td width="66%">
  148. <input type="text" name="tgl_klr" id="tanggal"/>
  149. </td>
  150. </tr>
  151. <tr>
  152. <td width="32%">Jumlah Keluar</td>
  153. <td width="2%">:</td>
  154. <td width="66%">
  155. <input name="jml_klr" size="30" maxlength="30" required="" >
  156. </td>
  157. </tr>
  158. <tr>
  159. <td width="32%">&nbsp;</td>
  160. <td width="2%">&nbsp;</td>
  161. <td width="66%">
  162. <input name="btnSimpan" type="submit" value="Simpan">
  163. <!-- membuat link ke mahasiswa_tampil.php pada tombol Batal -->
  164. <input name="btnBatal" type="reset"
  165. onclick="window.location.href='?page=barang_keluar&hal=1'" value="Batal" />
  166. </td>
  167. </tr>
  168. </table>
  169. </form>
  170.  
  171.  
  172. <?php
  173.  
  174.  
  175. //jika tombol Simpan di klik maka...
  176. if (isset($_POST['btnSimpan'])) {
  177. /*
  178. eksekusi query untuk memasukkan data pada tb_mahasiswa dengan field yang diisi
  179. nim,nama,jekel,alamat,sts_mhs
  180.  
  181. ".$_POST['txtNIM']." digunakan menampung data dari txtNIM
  182. ... dst
  183. */
  184.  
  185.  
  186.  
  187. $sql_insert = "INSERT INTO brg_klr (id_trans_klr,tgl_klr,kode_brg,nama_brg,jml_klr,id_suplier) VALUES (
  188. '".$_POST['id_trans_klr']."',
  189. '".$_POST['tgl_klr']."',
  190. '".$_POST['kode_brg']."',
  191. '".$_POST['nama_brg']."',
  192. '".$_POST['jml_klr']."',
  193. '".$_POST['id_suplier']."')";
  194. $query_insert = mysql_query($sql_insert) or die (mysql_error());
  195.  
  196. //mengcopy file gambar ke lokasi yang ditentukan [folder=imgFoto]
  197.  
  198. //jika proses penyimpanan berhasil maka...
  199. if ($query_insert) {
  200. //menampilkan pesan data berhasil disimpan
  201. echo"<script>alert('Simpan data berhasil !')</script>";
  202. //merefresh halaman ke mahasiswa_tampil.php
  203. echo "<meta http-equiv='refresh' content='0; url=?page=barang_keluar&hal=1'>";
  204. }
  205. }
  206.  
  207. }//menutup kondisi jika SES_USER tidak kosong di atas
  208.  
  209. ?>
  210.  
15060
Please login to answer!
/sangkep/answer/add-json/nogzip/1
/sangkep/answer/send-notification