Primer commit del sistema avantika sin cambios
This commit is contained in:
85
ajax/centralizador.php
Executable file
85
ajax/centralizador.php
Executable file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
if(isset($_POST['action']))
|
||||
$_POST['type'] = $_POST['action'];
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST['type'])
|
||||
{
|
||||
case 'searchVentas':
|
||||
|
||||
$sucursalId = $_POST['sucursalId2'];
|
||||
$usuarioId = $_POST['usuarioId2'];
|
||||
$fechaIni = $_POST['fechaIni2'];
|
||||
$fechaFin = $_POST['fechaFin2'];
|
||||
|
||||
if($sucursalId == ''){
|
||||
$util->setError(20084,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaIni == ''){
|
||||
$util->setError(20114,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if($fechaFin == ''){
|
||||
$util->setError(20115,'error');
|
||||
$util->PrintErrors();
|
||||
echo 'fail[#]';
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$venta->setSucursalId($sucursalId);
|
||||
$venta->setUsuarioId($usuarioId);
|
||||
|
||||
$fechaIni = date('Y-m-d',strtotime($fechaIni));
|
||||
$fechaFin = date('Y-m-d',strtotime($fechaFin));
|
||||
|
||||
$ventas = $venta->SearchCentral($fechaIni, $fechaFin);
|
||||
|
||||
$items = array();
|
||||
foreach($ventas['items'] as $res){
|
||||
|
||||
$fecha = date('d-m-Y',strtotime($res['fecha']));
|
||||
$hora = date('H:i:s',strtotime($res['fecha']));
|
||||
$fecha = $util->FormatDateDMMMY($fecha);
|
||||
$res['fecha'] = $fecha.' '.$hora;
|
||||
|
||||
$usuario->setUsuarioId($res['usuarioId']);
|
||||
$res['usuario'] = $usuario->GetNameById();
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
if($res['totalDesc'] > 0)
|
||||
$res['total'] = $res['totalDesc'];
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$ventas['items'] = $items;
|
||||
|
||||
echo 'ok[#]';
|
||||
|
||||
$smarty->assign('ventas', $ventas);
|
||||
$smarty->assign('DOC_ROOT', DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/ventas.tpl');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user