Advertisement
ismilliazarputri

pengambilan_add_add.php

Mar 4th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.97 KB | None | 0 0
  1. <script>
  2.   var datafield = [
  3.   '<td nowrap="nowrap"><strong>Kategori</strong></td><td nowrap="nowrap"><strong>:</strong></td><td nowrap="nowrap"><?php echo $combo; ?></td><td><strong>Nama Barang</strong></td><td nowrap="nowrap"><strong>:</strong></td><td nowrap="nowrap"><select id="tb_barang"><option value="0">....</option></select></td><td nowrap="nowrap"><input type="button" value="DEL" onclick="delfield(this)"></td>',
  4.   '<td nowrap="nowrap"><strong>Keterangan</strong></td><td nowrap="nowrap"><strong>:</strong></td><td nowrap="nowrap"><input name="txtKeterangan[]" value="" size="70" maxlength="200" /></td><td nowrap="nowrap"><strong>Jumlah Ambil </strong></td><td nowrap="nowrap"><strong>:</strong></td><td nowrap="nowrap" colspan="2"><input name="txtJumlahambil[]" value="" size="10" maxlength="4" /></td>'
  5.   ];
  6.  
  7.   function addfield() {
  8.     var df=document.getElementById("datafield");
  9.     var el=document.createElement("TR");
  10.     el.innerHTML=datafield[0];
  11.     df.appendChild(el);
  12.     el=document.createElement("TR");
  13.     el.innerHTML=datafield[1];
  14.     df.appendChild(el);
  15.   }
  16.  
  17.   function delfield(t) {
  18.     var pr=t.parentNode.parentNode.parentNode;
  19.     var el1=t.parentNode.parentNode;
  20.     var el2=el1.nextElementSibling;
  21.     pr.removeChild(el2);
  22.     pr.removeChild(el1);
  23.   }
  24.  
  25.   function loadbarang(kd_kategori) {
  26.   var xmlhttp;
  27.   if(window.XMLHttpRequest) {xmlhttp=new XMLHttpRequest();}
  28.   else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
  29.   xmlhttp.onreadystatechange=function() {
  30.     if(xmlhttp.readyState==4 && xmlhttp.status==200) {document.getElementById("tb_barang").innerHTML=xmlhttp.responseText;}
  31.   }
  32.   xmlhttp.open("GET","loadbarang.php?kd_barang="+kd_kategori,true);
  33.   xmlhttp.send();
  34. }
  35. </script>
  36. <form action="" method="post" name="form1" target="_self">
  37.   <table id="datafield" class="table-list" width="700" border="0" cellspacing="1" cellpadding="3" >
  38.     <tr>
  39.         <th colspan="7" scope="col"><strong>TAMBAH DATA PENGAMBILAN BARANG</strong></th>
  40.     </tr>
  41.     <tr>
  42.       <td width="133"><strong>Tanggal Transaksi</strong></td>
  43.       <td width="5"><strong>:</strong></td>
  44.       <td width="441"><input name="txtTanggal" class="tcal"  value="<?php echo $tanggal; ?>" size="22" align="10"/></td>
  45.       <td><strong>Nama Pengambil</strong></td>
  46.       <td><strong>:</strong></td>
  47.       <td>
  48.         <select name="cmbNamapengambil">
  49.           <option value="KOSONG">....</option>
  50.         <?php
  51.           $mySql = "SELECT * FROM tb_karyawan ORDER BY nama_karyawan";
  52.           $myQry = mysql_query($mySql, $koneksidb) or die ("Gagal Query".mysql_error());
  53.           while ($myData = mysql_fetch_array($myQry)) {
  54.             if ($myData['kd_karyawan']== $dataNamapengambil) {
  55.                 $cek = " selected";
  56.             } else { $cek=""; }
  57.             echo "<option value='$myData[kd_karyawan]' $cek> $myData[nama_karyawan] </option>";
  58.           }
  59.           ?>
  60.         </select>
  61.       </td>
  62.       <td id="addfield"><input type="button" value="ADD FIELD" onclick="addfield()"></td>
  63.     </tr>
  64.     <tr>
  65.       <td nowrap="nowrap"><strong>Kategori</strong></td>
  66.       <td nowrap="nowrap"><strong>:</strong></td>
  67.       <td nowrap="nowrap">
  68.       <?php echo $combo; ?>
  69.         </td>
  70.         <td>
  71.         <strong>Nama Barang</strong></td>
  72.         <td nowrap="nowrap"><strong>:</strong></td>
  73.         <td nowrap="nowrap" colspan="2">
  74.         <select id="tb_barang">
  75.           <option value="0">....</option>
  76.         </select>
  77.       </td>
  78.     </tr>
  79.     <tr>
  80.       <td nowrap="nowrap"><strong>Keterangan</strong></td>
  81.       <td nowrap="nowrap"><strong>:</strong></td>
  82.       <td nowrap="nowrap"><input name="txtKeterangan[]" value="" size="70" maxlength="200" /></td>
  83.       <td nowrap="nowrap"><strong>Jumlah Ambil </strong></td>
  84.       <td nowrap="nowrap"><strong>:</strong></td>
  85.       <td nowrap="nowrap" colspan="2"><input name="txtJumlahambil[]" value="" size="10" maxlength="4" /></td>
  86.     </tr>
  87.   </table>
  88.   <input type="submit" name="btnSimpan" value=" Simpan " style="cursor:pointer;"><input value="Kembali" type="button" onClick="self.history.back()">
  89. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement