Primer commit del sistema avantika sin cambios
This commit is contained in:
160
modules/pedidos-editar.php
Executable file
160
modules/pedidos-editar.php
Executable file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
$empresa->AuthUser();
|
||||
|
||||
if(!$usuario->AllowPage($page, $_SESSION['loginKey'])){
|
||||
header('Location: '.WEB_ROOT);
|
||||
exit;
|
||||
}
|
||||
|
||||
$pedidoId = intval($_GET['id']);
|
||||
|
||||
$_SESSION['prodsEdit'] = array();
|
||||
unset($_SESSION['prodsEdit']);
|
||||
|
||||
$_SESSION['prodsDel'] = array();
|
||||
unset($_SESSION['prodsDel']);
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
$proveedor->setProveedorId($info['proveedorId']);
|
||||
$infPv = $proveedor->Info();
|
||||
|
||||
$info['proveedor'] = $infPv['nombre'];
|
||||
$info['noProv'] = $infPv['noProv'];
|
||||
|
||||
$info['fechaEntrega'] = date('d-m-Y',strtotime($info['fechaEntrega']));
|
||||
$info['fechaEntregaF'] = date('d-m-Y',strtotime($info['fechaEntregaF']));
|
||||
$info['fecha'] = date('d-m-Y H:i:s',strtotime($info['fecha']));
|
||||
|
||||
if($info['status'] != 'OrdenCompIng'){
|
||||
|
||||
$resProducts = $pedido->GetProductos();
|
||||
|
||||
$products = array();
|
||||
$products2 = array();
|
||||
foreach($resProducts as $card){
|
||||
|
||||
$prodCatId = $card['prodCatId'];
|
||||
$prodSubcatId = $card['prodSubcatId'];
|
||||
$productoId = $card['productoId'];
|
||||
|
||||
$prodCat->setProdCatId($prodCatId);
|
||||
$card['departamento'] = $prodCat->GetNameById();
|
||||
|
||||
$prodSubcat->setProdSubcatId($prodSubcatId);
|
||||
$card['linea'] = $prodSubcat->GetNameById();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infP = $producto->Info();
|
||||
$card['modelo'] = $infP['modelo'];
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
$card['atributos'] = $producto->GetAtributosAll();
|
||||
|
||||
//PROPORCIONES
|
||||
|
||||
//Colores
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$resColores = $producto->GetColores();
|
||||
|
||||
$colores = array();
|
||||
foreach($resColores as $res){
|
||||
|
||||
$colorId = $res['colorId'];
|
||||
|
||||
$pedido->setColorId($colorId);
|
||||
$pedido->setProductoId($productoId);
|
||||
$cantidad = $pedido->GetProporcionByColor();
|
||||
|
||||
$proporcionC[$colorId] = $cantidad;
|
||||
|
||||
$res['cantidad'] = $cantidad;
|
||||
|
||||
$atribVal->setAtribValId($res['colorId']);
|
||||
$res['nombre'] = $atribVal->GetNameById();
|
||||
|
||||
$colores[$colorId] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
//Tallas
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$resTallas = $producto->GetTallas();
|
||||
|
||||
$tallas = array();
|
||||
foreach($resTallas as $res){
|
||||
|
||||
$tallaId = $res['tallaId'];
|
||||
|
||||
$pedido->setTallaId($tallaId);
|
||||
$pedido->setProductoId($productoId);
|
||||
$cantidad = $pedido->GetProporcionByTalla();
|
||||
|
||||
$proporcionT[$tallaId] = $cantidad;
|
||||
|
||||
$res['cantidad'] = $cantidad;
|
||||
|
||||
$atribVal->setAtribValId($tallaId);
|
||||
$res['nombre'] = $atribVal->GetNameById();
|
||||
|
||||
$tallas[$tallaId] = $res;
|
||||
|
||||
}//foreach
|
||||
|
||||
//Obtenemos Totales
|
||||
|
||||
$totales = array();
|
||||
$subtotales = array();
|
||||
foreach($tallas as $idT => $t){
|
||||
|
||||
$cantT = $t['cantidad'];
|
||||
|
||||
$total = 0;
|
||||
foreach($colores as $idC => $c){
|
||||
|
||||
$cantC = $c['cantidad'];
|
||||
|
||||
$subtotal = $cantC * $cantT;
|
||||
$total += $subtotal;
|
||||
|
||||
$subtotales[$idT][$idC] = $subtotal;
|
||||
}
|
||||
|
||||
$totales[$idT] = $total;
|
||||
|
||||
}//foreach
|
||||
|
||||
$card['tallas'] = $tallas;
|
||||
$card['colores'] = $colores;
|
||||
$card['totales'] = $totales;
|
||||
$card['subtotales'] = $subtotales;
|
||||
$card['proporcionT'] = $proporcionT;
|
||||
$card['proporcionC'] = $proporcionC;
|
||||
|
||||
//FIN PROPORCIONES
|
||||
|
||||
$card['departamento'] = utf8_encode($card['departamento']);
|
||||
$card['linea'] = utf8_encode($card['linea']);
|
||||
$card['tallas'] = $util->EncodeResult($tallas);
|
||||
$card['colores'] = $util->EncodeResult($colores);
|
||||
|
||||
$products[] = $card;
|
||||
|
||||
}//foreach
|
||||
|
||||
$_SESSION['prodsEdit'] = $products;
|
||||
|
||||
$proveedores = $proveedor->EnumerateAll();
|
||||
$categorias = $prodCat->EnumerateAll();
|
||||
|
||||
}//if
|
||||
|
||||
$smarty->assign('info', $info);
|
||||
$smarty->assign('products', $products);
|
||||
$smarty->assign('categorias', $categorias);
|
||||
$smarty->assign('proveedores', $proveedores);
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user