<?php use_helper('UrlFunctions'); ?>
<?php

if(isset($delete)){
  if($id){
    $o_SucursalBean = new SucursalBean();
    $o_SucursalBean->setIdSucursal($id);
    
    $o_SucursalBean->setUsuarioEliminado(myUser::getUser()->getUserId());
    $o_SucursalSystemClass = new SucursalSystemClass($o_SucursalBean);
    $bResult = $o_SucursalSystemClass->eliminarSucursal();
    
    if($bResult){
      ?>
      <script language="JavaScript">
      parent.objMainTab.reqBody('<?=buildUrl('suc/list')?>','001&delete=1&cod=<?=$o_SucursalBean->getIdSucursal()?>');
      parent.objMainTab.windowsCloseAll();
      </script>
      <?
      
    }else{
       $url = buildUrl('suc/delete', "block=".$block."&error=1");
    }
  } 
}
