Example #1
0
<?php

define("BYPASS_INSTANCE_CHECK", false);
require_once "../../../server/bootstrap.php";
$page = new GerenciaTabPage();
$page->addComponent(new TitleComponent("Productos"));
$page->nextTab("Lista");
$cols = array("codigo_producto" => "Codigo producto", "nombre_producto" => "Nombre Producto", "id_unidad" => "Existencias", "precio" => "Precio", "activo" => "Activo");
$tabla = new TableComponent($cols, ProductosController::Lista());
function precio($precio, $obj)
{
    if ($obj["metodo_costeo"] === "costo") {
        return FormatMoney($obj["costo_estandar"]);
    }
    return FormatMoney($precio);
}
function calcExistencias($id_unidad, $row)
{
    $unidadM = UnidadMedidaDAO::getByPK($id_unidad);
    if (is_null($unidadM)) {
        return ProductoDAO::ExistenciasTotales($row["id_producto"]);
    }
    return ProductoDAO::ExistenciasTotales($row["id_producto"]) . " " . $unidadM->getAbreviacion();
}
$tabla->addColRender("activo", "funcion_activo");
$tabla->addColRender("precio", "precio");
$tabla->addColRender("id_unidad", "calcExistencias");
$tabla->addOnClick("id_producto", "(function(a){ window.location = 'productos.ver.php?pid=' + a; })");
$page->addComponent($tabla);
$page->nextTab("Unidades");
$page->addComponent(new TitleComponent("Lista de unidades existentes", 2));
Example #2
0
<?php

define("BYPASS_INSTANCE_CHECK", false);
require_once "../../../server/bootstrap.php";
$page = new GerenciaComponentPage();
$page->addComponent(new TitleComponent("Productos"));
$page->addComponent(new MessageComponent("Lista de productos en sus empresas"));
$tabla = new TableComponent(array("codigo_producto" => "codigo_producto", "nombre_producto" => "nombre_producto", "descripcion" => "descripcion", "activo" => "activo"), ProductosController::Lista());
$tabla->addColRender("activo", "funcion_activo");
$tabla->addOnClick("id_producto", "(function(a){ window.location = 'productos.ver.php?pid=' + a; })");
$page->addComponent($tabla);
$page->render();
Example #3
0
// sacar las propiedades indicadas
$campos = ConfiguracionDAO::Propiedades();
$columns = array();
foreach ($campos as $key => $value) {
    if ($value == "foto_del_producto") {
        unset($campos[$key]);
    } else {
        $columns[$value] = ucwords(str_replace('_', ' ', $value));
    }
}
// sacar los productos correspondientes
function filter($product)
{
    return $product->getVisibleEnVc();
}
$products = array_filter(ProductosController::Lista(), "filter");
// dar formato a los campos como corresponda
foreach ($products as $product) {
    $product->setPrecio(FormatMoney($product->getPrecio()));
    $product->setCostoEstandar(FormatMoney($product->getCostoEstandar()));
    $product->setCostoExtraAlmacen(FormatMoney($product->getCostoExtraAlmacen()));
    if ($product->getCompraEnMostrador()) {
        $product->setCompraEnMostrador("S&iacute;");
    } else {
        $product->setCompraEnMostrador("No");
    }
    $unidad = UnidadMedidaDAO::getByPK($product->getIdUnidadCompra());
    if (!is_null($unidad)) {
        $product->setIdUnidadCompra($unidad->getDescripcion());
    }
    $unidad = UnidadMedidaDAO::getByPK($product->getIdUnidad());