Ejemplo n.º 1
0
 public static function getInputQ($product_id, $cut_id)
 {
     $q = 0;
     return Model::many($query[0], new OperationData());
     $operations = self::getInputByProductId($product_id);
     $input_id = OperationTypeData::getByName("entrada")->id;
     $output_id = OperationTypeData::getByName("salida")->id;
     foreach ($operations as $operation) {
         if ($operation->operation_type_id == $input_id) {
             $q += $operation->q;
         } else {
             if ($operation->operation_type_id == $output_id) {
                 $q += -$operation->q;
             }
         }
     }
     // print_r($data);
     return $q;
 }
Ejemplo n.º 2
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>";
}
Ejemplo n.º 3
0
<?php

print_r($_POST);
if (count($_POST) > 0) {
    echo $cut->id;
    echo ":D";
    $op = new OperationData();
    $op->product_id = $_POST["product_id"];
    $op->operation_type_id = OperationTypeData::getByName("entrada")->id;
    if (OperationTypeData::getByName("entrada")->name == "entrada") {
        $op->sell_id = "NULL";
    }
    $op->q = $_POST["q"];
    $op->cut_id = $cut->id;
    if ($_POST["is_oficial"] == "1") {
        $op->is_oficial = 1;
    } else {
        $op->is_oficial = 0;
    }
    $add = $op->add();
    if ($op->is_oficial == 1) {
        print "<script>window.location='index.php?view=history&product_id={$_POST['product_id']}';</script>";
    } else {
        print "<script>window.location='index.php?view=historyn&product_id={$_POST['product_id']}';</script>";
    }
}
Ejemplo n.º 4
0
	window.location="index.php?view=sell";
</script>
<?php 
        }
        //////////////////////////////////
        if ($process == true) {
            $sell = new SellData();
            $sell->q = $_POST["q"];
            $sell->mesero_id = $_POST["mesero_id"];
            $sell->item_id = $_POST["mesa"];
            $s = $sell->add();
            foreach ($cart as $c) {
                print_r($c);
                print "<br>";
                $op = new OperationData();
                $op->product_id = $c["product_id"];
                $op->operation_type_id = OperationTypeData::getByName("salida")->id;
                $op->sell_id = $s[1];
                $op->q = $c["q"];
                if (isset($_POST["is_oficial"])) {
                    $op->is_oficial = 1;
                }
                $add = $op->add();
                unset($_SESSION["cart"]);
                setcookie("selled", "selled");
            }
            ////////////////////
            print "<script>window.location='index.php?view=onesell&id={$s['1']}';</script>";
        }
    }
}
Ejemplo n.º 5
0
 public static function getInputQYesF($ingredient_id)
 {
     $q = 0;
     $operations = self::getInputByProductId($ingredient_id);
     $input_id = OperationTypeData::getByName("entrada")->id;
     $output_id = OperationTypeData::getByName("salida")->id;
     foreach ($operations as $operation) {
         if ($operation->operation_type_id == $input_id) {
             $q += $operation->q;
         } else {
             if ($operation->operation_type_id == $output_id) {
                 $q += -$operation->q;
             }
         }
     }
     // print_r($data);
     return $q;
 }