while ($rs = $query->fetch_array()) {
             $detail = array();
             array_push($detail, $rs["nama"]);
             array_push($detail, $rs["jumlah"]);
             array_push($detail, "Rp " . number_format($rs["harga_beli"], 2, ",", "."));
             array_push($detail, "<button type='button' class='btn btn-sm btn-primary' id='btn-ubah-data' data-id='" . $rs["id"] . "' data-jumlah='" . $rs['jumlah'] . "' data-harga='" . $rs["harga_beli"] . "'>\n\t\t\t\t\t\t\t\t\t\t\t<i class='fa fa-pencil'></i></button>\n\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='btn btn-sm btn-danger' id='btn-hapus-data' data-id='" . $rs["id"] . "'>\n\t\t\t\t\t\t\t\t\t\t\t<i class='fa fa-trash-o'></i></button>");
             array_push($collect, $detail);
             unset($detail);
         }
     }
     echo json_encode(array("aaData" => $collect));
     break;
 case "tambah-harga-beli":
     $arr = array();
     if (isset($_POST['cmb-barang']) && $_POST['cmb-barang'] != "" && isset($_POST['txt-jumlah']) && $_POST['txt-jumlah'] != "" && isset($_POST['txt-harga-beli']) && $_POST['txt-harga-beli'] != "") {
         if ($result = $barang->tambah_harga_beli($_POST['cmb-barang'], $_POST['txt-jumlah'], $_POST['txt-harga-beli'])) {
             $arr['status'] = TRUE;
             $arr['msg'] = "Data tersimpan..";
         } else {
             $arr['status'] = FALSE;
             $arr['msg'] = "Gagal menyimpan..";
         }
     } else {
         $arr['status'] = FALSE;
         $arr['msg'] = "Harap isi data dengan lengkap..";
     }
     echo json_encode($arr);
     break;
 case "ubah-harga-beli":
     $arr = array();
     if (isset($_POST['cmb-barang']) && $_POST['cmb-barang'] != "" && isset($_POST['txt-jumlah']) && $_POST['txt-jumlah'] != "" && isset($_POST['txt-harga-beli']) && $_POST['txt-harga-beli'] != "" && isset($_POST['txt-id']) && $_POST['txt-id'] != "") {