Beispiel #1
0
<?php

$sell = Selldata::getById($_GET["id"]);
$sell->cajero_id = Session::getUID();
$sell2 = new Sell2Data();
$sell2->user_id = $_SESSION["user_id"];
$s = $sell2->add_re_out();
$products = OperationData::getAllProductsBySellId($sell->id);
foreach ($products as $prod) {
    $product = ProductData::getById($prod->product_id);
    if ($product->use_ingredient) {
        $ingredients = ProductIngredientData::getAllByProductId($prod->product_id);
        foreach ($ingredients as $ing) {
            $ingredient = IngredientData::getById($ing->ingredient_id);
            $q = Operation2Data::getQYesF($ing->ingredient_id);
            if ($q > 0) {
                $op = new Operation2Data();
                $op->ingredient_id = $ingredient->id;
                $op->operation_type_id = 2;
                // 2 - salida
                $op->sell_id = $s[1];
                $op->q = $prod->q * $ing->q;
                $add = $op->add();
            }
        }
    }
    # code...
}
// inventariemos
//print_r(expression)
$sell->apply();
Beispiel #2
0
<div class="btn-group pull-right">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
    <i class="fa fa-download"></i> Descargar <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="report/onere-word.php?id=<?php 
echo $_GET["id"];
?>
">Word 2007 (.docx)</a></li>
  </ul>
</div>
<h1>Resumen de Reabastecimiento</h1>
<?php 
if (isset($_GET["id"]) && $_GET["id"] != "") {
    $sell = Sell2Data::getById($_GET["id"]);
    $operations = Operation2Data::getAllProductsBySellId($_GET["id"]);
    $total = 0;
    if (isset($_COOKIE["selled"])) {
        foreach ($operations as $operation) {
            //		print_r($operation);
            $qx = Operation2Data::getQYesF($operation->product_id);
            // print "qx=$qx";
            $p = $operation->getProduct();
            if ($qx == 0) {
                echo "<p class='alert alert-danger'>El producto <b style='text-transform:uppercase;'> {$p->name}</b> no tiene existencias en inventario.</p>";
            } else {
                if ($qx <= $p->inventary_min / 2) {
                    echo "<p class='alert alert-danger'>El producto <b style='text-transform:uppercase;'> {$p->name}</b> tiene muy pocas existencias en inventario.</p>";
                } else {
                    if ($qx <= $p->inventary_min) {
Beispiel #3
0
<?php

if (isset($_SESSION["reabastecer"])) {
    $cart = $_SESSION["reabastecer"];
    if (count($cart) > 0) {
        $process = true;
        //////////////////////////////////
        if ($process == true) {
            $sell = new Sell2Data();
            $sell->user_id = $_SESSION["user_id"];
            if (isset($_POST["client_id"]) && $_POST["client_id"] != "") {
                $sell->person_id = $_POST["client_id"];
                $s = $sell->add_re_with_client();
            } else {
                $s = $sell->add_re();
            }
            foreach ($cart as $c) {
                $op = new Operation2Data();
                $op->ingredient_id = $c["product_id"];
                $op->operation_type_id = 1;
                // 1 - entrada
                $op->sell_id = $s[1];
                $op->q = $c["q"];
                if (isset($_POST["is_oficial"])) {
                    $op->is_oficial = 1;
                }
                $add = $op->add();
            }
            unset($_SESSION["reabastecer"]);
            setcookie("selled", "selled");
            ////////////////////