Esempio n. 1
0
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));
$u = ProductosController::BuscarUnidadUdm();
$tUnidades = new TableComponent(array("id_categoria_unidad_medida" => "Categoria", "abreviacion" => "Nombre", "factor_conversion" => "Factor de conversion", "activa" => "Activa"), $u["resultados"]);
function nombreRender($v, $obj)
{
    return $obj["descripcion"] . " (" . $v . ")";
}
function uCatRender($v, $obj)
{
    $c = CategoriaUnidadMedidaDAO::getByPK($v);
    return $c->getDescripcion();
}
function uFactorConversion($fConversion, $obj)
{
    //if($fConversion == 1) return "-";
    //de lo contrario, buscar a que categoria pertenece
    //y poner $fConversion . unidad_referencia
Esempio n. 2
0
 protected function GenerateResponse()
 {
     try {
         $this->response = ProductosController::BuscarUnidadUdm(isset($_GET['query']) ? $_GET['query'] : null);
     } catch (Exception $e) {
         //Logger::error($e);
         throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage()));
     }
 }
Esempio n. 3
0
 public function testBuscarConQuery()
 {
     $resultado = ProductosController::BuscarUnidadUdm('m');
     $this->assertGreaterThan(0, count($resultado["resultados"]));
     $this->assertInternalType("array", $resultado['resultados']);
 }