114 lines
3.2 KiB
PHP
Executable File
114 lines
3.2 KiB
PHP
Executable File
<?php
|
|
|
|
if($_SESSION['tipoUsr'] != 'Cliente'){
|
|
header('Location: '.WEB_ROOT.'/facturas');
|
|
exit;
|
|
}
|
|
|
|
$_SESSION['tipoComp'] = '';
|
|
$_SESSION['compFI'] = '';
|
|
$_SESSION['compFF'] = '';
|
|
$_SESSION['conceptos'] = array();
|
|
$_SESSION['impuestos'] = array();
|
|
$_SESSION["notasPorFacturar"] = array();
|
|
|
|
$totalDesglosado = array(
|
|
'subtotal' => '0.00',
|
|
'descuento' => '0.00',
|
|
'afterDescuento' => '0.00',
|
|
'iva' => '0.00',
|
|
'afterIva' => '0.00',
|
|
'ieps' => '0.00',
|
|
'afterImpuestos' => '0.00',
|
|
'retIva' => '0.00',
|
|
'retIsr' => '0.00',
|
|
'total' => '0.00'
|
|
);
|
|
|
|
$clienteId = $_SESSION['loginKey'];
|
|
|
|
$cliente->setClienteId($clienteId);
|
|
$post = $cliente->Info();
|
|
|
|
$post['razonSocial'] = $post['nombre'];
|
|
$post['metodoPago'] = 'Efectivo';
|
|
|
|
if(is_numeric($_GET['ventaId'])){
|
|
|
|
$ventaId = $_GET['ventaId'];
|
|
|
|
if($_SESSION['idVta'] != $ventaId){
|
|
header('Location: '.WEB_ROOT.'/facturas-listado');
|
|
exit;
|
|
}
|
|
|
|
|
|
$venta->setVentaId($ventaId);
|
|
$infV = $venta->Info();
|
|
|
|
$sucursalId = $infV['sucursalId'];
|
|
$_SESSION['idSuc'] = $sucursalId;
|
|
|
|
$venta->LoadProductos();
|
|
|
|
if($infV['valDesc'] > 0){
|
|
$datos['porcentajeDescuento'] = $infV['valDesc'];
|
|
$post['porcentajeDescuento'] = $infV['valDesc'];
|
|
}
|
|
|
|
$totalDesglosado = $venta->GetTotalDesglosado($datos);
|
|
|
|
$difCents = $infV['total'] - $totalDesglosado['total'];
|
|
$difCents = number_format($difCents,2,'.','');
|
|
|
|
if($difCents == 0.01 || $difCents == -0.01){
|
|
$totalDesglosado['iva'] += $difCents;
|
|
$totalDesglosado['afterIva'] += $difCents;
|
|
$totalDesglosado['afterImpuestos'] += $difCents;
|
|
$totalDesglosado['total'] += $difCents;
|
|
}
|
|
|
|
$totalDesglosado['iva'] = number_format($totalDesglosado['iva'],2,'.','');
|
|
$totalDesglosado['afterIva'] = number_format($totalDesglosado['afterIva'],2,'.','');
|
|
$totalDesglosado['afterDescuento'] = number_format($totalDesglosado['afterDescuento'],2,'.','');
|
|
$totalDesglosado['afterImpuestos'] = number_format($totalDesglosado['afterImpuestos'],2,'.','');
|
|
$totalDesglosado['total'] = number_format($totalDesglosado['total'],2,'.','');
|
|
|
|
if($totalDesglosado){
|
|
foreach($totalDesglosado as $key => $total)
|
|
{
|
|
$totalDesglosado[$key] = number_format($totalDesglosado[$key], 2);
|
|
}
|
|
}
|
|
|
|
$concepts = $util->DecodeResult($_SESSION["conceptos"]);
|
|
$smarty->assign('ventaId', $ventaId);
|
|
$smarty->assign('conceptos', $concepts);
|
|
$smarty->assign("totalDesglosado", $totalDesglosado);
|
|
|
|
}//elseif
|
|
|
|
$ivas = $main->ListIvas();
|
|
$retIsrs = $main->ListRetIsr();
|
|
$retIvas = $main->ListRetIva();
|
|
$tiposDeMoneda = $main->ListTipoDeMoneda();
|
|
$comprobantes = $main->ListTiposDeComprobantesValidos();
|
|
|
|
$sucursal->setSucursalId($sucursalId);
|
|
$infSuc = $sucursal->Info();
|
|
$infSuc['nombre'] = urldecode($infSuc['nombre']);
|
|
$infSuc['nombre'] = utf8_decode($infSuc['nombre']);
|
|
|
|
$excentoIva = $main->ListExcentoIva();
|
|
|
|
$smarty->assign("ivas", $ivas);
|
|
$smarty->assign("retIsrs", $retIsrs);
|
|
$smarty->assign("retIvas", $retIvas);
|
|
$smarty->assign("excentoIva", $excentoIva);
|
|
$smarty->assign("infSuc", $infSuc);
|
|
$smarty->assign("post", $post);
|
|
$smarty->assign('totalDesglosado', $totalDesglosado);
|
|
$smarty->assign("tiposDeMoneda", $tiposDeMoneda);
|
|
$smarty->assign("comprobantes", $comprobantes);
|
|
|
|
?>
|