Пример #1
0
<?php

$ingredients = IngredientData::getAll();
$operations = ProductIngredientData::getAllByProductId($_GET["id"]);
?>
<div class="content">
<h1>Ingredientes</h1>
<?php 
if (isset($_GET["id"]) && $_GET["id"] != "") {
    ?>

<a data-toggle="modal" href="#myModal" class="btn btn-default"><i class="glyphicon glyphicon-plus-sign"></i> Agregar Ingrediente</a>

  <!-- Modal -->
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title">Agregar Ingrediente</h4>
        </div>
        <div class="modal-body">
         <form class="form-horizontal" method="post" action="index.php?view=addproductingredient" role="form">
  <div class="form-group">
    <label for="inputEmail1" class="col-lg-2 control-label">Ingrediente</label>
    <div class="col-lg-10">
<select name="ingredient_id" class="form-control" required>
		<option value="">-- INGREDIENTES -- </option>
	<?php 
    foreach ($ingredients as $product) {
        ?>
Пример #2
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();
Пример #3
0
<?php

// print_r($_POST);
$operation = ProductIngredientData::getById($_POST["operation_id"]);
$operation->q = $_POST["q"];
$operation->is_required = isset($_POST["is_required"]) ? 1 : 0;
$operation->update();
header("Location: index.php?view=productingredients&id=" . $operation->product_id);
Пример #4
0
<?php

// print_r($_POST);
$operation = new ProductIngredientData();
$operation->product_id = $_POST["product_id"];
$operation->is_required = 1;
$operation->ingredient_id = $_POST["ingredient_id"];
$operation->q = $_POST["q"];
$operation->is_required = isset($_POST["is_required"]) ? 1 : 0;
$operation->add();
header("Location: index.php?view=productingredients&id={$_POST['product_id']}");
// header("Location: index.php?view=categories");