Example #1
0
<?php

if (isset($_GET["product_id"])) {
    $product = IngredientData::getById($_GET["product_id"]);
    $operations = Operation2Data::getAllByProductId($product->id);
    ?>
<div class="row">
	<div class="col-md-12">
	<!--
<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/history-word.php?id=<?php 
    echo $product->id;
    ?>
">Word 2007 (.docx)</a></li>
  </ul>
</div>
-->
<h1><?php 
    echo $product->name;
    ?>
 <small>Historial</small></h1>
	</div>
	</div>

<div class="row">

 public function getIngredient()
 {
     return IngredientData::getById($this->ingredient_id);
 }
Example #3
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();