function transaksi_pembelian($tglTebus, $noLO, $noSA, $idBarang, $jmlTabung, $hargaSatuan, $pajak, $diskon, $beaAdmin, $grandTotal, $idBank, $bukti, $jenisTarikan, $idKaryawan, $idSPBE)
 {
     $tglTebus = $this->clearText($tglTebus);
     $noLO = $this->clearText($noLO);
     $noSA = $this->clearText($noSA);
     $idBarang = $this->clearText($idBarang);
     $jmlTabung = $this->clearText($jmlTabung);
     $hargaSatuan = $this->clearText($hargaSatuan);
     $pajak = $this->clearText($pajak);
     $diskon = $this->clearText($diskon);
     $beaAdmin = $this->clearText($beaAdmin);
     $grandTotal = $this->clearText($grandTotal);
     $idBank = $this->clearText($idBank);
     $bukti = $this->clearText($bukti);
     $jenisTarikan = $this->clearText($jenisTarikan);
     $idKaryawan = $this->clearText($idKaryawan);
     $idSPBE = $this->clearText($idSPBE);
     $id = $this->autocode_pembelian($tglTebus);
     $query = "INSERT INTO `pembelian` VALUES('{$id}', '{$tglTebus}', '{$noLO}', '{$noSA}', '{$idBarang}', \n\t\t\t'{$jmlTabung}', '{$hargaSatuan}', '{$pajak}', '{$diskon}', '{$beaAdmin}', '{$grandTotal}', '{$idBank}', \n\t\t\t'{$bukti}', '{$jenisTarikan}', '{$idKaryawan}', '{$idSPBE}');";
     if ($result = $this->runQuery($query)) {
         $bank = new bank();
         $hasilBank = $bank->transaksi_tarik($idBank, $bukti, $tglTebus, "Pembelian " . $id, $grandTotal, 0, $idKaryawan, $jenisTarikan);
         $loading = new loading();
         $hasilLoading = $loading->loading_pembelian_baru($id);
         if ($hasilBank == TRUE && $hasilLoading == TRUE) {
             return TRUE;
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
Beispiel #2
0
<?php

if (isset($_POST['apa']) && $_POST['apa'] != "") {
    include 'modules/model/class.loading.php';
    $loading = new loading();
    switch ($_POST['apa']) {
        case "get-loading":
            $collect = array();
            if ($query = $loading->get_loading_belum_acc_gudang()) {
                while ($rs = $query->fetch_array()) {
                    $kendaraan = $rs['nopol'] == null ? " " : $rs['nopol'];
                    if ($rs['id_gudang_berangkat'] == null) {
                        $tombol = "<button type='button' class='btn btn-sm btn-primary' id='btn-show-out' \n\t\t\t\t\t\t\t\t\tdata-id='" . $rs["id_pembelian"] . "' data-idbarang='" . $rs["id_barang"] . "' data-jml='" . $rs["tabung_kosong"] . "'>\n\t\t\t\t\t\t\t\t\t<i class='fa fa-check'></i></button>";
                    } else {
                        $tombol = "<button type='button' class='btn btn-sm btn-primary' id='btn-show-in' \n\t\t\t\t\t\t\t\t\tdata-id='" . $rs["id_pembelian"] . "' data-idbarang='" . $rs["id_barang"] . "' data-jml='" . $rs["tabung_isi"] . "'>\n\t\t\t\t\t\t\t\t\t<i class='fa fa-check'></i></button>";
                    }
                    if ($rs['id_gudang_berangkat'] != null && $rs['id_gudang_kembali'] != null) {
                        $tombol = "";
                    }
                    $driver = $rs['nama_driver'] == null ? " " : $rs['nama_driver'];
                    $detail = array();
                    array_push($detail, $rs['id_pembelian'] . " - " . $kendaraan . " - " . $driver . " - " . $rs['nama_barang'] . " - " . $rs['nama_spbe']);
                    array_push($detail, $rs["tabung_kosong"]);
                    array_push($detail, $rs["tabung_isi"]);
                    array_push($detail, $tombol);
                    array_push($collect, $detail);
                    unset($detail);
                }
            }
            echo json_encode(array("aaData" => $collect));
            break;
Beispiel #3
0
<?php

if (isset($_POST['apa']) && $_POST['apa'] != "") {
    include 'modules/model/class.loading.php';
    $loading = new loading();
    switch ($_POST['apa']) {
        case "get-loading":
            $collect = array();
            if (isset($_POST['lo']) && $_POST['lo'] != "") {
                if ($query = $loading->get_loading_by_lo($_POST['lo'])) {
                    while ($rs = $query->fetch_array()) {
                        $kendaraan = $rs['nopol'] == null ? " " : $rs['nopol'];
                        $tombol = "";
                        if ($rs['nopol'] == null && $rs['jam_kembali'] == "00:00:00") {
                            $tombol = "<button type='button' class='btn btn-sm btn-primary' id='btn-show-out' \n\t\t\t\t\t\t\t\t\t\tdata-id='" . $rs["id_pembelian"] . "'><i class='fa fa-truck'></i></button>";
                        } elseif ($rs['nopol'] != null && $rs['jam_kembali'] == "00:00:00") {
                            $tombol = "<button type='button' class='btn btn-sm btn-primary' id='btn-show-in' \n\t\t\t\t\t\t\t\t\t\tdata-id='" . $rs["id_pembelian"] . "'><i class='fa fa-truck'></i></button>";
                        }
                        $driver = $rs['nama_driver'] == null ? " " : $rs['nama_driver'];
                        $detail = array();
                        array_push($detail, $kendaraan . " - " . $driver . " - " . $rs['nama_barang']);
                        array_push($detail, $rs["tgl_loading"]);
                        array_push($detail, $rs["nama_spbe"]);
                        array_push($detail, $rs["jam_berangkat"]);
                        array_push($detail, $rs["tabung_kosong"]);
                        array_push($detail, $rs["jam_kembali"]);
                        array_push($detail, $rs["tabung_isi"]);
                        array_push($detail, $tombol);
                        array_push($collect, $detail);
                        unset($detail);
                    }