<?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); }
<?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">×</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) { ?>
<?php $page = 1; if (isset($_GET["page"])) { $page = $_GET["page"]; } $limit = 10; if (isset($_GET["limit"]) && $_GET["limit"] != "" && $_GET["limit"] != $limit) { $limit = $_GET["limit"]; } $products = IngredientData::getAll(); if (count($products) > 0) { if ($page == 1) { $curr_products = IngredientData::getAllByPage($products[0]->id, $limit); } else { $curr_products = IngredientData::getAllByPage($products[($page - 1) * $limit]->id, $limit); } $npaginas = floor(count($products) / $limit); $spaginas = count($products) % $limit; if ($spaginas > 0) { $npaginas++; } ?> <h3>Pagina <?php echo $page . " de " . $npaginas; ?> </h3> <div class="btn-group pull-right"> <?php $px = $page - 1;
<?php if (count($_POST) > 0) { $product = new IngredientData(); $product->code = $_POST["code"]; $product->name = $_POST["name"]; $product->price_out = $_POST["price_out"]; $product->unit = $_POST["unit"]; $product->user_id = Session::getUID(); $product->add(); print "<script>window.location='index.php?view=ingredients';</script>"; }
<?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();
<section class="content-header"> <a href="index.php?view=newingredient" class="btn pull-right btn-default"><i class="glyphicon glyphicon-plus-sign"></i> Agregar Ingrediente</a> <h1>Ingredientes</h1> </section> <section class="content"> <div class="row"> <div class="col-md-12"> <div class="clearfix"></div> <?php $products = IngredientData::getAllActive(); if (count($products) > 0) { ?> <div class="clearfix"></div> <div class="box box-solid box-primary"> <div class="box-header"> <h3 class="box-title"></h3> </div> <div class="box-body table-responsive"> <table class="table table-bordered table-hover datatable"> <thead> <th>Codigo</th> <th>Nombre</th> <th>Precio</th> <th></th> </thead> <?php