Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Err… harus lebih rapi
- .....
- <!--DataTable......-->
- Hide quoted text
- <div class="table-responsive">
- <form action="" method="POST" id="formcheck">
- <table class="table table-bordered table-striped table-hover" id="table-datatable">
- <thead>
- <tr>
- <th></th>
- <th width="5%">NO</th>
- <th width="10%">TANGGAL</th>
- <th>DIVISI</th>
- <th>NAMA KASIR</th>
- <th>NAMA PENJUAL</th>
- <th>NOMOR PENJUAL</th>
- <th>PEMBELIAN</th>
- <th width="12%">NOMINAL</th>
- <th>STATUS</th>
- <th width="9%">OPSI</th>
- </tr>
- </thead>
- <tfoot style="display: table-header-group">
- <tr>
- <td></td>
- <td></td>
- <th>TANGGAL</th>
- <th>DIVISI</th>
- <th>NAMA KASIR</th>
- <th>NAMA PENJUAL</th>
- <th>NOMOR PENJUAL</th>
- <th>PEMBELIAN</th>
- <th>NOMINAL</th>
- <th>STATUS</th>
- <td></td>
- </tr>
- </tfoot>
- <tbody>
- <?php
- $no=1;
- $data = mysqli_query($koneksi,"SELECT * FROM sa_beli2nd,divisi where divisi_id=kode_divisi order by tanggal_beli desc, kode_divisi asc, id_beli desc");
- while($d = mysqli_fetch_array($data)){
- ?>
- <tr>
- <td class="text-center"><input type="checkbox" class="check" name="check" id="check"
- onclick="konfirmasi(this)" value="<?php echo $d['id_beli']; ?>"></td>
- <td class="text-center"><?php echo $no++; ?></td>
- <td class="text-center"><?php echo date('d-m-Y', strtotime($d['tanggal_beli'])); ?></td>
- <td><?php echo $d['divisi']; ?></td>
- <td><?php echo $d['kasir']; ?></td>
- <td><?php echo $d['penjual']; ?></td>
- <td><?php echo $d['no_penjual']; ?></td>
- <td><?php echo $d['jenis_beli']; ?></td>
- <td class="text-right text-primary"><?php echo "Rp. ".number_format($d['nominal'])." ,-";?></td>
- <td><?php echo $d['status']; ?></td>
- <td class="text-center">
- <?php if($id_user == '3'){ ?>
- <button type="button" class="btn btn-warning btn-sm" data-toggle="modal" data-target="#edit_sa_<?php echo $d['id_beli'] ?>">
- <i class="fa fa-cog" style="display:grid; justify-content:center;"></i>
- </button>
- <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#hapus_sa_<?php echo $d['id_beli'] ?>">
- <i class="fa fa-trash" style="display:grid; justify-content:center;"></i>
- </button>
- <?php } ?>
- <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#lihat_sa_<?php echo $d['id_beli'] ?>">
- <i class="fa fa-eye" style="display:grid; justify-content:center;"></i>
- </button>
- </td>
- </tr>
- //Jquery Ajax Menandai data......
- <script>
- function konfirmasi(obj){
- var idKonfirmasi = $(obj).val();
- //$(obj).data("check")
- //document.getElementById("check").checked
- if(true){
- var checked = confirm("Ingin menandai data ini?")
- if (checked === true) {
- alert("update/edit "+idKonfirmasi);
- $.ajax({
- url: "sa_beli2nd_update.php",
- method: "POST",
- data: {type: "editData", id: idKonfirmasi},
- success: function(){
- window.location.replace="sa_beli2nd.php";
- }
- //tidak ada kondisi kalau gagal!!!
- });
- }else{
- let check = document.getElementById("check");
- check.checked = false;
- }
- }
- }
- </script>
- <?php
- //File Proccess (sa_beli2nd_update.php)
- if($_POST["type"] == "editData" ){
- $id = $_POST["id"];
- $query = mysqli_query($koneksi, "UPDATE sa_beli2nd set status= 'Tuntas' WHERE id = '$id' ");
- if($query){
- //header("location:sa_beli2nd.php");
- return 1;//mengembalikan nilai bukan header location
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement