Advertisement
kura2yamato

php - solve 54

Aug 23rd, 2020
1,351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form method="post" action="<?=site_url('ppb/process')?>">
  2.     <div class="row">
  3.         <div class="col-lg-4">
  4.             <div class="box box-widget">
  5.                 <div class="box-body">
  6.                     <table width="100%">
  7.                         <tr>
  8.                             <td style="vertical-align:top">
  9.                                 <label for="date">No. PPB*</label>
  10.                             </td>
  11.                             <td>
  12.                                 <div class="form-group">
  13.                                     <input id="idf" value="1" type="hidden" />
  14.                                     <input type="text" name="noppb" id="nama" value ="<?=$row->ppb_id ?? $newKode?>" readonly class="form-control" autocomplete="off" required>
  15.                                  </div>
  16.                             </td>
  17.                         </tr>
  18.                         <tr>
  19.                             <td style="vertical-align:top; width:30%">
  20.                                 <label for="user">Diajukan tgl.*</label>
  21.                              </td>
  22.                             <td>
  23.                                 <div class="form-group">
  24.                                     <input type="date" id="date" name="tgl" value="<?=date('Y-m-d')?>" class="form-control">
  25.                                 </div>
  26.                             </td>
  27.                         </tr>
  28.                         <tr>
  29.                             <td style="vertical-align:top; width:30%">
  30.                                 <label for="user">Jenis Bahan*</label>
  31.                             </td>
  32.                             <td>
  33.                                 <div class="form-group">
  34.                                     <select name="jenis" id="nama" class="form-control" autofocus required>
  35.                                         <option value=""> - Pilih - </option>
  36.                                         <option value="Bahan Produksi"> Bahan Produksi </option>
  37.                                         <option value="Bahan Pendukung"> Bahan Pendukung </option>
  38.                                         <option value="Bahan Sampel"> Bahan Sampel </option>
  39.                                         <option value="Lain - lain"> Lain - lain </option>
  40.                                     </select>
  41.                                 </div>
  42.                             </td>
  43.                         </tr>
  44.                         <tr>
  45.                             <td style="vertical-align:top">
  46.                                 <label for="customer"> Keperluan*</label>
  47.                             </td>
  48.                             <td>
  49.                                 <div class="form-group">
  50.                                     <input type="text" name="keperluan" id="nama" value ="" class="form-control" autocomplete="off" autofocus required>
  51.                                 </div>
  52.                             </td>
  53.                         </tr>
  54.                     </table>
  55.                 </div>
  56.             </div>
  57.         </div>
  58.     </div>
  59.     <div class="row">
  60.         <div class="col-lg-12">
  61.             <div class="box box-widget">
  62.                 <div class="box-body table-responsive">
  63.                     <table id="" class="table table-bordered tabel-striped">
  64.                         <thead>
  65.                             <tr>
  66.                                 <th>Deskripsi</th>
  67.                                 <th>QTY</th>
  68.                                 <th>Satuan</th>
  69.                                 <th>Harga @</th>
  70.                                 <th>Total Bayar</th>
  71.                                 <th>Pembayaran</th>
  72.                                 <th>Supplier</th>
  73.                                 <th>Rekening</th>
  74.                                 <?php if($this->fungsi->user_login()->level == 1 ) { ?>
  75.                                 <th>*</th>
  76.                                 <?php } ?>
  77.                             </tr>
  78.                         </thead>
  79.                         <tbody id='bodyDetail'>
  80.                         <script language="javascript">
  81.                             function tambahHobi() {
  82.                                     var idf = document.getElementById("idf").value;
  83.                                     var stre;
  84.                                     <?php
  85.                                     $koneksi = mysqli_connect("localhost","root","","posijb");
  86.                                     $ambildata = mysqli_query($koneksi, "SELECT * FROM customer");  //ambil data dari tabel kategori
  87.                                     while($a=mysqli_fetch_array($ambildata)){ ?>
  88.  
  89.                                     stre="<input id='srow" + idf + "' type='text' size='40' class='form-control' name='deskripsi[]' /><p></p>";
  90.                                     stre1="<input id='srow" + idf + "' type='text' size='10' class='form-control' name='qty[]' /><p></p>";
  91.                                     stre2="<select id='srow" + idf + "' class='form-control' name='satuan[]' autofocus required> <option value=''> - Pilih - </option> <option value='Kg'> Kg </option> <option value='Pcs'> Pcs </option> <option value='Rim'> Rim </option> <option value='Lembar'> Lembar </option> <option value='Buku'> Buku </option> </select><p></p>";
  92.                                     stre3="<input id='srow" + idf + "' type='text' size='7' class='form-control' name='harga[]' /><p></p>";
  93.                                     stre4="<input id='srow" + idf + "' type='text' class='form-control' name='bayar[]' /><p></p>";
  94.                                     stre5="<select id='srow" + idf + "' class='form-control' name='pembayaran[]' autofocus required> <option value=''> - Pilih - </option> <option value='Cash'> Cash </option> <option value='Tempo 1 Mggu'> Tempo 1 Mggu </option> <option value='Tempo 2 Mggu'> Tempo 2 Mggu </option> <option value='Tempo 3 Mggu'> Tempo 3 Mggu </option> <option value='Tempo 1 Bln'> Tempo 1 Bln </option> </select><p></p>";
  95.                                     stre6="<input id='srow" + idf + "' type='text' class='form-control' name='supplier_id[]' placeholder='Supplier' /><p></p>";
  96.                                     stre7="<input id='srow" + idf + "' type='text' size='30' class='form-control' name='rekening[]' placeholder='Rekening' /><p></p>";
  97.                                     stre8="<button class='btn btn-danger' id='srow" + idf + "' onclick='hapusElemen(\"#srow" + idf + "\"); return false;'>X</button></p>";
  98.  
  99.                     txt="<tr>";
  100.                     txt=txt+"<td>"+stre+"</td>";
  101.                     txt=txt+"<td>"+stre1+"</td>";
  102.                     txt=txt+"<td>"+stre2+"</td>";
  103.                     txt=txt+"<td>"+stre3+"</td>";
  104.                     txt=txt+"<td>"+stre4+"</td>";
  105.                     txt=txt+"<td>"+stre5+"</td>";
  106.                     txt=txt+"<td>"+stre6+"</td>";
  107.                     txt=txt+"<td>"+stre7+"</td>";
  108.                     txt=txt+"<td>"+stre8+"</td>";
  109.  
  110.  
  111.                                     txt=txt+"<tr>";
  112.                                     $("#bodyDetail").append(txt);
  113. /*
  114.                                     $("#divHobi").append(stre);
  115.                                     $("#divHobi1").append(stre1);
  116.                                     $("#divHobi2").append(stre2);
  117.                                     $("#divHobi3").append(stre3);
  118.                                     $("#divHobi4").append(stre4);
  119.                                     $("#divHobi5").append(stre5);
  120.                                     $("#divHobi6").append(stre6);
  121.                                     $("#divHobi7").append(stre7);
  122.                                     $("#divHobi8").append(stre8);  
  123. */
  124.                                     idf = (idf-1) + 2;
  125. <?php } ?>
  126.                                     document.getElementById("idf").value = idf;
  127.                                 }
  128.                             function hapusElemen(idf) {
  129.                                     $(idf).remove();
  130.                                     $(idf).remove();
  131.                                     $(idf).remove();
  132.                                     $(idf).remove();
  133.                                     $(idf).remove();
  134.                                     $(idf).remove();
  135.                                     $(idf).remove();
  136.                                     $(idf).remove();
  137.                                     $(idf).remove();
  138.                                 }
  139.                         </script>
  140.                             <tr>
  141.                                 <td id="divHobi"></td>
  142.                                 <td id="divHobi1"></td>
  143.                                 <td id="divHobi2"></td>
  144.                                 <td id="divHobi3"></td>
  145.                                 <td id="divHobi4"></td>
  146.                                 <td id="divHobi5"></td>
  147.                                 <td id="divHobi6"></td>
  148.                                 <td id="divHobi7"></td>
  149.                                 <td id="divHobi8"></td>
  150.                             </tr>
  151.                         </tbody>
  152.                     </table>
  153.                 </div>
  154.             </div>
  155.         </div>
  156.     </div>
  157.         <button type="button" onclick="tambahHobi(); return false;" class="btn btn-primary">+ Rincian </button>          
  158.         <button type="submit" class="btn btn-success pull-right" >Simpan</button>
  159.     </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement