Esempio n. 1
0
<?php

if (isset($_POST['apa']) && $_POST['apa'] != "") {
    include 'modules/model/class.pembelian.php';
    $pembelian = new pembelian();
    switch ($_POST['apa']) {
        case "get-barang":
            include 'modules/model/class.barang.php';
            $barang = new barang();
            if ($query = $barang->get_barang()) {
                while ($rs = $query->fetch_array()) {
                    echo "<option value='" . $rs['id'] . "' data-harga='" . $rs['harga_beli'] . "'>" . $rs['nama'] . "</option>";
                }
            }
            break;
        case "get-bank":
            $bank = new bank();
            if ($query = $bank->get_bank()) {
                while ($rs = $query->fetch_array()) {
                    echo "<option value='" . $rs['id'] . "'>" . $rs['nama'] . " " . $rs['nomor_rekening'] . "</option>";
                }
            }
            break;
        case "get-spbe":
            include 'modules/model/class.spbe.php';
            $spbe = new spbe();
            if ($query = $spbe->get_spbe_barang_by_barang($_POST['barang'])) {
                while ($rs = $query->fetch_array()) {
                    echo "<option value='" . $rs['id'] . "' data-ship='" . $rs['ship_to'] . "' data-sold='" . $rs['sold_to'] . "'>" . $rs['nama_spbe'] . "</option>";
                }
            }
Esempio n. 2
0
<?php

if (isset($_POST['apa']) && $_POST['apa'] != "") {
    include 'modules/model/class.pembelian.php';
    $pembelian = new pembelian();
    switch ($_POST['apa']) {
        case "get-request":
            $collect = array();
            if ($query = $pembelian->runQuery("SELECT `request_hapus`.*, `karyawan`.`nama` FROM `request_hapus` \n\t\t\t\tINNER JOIN `karyawan` ON(`request_hapus`.`id_karyawan` = `karyawan`.`id`) WHERE `jenis` = '2' \n\t\t\t\tAND `is_proses` = '0' AND `request_hapus`.`hapus` = '0';")) {
                while ($rs = $query->fetch_array()) {
                    $detail = array();
                    array_push($detail, $rs["tgl"]);
                    array_push($detail, $rs["nama"]);
                    array_push($detail, $rs["id_hapus"]);
                    array_push($detail, $rs["keterangan"]);
                    array_push($detail, "<button class='btn btn-sm btn-primary' id='btn-cek' data-id='" . $rs['id_hapus'] . "'>\n\t\t\t\t\t\t\t<i class='fa fa-search'></i></button>\n\t\t\t\t\t\t\t<button class='btn btn-sm btn-danger' id='btn-hapus-req' data-id='" . $rs['id'] . "'>\n\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 "get-tebus":
            $collect = array();
            if (isset($_POST['id']) && $_POST['id'] != "") {
                if ($query = $pembelian->get_pembelian_by_id($_POST['id'])) {
                    while ($rs = $query->fetch_array()) {
                        $detail = array();
                        array_push($detail, $rs["tgl_tebus"]);
                        array_push($detail, $rs["no_lo"]);
                        array_push($detail, $rs["no_sa"]);