Files
ventas_php/modules/envios.php

58 lines
1.5 KiB
PHP
Executable File

<?php
$empresa->AuthUser();
if(!$usuario->AllowPage($page, $_SESSION['loginKey'])){
header('Location: '.WEB_ROOT);
exit;
}
$envio->setPage(intval($_GET['p']));
$envio->setTipo('CT');
if($Usr['type'] == 'gerente'){
$envio->setSucursalId($_SESSION['idSuc']);
$resEnvios = $envio->EnumBySuc();
$sucursal->setSucursalId($_SESSION['idSuc']);
$nomSuc = utf8_decode(urldecode($sucursal->GetNameById()));
}else{
$resEnvios = $envio->Enumerate();
}
$envios = array();
foreach($resEnvios['items'] as $res){
$sucursal->setSucursalId($res['sucursalId']);
$res['sucursal'] = utf8_decode(urldecode($sucursal->GetNameById()));
$envio->setEnvioId($res['envioId']);
$res['noCajas'] = $envio->GetTotalCajas();
$fecha = date('d-m-Y',strtotime($res['fecha']));
$hora = date('H:i:s',strtotime($res['fecha']));
$fecha = $util->FormatDateDMMMY($fecha);
$res['fecha'] = $fecha.' '.$hora;
$total = $envio->GetValorTotal();
$res['total'] = number_format($total,2);
$res['prendas'] = $envio->GetTotalPrendas();
$envios[] = $res;
}
$resEnvios['items'] = $envios;
$msg = $_SESSION['msgEnv'];
$_SESSION['msgEnv'] = '';
$resSuc = $sucursal->GetSucursalesByEmpresaId();
$resSuc2 = $util->DecodeUrlResult($resSuc);
$sucursales = $util->DecodeResult($resSuc2);
$smarty->assign('msg', $msg);
$smarty->assign('nomSuc', $nomSuc);
$smarty->assign('envios', $resEnvios);
$smarty->assign('sucursales', $sucursales);
?>