fixes bug#8042
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@60884 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
19a399a494
commit
5a42085280
|
@ -40,5 +40,6 @@ public interface FiscalImpressoraDAO {
|
|||
public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa, String tipoTotalizador,String descEcf);
|
||||
public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa, String tipoformapago);
|
||||
FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa, String tipoformapago, String descEcf);
|
||||
FiscalRelgerencialEmpresa buscarRelGerencial(Empresa empresa, String tipoRelGerencial );
|
||||
|
||||
}
|
||||
|
|
|
@ -183,6 +183,16 @@ public class FiscalImpressoraHibernateDAO extends GenericHibernateDAO<FiscalImpr
|
|||
return (FiscalFormapagoEmpresa) criteria.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FiscalRelgerencialEmpresa buscarRelGerencial(Empresa empresa,String tipoRelGerencial){
|
||||
Criteria criteria = getSession().createCriteria(FiscalRelgerencialEmpresa.class);
|
||||
criteria.add(Restrictions.eq("activo", true));
|
||||
criteria.add(Restrictions.eq("empresa", empresa));
|
||||
criteria.add(Restrictions.eq("tiporelgerencial", tipoRelGerencial));
|
||||
|
||||
return (FiscalRelgerencialEmpresa) criteria.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FiscalFormapagoEmpresa actualizacionFormapagoEmpresa(FiscalFormapagoEmpresa entidad) {
|
||||
getSession().merge(entidad);
|
||||
|
|
|
@ -34,6 +34,7 @@ public interface FiscalImpressoraService{
|
|||
public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id);
|
||||
public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad);
|
||||
public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad);
|
||||
public FiscalRelgerencialEmpresa suscribirActualizarRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) throws BusinessException;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,16 @@ public class FiscalImpressoraServiceImpl implements FiscalImpressoraService {
|
|||
Gratuidade,
|
||||
CUSTOM;
|
||||
}
|
||||
|
||||
public enum TipoRelatorioGerencial {
|
||||
RelatorioGeral,
|
||||
CupomEmbarque,
|
||||
CupomEmbGratuidade,
|
||||
IdentificacaoPafECF,
|
||||
ManifestoFiscal,
|
||||
ParametrosConfiguracao,
|
||||
IdentificacaoIdaVolta
|
||||
/*CUSTOM*/;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
FiscalImpressoraDAO fiscalImpressoraDAO;
|
||||
|
@ -205,6 +214,34 @@ public class FiscalImpressoraServiceImpl implements FiscalImpressoraService {
|
|||
return fiscalImpressoraDAO.suscribirRelgerencialEmpresa(entidad);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor=BusinessException.class)
|
||||
public FiscalRelgerencialEmpresa suscribirActualizarRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) throws BusinessException {
|
||||
|
||||
FiscalRelgerencialEmpresa item = null;
|
||||
|
||||
item = fiscalImpressoraDAO.buscarRelGerencial(entidad.getEmpresa(), entidad.getTiporelgerencial());
|
||||
|
||||
if ( (entidad.getFiscalrelgerencialId() == null) && (item != null) ){
|
||||
throw new BusinessException("editarRelgerencialEmpresaController.MSG.erroTipoRelgerencial");
|
||||
}
|
||||
|
||||
if ( (entidad.getFiscalrelgerencialId() != null) && (item != null) && (!item.getFiscalrelgerencialId().equals(entidad.getFiscalrelgerencialId())) ){
|
||||
throw new BusinessException("editarRelgerencialEmpresaController.MSG.erroTipoRelgerencial");
|
||||
}
|
||||
|
||||
entidad.setActivo(true);
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
if (entidad.getFiscalrelgerencialId() == null){
|
||||
return fiscalImpressoraDAO.suscribirRelgerencialEmpresa(entidad);
|
||||
}else{
|
||||
return fiscalImpressoraDAO.actualizacionRelgerencialEmpresa(entidad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) {
|
||||
|
|
Loading…
Reference in New Issue