public function getTotal() { $products = BuyProductData::getAllByBuyId($this->id); $total = 0; foreach ($products as $px) { $p = ProductData::getById($px->product_id); $total += $p->price * $px->q; } return $total; }
<?php $product = ProductData::getById($_GET['product_id']); ?> <?php if ($product != null) { ?> <div class="row"> <div class="col-md-8"> <div style="font-size:34px;">Alta en inventario</div> <h2>Producto: <?php echo $product->name; ?> </h2> <br><form class="form-horizontal" method="post" action="index.php?view=processinput" role="form"> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Unidad</label> <div class="col-lg-10"> <input type="text" value="<?php echo $product->unit; ?> " readonly="readonly" class="form-control" id="inputEmail1" placeholder="Cantidad de productos"> </div> </div> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Cantidad</label> <div class="col-lg-10"> <input type="float" required name="q" class="form-control" id="inputEmail1" placeholder="Cantidad de productos"> </div>
<?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 = ProductData::getAll(); if (count($products) > 0) { if ($page == 1) { $curr_products = ProductData::getAllByPage($products[0]->id, $limit); } else { $curr_products = ProductData::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;
<td>Mesero: <?php echo $mesero->name . " " . $mesero->lastname; ?> </td> <td></td> </tr> <tr> <th>Producto</th> <th>Cant.</th> <th>Tiempo (mins)</th> </tr> <?php $np = 0; $nd = 0; foreach ($operations as $operation) { $product = ProductData::getById($operation->product_id); ?> <tr> <td><?php echo $product->name; ?> </td> <td><?php echo $operation->q; ?> </td> <td><?php echo $product->duration * $operation->q; ?> </td> </tr>
<?php // print_r($_POST); $product = new ProductData(); foreach ($_POST as $k => $v) { $product->{$k} = $v; # code... } $alphabeth = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ1234567890_-"; $code = ""; for ($i = 0; $i < 11; $i++) { $code .= $alphabeth[rand(0, strlen($alphabeth) - 1)]; } $product->short_name = $code; $handle = new Upload($_FILES['image']); if ($handle->uploaded) { $url = "storage/products/"; $handle->Process($url); $product->image = $handle->file_dst_name; } if (isset($_POST["is_public"])) { $product->is_public = 1; } else { $product->is_public = 0; } if (isset($_POST["in_existence"])) { $product->in_existence = 1; } else { $product->in_existence = 0; } if (isset($_POST["is_featured"])) {
<?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();
<?php $products = ProductData::getAll(); ?> <section class="content"> <div class="row"> <div class="col-md-12"> <h1>Reportes</h1> <form> <input type="hidden" name="view" value="reports"> <div class="row"> <div class="col-md-3"> <select name="product_id" class="form-control"> <option value="">-- TODOS --</option> <?php foreach ($products as $p) { ?> <option value="<?php echo $p->id; ?> "><?php echo $p->name; ?> </option> <?php } ?> </select>
<h2>Confirmacion de compra</h2> <h4>Metodo de pago: <b><?php echo $pm->name; ?> </b></h4> <table class="table table-bordered"> <thead> <th>Codigo</th> <th>Producto</th> <th>Cantidad</th> <th>Precio Unitario</th> <th>Total</th> </thead> <?php foreach ($_SESSION["cart"] as $s) { $p = ProductData::getById($s["product_id"]); ?> <tr> <td><?php echo $p->code; ?> </td> <td><?php echo $p->name; ?> </td> <td style="width:100px;"> <?php echo $s["q"]; ?> </td>
break; } } ?> <div class="row"> <div class="col-md-12"> <h1>Bienvenido a Inventio Lite</h1> </div> </div> <div class="row"> <div class="col-lg-3 col-xs-6"> <!-- small box --> <div class="small-box bg-aqua"> <div class="inner"> <h3><?php echo count(ProductData::getAll()); ?> </h3> <p>Productos</p> </div> <div class="icon"> <i class="ion ion-bag"></i> </div> <a href="./?view=products" class="small-box-footer">Ver mas <i class="fa fa-arrow-circle-right"></i></a> </div> </div> <!-- ./col --> <div class="col-lg-3 col-xs-6"> <!-- small box --> <div class="small-box bg-purple">
if (isset($_GET["cat"])) { $cat = CategoryData::getByPreffix($_GET["cat"]); $products = ProductData::getPublicsByCategoryId($cat->id); } else { if (isset($_GET["opt"])) { if ($_GET["opt"] == "news") { $products = ProductData::getNews(); } else { if ($_GET["opt"] == "offers") { $products = ProductData::getOffers(); } } } else { if (isset($_GET["act"]) && $_GET["act"] == "search") { $products = ProductData::getLike($_GET["q"]); } } } ?> <section> <div class="container"> <div class="row"> <div class="col-md-12"> <div style="background:#333;font-size:25px;color:white;padding:5px;"><?php if (isset($_GET["act"]) && $_GET["act"] != "") { echo "Busqueda: " . $_GET["q"]; } else { echo $cat->name;
<b> </b> </div> <div class="list-group"> <a href='index.php?view=products' class='list-group-item'><span class='pull-right'><i class='glyphicon glyphicon-chevron-right'></i></span><i class='glyphicon glyphicon-glass'></i> Productos</a> </div> </div> </div> <div class="col-md-9"> <div class="clearfix"></div> <?php $products = ProductData::getAllUnActive(); 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 class="box-tools pull-right"> <button class="btn btn-primary btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button> <button class="btn btn-primary btn-sm" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body table-responsive"> <table class="table table-bordered table-hover datatable"> <thead>
<label for="inputPassword1" class="col-lg-2 control-label">Descripcion</label> <div class="col-lg-10"> <textarea class="form-control" id="inputPassword1" placeholder="Descripcion" rows="3" name="description"></textarea> </div> </div> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Valor</label> <div class="col-lg-10"> <input type="text" class="form-control" name="val" placeholder="Valor del cupon"> </div> </div> <div class="form-group"> <label for="inputEmail1" class="col-lg-2 control-label">Producto</label> <div class="col-lg-10"> <?php $categories = ProductData::getAll(); if (count($categories) > 0) { ?> <select name="product_id" class="form-control"> <option value="">-- CUALQUIERA --</option> <?php foreach ($categories as $cat) { ?> <option value="<?php echo $cat->id; ?> "><?php echo $cat->name; ?> </option>
<?php if (count($_POST) > 0) { $product = new ProductData(); $product->barcode = $_POST["barcode"]; $product->name = $_POST["name"]; $product->price_in = $_POST["price_in"]; $product->price_out = $_POST["price_out"]; $product->unit = $_POST["unit"]; $product->description = $_POST["description"]; $product->presentation = $_POST["presentation"]; //$product->inventary_min = $_POST["inventary_min"]; $category_id = "NULL"; if ($_POST["category_id"] != "") { $category_id = $_POST["category_id"]; } $inventary_min = "\"\""; if ($_POST["inventary_min"] != "") { $inventary_min = $_POST["inventary_min"]; } $product->category_id = $category_id; $product->inventary_min = $inventary_min; $product->user_id = $_SESSION["user_id"]; 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; $prod = $product->add_with_image(); }
<?php // print_r($_POST); $product = new ProductData(); foreach ($_POST as $k => $v) { $product->{$k} = $v; # code... } ////////////////////////////////////// / / / / / / / / / / / / / / / / / / / / / / / / / $handle = new Upload($_FILES['image']); if ($handle->uploaded) { $url = "storage/products/"; $handle->Process($url); $product->image = $handle->file_dst_name; $product->update_image(); } ////////////////////////////////////// / / / / / / / / / / / / / / / / / / / / / / / / / if (isset($_POST["is_public"])) { $product->is_public = 1; } else { $product->is_public = 0; } if (isset($_POST["in_existence"])) { $product->in_existence = 1; } else { $product->in_existence = 0; } if (isset($_POST["is_featured"])) { $product->is_featured = 1; } else { $product->is_featured = 0;
<?php $cat = ProductData::getById($_GET["id"]); $cat->active(); Core::redir("index.php?view=products");
<?php if (count($_POST) > 0) { $product = new ProductData(); $product->name = $_POST["name"]; $product->price_in = $_POST["price_in"]; $product->price_out = $_POST["price_out"]; $product->unit = $_POST["unit"]; $product->description = $_POST["description"]; $product->presentation = $_POST["presentation"]; //$product->inventary_min = $_POST["inventary_min"]; $category_id = "NULL"; if ($_POST["category_id"] != "") { $category_id = $_POST["category_id"]; } $inventary_min = "\"\""; 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 {
public function getProduct() { return ProductData::getById($this->product_id); }
<?php $coin_symbol = ConfigurationData::getByPreffix("general_coin")->val; $img_default = ConfigurationData::getByPreffix("general_img_default")->val; $cnt = 0; $slides = SlideData::getPublics(); $featureds = ProductData::getFeatureds(); ?> <section> <div class="container"> <div class="row"> <div class="col-md-12"> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <?php if (count($slides) > 0) { ?> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <?php foreach ($slides as $s) { ?> <li data-target="#carousel-example-generic" data-slide-to="<?php echo $cnt; ?> " class="<?php if ($cnt == 0) { echo "active";
$total = 0; ?> <h2>Lista de venta</h2> <table class="table table-bordered table-hover"> <thead> <th style="width:30px;">Codigo</th> <th style="width:30px;">Cantidad</th> <th style="width:30px;">Unidad</th> <th>Producto</th> <th style="width:30px;">Precio Unitario</th> <th style="width:30px;">Precio Total</th> <th ></th> </thead> <?php foreach ($_SESSION["cart"] as $p) { $product = ProductData::getById($p["product_id"]); ?> <tr > <td><?php echo $product->id; ?> </td> <td ><?php echo $p["q"]; ?> </td> <td><?php echo $product->unit; ?> </td> <td><?php
public function getCategory() { return ProductData::getById($this->category_id); }
<?php if (isset($_GET["product_id"])) { $product = ProductData::getById($_GET["product_id"]); $operations = OperationData::getAllByProductIdCutIdUnOficial($product->id, $_GET["cutid"]); ?> <div class="row"> <div class="col-md-12"> <a href="index.php?view=cuthistory&product_id=<?php echo $_GET["product_id"]; ?> &cutid=<?php echo $_GET["cutid"]; ?> " class="btn btn-default pull-right btn-lg"><i class="glyphicon glyphicon-chevron-left"></i> Operaciones con Factura </a> <h1><i class="glyphicon glyphicon-time"></i> Historial</h1> <h2><?php echo $product->name; ?> <small>Operaciones sin factura</small></h2> </div> </div> <div class="row"> <div class="col-md-4"> <?php
<?php $category = Categorydata::getById($_GET["id"]); $products = ProductData::getAllByCategoryId($category->id); foreach ($products as $product) { $product->del_category(); } $category->del(); Core::redir("./index.php?view=categories");