102 lines
2.7 KiB
PHP
Executable File
102 lines
2.7 KiB
PHP
Executable File
<?php
|
|
|
|
$empresa->AuthUser();
|
|
|
|
if(!$usuario->AllowPage($page, $_SESSION['loginKey'])){
|
|
header('Location: '.WEB_ROOT);
|
|
exit;
|
|
}
|
|
|
|
$sucursalId = $_SESSION['idSuc'];
|
|
|
|
$inventario->SetPage($_GET["p"]);
|
|
// $result = $inventario->EnumerateAll();
|
|
|
|
if($sucursalId)
|
|
{
|
|
$add = " AND inventario.sucursalId = '".$sucursalId."'";
|
|
}
|
|
|
|
$sql = "SELECT
|
|
SUM(inventario.cantidad) AS cantidad, inventario.productoId, proveedorId, producto.codigoBarra, producto.modelo, producto.precioVenta, inventario.sucursalId
|
|
FROM
|
|
inventario
|
|
JOIN producto ON producto.productoId = inventario.productoId
|
|
WHERE
|
|
1
|
|
".$add."
|
|
AND
|
|
status = 'Bloqueado'
|
|
GROUP BY productoId ORDER BY inventario.sucursalId";
|
|
$util->DBSelect($_SESSION["empresaId"])->setQuery($sql);
|
|
$result = $util->DBSelect($_SESSION["empresaId"])->GetResult();
|
|
|
|
$items = array();
|
|
foreach($result as $key => $res){
|
|
|
|
$granTotal += $res["cantidad"];
|
|
$proveedor->setProveedorId($res['proveedorId']);
|
|
$res['proveedor'] = $proveedor->GetNameById();
|
|
|
|
$producto->setProductoId($res['productoId']);
|
|
$resTallas = $producto->GetTallas();
|
|
|
|
$tallas = array();
|
|
foreach($resTallas as $val){
|
|
$atribVal->setAtribValId($val['tallaId']);
|
|
$tallas[] = $atribVal->GetNameById();
|
|
}
|
|
|
|
$res['talla'] = implode(', ',$tallas);
|
|
|
|
$producto->setProductoId($res['productoId']);
|
|
$resColores = $producto->GetColores();
|
|
|
|
$colores = array();
|
|
foreach($resColores as $val){
|
|
$atribVal->setAtribValId($val['colorId']);
|
|
$colores[] = $atribVal->GetNameById();
|
|
}
|
|
|
|
$res['color'] = implode(', ',$colores);
|
|
|
|
$producto->setProductoId($res['productoId']);
|
|
$resAtributos = $producto->GetAtributos();
|
|
|
|
$atributos = array();
|
|
foreach($resAtributos as $val){
|
|
$atribVal->setAtribValId($val['atribValId']);
|
|
$atributos[] = $atribVal->GetNameById();
|
|
}
|
|
|
|
$res['atributos'] = implode(', ',$atributos);
|
|
$sucursal->setSucursalId($res["sucursalId"]);
|
|
$res["sucursal"] = utf8_decode(urldecode($sucursal->GetNameById()));
|
|
|
|
//Obtenemos los Codigos de Barra
|
|
/*
|
|
$inventario->setProductoId($res['productoId']);
|
|
$inventario->setSucursalId($sucursalId);
|
|
$res['cantidad'] = $inventario->GetTotalItemsBloqBySuc();
|
|
*/
|
|
if($res['cantidad'])
|
|
$items[] = $res;
|
|
}
|
|
$productos['items'] = $items;
|
|
|
|
|
|
$msg = $_SESSION['msgI'];
|
|
$_SESSION['msgI'] = '';
|
|
|
|
$proveedores = $proveedor->EnumerateAll();
|
|
$categorias = $prodCat->EnumerateAll();
|
|
|
|
$smarty->assign('msg', $msg);
|
|
$smarty->assign('tipo', 'Bloqueados');
|
|
$smarty->assign('nomSuc', $nomSuc);
|
|
$smarty->assign('granTotal', $granTotal);
|
|
$smarty->assign('productos', $productos);
|
|
$smarty->assign('proveedores', $proveedores);
|
|
$smarty->assign('categorias', $categorias);
|
|
|
|
?>
|