Primer commit del sistema avantika sin cambios
This commit is contained in:
110
ajax/reportes-invparcial.php
Executable file
110
ajax/reportes-invparcial.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
include_once('../init.php');
|
||||
include_once('../config.php');
|
||||
include_once(DOC_ROOT.'/libraries.php');
|
||||
|
||||
$Usr = $user->Info();
|
||||
$smarty->assign('Usr', $Usr);
|
||||
|
||||
switch($_POST["type"])
|
||||
{
|
||||
case "addSolicitud":
|
||||
|
||||
$resSuc = $sucursal->GetSucursalesByEmpresaId();
|
||||
$sucursales = $util->DecodeUrlResult($resSuc);
|
||||
|
||||
$smarty->assign('sucursales', $sucursales);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/agregar-solicitud-invparcial-popup.tpl');
|
||||
|
||||
break;
|
||||
|
||||
case "saveSolicitud":
|
||||
|
||||
$inventario->setSucursalId2($_POST["sucursalId"]);
|
||||
$inventario->setTipo($_POST["tipo"]);
|
||||
|
||||
if($inventario->ExistReport()){
|
||||
$util->setError(10049,'error');
|
||||
$util->PrintErrors();
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$inventario->SaveReporteParcial())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$reportesInv = $inventario->EnumReporteParcial();
|
||||
|
||||
if(count($reportesInv['items']))
|
||||
$reportesInv['items'] = $util->EncodeResult($reportesInv['items']);
|
||||
|
||||
$items = array();
|
||||
foreach($reportesInv['items'] as $res){
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$reportesInv['items'] = $items;
|
||||
|
||||
$smarty->assign("reportesInv", $reportesInv);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-invparcial.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "deleteSolicitud":
|
||||
|
||||
$inventario->setRepInvParcialId($_POST["id"]);
|
||||
$info = $inventario->InfoInvParcialById();
|
||||
|
||||
if(!$inventario->DeleteReporteParcial())
|
||||
{
|
||||
echo "fail[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status_on_popup.tpl');
|
||||
}
|
||||
else
|
||||
{
|
||||
//Eliminamos el archivo generado en reportes de inventario total
|
||||
@unlink(DOC_ROOT.'/reportes/'.$info['archivo']);
|
||||
|
||||
echo "ok[#]";
|
||||
$smarty->display(DOC_ROOT.'/templates/boxes/status.tpl');
|
||||
echo "[#]";
|
||||
$reportesInv = $inventario->EnumReporteParcial();
|
||||
|
||||
if(count($reportesInv['items']))
|
||||
$reportesInv['items'] = $util->EncodeResult($reportesInv['items']);
|
||||
|
||||
$items = array();
|
||||
foreach($reportesInv['items'] as $res){
|
||||
|
||||
$sucursal->setSucursalId($res['sucursalId']);
|
||||
$res['sucursal'] = urldecode($sucursal->GetNameById());
|
||||
|
||||
$items[] = $res;
|
||||
}
|
||||
$reportesInv['items'] = $items;
|
||||
|
||||
$smarty->assign("reportesInv", $reportesInv);
|
||||
$smarty->assign("DOC_ROOT", DOC_ROOT);
|
||||
$smarty->display(DOC_ROOT.'/templates/lists/reportes-invparcial.tpl');
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}//switch
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user