<?php

include "src/Koneksi.php";
include "src/produk.php";
$produk = new Produk($dbh);
if (isset($_POST['submit'])) {
    $id_produk = $_GET['id_edit'];
    $nama = $_POST['nama'];
    $deskripsi = $_POST['deskripsi'];
    $qty = $_POST['qty'];
    $harga = $_POST['harga'];
    $gambar = $_POST['gambar'];
    $stock = $_POST['stock'];
    $produk->updateDataProduk($id_produk, $nama, $deskripsi, $qty, $harga, $gambar, $stock);
    echo "\n        <script>\n            window.location = 'admin-produk.php';\n        </script>\n    ";
}
if (isset($_GET['id_edit'])) {
    $id_produk = $_GET['id_edit'];
    extract($produk->getIDProduk($id_produk));
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="icon" type="image/png" href="asset/img/250.png">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        <title>Pangeran Shoop Update Produk</title>
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function getShowProductById($id)
 {
     $produk = Produk::findOrFail($id);
     return View::make('home.detailproduk')->with('produk', $produk);
 }
    public function updateEkspedisi($id)
    {
        $id = Kabupaten::find($id)->nama;
        if (\Cache::has('rajaongkir')) {
            $rs = \Cache::get('rajaongkir');
        } else {
            $rs = \RajaOngkir::getCity();
            \Cache::put('rajaongkir', $rs, 60);
        }
        $cart = Shpcart::cart()->contents();
        $berat = 0;
        foreach ($cart as $value) {
            $beratnew = \Produk::find($value['produkId'])->berat;
            $berat = $berat + $value['qty'] * $beratnew;
        }
        //$berat = ceil($berat/1000);
        $html = '';
        if ($berat != 0) {
            $statusApi = $this->setting->statusApi;
            $alresult = null;
            $asal = $this->setting->kotaAsal;
            $results = $rs['rajaongkir']['results'];
            //cari tujuan pengirim
            $destination = array_filter($results, function ($obj) use($id) {
                if (strtolower($obj['city_name']) == strtolower($id)) {
                    return true;
                }
                return false;
            });
            $destination = array_values($destination)[0];
            //cari kota asal pengirim
            $origin = array_filter($results, function ($obj) use($asal) {
                if (strtolower($obj['city_name']) == strtolower($asal)) {
                    return true;
                }
                return false;
            });
            $origin = array_values($origin)[0];
            if ($statusApi == 1) {
                $alresult = \RajaOngkir::getCost($origin['city_id'], $destination['city_id'], $berat, 'jne');
            }
            if ($statusApi == 2) {
                $alresult = \RajaOngkir::getCost($origin['city_id'], $destination['city_id'], $berat, 'tiki');
            }
            if ($statusApi == 3) {
                $alresult = \RajaOngkir::getCost($origin['city_id'], $destination['city_id'], $berat, 'pos');
            }
            if ($alresult != null) {
                foreach ($alresult['rajaongkir']['results'] as $key => $item) {
                    if (count($item['costs']) > 0) {
                        foreach ($item['costs'] as $service) {
                            $html = $html . '<label class="radio span12" style="margin-left:0;margin-right:10px">
                              <input style="margin-left:0;margin-right:10px" type="radio" name="ekspedisilist" id="optionsRadios1" value="' . $item['code'] . ' : ' . $service['service'] . ' ' . $service['description'] . ';' . $service['cost'][0]['value'] . '"><small>' . $item['name'] . '|' . $service['service'] . ':
                              ' . $service['description'] . ' harga : ' . price($service['cost'][0]['value']) . '</small>
                            </label>';
                        }
                    }
                }
            }
            $tarif = \Tarif::join('paket', 'tarif.paketId', '=', 'paket.id')->whereRaw('(tarif.tujuan ="' . $id . '" or tarif.tujuan LIKE "%' . strtolower($id) . '%" or tarif.tujuan LIKE "%' . strtoupper($id) . '%" or tarif.tujuan LIKE "%' . ucfirst($id) . '%") and paket.akunId=' . $this->akunId)->get();
            $beratLokal = ceil($berat / 1000);
            foreach ($tarif as $key => $value) {
                $html = $html . '<label class="radio">
                                    <input type="radio" style="margin-left:0;margin-right:10px" name="ekspedisilist" value="' . $value->paket->ekspedisi->nama . ' ' . $value->nama . ';' . $value->harga * $beratLokal . '">
                                    ' . $value->paket->ekspedisi->nama . ' ' . $value->paket->nama . ' - ' . price($value->harga * $beratLokal) . '
                                </label><br>';
            }
            if ($html == '') {
                $html = $html . '<p>Tidak ditemukan ekpedisi dari <strong>' . $this->setting->kotaAsal . '</strong> ke tujuan : <strong>' . $id . '</strong> <br>
                    <small><i>untuk informasi pengiriman silakan hubungi kami <a href="' . URL::to('kontak') . '" target="_blank">disini</a></i></small> <a type="button" class="btn btn-link close" data-dismiss="modal" aria-hidden="true">[tutup]</a>
                </p>

                ';
                $html = '<div id="result_ekspedisi">' . $html . '<hr></div>';
                return \Response::json(['not_found' => true, 'html' => $html]);
            } else {
                $html = '<p>Ekspedisi list dari <strong>' . $this->setting->kotaAsal . '</strong> ke tujuan: <strong>' . $id . '</strong> (' . ceil($berat / 1000) . ' Kg)</p>' . $html;
                $html = '<div id="result_ekspedisi">' . $html . '<hr></div>';
                return \Response::json(['not_found' => false, 'html' => $html]);
            }
        }
    }
Beispiel #4
0
 public function activate($id)
 {
     $produk = Produk::find($id);
     $produk->activated = 1;
     return $produk->save();
 }
<?php

include "src/Koneksi.php";
include "src/produk.php";
$produk = new Produk($dbh);
$hasil = $produk->getProduk();
if (isset($_GET['delete'])) {
    $produk_hapus = new Produk($dbh);
    $produk_hapus->deleteProduk($_GET['delete']);
    echo "\n        <script>\n            window.location = 'admin-produk.php';\n        </script>\n    ";
}
?>


<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="icon" type="image/png" href="asset/img/250.png">
        <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
        <title>Pangeran Shoop | Admin Produk</title>

        <link href="asset/css/bootstrap.min.css" rel="stylesheet">
        <link href="asset/css/style.css" rel="stylesheet">

        <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<?php

include "src/Koneksi.php";
include "src/produk.php";
$error = "";
$produk = new Produk($dbh);
if (isset($_POST['submit'])) {
    if (empty($_POST['nama'])) {
        $error .= "<br>nama produk belum diisi</br>";
    }
    if (empty($_POST['deskripsi'])) {
        $error .= "<br>deskripsi produk harus diisi</br>";
    }
    if (empty($_POST['qty'])) {
        $error .= "<br>qty belum diisi</br>";
    }
    if (empty($_POST['harga'])) {
        $error .= "<br>harga belum diisi</br>";
    }
    if (empty($_POST['stok'])) {
        $error .= "<br>stok belum diisi</br>";
    }
    if (empty($error)) {
        $produk->insertDataProduk($_POST['nama'], $_POST['deskripsi'], $_POST['qty'], $_POST['harga'], $_POST['gambar'], $_POST['stok']);
        echo "\n        <script>\n            window.location = 'admin-produk.php';\n        </script>\n    ";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
            <?php 
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'verticalForm', 'htmlOptions' => array('class' => 'well')));
?>
<table WIDTH="100%" >
    <TR>
        <TD width="45%" valign="center">

            <p class="help-block">Fields with <span class="required">*</span> are required.</p>

            <?php 
echo $form->errorSummary($model);
?>
            <?php 
$nama = CHtml::listData(Produk::model()->findAll(), 'barcode_id', 'barcode_id');
?>
            
            Barcode ID
            <?php 
$this->widget('ext.select2.ESelect2', array('model' => $model, 'attribute' => 'barcode_id', 'data' => $nama, 'htmlOptions' => array('style' => 'width:340px', 'prompt' => '-- Masukkan Barcode Produk --', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('Issue/CekNamaProduk'), 'class' => 'span5', 'update' => '#kode', 'beforeSend' => 'function() {$("#Beli_jumlah").find("option").remove();}'))));
?>
            Serial Number
            <?php 
$this->widget('ext.select2.ESelect2', array('model' => $model, 'attribute' => 'serial_number', 'htmlOptions' => array('style' => 'width:340px', 'prompt' => '-- Masukkan Serial Number --')));
?>

        </TD>
        <TD width="" bgcolor="#eee" >
            
        </TD>
        <TD  width="65%">
            <div id="kode" class="alert alert-info"></div>
Beispiel #8
0
<?php

include "src/Koneksi.php";
include "src/produk.php";
$produk = new Produk($dbh);
$hasil = $produk->getProduk();
include "homepage1.html";
Beispiel #9
0
<?php

session_start();
$host = 'localhost';
$user = '******';
$pass = '';
$dbnm = 'sicoranch';
include "produk.php";
include "page_koperasi.php";
$db = new Produk($host, $user, $pass, $dbnm);
$nama_produk = $_POST['nama_produk'];
$harga_produk = $_POST['harga_produk'];
$kategori_produk = $_POST['kategori_produk'];
$status_produk = $_POST['status_produk'];
$deskripsi_produk = $_POST['deskripsi_produk'];
$produk = null;
$id_koperasi = $_SESSION['id_koperasi'];
$set = true;
if (isset($_POST['simpan'])) {
    if (($_FILES["produk"]["type"] == "image/jpeg" || $_FILES["produk"]["type"] == "image/png" || $_FILES["produk"]["type"] == "image/jpg") && $_FILES["produk"]["size"] < 20000000) {
        if ($_FILES["produk"]["error"] > 0) {
            echo '<div class="alert alert-danger">Error<button class="close" data-dismiss="alert">&times;</button></div>';
            $set = false;
        } else {
            if (file_exists("produk/" . $_FILES["produk"]["name"])) {
                echo '<div class="alert alert-warning">File sudah ada<button class="close" data-dismiss="alert">&times;</button></div>';
                move_uploaded_file($_FILES["produk"]["tmp_name"], "produk2/" . $_FILES["produk"]["name"]);
                $produk = "produk/" . $_FILES["produk"]["name"];
            } else {
                move_uploaded_file($_FILES["produk"]["tmp_name"], "produk/" . $_FILES["produk"]["name"]);
                $produk = "produk/" . $_FILES["produk"]["name"];