Guest User

Untitled

a guest
May 8th, 2019
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $PartID     = $_POST['PartID'];
  4. $QtyRequest = $_POST['QtyRequest'];
  5. $UnitID     = $_POST['UnitID'];
  6. $LocationID = $_POST['LocationID'];
  7. $MPROSector = $_POST['MPROSector'];
  8. $Notes      = $_POST['Notes'];
  9. $count      = count($PartID);
  10.  
  11. for ($i = 0; $i < $count; $i++) {
  12.     /*VALIDASI CEK STOK*/
  13.     $text = "SELECT SUM(Qty) as QtyStock FROM buku_stock201905 where PartID='$PartID[$i]' AND LocationID='$LocationID[$i]'";
  14.     $q    = sqlsrv_query($conn, $text);
  15.     while ($r = sqlsrv_fetch_array($q, SQLSRV_FETCH_ASSOC)) {
  16.         $QtyStock = $r['QtyStock'];
  17.     }
  18.    
  19.     if ($QtyRequest[$i] >= $QtyStock) {
  20.         echo "<script>alert('Gagal Menyimpan MPRO, Stock Tidak Cukup');history.go(-1);</script>";
  21.     } else {
  22.         $queryhd               = sqlsrv_query($conn, $sqlhd);
  23.         $query                 = sqlsrv_query($conn, $updatereq);
  24.         $queryinsertdt         = sqlsrv_query($conn, $sqldt);
  25.         $queryinsertobukustock = sqlsrv_query($conn, $sqlbukustock);
  26.         echo "<script>alert('Berhasil Menyimpan MPRO');history.go(-1);</script>";
  27.     }
  28. }
  29. ?>
RAW Paste Data