Files
ventas_php/modules/devoluciones-ticket.php

78 lines
1.9 KiB
PHP
Executable File

<?php
$empresa->AuthUser();
if(!$usuario->AllowPage($page, $_SESSION['loginKey'])){
header('Location: '.WEB_ROOT);
exit;
}
$mode = 'cobro';
if(isset($_GET['devolucionId'])){
$devolucionId = intval($_GET['devolucionId']);
$mode = 'detalles';
}else{
$devolucionId = intval($_GET['id']);
}
$rfc->setRfcId(1);
$infE = $util->EncodeRow($rfc->Info());
$devolucion->setDevolucionId($devolucionId);
$info = $devolucion->Info();
$info['hora'] = date('H:i:s',strtotime($info['fecha']));
$info['fecha'] = date('d-m-Y',strtotime($info['fecha']));
$usuario->setUsuarioId($info['usuarioId']);
$info['usuario'] = strtoupper($usuario->GetFullNameById());
//$_SESSION['idSuc'];
$sucursal->setSucursalId($info['sucursalId']);
$infS = $sucursal->Info();
$infS['nombre'] = strtoupper($infS['nombre']);
$infS = $util->DecodeUrlRow($infS);
$infS = $util->DecodeRow($infS);
//Obtenemos los Productos
$devolucion->setDevolucionId($devolucionId);
$resProds = $devolucion->GetProductos();
$saldoFavor = 0;
$productos = array();
foreach($resProds as $res){
$producto->setProdItemId($res['prodItemId']);
$infI = $producto->GetInfoItemById();
$producto->setProductoId($infI['productoId']);
$infP = $producto->Info();
$atribVal->setAtribValId($infI['tallaId']);
$talla = $atribVal->GetNameById();
$atribVal->setAtribValId($infI['colorId']);
$color = $atribVal->GetNameById();
$res['nombre'] = $infP['modelo'].' '.$talla.' '.$color;
$res['codigoBarra'] = $infI['codigoBarra'];
$saldoFavor += $res['total'];
$productos[] = $res;
}
$info['total'] = $saldoFavor;
$smarty->assign('infE', $infE);
$smarty->assign('infS', $infS);
$smarty->assign('info', $info);
$smarty->assign('mode', $mode);
$smarty->assign('productos', $productos);
$smarty->display(DOC_ROOT."/templates/devoluciones-ticket.tpl");
exit;
?>