예제 #1
0
    if ($_POST["inventary_min"] != "") {
        $inventary_min = $_POST["inventary_min"];
    }
    $product->category_id = $category_id;
    $product->inventary_min = $inventary_min;
    $product->user_id = Session::getUID();
    if (isset($_FILES["image"])) {
        $image = new Upload($_FILES["image"]);
        if ($image->uploaded) {
            $image->Process("storage/products/");
            if ($image->processed) {
                $product->image = $image->file_dst_name;
                $product->add_with_image();
            }
        } else {
            $product = $product->add();
        }
    } else {
        $product = $product->add();
    }
    if ($_POST["q"] != "" || $_POST["q"] != "0") {
        $op = new OperationData();
        $op->product_id = $product[1];
        $op->operation_type_id = OperationTypeData::getByName("entrada")->id;
        $op->q = $_POST["q"];
        $op->sell_id = "NULL";
        $op->is_oficial = 1;
        $op->add();
    }
    print "<script>window.location='index.php?view=products';</script>";
}
예제 #2
0
if ($go && isset($_SESSION["cart"])) {
    $cart = $_SESSION["cart"];
    if (count($cart) > 0) {
        /*			$sell = new SellData();
        			$sell->user_id = $_SESSION["user_id"];
        			$sell->total = $_POST["total"];
        			$sell->discount = $_POST["discount"];
        			$s = $sell->add();
        */
        foreach ($cart as $c) {
            $op = new OperationData();
            $op->item_id = $c["item_id"];
            $op->client_id = $_POST["client_id"];
            $op->start_at = $_POST["start_at"];
            $op->finish_at = $_POST["finish_at"];
            $op->user_id = $_SESSION["user_id"];
            $add = $op->add();
            $item = ItemData::getById($c["item_id"]);
            $item->unavaiable();
            unset($_SESSION["cart"]);
            setcookie("selled", "selled");
        }
        ////////////////////
    }
}
if ($go) {
    print "<script>window.location='index.php?view=rents';</script>";
} else {
    print "<script>alert('Rango de fecha invalido!');</script>";
    print "<script>window.location='index.php?view=rent';</script>";
}
예제 #3
0
<?php

// print_r($_POST);
$operation = new OperationData();
$operation->product_id = $_POST["product_id"];
$operation->operation_type_id = 1;
$operation->is_oficial = 1;
$operation->q = $_POST["q"];
$operation->sell_id = $_POST["sell_id"];
$operation->add();
header("Location: index.php?view=onesell&id={$_POST['sell_id']}");
// header("Location: index.php?view=categories");