Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 21st, 2017 80 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. $material=$_GET['material'];
  2.  
  3. mysql_select_db($database_ska, $ska);
  4. $query_brg = "SELECT * FROM inv WHERE material LIKE '%$material%'";
  5. $brg = mysql_query($query_brg, $ska) or die(mysql_error());
  6. $totalRows_brg = mysql_num_rows($brg);
  7.  
  8. <form id="form1" name="form1" method="GET" action="">
  9.   <label>Material
  10.     <input name="material" type="text" id="material" size="10" />
  11.   </label>
  12.   <input type="submit" name="insert" id="insert" value="Submit" />
  13. </form>
  14. <p>PEMAKAIAN MATERIAL</p>
  15. <form id="form2" name="form2" method="post" action="<?php echo $editFormAction; ?>">
  16.  
  17. <script>
  18.  var thoudelim = ",";
  19.  var decdelim = ".";
  20.  var curr = "";
  21.  var d=document;
  22.  
  23.  function haltnondigit(e) {
  24.   var allowkey=Array(48,49,50,51,52,53,54,55,56,57,8,9,188,190,45,46,13,33,34,35,36,37,38,39,40,112,113,114,115,116,117,118,119,120,121,123);
  25.   if(allowkey.indexOf(e.keyCode)==-1) return false;
  26.   return true;
  27.  }
  28.  function format(s,r) {
  29.   s=Math.round(s*Math.pow(10,r))/Math.pow(10,r);
  30.   s=String(s);s=s.split(".");var l=s[0].length;var t="";var c=0;
  31.   while(l>0){t=s[0][l-1]+(c%3==0&&c!=0?thoudelim:"")+t;l--;c++;}
  32.   s[1]=s[1]==undefined?"0":s[1];
  33.   for(i=s[1].length;i<r;i++) {s[1]+="0";}
  34.   return curr+t+decdelim+s[1];
  35.  }
  36.  function input_focus(t) {
  37.   t.value=t.getAttribute('ref');t.select();
  38.  }
  39.  function input_keydown(t,e) {
  40.   return haltnondigit(e);t.value=t.getAttribute('ref');
  41.  }
  42.  function input_keyup(t,s) {
  43.   t.setAttribute('ref',t.value);
  44.   if(s=="qtystock") {
  45.    var temp=parseFloat(t.parentNode.nextSibling.firstChild.getAttribute('ref'))*t.value;
  46.    t.parentNode.nextSibling.nextSibling.firstChild.setAttribute('ref',temp);
  47.    t.parentNode.nextSibling.nextSibling.firstChild.innerHTML=format(temp,2);
  48.   }
  49.   else if(s=="qtypakai") {
  50.    var temp=parseFloat(t.parentNode.previousSibling.firstChild.getAttribute('ref'))*t.value;
  51.    t.parentNode.nextSibling.firstChild.setAttribute('ref',temp);
  52.    t.parentNode.nextSibling.firstChild.innerHTML=format(temp,2);
  53.   }
  54.   calc_total();
  55.  }
  56.  function input_onblur(t) {
  57.   t.value=format(t.value,2);
  58.   return false;
  59.  }
  60.  function calc_total() {
  61.   var x=d.getElementsByTagName("div");
  62.   var total=0;
  63.   for(i=0;i<x.length;i++) {
  64.    if(x[i].id=="jumlah") total+=isNaN(parseFloat(x[i].getAttribute("ref")))?0:parseFloat(x[i].getAttribute("ref"));
  65.   }
  66.   d.getElementById("total").value=format(total,2);
  67.  }
  68. </script>
  69. <table width="900" border="1">
  70.     <tr>
  71.       <td width="420">MATERIAL</td>
  72.       <td width="96">QTY STOCK</td>
  73.       <td width="95">QTY PAKAI</td>
  74.       <td width="209">QTY SISA</td>
  75.     </tr>
  76.  <?php
  77.     $i=1;
  78.     while($row_brg = mysql_fetch_assoc($brg)){
  79. echo "
  80.    <tr>
  81.       <td>".$row_brg['material']."</td>
  82.         <td>".$row_brg['qty']."
  83.      </td><td><input type='text' name='qtypakai".$i."' id='qtypakai' value=0,00
  84.         rel=".$row_brg['qty']."
  85.        ref='0'
  86.        onfocus='input_focus(this);'
  87.         onkeydown='return input_keydown(this,event);'      
  88.        onkeyup='input_keyup(this,\"qtypakai\");'
  89.        onblur='return input_onblur(this);'
  90.         >
  91.          </td><td><div id='jumlah' ref=0,00>0,00</div>
  92.          </td>
  93.    </tr>";
  94.     }
  95. ?>
  96. <tr>
  97. <td colspan="3">TOTAL </td>
  98. <td><input name="total" type="text" id="total" readonly="readonly" /></td>
  99. </tr>
  100.   </table>
  101.   <p align="center">
  102.     <input type="submit" name="submit" id="submit" onclick="return tanya()" value="POSTING"  />
  103.     <input type="reset" name="reset" id="reset" value="RESET" />
  104.     <input type="hidden"name="n"value= "<?php echo $jum ?>" />
  105.     <input type="hidden" name="MM_insert" value="form2" />
  106.   </p>
  107.   <p>&nbsp;</p>
  108. </form>
  109. <script>
  110.  calc_total();
  111. </script>
  112. <p>&nbsp;</p>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top